Added industries collection
This commit is contained in:
parent
1ad6bf17cb
commit
ccbfe642a8
19 changed files with 277 additions and 58 deletions
39
imports/api/Industries/Industries.js
Normal file
39
imports/api/Industries/Industries.js
Normal 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;
|
||||
29
imports/api/Industries/IndustryRegistries.js
Normal file
29
imports/api/Industries/IndustryRegistries.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue