Compare commits
No commits in common. "cde1fafacb933c0fa0b8c95fb399db53a79249bb" and "5d649a1e376c3a4d62de107d0f00e4295a45aae3" have entirely different histories.
cde1fafacb
...
5d649a1e37
|
@ -3,8 +3,8 @@ import { model, Schema, Document } from 'mongoose'
|
||||||
|
|
||||||
const ScriptSchema: Record<keyof IScript, any> = {
|
const ScriptSchema: Record<keyof IScript, any> = {
|
||||||
title: { type: String, required: true },
|
title: { type: String, required: true },
|
||||||
body: { type: String, required: true },
|
video: { type: String, required: true },
|
||||||
video: { type: String }
|
body: { type: String, required: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScriptDocument extends Document<IScript> {}
|
export interface ScriptDocument extends Document<IScript> {}
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
import { Context, Service, ServiceBroker, ServiceSchema } from 'moleculer'
|
|
||||||
import DbConnection from '../mixins/db.mixin'
|
|
||||||
import { Script } from '../models/script'
|
|
||||||
|
|
||||||
export default class LiteratureListService extends Service {
|
|
||||||
|
|
||||||
private DbMixin = new DbConnection(Script).start()
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
public constructor (public broker: ServiceBroker, schema: ServiceSchema<{}> = {}) {
|
|
||||||
super(broker)
|
|
||||||
|
|
||||||
this.parseServiceSchema(Service.mergeSchemas({
|
|
||||||
name: 'script',
|
|
||||||
mixins: [this.DbMixin],
|
|
||||||
settings: {
|
|
||||||
fields: [
|
|
||||||
'_id',
|
|
||||||
'body',
|
|
||||||
'video',
|
|
||||||
'title'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async seedDB(this: Service) {
|
|
||||||
/*await this.adapter.insertMany([
|
|
||||||
{
|
|
||||||
description: 'Essential reading for all coomunists',
|
|
||||||
literature: await this.broker.call('literature-item.find'),
|
|
||||||
name: 'Coomunist Essentials'
|
|
||||||
},
|
|
||||||
])*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, schema))
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue