routeGenModel.js 835 B

123456789101112131415161718192021222324252627282930313233343536
  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. })
  16. const Agency = mongoose.model('Agency', agencySchema)
  17. const Job = mongoose.model('Job', jobSchema)
  18. const Model = mongoose.model('Model', modelSchema)
  19. export { Agency, Job, Model }
  20. export class AgencyController extends RESTController {
  21. constructor () {
  22. super(Agency, '_id')
  23. }
  24. }
  25. export class ModelController extends RESTController {
  26. constructor () {
  27. super(Model, 'name')
  28. }
  29. }