More migrations...

This commit is contained in:
Stefan Zermatten
2018-11-15 15:22:20 +02:00
parent a5e7bd95c7
commit c7fcb4de0c
7 changed files with 35 additions and 19 deletions

View File

@@ -10,10 +10,13 @@ let partySchema = new SimpleSchema({
optional: true,
},
characters: {
type: [String],
type: Array,
defaultValue: [],
},
characters: {
type: String,
regEx: SimpleSchema.RegEx.Id,
index: 1,
defaultValue: [],
},
owner: {
type: String,

View File

@@ -72,3 +72,5 @@ getDefaultCreatureDocs = function(charId, creatureType = "pc"){
}
return docs;
}
export default getDefaultCreatureDocs;

View File

@@ -1,8 +1,9 @@
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import SimpleSchema from 'simpl-schema';
import Effects from "/imports/api/creature/Effects.js"
import deathSaveSchema from "/imports/api/creature/subSchemas/DeathSaves.js"
import deathSaveSchema from "/imports/api/creature/subSchemas/DeathSavesSchema.js"
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
import getDefaultCreatureDocs from "/imports/api/creature/CreatureDefaults.js";
//set up the collection for creatures
Creatures = new Mongo.Collection("creatures");
@@ -32,9 +33,11 @@ let creatureSchema = new SimpleSchema({
//permissions
party: {type: String, regEx: SimpleSchema.RegEx.Id, optional: true},
owner: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
readers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1},
writers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1},
//TODO add per-creature settings
readers: {type: Array, defaultValue: []},
"readers.$": {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
writers: {type: Array, defaultValue: []},
"writers.$": {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
settings: {type: Object},
//how many experiences to load at a time in XP table
"settings.experiencesInc": {type: SimpleSchema.Integer, defaultValue: 20},
//slowed down by carrying too much?
@@ -144,7 +147,7 @@ if (Meteor.isServer){
});
//give characters default items
Characters.after.insert(function(userId, char) {
Creatures.after.insert(function(userId, char) {
if (Meteor.isServer){
var containerId = Containers.insert({
name: "Coin Pouch",

View File

@@ -1,6 +1,8 @@
import SimpleSchema from 'simpl-schema';
Libraries = new Mongo.Collection("library");
Schemas.Library = new SimpleSchema({
librarySchema = new SimpleSchema({
name: {type: String},
owner: {type: String, regEx: SimpleSchema.RegEx.Id},
readers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: []},
@@ -8,7 +10,7 @@ Schemas.Library = new SimpleSchema({
public: {type: Boolean, defaultValue: false},
});
Libraries.attachSchema(Schemas.Library);
Libraries.attachSchema(librarySchema);
Libraries.allow({
insert(userId, doc) {
@@ -45,3 +47,5 @@ Libraries.canEdit = function(userId, libraryId){
const library = Libraries.findOne(libraryId);
return canEdit(userId, library);
};
export default Libraries;

View File

@@ -1,6 +1,9 @@
import SimpleSchema from 'simpl-schema';
import libraryAttacksSchema from "/imports/api/library/";
LibraryItems = new Mongo.Collection("libraryItems");
Schemas.LibraryItems = new SimpleSchema({
libraryItemsSchema = new SimpleSchema({
libraryName:{type: String, optional: true, trim: false},
name: {type: String, defaultValue: "New Item", trim: false},
plural: {type: String, optional: true, trim: false},
@@ -12,6 +15,7 @@ Schemas.LibraryItems = new SimpleSchema({
library: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
settings: {type: Object},
"settings.category": {
type: String,
optional: true,
@@ -24,11 +28,11 @@ Schemas.LibraryItems = new SimpleSchema({
defaultValue: false,
},
effects: {type: [Schemas.LibraryEffects], defaultValue: []},
attacks: {type: [Schemas.LibraryAttacks], defaultValue: []},
effects: [Schemas.LibraryEffects],
attacks: [Schemas.LibraryAttacks],
});
LibraryItems.attachSchema(Schemas.LibraryItems);
LibraryItems.attachSchema(libraryItemsSchema);
LibraryItems.allow({
insert(userId, doc) {

View File

@@ -1,5 +1,5 @@
import "characterList.js";
import "library.js";
import "singleCharacter.js";
import "user.js";
import "users.js";
import "./characterList.js";
import "./library.js";
import "./singleCharacter.js";
import "./user.js";
import "./users.js";

View File

@@ -1,4 +1,4 @@
import Libraries from "/imports/api/library/library.js"
import Libraries from "/imports/api/library/Library.js"
const standardLibraryIds = [
"SRDLibraryGA3XWsd",