Added new models. Major changes to the table widget. Still has problems with the editing in the table widget.
This commit is contained in:
24
imports/api/rooms.js
Normal file
24
imports/api/rooms.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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.
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user