我有一些数据,我想用户应该放置这样的数据,
unpause: {
'TERRORIST': false,
'CT': false
},
ready: {
'TERRORIST': false,
'CT': false
},
players: {
"STEAM_1:1:442864975": { steamid: 'STEAM_1:1:442864975', team: 'CT', name: 'n3pixe', clantag: undefined, captain: true },
"STEAM_1:0:232972586": { steamid: 'STEAM_1:0:232972586', team: 'TERRORIST', name: 'n3pix', clantag: undefined, captain: true },
"STEAM_1:0:145662786": { steamid: 'STEAM_1:0:145662786', team: 'TERRORIST', name: 'praaven =D', clantag: undefined, captain: false }
},
所以,输出就是它们。我应该使用哪种设计?
unpause: [{
type: String,
enum: ['TERRORIST', 'CT'],
require: false
}], // Max 2 items need. One item for 'CT' and another one for 'TERRORIST', must be. How can I do this?
ready: [{
type: String,
enum: ['TERRORIST', 'CT'],
require: false
}], // Max 2 items need. One item for 'CT' and another one for 'TERRORIST', must be.
players: [{
type: String,
...
}] // I'm confusing much on players object. How can I force user to push objects like on top code?
谢谢,祝你有美好的一天!