rename /rpg-docs to /app

This commit is contained in:
Andrew Zhu
2018-06-07 01:07:49 -07:00
parent de93636c7c
commit c099e3173b
420 changed files with 12 additions and 25 deletions

View File

@@ -0,0 +1,3 @@
Meteor.publish("changeLog", function(){
return ChangeLogs.find();
});

View File

@@ -0,0 +1,34 @@
Meteor.publish("characterList", function(){
var userId = this.userId;
if (!userId) {
this.ready();
return;
}
return [
Characters.find(
{$or: [{readers: userId}, {writers: userId}, {owner: userId}]},
{
fields: {
name: 1,
urlName: 1,
race: 1,
alignment: 1,
gender: 1,
readers: 1,
writers:1,
owner: 1,
color: 1,
picture: 1,
}
}
),
Parties.find({owner: userId}),
];
});
DDPRateLimiter.addRule({
name: "characterList",
type: "subscription",
userId(){ return true; },
connectionId(){ return true; },
}, 8, 5000);

View File

@@ -0,0 +1,25 @@
const standardLibraryIds = [
"SRDLibraryGA3XWsd",
];
Meteor.publish("standardLibraries", function(){
return Libraries.find({_id: {$in: standardLibraryIds}});
});
Meteor.publish("standardLibraryItems", function(categoryKey){
return LibraryItems.find({
library: {$in: standardLibraryIds},
"settings.category": categoryKey,
}, {
sort: {name: 1},
});
});
Meteor.publish("standardLibrarySpells", function(level){
return LibrarySpells.find({
library: {$in: standardLibraryIds},
level,
}, {
sort: {name: 1},
});
});

View File

@@ -0,0 +1,62 @@
Meteor.publish("singleCharacter", function(characterId){
userId = this.userId;
var char = Characters.findOne({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
{"settings.viewPermission": "public"},
],
});
if (char){
return [
Characters.find({_id: characterId}),
//get all the assets for this character including soft deleted ones
Actions.find ({charId: characterId}, {removed: true}),
Attacks.find ({charId: characterId}, {removed: true}),
Buffs.find ({charId: characterId}, {removed: true}),
Classes.find ({charId: characterId}, {removed: true}),
Conditions.find ({charId: characterId}, {removed: true}),
Containers.find ({charId: characterId}, {removed: true}),
CustomBuffs.find ({charId: characterId}, {removed: true}),
Effects.find ({charId: characterId}, {removed: true}),
Experiences.find ({charId: characterId}, {removed: true}),
Features.find ({charId: characterId}, {removed: true}),
Items.find ({charId: characterId}, {removed: true}),
Notes.find ({charId: characterId}, {removed: true}),
Spells.find ({charId: characterId}, {removed: true}),
SpellLists.find ({charId: characterId}, {removed: true}),
TemporaryHitPoints.find ({charId: characterId}, {removed: true}),
Proficiencies.find ({charId: characterId}, {removed: true}),
];
} else {
return [];
}
});
DDPRateLimiter.addRule({
name: "singleCharacter",
type: "subscription",
userId: null,
connectionId(){ return true; },
}, 8, 10000, function(reply, ruleInput){
if(!reply.allowed){
logRateError(reply, ruleInput);
}
});
Meteor.publish("singleCharacterName", function(characterId){
userId = this.userId;
return Characters.find({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
{"settings.viewPermission": "public"},
],
}, {
fields:{"name": 1}
});
});

View File

@@ -0,0 +1,8 @@
Meteor.publish("user", function(){
return Meteor.users.find(this.userId, {fields: {
roles: 1,
username: 1,
profile: 1,
apiKey: 1,
}});
});

View File

@@ -0,0 +1,7 @@
Meteor.publish("userNames", function(ids){
if (!this.userId || !ids) return [];
return Meteor.users.find(
{_id: {$in: ids}},
{fields: {username: 1}}
);
});