Created the Media model

This commit is contained in:
Mathias Wagner 2022-09-08 22:09:49 +02:00
parent 5d192dc12a
commit 0d5834f53d
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

40
models/Media.ts Normal file
View File

@ -0,0 +1,40 @@
import mongoose, {Schema} from 'mongoose';
import * as crypto from "crypto";
export interface IMedia {
assetId: string
clientId: number
assetName: string
assetEnding: string
assetDescription: string
created: Date
}
const MediaSchema = new Schema<IMedia>({
assetId: {
type: String,
default: crypto.randomBytes(12).toString('hex')
},
clientId: {
type: Number,
required: true
},
assetName: {
type: String,
default: "Sheepstar Asset"
},
assetDescription: {
type: String,
default: "Well I dont know what this is for"
},
assetEnding: {
type: String,
required: true
},
created: {
type: Date,
default: Date.now
}
});
export const Media = mongoose.model('media', MediaSchema);