Added industries collection

This commit is contained in:
vjrj 2018-02-26 12:11:23 +01:00
parent 1ad6bf17cb
commit ccbfe642a8
19 changed files with 277 additions and 58 deletions

View file

@ -0,0 +1,39 @@
/* eslint-disable consistent-return */
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
import LocationSchema from '/imports/api/Utility/LocationSchema.js';
const Industries = new Mongo.Collection('industries');
Industries.allow({
insert: () => false,
update: () => false,
remove: () => false
});
Industries.deny({
insert: () => true,
update: () => true,
remove: () => true
});
Industries.schema = new SimpleSchema({
geo: LocationSchema,
name: { type: String, optional: true },
registry: String
});
Industries.attachSchema(Industries.schema);
export const industriesRemap = (odoc) => {
const doc = odoc;
const geo = doc.geo;
doc.lat = geo.coordinates[1];
doc.lon = geo.coordinates[0];
doc.id = doc._id;
delete doc.geo;
return doc;
};
export default Industries;

View file

@ -0,0 +1,29 @@
/* eslint-disable consistent-return */
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
const IndustryRegistries = new Mongo.Collection('industryregistries', { idGeneration: 'MONGO' });
IndustryRegistries.allow({
insert: () => false,
update: () => false,
remove: () => false
});
IndustryRegistries.deny({
insert: () => true,
update: () => true,
remove: () => true
});
IndustryRegistries.schema = new SimpleSchema({
name: String,
agency: String,
region: String
});
IndustryRegistries.attachSchema(IndustryRegistries.schema);
export default IndustryRegistries;