Guest User

Untitled

a guest
Nov 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. import { Mongo } from 'meteor/mongo';
  2. import SimpleSchema from 'simpl-schema';
  3.  
  4. const Restaurants = new Mongo.Collection('Restaurants');
  5.  
  6. Restaurants.allow({
  7. insert: () => false,
  8. update: () => false,
  9. remove: () => false,
  10. });
  11.  
  12. Restaurants.deny({
  13. insert: () => true,
  14. update: () => true,
  15. remove: () => true,
  16. });
  17.  
  18. const RestaurantsSchema = new SimpleSchema({
  19. name: {
  20. type: String,
  21. label: 'The name of the restaurant.',
  22. },
  23. address: {
  24. type: Object,
  25. label: 'The address of the restaurant.',
  26. },
  27. 'address.street': {
  28. type: String,
  29. label: 'The street address of the restaurant.',
  30. },
  31. 'address.suite': {
  32. type: String,
  33. label: 'The suite number of the restaurant.',
  34. optional: true,
  35. },
  36. 'address.postalCode': {
  37. type: String,
  38. label: 'The suite number of the restaurant.',
  39. },
  40. 'address.city': {
  41. type: String,
  42. label: 'The city of the restaurant.',
  43. },
  44. 'address.state': {
  45. type: String,
  46. label: 'The state of the restaurant.',
  47. },
  48. 'address.country': {
  49. type: String,
  50. label: 'The country of the restaurant.',
  51. },
  52. telephone: {
  53. type: String,
  54. label: 'The telephone number of the restaurant.',
  55. },
  56. fax: {
  57. type: String,
  58. label: 'The fax number of the restaurant.',
  59. optional: true,
  60. },
  61. website: {
  62. type: String,
  63. label: 'The website of the restaurant.',
  64. optional: true,
  65. },
  66. hours: {
  67. type: Array,
  68. label: 'The opening hours of the restaurant.',
  69. },
  70. 'hours.$': {
  71. type: Object,
  72. label: 'A single day the restaurant is open.',
  73. },
  74. 'hours.$.day': {
  75. type: String,
  76. label: 'The day of the week the restaurant is open.',
  77. },
  78. 'hours.$.from': {
  79. type: String,
  80. label: 'The time the restaurant is open from on this day.',
  81. },
  82. 'hours.$.to': {
  83. type: String,
  84. label: 'The time the restaurant is open until on this day.',
  85. },
  86. 'hours.$.closed': {
  87. type: Boolean,
  88. label: 'Is the restaurant closed on this day?',
  89. },
  90. });
  91.  
  92. Restaurants.attachSchema(RestaurantsSchema);
  93.  
  94. export default Restaurants;
Add Comment
Please, Sign In to add comment