adding default/required attributes to the models
This commit is contained in:
1 parent
481f64f1fe
commit
734e158347
3 files changed
+21
-21
No files matched your search
+12
-12
@@ -3,30 +3,30 @@ import Plotter from './plotter'
|
||||
import Formula from './formula'
|
||||
|
||||
const eventSchema = new Schema({
|
||||
designator: String,
|
||||
name: String,
|
||||
hostId: String,
|
||||
designator: { type: String, required: true },
|
||||
name: { type: String, required: true },
|
||||
hostId: { type: String, required: true },
|
||||
description: String,
|
||||
startDatetime: Number,
|
||||
finishDatetime: Number,
|
||||
startDatetime: { type: Number, required: true },
|
||||
finishDatetime: { type: Number, required: true },
|
||||
formula: { type: Schema.Types.ObjectId, ref: Formula.modelName },
|
||||
plotter: { type: Schema.Types.ObjectId, ref: Plotter.modelName },
|
||||
rules: [{
|
||||
position: Number,
|
||||
title: String,
|
||||
position: { type: Number, required: true },
|
||||
title: { type: String, required: true },
|
||||
description: String
|
||||
}],
|
||||
prizes: [{
|
||||
rank: Number,
|
||||
amount: Number,
|
||||
rank: { type: Number, required: true },
|
||||
amount: { type: Number, required: true },
|
||||
additional: [{
|
||||
condition: String,
|
||||
amount: Number,
|
||||
asset: String
|
||||
amount: { type: Number, required: true },
|
||||
asset: { type: String, required: true }
|
||||
}]
|
||||
}],
|
||||
participants: [{
|
||||
teamId: String,
|
||||
teamId: { type: String, required: true },
|
||||
botId: String,
|
||||
releaseId: String
|
||||
}]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import mongoose, { Schema } from 'mongoose'
|
||||
|
||||
const formulaSchema = new Schema({
|
||||
ownerId: String,
|
||||
isTemplate: Boolean,
|
||||
name: String
|
||||
ownerId: { type: String, required: true },
|
||||
isTemplate: { type: Boolean, default: false },
|
||||
name: { type: String, required: true }
|
||||
})
|
||||
|
||||
const Formula = mongoose.model('Formula', formulaSchema)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import mongoose, { Schema } from 'mongoose'
|
||||
|
||||
const plotterSchema = new Schema({
|
||||
ownerId: String,
|
||||
isTemplate: Boolean,
|
||||
name: String,
|
||||
host: String,
|
||||
repo: String,
|
||||
moduleName: String
|
||||
ownerId: { type: String, required: true },
|
||||
isTemplate: { type: Boolean, default: false },
|
||||
name: { type: String, required: true },
|
||||
host: { type: String, required: true },
|
||||
repo: { type: String, required: true },
|
||||
moduleName: { type: String, required: true }
|
||||
})
|
||||
|
||||
const Plotter = mongoose.model('Plotter', plotterSchema)
|
||||
|
||||
Reference in new issue
Block a user