28 lines
762 B
TypeScript
28 lines
762 B
TypeScript
|
import * as mongoose from 'mongoose';
|
||
|
|
||
|
const Schema = mongoose.Schema;
|
||
|
const Int32 = require('mongoose-int32');
|
||
|
|
||
|
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'},
|
||
|
artist: {type: String, default: 'unknown'},
|
||
|
subtitle: 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);
|