index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // TODO: App Specific Models
  2. const {database} = require('@alancnet/material-framework/server')
  3. const { Location, Retailer } = database
  4. const initialize = require('./initialize')
  5. // const Location = require('./location')
  6. const Workday = require('./workday')
  7. const Service = require('./service')
  8. //const Retailer = require('./retailer')
  9. const StaffMember = require('./staff-member')
  10. const StaffingAgency = require('./staffing-agency')
  11. const Labor = require('./labor')
  12. const LocationWorkday = Location.hasMany(Workday)
  13. const WorkdayLocation = Workday.belongsTo(Location)
  14. const WorkdayService = Workday.hasMany(Service)
  15. const ServiceWorkday = Service.belongsTo(Workday)
  16. const RetailerService = Retailer.hasMany(Service)
  17. const ServiceRetailer = Service.belongsTo(Retailer)
  18. const LocationStaffMember = Location.hasMany(StaffMember)
  19. const StaffMemberLocation = StaffMember.belongsTo(Location)
  20. const LocationRetailer = Location.hasMany(Retailer)
  21. const RetailerLocation = Retailer.belongsTo(Location)
  22. // const StaffingAgencyStaffMember = StaffingAgency.hasMany(StaffMember)
  23. // const StaffMemberStaffingAgency = StaffMember.belongsTo(StaffingAgency)
  24. const originalInit = database.init
  25. const init = async () => {
  26. await originalInit()
  27. await initialize.init(database)
  28. }
  29. module.exports = Object.assign(database, {
  30. init,
  31. Location,
  32. Workday,
  33. Service,
  34. Retailer,
  35. StaffMember,
  36. StaffingAgency,
  37. LocationWorkday,
  38. WorkdayLocation,
  39. WorkdayService,
  40. ServiceWorkday,
  41. RetailerService,
  42. ServiceRetailer,
  43. LocationStaffMember,
  44. StaffMemberLocation,
  45. Labor,
  46. LocationRetailer,
  47. RetailerLocation
  48. })