Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. "errors": [
  2. {
  3. "status": "500",
  4. "code": "EUNKNOWN",
  5. "title": "An unknown error has occured",
  6. "detail": "Something broke when connecting to the database - Invalid column name 'meta'."
  7. }
  8. ]
  9.  
  10. const jsonApi = require('../../.')
  11. const workersHandler = require('../handlers/workersHandler.js')
  12.  
  13. jsonApi.define({
  14. namespace: 'json:api',
  15. resource: 'workers',
  16. description: 'Registered subcontractor workers.',
  17. handlers: new RelationalDbStore({
  18. dialect: "mssql",
  19. host: "rnddevinstance.cg3oj9ysudvn.us-west-2.rds.amazonaws.com",
  20. port: 1433,
  21. database: "DevDB", // If not provided, defaults to the name of the resource
  22. username: "rnam",
  23. password: "administrator",
  24. logging: console.log
  25. }),
  26. searchParams: { },
  27. attributes: {
  28. first_name: jsonApi.Joi.string().alphanum().max(255).required()
  29. .description('The workers first name')
  30. .example('Jerry'),
  31. last_name: jsonApi.Joi.string().alphanum().max(255).required()
  32. .description('The workers last name')
  33. .example('Seinfeld'),
  34. phone_number: jsonApi.Joi.string().max(15).required()
  35. .description('Primary contact phone number')
  36. .example('(123) 456-7890'),
  37. middle_name: jsonApi.Joi.string().alphanum().max(255)
  38. .description('The workers middle name or initial')
  39. .example('C'),
  40. title: jsonApi.Joi.string().alphanum().max(8)
  41. .description('The workers title')
  42. .example('Mr'),
  43. suffix: jsonApi.Joi.string().alphanum().max(8)
  44. .description('The workers title')
  45. .example('Jr'),
  46. email_address: jsonApi.Joi.string().email().max(255)
  47. .description('The workers preferred contact email address')
  48. .example('jerry.seinfeld@gmail.com'),
  49. birth_date: jsonApi.Joi.string().regex(/^[12]ddd-[01]d-[0123]d$/)
  50. .description('The workers birthday, YYYY-MM-DD')
  51. .example('1985-05-01'),
  52. date_created: jsonApi.Joi.string().required().regex(/^[12]ddd-[01]d-[0123]d$/)
  53. .description('The day the worker was first registered in the system., YYYY-MM-DD')
  54. .example('2017-02-01'),
  55. date_modified: jsonApi.Joi.string().regex(/^[12]ddd-[01]d-[0123]d$/)
  56. .description('The last day this workers profile was updated., YYYY-MM-DD')
  57. .example('2017-04-01'),
  58. address_line1: jsonApi.Joi.string().max(255)
  59. .description('The workers mailing address.')
  60. .example('7500 Old Georgetown Road'),
  61. address_line2: jsonApi.Joi.string().max(255)
  62. .description('The workers mailing address.')
  63. .example('R&D Office'),
  64. address_line3: jsonApi.Joi.string().max(255)
  65. .description('The workers mailing address.')
  66. .example('Metro Level'),
  67. address_line4: jsonApi.Joi.string().max(255)
  68. .description('The workers mailing address.')
  69. .example('Desk Number 1234'),
  70. city: jsonApi.Joi.string().max(255)
  71. .description('The workers city mailing address.')
  72. .example('Bethesda'),
  73. state: jsonApi.Joi.string().alphanum().max(2)
  74. .description('The workers mailing address state in abbreviated form. SS')
  75. .example('MD'),
  76. postal_code: jsonApi.Joi.string().alphanum().max(10)
  77. .description('The workers address postal code.')
  78. .example('21084'),
  79. country: jsonApi.Joi.string().max(255).default('United States')
  80. .description('The workers country of residence.')
  81. .example('United States'),
  82. clark_region: jsonApi.Joi.string().max(255)
  83. .description('Clark region of worker at the time of registration.')
  84. .example('Mid Atlantic')
  85. },
  86. examples: [
  87. {
  88. id: '12',
  89. type: 'people',
  90. first_name: 'Jerry',
  91. last_name: 'Seinfeld',
  92. email: 'jerry.seinfeld@example.com',
  93. phone_number: '(123) 456-7890',
  94. date_created: '2017-04-15'
  95. }
  96. ]
  97. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement