Iterated on tabletop model

This commit is contained in:
ThaumRystra
2024-03-08 15:26:17 +02:00
parent b13ca8c64b
commit 3c78f5b2f5

View File

@@ -17,33 +17,48 @@ const InitiativeSchema = new SimpleSchema({
},
activeCreature: {
type: String,
regEx: SimpleSchema.RegEx.id,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
});
// All creatures in a tabletop have a shared time and space.
let TabletopSchema = new SimpleSchema({
// Details
name: {
type: String,
optional: true,
},
description: {
type: String,
optional: true,
},
imageUrl: {
type: String,
optional: true,
},
// Permissions by userId
// Who owns this tabletop and can delete it
owner: String,
// The owner will need to included in one of these arrays for specific permissions
// A user should not appear in more than one of the following arrays
gameMasters: [String],
players: [String],
spectators: [String],
// Does everyone else have the spectator permission?
public: {
type: Boolean,
defaultValue: false,
index: 1,
},
// Initiative
initiative: {
type: InitiativeSchema,
defaultValue: {},
},
gameMaster: {
type: String,
regEx: SimpleSchema.RegEx.id,
},
players: {
type: Array,
defaultValue: [],
},
'players.$': {
type: String,
regEx: SimpleSchema.RegEx.id,
},
});
Tabletops.attachSchema(TabletopSchema);