Migrated the Media.ts model
This commit is contained in:
parent
41ca7ec669
commit
606df61f2c
@ -1,40 +1,41 @@
|
|||||||
import mongoose, {Schema} from 'mongoose';
|
import {sequelize} from "../app";
|
||||||
import * as crypto from "crypto";
|
import * as crypto from "crypto";
|
||||||
|
import {DataTypes, InferAttributes, InferCreationAttributes, Model} from "sequelize";
|
||||||
|
|
||||||
export interface IMedia {
|
export interface IMedia extends Model<InferAttributes<IMedia>, InferCreationAttributes<IMedia>> {
|
||||||
assetId: string
|
assetId?: string
|
||||||
clientId: number
|
clientId: number
|
||||||
assetName: string
|
assetName: string
|
||||||
assetEnding: string
|
assetEnding: string
|
||||||
assetDescription: string
|
assetDescription?: string
|
||||||
created: Date
|
created?: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
const MediaSchema = new Schema<IMedia>({
|
const MediaSchema = sequelize.define<IMedia>('media', {
|
||||||
assetId: {
|
assetId: {
|
||||||
type: String,
|
type: DataTypes.STRING,
|
||||||
default: () => crypto.randomBytes(12).toString('hex')
|
defaultValue: () => crypto.randomBytes(12).toString('hex')
|
||||||
},
|
},
|
||||||
clientId: {
|
clientId: {
|
||||||
type: Number,
|
type: DataTypes.BIGINT,
|
||||||
required: true
|
allowNull: false
|
||||||
},
|
},
|
||||||
assetName: {
|
assetName: {
|
||||||
type: String,
|
type: DataTypes.STRING,
|
||||||
default: "Sheepstar Asset"
|
defaultValue: "Sheepstar Asset"
|
||||||
},
|
},
|
||||||
assetDescription: {
|
assetDescription: {
|
||||||
type: String,
|
type: DataTypes.STRING,
|
||||||
default: "Well I dont know what this is for"
|
defaultValue: "Well I dont know what this is for"
|
||||||
},
|
},
|
||||||
assetEnding: {
|
assetEnding: {
|
||||||
type: String,
|
type: DataTypes.STRING,
|
||||||
default: "txt"
|
defaultValue: "txt"
|
||||||
},
|
},
|
||||||
created: {
|
created: {
|
||||||
type: Date,
|
type: DataTypes.DATE,
|
||||||
default: Date.now
|
defaultValue: Date.now
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Media = mongoose.model('media', MediaSchema);
|
export const Media = MediaSchema;
|
Loading…
x
Reference in New Issue
Block a user