Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "errors": [
- {
- "status": "500",
- "code": "EUNKNOWN",
- "title": "An unknown error has occured",
- "detail": "Something broke when connecting to the database - Invalid column name 'meta'."
- }
- ]
- const jsonApi = require('../../.')
- const workersHandler = require('../handlers/workersHandler.js')
- jsonApi.define({
- namespace: 'json:api',
- resource: 'workers',
- description: 'Registered subcontractor workers.',
- handlers: new RelationalDbStore({
- dialect: "mssql",
- host: "rnddevinstance.cg3oj9ysudvn.us-west-2.rds.amazonaws.com",
- port: 1433,
- database: "DevDB", // If not provided, defaults to the name of the resource
- username: "rnam",
- password: "administrator",
- logging: console.log
- }),
- searchParams: { },
- attributes: {
- first_name: jsonApi.Joi.string().alphanum().max(255).required()
- .description('The workers first name')
- .example('Jerry'),
- last_name: jsonApi.Joi.string().alphanum().max(255).required()
- .description('The workers last name')
- .example('Seinfeld'),
- phone_number: jsonApi.Joi.string().max(15).required()
- .description('Primary contact phone number')
- .example('(123) 456-7890'),
- middle_name: jsonApi.Joi.string().alphanum().max(255)
- .description('The workers middle name or initial')
- .example('C'),
- title: jsonApi.Joi.string().alphanum().max(8)
- .description('The workers title')
- .example('Mr'),
- suffix: jsonApi.Joi.string().alphanum().max(8)
- .description('The workers title')
- .example('Jr'),
- email_address: jsonApi.Joi.string().email().max(255)
- .description('The workers preferred contact email address')
- .example('jerry.seinfeld@gmail.com'),
- birth_date: jsonApi.Joi.string().regex(/^[12]ddd-[01]d-[0123]d$/)
- .description('The workers birthday, YYYY-MM-DD')
- .example('1985-05-01'),
- date_created: jsonApi.Joi.string().required().regex(/^[12]ddd-[01]d-[0123]d$/)
- .description('The day the worker was first registered in the system., YYYY-MM-DD')
- .example('2017-02-01'),
- date_modified: jsonApi.Joi.string().regex(/^[12]ddd-[01]d-[0123]d$/)
- .description('The last day this workers profile was updated., YYYY-MM-DD')
- .example('2017-04-01'),
- address_line1: jsonApi.Joi.string().max(255)
- .description('The workers mailing address.')
- .example('7500 Old Georgetown Road'),
- address_line2: jsonApi.Joi.string().max(255)
- .description('The workers mailing address.')
- .example('R&D Office'),
- address_line3: jsonApi.Joi.string().max(255)
- .description('The workers mailing address.')
- .example('Metro Level'),
- address_line4: jsonApi.Joi.string().max(255)
- .description('The workers mailing address.')
- .example('Desk Number 1234'),
- city: jsonApi.Joi.string().max(255)
- .description('The workers city mailing address.')
- .example('Bethesda'),
- state: jsonApi.Joi.string().alphanum().max(2)
- .description('The workers mailing address state in abbreviated form. SS')
- .example('MD'),
- postal_code: jsonApi.Joi.string().alphanum().max(10)
- .description('The workers address postal code.')
- .example('21084'),
- country: jsonApi.Joi.string().max(255).default('United States')
- .description('The workers country of residence.')
- .example('United States'),
- clark_region: jsonApi.Joi.string().max(255)
- .description('Clark region of worker at the time of registration.')
- .example('Mid Atlantic')
- },
- examples: [
- {
- id: '12',
- type: 'people',
- first_name: 'Jerry',
- last_name: 'Seinfeld',
- email: 'jerry.seinfeld@example.com',
- phone_number: '(123) 456-7890',
- date_created: '2017-04-15'
- }
- ]
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement