Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Mongo } from 'meteor/mongo';
// Create a collection where users can only modify documents that
// they own. Ownership is tracked by an 'owner' field on each
// document. All documents must be owned by the user that created
// them and ownership can't be changed. Only a document's owner
// is allowed to delete it, and the 'locked' attribute can be
// set on a document to prevent its accidental deletion.
Things = new Mongo.Collection('Things');
Things.allow({
insert: function (userId, doc) {
// the user must be logged in, and the document must be owned by the user
return (userId && doc.owner === userId);
},
update: function (userId, doc, fields, modifier) {
// can only change your own documents
return doc.owner === userId;
},
remove: function (userId, doc) {
// can only remove your own documents
return doc.owner === userId;
},
fetch: ['owner']
});
Things.deny({
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
import SimpleSchema from 'simpl-schema';
// 公司保管庫資料集
export const dbCompanyArchive = new Mongo.Collection('companyArchive');
export default dbCompanyArchive;
const schema = new SimpleSchema({
// 保管狀態
status: {
type: String,
allowedValues: ['archived', 'foundation', 'market']
},
// 公司名稱
name: {
type: String
},
// 相關搜索用Tag
tags: {
type: Array,
maxCount: 50
import { Mongo } from 'meteor/mongo';
import { Brands } from '/imports/api/brands/brands';
import { KbAutoFieldSchema, KbTopicsSchema, KbCategoriesSchema, KbArticlesSchema } from './schema';
/* ----------------------- Collections ----------------------- */
export const KbTopics = new Mongo.Collection('knowledgebase_topics');
export const KbCategories = new Mongo.Collection('knowledgebase_categories');
export const KbArticles = new Mongo.Collection('knowledgebase_articles');
KbTopics.attachSchema(KbAutoFieldSchema);
KbTopics.attachSchema(KbTopicsSchema);
KbCategories.attachSchema(KbAutoFieldSchema);
KbCategories.attachSchema(KbCategoriesSchema);
KbArticles.attachSchema(KbAutoFieldSchema);
KbArticles.attachSchema(KbArticlesSchema);
KbTopics.helpers({
brand() {
return Brands.findOne(this.brandId) || {};
},
});
'use strict'
import {Meteor} from 'meteor/meteor'
import {Mongo} from 'meteor/mongo'
import {epoch} from '../both/util'
export const Genres = new Mongo.Collection('genres')
export const Movies = new Mongo.Collection('movies')
export const MovieCache = new Mongo.Collection('movieCache')
export const State = new Mongo.Collection('state')
export const Recent = new Mongo.Collection('recent')
export const Watched = new Mongo.Collection('watched')
/* State */
export const initState = options => {
const defaults = {
_id: '0', // There can be only one...
cwd: process.env.PWD,
dir: '~/',
loading: 100,
queueTotal: 0
}
return State.insert(Object.assign(defaults, options))
}
import {Mongo} from 'meteor/mongo';
export let Projects = new Mongo.Collection('projects');
Projects.allow({
insert: function(){
let user = Meteor.user();
return !!user;
},
update: function(){
let user = Meteor.user();
return !!user;
},
remove: function(){
let user = Meteor.user();
return !!user;
import { Meteor } from "meteor/meteor";
import { Mongo } from "meteor/mongo";
import * as Schemas from "./schemas";
/**
* @name JobItems
* @memberof Collections
* @type {MongoCollection}
*/
export const JobItems = new Mongo.Collection("JobItems");
JobItems.attachSchema(Schemas.JobItems);
/**
* @name Mappings
* @memberof Collections
* @type {MongoCollection}
*/
export const Mappings = new Mongo.Collection("Mappings");
Mappings.attachSchema(Schemas.Mappings);
/**
* Meteor Mongo.Collection instances that are available only in browser code
* @namespace Collections/ClientOnly
*/
import {Meteor} from "meteor/meteor";
import {Mongo} from "meteor/mongo";
export const Authors = new Mongo.Collection("authors");
if (Meteor.isServer) {
Meteor.publish("authors", function () {
return Authors.find();
});
}
export const cfgProjects = new Mongo.Collection("cfgProjects", {
connection: null
});
//export const localCfgQueries = new PersistentMinimongo2(cfgQueries, 'GAV-Queries');
window.projects = cfgProjects;
export const cfgCards = new Mongo.Collection("cfgCards", { connection: null });
window.cards = cfgCards;
export const cfgRepositories = new Mongo.Collection("cfgRepositories", {
connection: null
});
window.repos = cfgRepositories;
export const cfgTeams = new Mongo.Collection("cfgTeams", {
connection: null
});
window.teams = cfgTeams;
import { Handlebars } from 'meteor/blaze';
import { Meteor } from 'meteor/meteor';
import { TimeSync } from 'meteor/mizzao:timesync';
import { Mongo } from 'meteor/mongo';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { UserStatus } from 'meteor/mizzao:user-status';
import moment from 'moment';
import './main.html';
const UserConnections = new Mongo.Collection('user_status_sessions');
const relativeTime = (timeAgo) => {
const diff = moment.utc(TimeSync.serverTime() - timeAgo);
const time = diff.format('H:mm:ss');
const days = +diff.format('DDD') - 1;
const ago = (days ? days + 'd ' : '') + time;
return `${ago} ago`;
};
Handlebars.registerHelper('userStatus', UserStatus);
Handlebars.registerHelper('localeTime', date => date != null ? date.toLocaleString() : undefined);
Handlebars.registerHelper('relativeTime', relativeTime);
Template.login.helpers({
loggedIn() {
return Meteor.userId();