service.js 564 B

1234567891011121314151617181920212223242526
  1. const Sequelize = require('sequelize')
  2. const sequelize = require('./sequelize')
  3. const Service = sequelize.define('service', {
  4. id: {
  5. type: Sequelize.UUID,
  6. defaultValue: Sequelize.UUIDV1,
  7. primaryKey: true
  8. },
  9. workdayId: Sequelize.UUID,
  10. retailerId: Sequelize.UUID,
  11. date: Sequelize.DATEONLY, // Copy from Workday
  12. delivered: Sequelize.INTEGER,
  13. scanned: Sequelize.INTEGER,
  14. cartons: Sequelize.INTEGER
  15. }, {
  16. paranoid: true,
  17. indexes: [
  18. {
  19. unique: true,
  20. fields: ['workdayId', 'retailerId']
  21. }
  22. ]
  23. })
  24. module.exports = Service