Initial commit: Своя Игра - multiplayer quiz game
This commit is contained in:
54
server/src/models/Game.js
Normal file
54
server/src/models/Game.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const gameSchema = new mongoose.Schema({
|
||||
gameCode: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true
|
||||
},
|
||||
hostId: String,
|
||||
hostName: String,
|
||||
teams: [{
|
||||
id: String,
|
||||
name: String,
|
||||
score: { type: Number, default: 0 },
|
||||
players: [{
|
||||
id: String
|
||||
}]
|
||||
}],
|
||||
currentRound: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
selectedCategories: {
|
||||
type: mongoose.Schema.Types.Mixed,
|
||||
default: []
|
||||
},
|
||||
usedCategoryIds: {
|
||||
type: [String],
|
||||
default: []
|
||||
},
|
||||
usedQuestions: [{
|
||||
category: String,
|
||||
points: Number
|
||||
}],
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['waiting', 'playing', 'finished'],
|
||||
default: 'waiting'
|
||||
},
|
||||
currentQuestion: {
|
||||
type: mongoose.Schema.Types.Mixed,
|
||||
default: null
|
||||
},
|
||||
answeringTeam: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
}, {
|
||||
timestamps: true
|
||||
});
|
||||
|
||||
const Game = mongoose.model('Game', gameSchema);
|
||||
|
||||
export default Game;
|
||||
Reference in New Issue
Block a user