@ozdao/prometheus-framework 0.2.257 → 0.2.258

Sign up to get free protection for your applications and to get access to all the features.
@@ -684,8 +684,8 @@ const applyCommonSchema = common_schema.common_schema;
684
684
  const applyEngagementSchema = engagement_schema.engagement_schema;
685
685
  const applyOwnershipSchema = ownership_schema.ownership_schema;
686
686
  const applyMetadataSchema = metadata_schema.metadata_schema;
687
- var event_model = (db) => {
688
- const EventSchema = new db.mongoose.Schema({
687
+ var event_model = (db, additionalFields = {}) => {
688
+ const baseSchema = {
689
689
  cover: {
690
690
  type: String
691
691
  },
@@ -711,42 +711,15 @@ var event_model = (db) => {
711
711
  },
712
712
  specialData: {
713
713
  type: Object
714
- // default: () => ({
715
- // subtitle: 'NMS Presents',
716
- // ticketPrice: 499,
717
- // ticketText: 'Hurry up and purchase your ticket at a special price of only',
718
- // ticketTextButton: 'Buy Ticket Now →',
719
- // ticketImage: null,
720
- // ticketLinkStripe: null,
721
- // video: null,
722
- // guests: [],
723
- // guestVideo: null,
724
- // guestTitle: null,
725
- // guestDescription: null,
726
- // guestFacebook: null,
727
- // guestInstagram: null,
728
- // guestTelegram: null,
729
- // guestTwitter: null,
730
- // guestSoundcloud: null,
731
- // guestSpotify: null,
732
- // guestYoutube: null,
733
- // paymentContact: null,
734
- // paymentText: 'For extra payment options contact',
735
- // previousTitle: null,
736
- // previousDescription: null,
737
- // previousLink: null,
738
- // previousLinkText: null,
739
- // logos: [],
740
- // lineup: [],
741
- // lineupBackground: null,
742
- // previousVideo: null
743
- // })
744
714
  },
745
- // Adding special boolean property
746
715
  special: {
747
716
  type: Boolean,
748
717
  default: false
749
718
  }
719
+ };
720
+ const EventSchema = new db.mongoose.Schema({
721
+ ...baseSchema,
722
+ ...additionalFields
750
723
  }, {
751
724
  timestamps: {
752
725
  currentTime: () => Date.now()
@@ -824,12 +797,13 @@ const EventsController = events_controller;
824
797
  const TicketsController = tickets_controller.tickets_controller;
825
798
  const eventsRoutes = events_routes;
826
799
  const ticketsRoutes = tickets_routes;
827
- const EventModel = event_model;
828
- const TicketModel = ticket_model;
829
- function initializeEvent(app, db, origins, publicPath) {
800
+ const createEventModel = event_model;
801
+ const createTicketModel = ticket_model;
802
+ function initializeEvent(app, db, origins, publicPath, options = {}) {
830
803
  console.log("initializeEvent publicPath:", publicPath);
831
- db.event = EventModel(db);
832
- db.ticket = TicketModel(db);
804
+ const { eventFields = {}, ticketFields = {} } = options;
805
+ db.event = createEventModel(db, eventFields);
806
+ db.ticket = createTicketModel(db);
833
807
  if (app) {
834
808
  eventsRoutes(app, db);
835
809
  ticketsRoutes(app, db, origins, publicPath);
@@ -838,8 +812,8 @@ function initializeEvent(app, db, origins, publicPath) {
838
812
  var events_server = {
839
813
  initialize: initializeEvent,
840
814
  models: {
841
- EventModel,
842
- TicketModel
815
+ EventModel: createEventModel,
816
+ TicketModel: createTicketModel
843
817
  },
844
818
  routes: {
845
819
  eventsRoutes,
@@ -683,8 +683,8 @@ const applyCommonSchema = common_schema;
683
683
  const applyEngagementSchema = engagement_schema;
684
684
  const applyOwnershipSchema = ownership_schema;
685
685
  const applyMetadataSchema = metadata_schema;
686
- var event_model = (db) => {
687
- const EventSchema = new db.mongoose.Schema({
686
+ var event_model = (db, additionalFields = {}) => {
687
+ const baseSchema = {
688
688
  cover: {
689
689
  type: String
690
690
  },
@@ -710,42 +710,15 @@ var event_model = (db) => {
710
710
  },
711
711
  specialData: {
712
712
  type: Object
713
- // default: () => ({
714
- // subtitle: 'NMS Presents',
715
- // ticketPrice: 499,
716
- // ticketText: 'Hurry up and purchase your ticket at a special price of only',
717
- // ticketTextButton: 'Buy Ticket Now →',
718
- // ticketImage: null,
719
- // ticketLinkStripe: null,
720
- // video: null,
721
- // guests: [],
722
- // guestVideo: null,
723
- // guestTitle: null,
724
- // guestDescription: null,
725
- // guestFacebook: null,
726
- // guestInstagram: null,
727
- // guestTelegram: null,
728
- // guestTwitter: null,
729
- // guestSoundcloud: null,
730
- // guestSpotify: null,
731
- // guestYoutube: null,
732
- // paymentContact: null,
733
- // paymentText: 'For extra payment options contact',
734
- // previousTitle: null,
735
- // previousDescription: null,
736
- // previousLink: null,
737
- // previousLinkText: null,
738
- // logos: [],
739
- // lineup: [],
740
- // lineupBackground: null,
741
- // previousVideo: null
742
- // })
743
713
  },
744
- // Adding special boolean property
745
714
  special: {
746
715
  type: Boolean,
747
716
  default: false
748
717
  }
718
+ };
719
+ const EventSchema = new db.mongoose.Schema({
720
+ ...baseSchema,
721
+ ...additionalFields
749
722
  }, {
750
723
  timestamps: {
751
724
  currentTime: () => Date.now()
@@ -823,12 +796,13 @@ const EventsController = events_controller;
823
796
  const TicketsController = tickets_controller;
824
797
  const eventsRoutes = events_routes;
825
798
  const ticketsRoutes = tickets_routes;
826
- const EventModel = event_model;
827
- const TicketModel = ticket_model;
828
- function initializeEvent(app, db, origins, publicPath) {
799
+ const createEventModel = event_model;
800
+ const createTicketModel = ticket_model;
801
+ function initializeEvent(app, db, origins, publicPath, options = {}) {
829
802
  console.log("initializeEvent publicPath:", publicPath);
830
- db.event = EventModel(db);
831
- db.ticket = TicketModel(db);
803
+ const { eventFields = {}, ticketFields = {} } = options;
804
+ db.event = createEventModel(db, eventFields);
805
+ db.ticket = createTicketModel(db);
832
806
  if (app) {
833
807
  eventsRoutes(app, db);
834
808
  ticketsRoutes(app, db, origins, publicPath);
@@ -837,8 +811,8 @@ function initializeEvent(app, db, origins, publicPath) {
837
811
  var events_server = {
838
812
  initialize: initializeEvent,
839
813
  models: {
840
- EventModel,
841
- TicketModel
814
+ EventModel: createEventModel,
815
+ TicketModel: createTicketModel
842
816
  },
843
817
  routes: {
844
818
  eventsRoutes,