Fixed Schemas.
This commit is contained in:
parent
6654aac896
commit
e7a1e768ee
|
@ -1,11 +1,10 @@
|
|||
import { Schema } from 'mongoose'
|
||||
import Level from './Level.js'
|
||||
import Player from './Player.js'
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const Finish = new Schema({
|
||||
map: Level,
|
||||
const Finish = new mongoose.Schema({
|
||||
map: { type: mongoose.Schema.ObjectId, ref: 'Level' },
|
||||
time: Number,
|
||||
time: Date,
|
||||
players: [Player]
|
||||
players: [{ type: mongoose.Schema.ObjectId, ref: 'Player' }]
|
||||
})
|
||||
|
||||
export default Finish
|
||||
export default mongoose.model("Finish", Finish)
|
|
@ -1,14 +1,12 @@
|
|||
import { Schema } from 'mongoose'
|
||||
import Finish from './Finishes.js'
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const Level = new Schema({
|
||||
const Level = new mongoose.Schema({
|
||||
name: String,
|
||||
mapper: String,
|
||||
release: Date,
|
||||
category: String,
|
||||
rating: Number,
|
||||
awardPoints: Number,
|
||||
finishes: [Finish]
|
||||
awardPoints: Number
|
||||
})
|
||||
|
||||
export default Level
|
||||
export default mongoose.model("Level", Level)
|
|
@ -1,13 +1,10 @@
|
|||
import { Schema } from 'mongoose'
|
||||
import Level from './Level.js'
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const Player = new Schema({
|
||||
const Player = new mongoose.Schema({
|
||||
name: String,
|
||||
points: Number,
|
||||
rankPoints: Number,
|
||||
teamPoints: Number,
|
||||
finishedMaps: [Level],
|
||||
favouritePartners: [Player]
|
||||
teamPoints: Number
|
||||
})
|
||||
|
||||
export default Player
|
||||
export default mongoose.model("Player", Player)
|
Loading…
Reference in New Issue
Block a user