Skip to content

Instantly share code, notes, and snippets.

@cleverbeagle
Last active September 6, 2018 20:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverbeagle/db63aadceb975e9ef75a8b3bc4bcb648 to your computer and use it in GitHub Desktop.
Save cleverbeagle/db63aadceb975e9ef75a8b3bc4bcb648 to your computer and use it in GitHub Desktop.
Start with the Data - Restaurant Schema
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
const Restaurants = new Mongo.Collection('Restaurants');
Restaurants.allow({
insert: () => false,
update: () => false,
remove: () => false,
});
Restaurants.deny({
insert: () => true,
update: () => true,
remove: () => true,
});
const RestaurantsSchema = new SimpleSchema({
name: {
type: String,
label: 'The name of the restaurant.',
},
address: {
type: Object,
label: 'The address of the restaurant.',
},
'address.street': {
type: String,
label: 'The street address of the restaurant.',
},
'address.suite': {
type: String,
label: 'The suite number of the restaurant.',
optional: true,
},
'address.postalCode': {
type: String,
label: 'The suite number of the restaurant.',
},
'address.city': {
type: String,
label: 'The city of the restaurant.',
},
'address.state': {
type: String,
label: 'The state of the restaurant.',
},
'address.country': {
type: String,
label: 'The country of the restaurant.',
},
telephone: {
type: String,
label: 'The telephone number of the restaurant.',
},
fax: {
type: String,
label: 'The fax number of the restaurant.',
optional: true,
},
website: {
type: String,
label: 'The website of the restaurant.',
optional: true,
},
hours: {
type: Array,
label: 'The opening hours of the restaurant.',
},
'hours.$': {
type: Object,
label: 'A single day the restaurant is open.',
},
'hours.$.day': {
type: String,
label: 'The day of the week the restaurant is open.',
},
'hours.$.from': {
type: String,
label: 'The time the restaurant is open from on this day.',
},
'hours.$.to': {
type: String,
label: 'The time the restaurant is open until on this day.',
},
'hours.$.closed': {
type: Boolean,
label: 'Is the restaurant closed on this day?',
},
});
Restaurants.attachSchema(RestaurantsSchema);
export default Restaurants;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment