Many changes aded to system.
This commit is contained in:
parent
e0571d14b7
commit
5ba618f471
22 changed files with 640 additions and 57 deletions
28
imports/api/assets.js
Normal file
28
imports/api/assets.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export const Assets = new Mongo.Collection('assets');
|
||||
|
||||
Assets.allow({
|
||||
insert: function(userId, doc){
|
||||
// if use id exists, allow insert
|
||||
return !!userId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
async 'add.asset' (assetName {
|
||||
check(assetName, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add assets. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return await Assets.insertAsync({
|
||||
assetName: assetName,
|
||||
tenant_id: "000000",
|
||||
|
||||
});
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue