Fixed inserting new characters. No wizard though

This commit is contained in:
Thaum Rystra
2020-02-29 17:31:21 +02:00
parent acb9369100
commit 692a7983f8
10 changed files with 123 additions and 78 deletions

View File

@@ -32,7 +32,7 @@ standard-minifier-js@2.6.0
shell-server@0.4.0
seba:minifiers-autoprefixer
templates:array
ecmascript@0.14.0
ecmascript@0.14.2
es5-shim@4.8.0
reactive-dict@1.3.0
percolate:synced-cron

View File

@@ -1 +1 @@
METEOR@1.9
METEOR@1.9.2

View File

@@ -13,7 +13,7 @@ aldeed:collection2@3.0.6
aldeed:schema-index@3.0.0
allow-deny@1.1.0
autoupdate@1.6.0
babel-compiler@7.5.1
babel-compiler@7.5.2
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
@@ -31,11 +31,11 @@ ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.3.0
ddp-server@2.3.1
deps@1.0.12
diff-sequence@1.1.1
dynamic-import@0.5.1
ecmascript@0.14.1
ecmascript@0.14.2
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.10.0
ecmascript-runtime-server@0.9.0
@@ -78,7 +78,7 @@ modern-browsers@0.1.5
modules@0.15.0
modules-runtime@0.12.0
momentjs:moment@2.24.0
mongo@1.8.0
mongo@1.8.1
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
@@ -105,7 +105,7 @@ service-configuration@1.0.11
session@1.2.0
sha@1.0.9
shell-server@0.4.0
socket-stream-client@0.2.2
socket-stream-client@0.2.3
spacebars@1.0.15
spacebars-compiler@1.1.3
splendido:accounts-emails-field@1.2.0

View File

@@ -3,10 +3,6 @@ import deathSaveSchema from "/imports/api/properties/subSchemas/DeathSavesSchema
import ColorSchema from "/imports/api/properties/subSchemas/ColorSchema.js";
import SharingSchema from '/imports/api/sharing/SharingSchema.js';
//Methods
import '/imports/api/creature/insertCreature.js';
import '/imports/api/creature/removeCreature.js';
//set up the collection for creatures
Creatures = new Mongo.Collection("creatures");
@@ -95,5 +91,27 @@ CreatureSchema.extend(SharingSchema);
Creatures.attachSchema(CreatureSchema);
const insertCreature = new ValidatedMethod({
name: "Creatures.methods.insertCreature",
validate: null,
run() {
if (!this.userId) {
throw new Meteor.Error("Creatures.methods.insert.denied",
"You need to be logged in to insert a creature");
}
// Create the creature document
let charId = Creatures.insert({
owner: this.userId,
});
this.unblock();
return charId;
},
});
export default Creatures;
export { CreatureSchema };
export { CreatureSchema, insertCreature };

View File

@@ -1,40 +0,0 @@
import getDefaultCharacterDocs from '/imports/api/creature/getDefaultCharacterDocs.js';
import Attributes from '/imports/api/properties/Attributes.js';
import Skills from '/imports/api/properties/Skills.js';
import DamageMultipliers from '/imports/api/properties/DamageMultipliers.js';
import Effects from '/imports/api/properties/Effects.js';
import Containers from '/imports/api/properties/Containers.js';
import Items from '/imports/api/properties/Items.js';
const addDefaultDocs = function(docs){
Attributes.rawCollection().insert(docs.attributes, {ordered: false});
Skills.rawCollection().insert(docs.skills, {ordered: false});
DamageMultipliers.rawCollection().insert(docs.damageMultipliers, {ordered: false});
Effects.rawCollection().insert(docs.effects, {ordered: false});
Containers.rawCollection().insert(docs.containers, {ordered: false});
Items.rawCollection().insert(docs.items, {ordered: false});
};
const insertCreature = new ValidatedMethod({
name: "Creatures.methods.insertCreature",
validate: null,
run() {
if (!this.userId) {
throw new Meteor.Error("Creatures.methods.insert.denied",
"You need to be logged in to insert a creature");
}
// Create the creature document
let charId = Creatures.insert({
owner: this.userId,
});
this.unblock();
return charId;
},
});
export default insertCreature;

View File

@@ -71,8 +71,8 @@
...mapMutations([
"toggleDrawer",
]),
recompute(creatureId){
recomputeCreature.call({creatureId});
recompute(charId){
recomputeCreature.call({charId});
},
isDarkColor,
},

View File

@@ -97,7 +97,7 @@
links(){
let links = [
{title: "Home", icon: "home", to: "/"},
{title: "Creatures", icon: "group", to: "/characterList", vif: Meteor.userId()},
{title: "Characters", icon: "group", to: "/characterList", vif: Meteor.userId()},
{title: "Library", icon: "book", to: "/library", vif: Meteor.userId()},
{title: "Send Feedback", icon: "bug_report", to: "/feedback"},
{title: "Patreon", icon: "", href: "https://www.patreon.com/dicecloud"},

View File

@@ -1,6 +1,6 @@
<template>
<toolbar-layout>
<span slot="toolbar">Creatures</span>
<span slot="toolbar">Characters</span>
<v-card class="ma-4">
<v-list v-if="CreaturesWithNoParty.length">
<v-list-tile
@@ -72,17 +72,16 @@
</template>
<script>
import Creatures from '/imports/api/creature/Creatures.js';
import Creatures, {insertCreature} from '/imports/api/creature/Creatures.js';
import Parties from '/imports/api/campaign/Parties.js';
import store from "/imports/ui/vuexStore.js";
import ToolbarLayout from "/imports/ui/layouts/ToolbarLayout.vue";
import LabeledFab from "/imports/ui/components/LabeledFab.vue";
import CharacterCreationDialog from "/imports/ui/creature/character/CharacterCreationDialog.vue";
import insertCreature from '/imports/api/creature/insertCreature.js';
const characterTransform = function(char){
char.url = `\/character\/${char._id}\/${char.urlName || "-"}`;
char.initial = char.name[0] || "?";
char.initial = char.name && char.name[0] || "?";
return char;
};
export default {
@@ -124,8 +123,14 @@
},
methods: {
insertCharacter(){
insertCreature.call(result);
insertCreature.call((error, result) => {
if (error){
console.error(error);
} else {
this.$router.push({ path: `/character/${result}`})
}
});
/*
store.commit("pushDialogStack", {
component: CharacterCreationDialog,

94
app/package-lock.json generated
View File

@@ -24,7 +24,7 @@
},
"ansi-regex": {
"version": "2.1.1",
"resolved": false,
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"ansi-styles": {
@@ -60,12 +60,12 @@
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"bcrypt": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.7.tgz",
"integrity": "sha512-K5UglF9VQvBMHl/1elNyyFvAfOY9Bj+rpKrCSR9sFwcW8FywAYJSRwTURNej5TaAK2TEJkcJ6r6lh1YPmspx5Q==",
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.8.tgz",
"integrity": "sha512-jKV6RvLhI36TQnPDvUFqBEnGX9c8dRRygKxCZu7E+MgLfKZbmmXL8a7/SFFOyHoPNX9nV81cKRC5tbQfvEQtpw==",
"requires": {
"nan": "2.14.0",
"node-pre-gyp": "0.13.0"
"node-pre-gyp": "0.14.0"
}
},
"brace-expansion": {
@@ -116,9 +116,9 @@
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"chownr": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
"integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw=="
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
},
"cliui": {
"version": "5.0.0",
@@ -392,7 +392,7 @@
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": false,
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "^1.0.0"
@@ -1239,6 +1239,37 @@
"requires": {
"inherits": "~2.0.1",
"readable-stream": "^2.0.2"
},
"dependencies": {
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"stream-http": {
@@ -1251,6 +1282,37 @@
"readable-stream": "^2.3.3",
"to-arraybuffer": "^1.0.0",
"xtend": "^4.0.0"
},
"dependencies": {
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"string_decoder": {
@@ -1421,9 +1483,9 @@
}
},
"node-pre-gyp": {
"version": "0.13.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz",
"integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==",
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz",
"integrity": "sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==",
"requires": {
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
@@ -1434,7 +1496,7 @@
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
"tar": "^4.4.2"
}
},
"nopt": {
@@ -1612,7 +1674,7 @@
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": false,
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
}
}
@@ -1736,7 +1798,7 @@
},
"string-width": {
"version": "1.0.2",
"resolved": false,
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "^1.0.0",
@@ -1754,7 +1816,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": false,
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"

View File

@@ -15,7 +15,7 @@
"dependencies": {
"@babel/runtime": "^7.8.4",
"animejs": "^2.2.0",
"bcrypt": "^3.0.7",
"bcrypt": "^3.0.8",
"core-js": "^2.6.11",
"css-box-shadow": "^1.0.0-3",
"date-fns": "^1.30.1",