import * as mongoose from 'mongoose'; import { Int32 } from 'mongoose-int32'; const Schema = mongoose.Schema; const Sample = new Schema({ start: {type: Int32, default: new Int32(0)}, length: {type: Int32, default: new Int32(0)} }); const Chart = new Schema({ name: {type: String, default: ''}, rating: {type: Int32, default: new Int32(0)}, type: {type: String, default: 'Challenge'} }); const FileSchema = new Schema({ title: {type: String, default: 'unknown'}, titleTranslit: String, artist: {type: String, default: 'unknown'}, artistTranslit: String, subtitle: String, subtitleTranslit: String, credit: String, uploader: {type: String, default: '00000000-0000-4000-a000-000000000000'}, sample: Sample, bpms: {type: [Number], default: 0}, charts: [Chart] }); export const File = mongoose.model('File', FileSchema);