feat: add initial script implementation

This commit is contained in:
Nicholai Nissen 2021-04-03 18:18:53 +02:00
parent 8ee077cb7f
commit 5d649a1e37
2 changed files with 16 additions and 0 deletions

5
common/types/script.ts Normal file
View file

@ -0,0 +1,5 @@
export interface Script {
title: string
video: string
body: string
}

11
services/models/script.ts Normal file
View file

@ -0,0 +1,11 @@
import { Script as IScript } from '../../common/types/script'
import { model, Schema, Document } from 'mongoose'
const ScriptSchema: Record<keyof IScript, any> = {
title: { type: String, required: true },
video: { type: String, required: true },
body: { type: String, required: true }
}
export interface ScriptDocument extends Document<IScript> {}
export const Script = model<ScriptDocument>('Script', new Schema<ScriptDocument>(ScriptSchema))