From 3c78f5b2f5c3208a26a3e375358a857a6d13148e Mon Sep 17 00:00:00 2001 From: ThaumRystra <9525416+ThaumRystra@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:26:17 +0200 Subject: [PATCH] Iterated on tabletop model --- app/imports/api/tabletop/Tabletops.js | 41 ++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/app/imports/api/tabletop/Tabletops.js b/app/imports/api/tabletop/Tabletops.js index 21456580..c3fdc16e 100644 --- a/app/imports/api/tabletop/Tabletops.js +++ b/app/imports/api/tabletop/Tabletops.js @@ -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);