25 lines
611 B
JavaScript
25 lines
611 B
JavaScript
|
|
import {Mongo} from "meteor/mongo";
|
||
|
|
import {Meteor} from "meteor/meteor";
|
||
|
|
|
||
|
|
export const Rooms = new Mongo.Collection('rooms');
|
||
|
|
|
||
|
|
if (Meteor.isServer) {
|
||
|
|
// This code only runs on the server
|
||
|
|
Meteor.publish('rooms', function(siteId) {
|
||
|
|
return Rooms.find({siteId});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
Meteor.methods({
|
||
|
|
'rooms.add'(name, siteId) {
|
||
|
|
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||
|
|
Rooms.insert({name, siteId});
|
||
|
|
}
|
||
|
|
},
|
||
|
|
'rooms.remove'(_id) {
|
||
|
|
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||
|
|
//TODO: Need to first verify there are no checked out assets to the room.
|
||
|
|
}
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|