routeGenModel.js 874 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import mongoose from 'mongoose'
  2. import { historySchema } from './core/basicSchema'
  3. import RESTController from './core/RESTController'
  4. const agencySchema = new mongoose.Schema({
  5. name: String,
  6. _history: historySchema
  7. })
  8. const jobSchema = new mongoose.Schema({
  9. type: {type: String, enum: ['catwalk', 'photoshoot', 'commercial']},
  10. description: String,
  11. salery: Number
  12. })
  13. const modelSchema = new mongoose.Schema({
  14. name: String,
  15. tag: String,
  16. _history: historySchema
  17. })
  18. const Agency = mongoose.model('Agency', agencySchema)
  19. const Job = mongoose.model('Job', jobSchema)
  20. const Model = mongoose.model('Model', modelSchema)
  21. export { Agency, Job, Model }
  22. export class AgencyController extends RESTController {
  23. constructor () {
  24. super(Agency, '_id')
  25. }
  26. }
  27. export class ModelController extends RESTController {
  28. constructor () {
  29. super(Model, 'name')
  30. }
  31. }