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", }); }, });