diff --git a/Bmore-Responsive.postman_collection.json b/Bmore-Responsive.postman_collection.json index 508eaa07..daf1f059 100644 --- a/Bmore-Responsive.postman_collection.json +++ b/Bmore-Responsive.postman_collection.json @@ -569,7 +569,7 @@ "response": [] }, { - "name": "Contact Send", + "name": "Contact Send Bulk", "event": [ { "listen": "test", @@ -620,6 +620,60 @@ }, "response": [] }, + { + "name": "Contact Send Single", + "event": [ + { + "listen": "test", + "script": { + "id": "b38d3eef-47f0-4f9e-a710-d82c4fef5492", + "exec": [ + "//get the 36 character id of the new contact and save it to env variable", + "//this will allow deletion of this in the Delete transaction", + "pm.environment.set(\"newContactId\", pm.response.text().slice(0,36));", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "type": "text", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/contact/send/{{modelType}}/{{id}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact", + "send", + "{{modelType}}", + "{{id}}" + ] + } + }, + "response": [] + }, { "name": "Update Contact", "event": [ @@ -1406,4 +1460,4 @@ } ], "protocolProfileBehavior": {} -} \ No newline at end of file +} diff --git a/src/email/index.js b/src/email/index.js index a59a362a..5fff6800 100644 --- a/src/email/index.js +++ b/src/email/index.js @@ -36,7 +36,7 @@ const sendMail = async (to, subject, html, text) => { * Send a forgot password email. * @param {string} userEmail email address of the user we're sending to * @param {string} resetPasswordToken temporary token for the reset password link - * + * * @returns {Boolean} */ const sendForgotPassword = async (userEmail, resetPasswordToken) => { @@ -45,8 +45,8 @@ const sendForgotPassword = async (userEmail, resetPasswordToken) => { await sendMail( userEmail, 'Password Reset - Healthcare Roll Call', - nunjucks.render('forgot_password_html.njk', { emailResetLink }), - nunjucks.render('forgot_password_text.njk', { emailResetLink }) + nunjucks.render('forgot_password_html.njk', {emailResetLink}), + nunjucks.render('forgot_password_text.njk', {emailResetLink}) ) return true } catch (e) { @@ -74,4 +74,4 @@ const sendContactCheckInEmail = async (info) => { } } -export default { sendForgotPassword, sendContactCheckInEmail } +export default {sendForgotPassword, sendContactCheckInEmail} diff --git a/src/routes/contact.js b/src/routes/contact.js index 20bdd1c4..cc106a62 100644 --- a/src/routes/contact.js +++ b/src/routes/contact.js @@ -2,7 +2,7 @@ import email from '../email' import models from '../models' import utils from '../utils' import validator from 'validator' -import { Router } from 'express' +import {Router} from 'express' const router = new Router() router.use(utils.authMiddleware) @@ -33,7 +33,7 @@ router.get('/', async (req, res) => { } } - const contacts = await models.Contact.findAll({ where }) + const contacts = await models.Contact.findAll({where}) // Temp fix for JSON types and Sequelize. let results = [] @@ -103,7 +103,7 @@ router.post('/', async (req, res) => { const response = new utils.Response() try { if (req.body.name !== undefined && req.body.name !== '') { - const { name, phone, email, UserId, entities, attributes } = req.body + const {name, phone, email, UserId, entities, attributes} = req.body // Validating emails if (email) { @@ -115,7 +115,7 @@ router.post('/', async (req, res) => { } } - const contact = await models.Contact.create({ name, email, phone, UserId, attributes }) + const contact = await models.Contact.create({name, email, phone, UserId, attributes}) let ec if (entities) { @@ -154,10 +154,10 @@ router.post('/send', async (req, res) => { try { /** @todo allow for passing entity and contact arrays */ const emails = [] - const { entityIds, contactIds, relationshipTitle } = req.body + const {entityIds, contactIds, relationshipTitle} = req.body if (entityIds === undefined && contactIds === undefined) { - const whereClause = (relationshipTitle !== undefined) ? { where: { relationshipTitle } } : {} + const whereClause = (relationshipTitle !== undefined) ? {where: {relationshipTitle}} : {} const associations = await models.EntityContact.findAll(whereClause) if (associations.length < 1) { @@ -191,12 +191,71 @@ router.post('/send', async (req, res) => { email.sendContactCheckInEmail(e) }) - response.setMessage('Contacts emailed') + response.setMessage({ + results: { + message: 'Contacts emailed', + total: emails.length + } + }) + } catch (e) { + console.error(e) + response.setCode(500) + } + + return res.status(response.getCode()).send(response.getMessage()) +}) + + +router.post('/send/:type/:id', async (req, res) => { + const response = new utils.Response() + + try { + let entity + if (req.params.type.toLowerCase() === 'entity') { + entity = await models.Entity.findById(req.params.id) + } else if (req.params.type.toLowerCase() === 'contact') { + entity = await models.Contact.findOne({ + where: { + id: req.params.id + } + }) + } + + if (entity.email !== null) { + const primary = entity.email.filter(e => e.isPrimary === 'true').length ? entity.email.filter(e => e.isPrimary === 'true')[0] : entity.email[0] + // short-lived temporary token that only lasts one hour + const temporaryToken = await utils.getToken(req.params.id, primary.address, 'Entity') + + const e = { + email: primary.address, + name: entity.name, + entityName: entity.name, + entityId: entity.id, + token: temporaryToken + } + email.sendContactCheckInEmail(e).then(() => { + response.setMessage(`${entity.name} emailed sent.`) + response.setCode(200) + }, err => { + response.setMessage('There was an error: ' + err) + response.setCode(500) + }) + } else { + response.setMessage('Email Address not found.') + response.setCode(404) + } + + response.setMessage({ + results: { + message: `${entity.name} emailed.`, + } + }) } catch (e) { console.error(e) response.setCode(500) } + return res.status(response.getCode()).send(response.getMessage()) }) @@ -205,7 +264,7 @@ router.put('/', async (req, res) => { const response = new utils.Response() try { if (validator.isUUID(req.body.id)) { - const { id, name, phone, email, UserId, entities, attributes } = req.body + const {id, name, phone, email, UserId, entities, attributes} = req.body const contact = await models.Contact.findOne({ where: { @@ -299,7 +358,7 @@ router.post('/link/:contact_id', async (req, res) => { } }) - let i=0 + let i = 0 for (const entity of req.body.entities) { const entityToLink = await models.Entity.findOne({ where: { @@ -312,11 +371,11 @@ router.post('/link/:contact_id', async (req, res) => { entityId: entityToLink.id, contactId: contact.id, } - + if (entity.title) { ec.relationshipTitle = contact.title } - + await models.EntityContact.createIfNew(ec) i++ } @@ -350,7 +409,7 @@ router.post('/unlink/:contact_id', async (req, res) => { } }) - let i=0 + let i = 0 for (const entity of req.body.entities) { const entityToUnLink = await models.Entity.findOne({ where: { @@ -366,7 +425,7 @@ router.post('/unlink/:contact_id', async (req, res) => { contactId: contact.id } }) - + await ec.destroy() i++ } diff --git a/src/routes/csv.js b/src/routes/csv.js index 01b40db8..e0abe141 100644 --- a/src/routes/csv.js +++ b/src/routes/csv.js @@ -1,36 +1,65 @@ -import { Router } from 'express' +import {Router} from 'express' import utils from '../utils' -import { parseAsync } from 'json2csv' +import {parseAsync} from 'json2csv' +import {Op} from 'sequelize' const router = new Router() router.use(utils.authMiddleware) // Gets a data dump from the passed in model (if it exists). router.get('/:model_type', async (req, res) => { + const response = new utils.Response() const modelType = req.params.model_type + try { + /** @todo refactor this when we change how CSV's are delivered. */ // eslint-disable-next-line no-prototype-builtins if (req.context.models.hasOwnProperty(modelType) && modelType !== 'User' && modelType !== 'UserRole') { - /** @todo add filtering */ - const results = await req.context.models[modelType].findAll({ raw: true }) + let options = {raw: true} + // search by name if filter query param is included + if (req.query && req.query.filter && req.query.filter.length) { + options.where = { + name: { + [Op.iLike]: '%' + req.query.filter + '%' + } + } + } - const processedResults = await utils.processResults(results, modelType) + /** @todo add a search filter for status once data has a status field. */ + let results = await req.context.models[modelType].findAll(options) if (results.length !== 0) { - response.setMessage = await parseAsync(JSON.parse(JSON.stringify(processedResults)), Object.keys(results[0]), {}) + const processedResults = await utils.processResults(results, modelType) + const fields = Object.keys(results[0]) + parseAsync(processedResults, {fields}).then(csv => { + response.setMessage(csv) + const dateObj = new Date() + const dateStr = `${dateObj.getUTCMonth() + 1}_${dateObj.getUTCDate()}_${dateObj.getUTCFullYear()}` + res.setHeader('Content-disposition', `attachment; filename=HCRC_${modelType}_${dateStr}.csv`) + res.set('Content-Type', 'text/csv') + return res.status(response.getCode()).send(response.getMessage()) + }, err => { + response.setCode(500) + response.setMessage('Not able to parse data: ' + err) + return res.status(response.getCode()).send(response.getMessage()) + }) + } else { + response.setCode(200) + response.setMessage('No results found') + return res.status(response.getCode()).send(response.getMessage()) } } else { response.setCode(400) response.setMessage('Model type is invalid') + return res.status(response.getCode()).send(response.getMessage()) } } catch (e) { console.error(e) response.setCode(500) + return res.status(response.getCode()).send(response.getMessage()) } - - return res.status(response.getCode()).send(response.getMessage()) }) export default router diff --git a/src/tests/contact.routes.spec.js b/src/tests/contact.routes.spec.js index 40e2114a..9b28a616 100644 --- a/src/tests/contact.routes.spec.js +++ b/src/tests/contact.routes.spec.js @@ -138,11 +138,11 @@ describe('Contact tests', function() { .post('/contact/send') .set('Accept', 'application/json') .set('authorization', authHeader) - .expect('Content-Type', 'text/html; charset=utf-8') + .expect('Content-Type', 'application/json; charset=utf-8') .expect(200) .end((err, res) => { if (err) return done(err) - expect(res.text).to.equal('Contacts emailed') + expect(res.body.results.message).to.equal('Contacts emailed') done() }) } catch(e) { @@ -259,7 +259,7 @@ describe('Contact tests', function() { .get('/csv/Contact') .set('Accept', 'application/json') .set('authorization', authHeader) - .expect('Content-Type', 'text/html; charset=utf-8') + .expect('Content-Type', 'text/csv; charset=utf-8') .expect(200) // eslint-disable-next-line no-unused-vars .end((err, res) => { diff --git a/swagger.json b/swagger.json index e797cc16..0f135dd1 100644 --- a/swagger.json +++ b/swagger.json @@ -1,208 +1,233 @@ { - "openapi" : "3.0.1", - "servers" : [ { - "description" : "localhost", - "url" : "http://localhost:3000" - } ], - "info" : { - "description" : "An emergency response and contact management API.", - "version" : "1.3.3", - "title" : "Bmore Responsive", - "contact" : { - "email" : "hello@codeforbaltimore.org" + "openapi": "3.0.1", + "servers": [ + { + "description": "localhost", + "url": "http://localhost:3000" + } + ], + "info": { + "description": "An emergency response and contact management API.", + "version": "1.3.3", + "title": "Bmore Responsive", + "contact": { + "email": "hello@codeforbaltimore.org" }, - "license" : { - "name" : "Apache 2.0", - "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, - "tags" : [ { - "name" : "developer", - "description" : "Operations available to regular developers" - }, { - "name" : "user", - "description" : "Operations related to system users" - }, { - "name" : "userRole", - "description" : "Operations related to userRole" - }, { - "name" : "entity", - "description" : "Operations related to entities" - }, { - "name" : "contact", - "description" : "Operations related to contacts" - }, { - "name" : "csv", - "description" : "Operations related to csv" - } ], - "security" : [ + "tags": [ + { + "name": "developer", + "description": "Operations available to regular developers" + }, + { + "name": "user", + "description": "Operations related to system users" + }, { - "bearerAuth" : [] + "name": "userRole", + "description": "Operations related to userRole" + }, + { + "name": "entity", + "description": "Operations related to entities" + }, + { + "name": "contact", + "description": "Operations related to contacts" + }, + { + "name": "csv", + "description": "Operations related to csv" } ], - "paths" : { - "/health" : { - "get" : { - "security" : [], - "tags" : [ "developer" ], - "summary" : "returns a healthcheck", - "description" : "This returns simple system information\n", - "responses" : { - "200" : { - "description" : "the system healthcheck", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/HealthcheckItem" + "security": [ + { + "bearerAuth": [] + } + ], + "paths": { + "/health": { + "get": { + "security": [], + "tags": [ + "developer" + ], + "summary": "returns a healthcheck", + "description": "This returns simple system information\n", + "responses": { + "200": { + "description": "the system healthcheck", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HealthcheckItem" } } } }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/user/login" : { - "post" : { - "security" : [], - "tags" : [ "user" ], - "summary" : "logs in a system user", - "description" : "The system login endpoint.", - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "email", "password" ], - "properties" : { - "email" : { - "type" : "string", - "format" : "email", - "example" : "test@test.test" + "/user/login": { + "post": { + "security": [], + "tags": [ + "user" + ], + "summary": "logs in a system user", + "description": "The system login endpoint.", + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "type": "string", + "format": "email", + "example": "test@test.test" }, - "password" : { - "type" : "string", - "example" : "test" + "password": { + "type": "string", + "example": "test" } } } } } }, - "responses" : { - "200" : { - "description" : "login token" + "responses": { + "200": { + "description": "login token" }, - "403" : { - "description" : "Forbidden" + "403": { + "description": "Forbidden" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/user" : { - "post" : { - "tags" : [ "user" ], - "summary" : "creates a new user", - "description" : "The new user endpoint. Note that displayname and phone are not written to the database.", - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "email", "password" ], - "properties" : { - "email" : { - "type" : "string", - "format" : "email", - "example" : "homer.simpson@sfpp.com" + "/user": { + "post": { + "tags": [ + "user" + ], + "summary": "creates a new user", + "description": "The new user endpoint. Note that displayname and phone are not written to the database.", + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "type": "string", + "format": "email", + "example": "homer.simpson@sfpp.com" }, - "password" : { - "type" : "string", - "format" : "password", - "example" : "donuts" + "password": { + "type": "string", + "format": "password", + "example": "donuts" }, - "roles" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "user" + "roles": { + "type": "array", + "items": { + "type": "string", + "example": "user" } }, - "displayName" : { - "type" : "string", - "example" : "Homer Simpson" + "displayName": { + "type": "string", + "example": "Homer Simpson" }, - "phone" : { - "type" : "string", - "example" : "1234567890" + "phone": { + "type": "string", + "example": "1234567890" } } } } } }, - "responses" : { - "200" : { - "description" : "user created" + "responses": { + "200": { + "description": "user created" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "get" : { - "tags" : [ "user" ], - "summary" : "returns all system users", - "description" : "Returns all users within the system and their information.\n", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "List of all users in the system and their information.", - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "properties" : { - "_meta" : { - "type" : "object", - "properties" : { - "total" : { - "type" : "number", - "example" : 1 + "get": { + "tags": [ + "user" + ], + "summary": "returns all system users", + "description": "Returns all users within the system and their information.\n", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "List of all users in the system and their information.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "_meta": { + "type": "object", + "properties": { + "total": { + "type": "number", + "example": 1 } } }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/UserItem" + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserItem" } } } @@ -210,534 +235,584 @@ } } }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "put" : { - "tags" : [ "user" ], - "summary" : "updates any single system user", - "description" : "By sending a valid payload you can update a user. Note that displayname and phone are not stored in the database.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "email", "password" ], - "properties" : { - "email" : { - "type" : "string", - "format" : "email", - "example" : "homer.simpson@sfpp.com" + "put": { + "tags": [ + "user" + ], + "summary": "updates any single system user", + "description": "By sending a valid payload you can update a user. Note that displayname and phone are not stored in the database.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "type": "string", + "format": "email", + "example": "homer.simpson@sfpp.com" }, - "password" : { - "type" : "string", - "format" : "password", - "example" : "donuts" + "password": { + "type": "string", + "format": "password", + "example": "donuts" }, - "roles" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "admin" + "roles": { + "type": "array", + "items": { + "type": "string", + "example": "admin" } }, - "displayName" : { - "type" : "string", - "example" : "Homer Simpson" + "displayName": { + "type": "string", + "example": "Homer Simpson" }, - "phone" : { - "type" : "string", - "example" : "1234567890" + "phone": { + "type": "string", + "example": "1234567890" } } } } } }, - "responses" : { - "200" : { - "description" : "user updated" + "responses": { + "200": { + "description": "user updated" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/user/{email}" : { - "get" : { - "tags" : [ "user" ], - "summary" : "returns a single system user", - "description" : "By passing the username, you can lookup a user.", - "parameters" : [ { - "in" : "path", - "name" : "email", - "schema" : { - "type" : "string", - "format" : "email" - }, - "required" : true, - "description" : "email of the user" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "the user object", - "content" : { - "session/json" : { - "schema" : { - "$ref" : "#/components/schemas/UserItem" + "/user/{email}": { + "get": { + "tags": [ + "user" + ], + "summary": "returns a single system user", + "description": "By passing the username, you can lookup a user.", + "parameters": [ + { + "in": "path", + "name": "email", + "schema": { + "type": "string", + "format": "email" + }, + "required": true, + "description": "email of the user" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "the user object", + "content": { + "session/json": { + "schema": { + "$ref": "#/components/schemas/UserItem" } } } }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "delete" : { - "tags" : [ "user" ], - "summary" : "deletes a single system user", - "description" : "By sending a valid payload you can delete a user.", - "parameters" : [ { - "in" : "path", - "name" : "email", - "schema" : { - "type" : "string", - "format" : "email" - }, - "required" : true, - "description" : "the email of the user to delete." - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "user deleted" - }, - "401" : { - "description" : "Unauthorized" - }, - "422" : { - "description" : "Invalid input" - }, - "500" : { - "description" : "Server error" + "delete": { + "tags": [ + "user" + ], + "summary": "deletes a single system user", + "description": "By sending a valid payload you can delete a user.", + "parameters": [ + { + "in": "path", + "name": "email", + "schema": { + "type": "string", + "format": "email" + }, + "required": true, + "description": "the email of the user to delete." + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "user deleted" + }, + "401": { + "description": "Unauthorized" + }, + "422": { + "description": "Invalid input" + }, + "500": { + "description": "Server error" } } } }, - "/userRole" : { - "post" : { - "tags" : [ "userRole" ], - "summary" : "creates a new user role", - "description" : "The new user role endpoint.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "role" ], - "properties" : { - "role" : { - "type" : "string", - "example" : "test" + "/userRole": { + "post": { + "tags": [ + "userRole" + ], + "summary": "creates a new user role", + "description": "The new user role endpoint.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { + "type": "string", + "example": "test" }, - "path" : { - "type" : "string", - "example" : "/test" + "path": { + "type": "string", + "example": "/test" }, - "method" : { - "type" : "string", - "example" : "GET" + "method": { + "type": "string", + "example": "GET" } } } } } }, - "responses" : { - "200" : { - "description" : "policy created" + "responses": { + "200": { + "description": "policy created" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "get" : { - "tags" : [ "userRole" ], - "summary" : "returns all system user roles", - "description" : "By passing in the appropriate options, you can search for\navailable user roles in the system\n", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "search results matching criteria" - }, - "401" : { - "description" : "Unauthorized" - }, - "500" : { - "description" : "Server error" + "get": { + "tags": [ + "userRole" + ], + "summary": "returns all system user roles", + "description": "By passing in the appropriate options, you can search for\navailable user roles in the system\n", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "search results matching criteria" + }, + "401": { + "description": "Unauthorized" + }, + "500": { + "description": "Server error" } } } }, - "/userRole/delete" : { - "post" : { - "tags" : [ "userRole" ], - "summary" : "deletes a single system user role", - "description" : "By sending a valid payload you can delete a user role.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "role" ], - "properties" : { - "role" : { - "type" : "string", - "example" : "test" + "/userRole/delete": { + "post": { + "tags": [ + "userRole" + ], + "summary": "deletes a single system user role", + "description": "By sending a valid payload you can delete a user role.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { + "type": "string", + "example": "test" }, - "path" : { - "type" : "string", - "example" : "/test" + "path": { + "type": "string", + "example": "/test" }, - "method" : { - "type" : "string", - "example" : "GET" + "method": { + "type": "string", + "example": "GET" } } } } } }, - "responses" : { - "200" : { - "description" : "policy deleted" + "responses": { + "200": { + "description": "policy deleted" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/entity" : { - "post" : { - "tags" : [ "entity" ], - "summary" : "creates a new entity", - "description" : "The new entity endpoint.", - "requestBody" : { - "description" : "The body of the payload. Contact ids must be populated if part of the body with existinct contactids.", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "name", "type" ], - "properties" : { - "name" : { - "type" : "string", - "example" : "The Leftorium" + "/entity": { + "post": { + "tags": [ + "entity" + ], + "summary": "creates a new entity", + "description": "The new entity endpoint.", + "requestBody": { + "description": "The body of the payload. Contact ids must be populated if part of the body with existinct contactids.", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "type" + ], + "properties": { + "name": { + "type": "string", + "example": "The Leftorium" }, - "type" : { - "type" : "string", - "example" : "Assisted Living Facility" + "type": { + "type": "string", + "example": "Assisted Living Facility" }, - "address" : { - "type" : "object", - "properties" : { - "street" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "123 Anyplace St." + "address": { + "type": "object", + "properties": { + "street": { + "type": "array", + "items": { + "type": "string", + "example": "123 Anyplace St." } }, - "city" : { - "type" : "string", - "example" : "Baltimore" + "city": { + "type": "string", + "example": "Baltimore" }, - "state" : { - "type" : "string", - "example" : "MD" + "state": { + "type": "string", + "example": "MD" }, - "zip" : { - "type" : "string", - "example" : "12345" + "zip": { + "type": "string", + "example": "12345" } } }, - "description" : { - "type" : "string", - "example" : "Everything for the left handed man, woman, and child!" + "description": { + "type": "string", + "example": "Everything for the left handed man, woman, and child!" } } } } } }, - "responses" : { - "200" : { - "description" : "entity created" + "responses": { + "200": { + "description": "entity created" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "get" : { - "tags" : [ "entity" ], - "summary" : "returns all system entities", - "description" : "By passing in the appropriate options, you can search for\navailable entities in the system\n", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - }, { - "in" : "query", - "name" : "type", - "schema" : { - "type" : "string", - "example" : "name" - }, - "description" : "The type of field you are searching on" - }, { - "in" : "query", - "name" : "value", - "schema" : { - "type" : "string", - "example" : "The Leftorium" - }, - "description" : "The value you are searching for" - } ], - "responses" : { - "200" : { - "description" : "search results matching criteria" - }, - "401" : { - "description" : "Unauthorized" - }, - "500" : { - "description" : "Server error" + "get": { + "tags": [ + "entity" + ], + "summary": "returns all system entities", + "description": "By passing in the appropriate options, you can search for\navailable entities in the system\n", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + }, + { + "in": "query", + "name": "type", + "schema": { + "type": "string", + "example": "name" + }, + "description": "The type of field you are searching on" + }, + { + "in": "query", + "name": "value", + "schema": { + "type": "string", + "example": "The Leftorium" + }, + "description": "The value you are searching for" + } + ], + "responses": { + "200": { + "description": "search results matching criteria" + }, + "401": { + "description": "Unauthorized" + }, + "500": { + "description": "Server error" } } }, - "put" : { - "tags" : [ "entity" ], - "summary" : "updates any single system entity", - "description" : "By sending a valid payload you can update an entity.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "id" ], - "properties" : { - "id" : { - "type" : "string", - "format" : "uuid", - "example" : "05533f95-b440-4f9d-876d-653636dce0c8" + "put": { + "tags": [ + "entity" + ], + "summary": "updates any single system entity", + "description": "By sending a valid payload you can update an entity.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "example": "05533f95-b440-4f9d-876d-653636dce0c8" }, - "name" : { - "type" : "string", - "example" : "The Leftorium" + "name": { + "type": "string", + "example": "The Leftorium" }, - "address" : { - "type" : "object", - "properties" : { - "street" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "123 Anyplace St." + "address": { + "type": "object", + "properties": { + "street": { + "type": "array", + "items": { + "type": "string", + "example": "123 Anyplace St." } }, - "city" : { - "type" : "string", - "example" : "Baltimore" + "city": { + "type": "string", + "example": "Baltimore" }, - "state" : { - "type" : "string", - "example" : "MD" + "state": { + "type": "string", + "example": "MD" }, - "zip" : { - "type" : "string", - "example" : "12345" + "zip": { + "type": "string", + "example": "12345" } } }, - "checkIn" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "updatedAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "checkIn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" }, - "status" : { - "type" : "string", - "example" : "Safe" + "status": { + "type": "string", + "example": "Safe" }, - "UserId" : { - "type" : "string", - "format" : "uuid", - "example" : "4d9721a2-07f8-45ac-9570-682f4774cfa5" + "UserId": { + "type": "string", + "format": "uuid", + "example": "4d9721a2-07f8-45ac-9570-682f4774cfa5" }, - "ContactId" : { - "type" : "string", - "format" : "uuid", - "example" : "4d9721a2-07f8-45ac-9570-682f4774cfa5" + "ContactId": { + "type": "string", + "format": "uuid", + "example": "4d9721a2-07f8-45ac-9570-682f4774cfa5" }, - "questionnaire" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "number", - "example" : 1 + "questionnaire": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 }, - "question1" : { - "type" : "string", - "example" : "They have left handed can openers" + "question1": { + "type": "string", + "example": "They have left handed can openers" }, - "question2" : { - "type" : "boolean", - "example" : false + "question2": { + "type": "boolean", + "example": false } } }, - "notes" : { - "type" : "string", - "example" : "Everything is okilly dokilly" + "notes": { + "type": "string", + "example": "Everything is okilly dokilly" } } } }, - "description" : { - "type" : "string", - "example" : "Everything for the left-handed man, woman, and child!" + "description": { + "type": "string", + "example": "Everything for the left-handed man, woman, and child!" }, - "attributes" : { - "type" : "object", - "properties" : { - "capacity" : { - "type" : "number", - "example" : 42 + "attributes": { + "type": "object", + "properties": { + "capacity": { + "type": "number", + "example": 42 } } } @@ -746,397 +821,440 @@ } } }, - "responses" : { - "200" : { - "description" : "entity updated" + "responses": { + "200": { + "description": "entity updated" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/entity/{entity_id}" : { - "get" : { - "tags" : [ "entity" ], - "summary" : "returns a single system entity", - "description" : "By passing the entity id, you can lookup an entity.", - "parameters" : [ { - "in" : "path", - "name" : "entity_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the entity" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "the entity object", - "content" : { - "session/json" : { - "schema" : { - "$ref" : "#/components/schemas/EntityItem" + "/entity/{entity_id}": { + "get": { + "tags": [ + "entity" + ], + "summary": "returns a single system entity", + "description": "By passing the entity id, you can lookup an entity.", + "parameters": [ + { + "in": "path", + "name": "entity_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the entity" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "the entity object", + "content": { + "session/json": { + "schema": { + "$ref": "#/components/schemas/EntityItem" } } } }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "delete" : { - "tags" : [ "entity" ], - "summary" : "deletes a single system entity", - "description" : "By sending a valid payload you can delete a user.", - "parameters" : [ { - "in" : "path", - "name" : "entity_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "the id of the entity to delete." - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "entity_id deleted" - }, - "401" : { - "description" : "Unauthorized" - }, - "422" : { - "description" : "Invalid input" - }, - "500" : { - "description" : "Server error" + "delete": { + "tags": [ + "entity" + ], + "summary": "deletes a single system entity", + "description": "By sending a valid payload you can delete a user.", + "parameters": [ + { + "in": "path", + "name": "entity_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "the id of the entity to delete." + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "entity_id deleted" + }, + "401": { + "description": "Unauthorized" + }, + "422": { + "description": "Invalid input" + }, + "500": { + "description": "Server error" } } } }, - "/entity/link/{entity_id}" : { - "post" : { - "tags" : [ "entity" ], - "summary" : "links an entity with a list of given contacts", - "description" : "By passing the entity id and list of contacts, you can link the entity to each contact.", - "parameters" : [ { - "in" : "path", - "name" : "entity_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the entity" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "contacts" ], - "properties" : { - "contacts" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "", - "title" : "" - } ] + "/entity/link/{entity_id}": { + "post": { + "tags": [ + "entity" + ], + "summary": "links an entity with a list of given contacts", + "description": "By passing the entity id and list of contacts, you can link the entity to each contact.", + "parameters": [ + { + "in": "path", + "name": "entity_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the entity" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "contacts" + ], + "properties": { + "contacts": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "", + "title": "" + } + ] } } } } } }, - "responses" : { - "200" : { - "description" : "Successful/already exists" + "responses": { + "200": { + "description": "Successful/already exists" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/entity/unlink/{entity_id}" : { - "post" : { - "tags" : [ "entity" ], - "summary" : "unlinks an entity from a list of given contacts", - "description" : "By passing the entity id and list of contacts, you can unlink the entity from each contact.", - "parameters" : [ { - "in" : "path", - "name" : "entity_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the entity" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "contacts" ], - "properties" : { - "contacts" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "" - } ] + "/entity/unlink/{entity_id}": { + "post": { + "tags": [ + "entity" + ], + "summary": "unlinks an entity from a list of given contacts", + "description": "By passing the entity id and list of contacts, you can unlink the entity from each contact.", + "parameters": [ + { + "in": "path", + "name": "entity_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the entity" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "contacts" + ], + "properties": { + "contacts": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "" + } + ] } } } } } }, - "responses" : { - "200" : { - "description" : "Successful/already exists" + "responses": { + "200": { + "description": "Successful/already exists" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "422" : { - "description" : "Invalid input" + "422": { + "description": "Invalid input" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/contact" : { - "post" : { - "security" : [ - { - "bearerAuth" : [] - } - ], - "tags" : [ "contact" ], - "summary" : "creates a new contact", - "description" : "The new contact endpoint.", - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "name" ], - "properties" : { - "name" : { - "type" : "string", - "example" : "The Leftorium" + "/contact": { + "post": { + "security": [ + { + "bearerAuth": [] + } + ], + "tags": [ + "contact" + ], + "summary": "creates a new contact", + "description": "The new contact endpoint.", + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "example": "The Leftorium" }, - "address" : { - "type" : "object", - "properties" : { - "street" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "123 Anyplace St." + "address": { + "type": "object", + "properties": { + "street": { + "type": "array", + "items": { + "type": "string", + "example": "123 Anyplace St." } }, - "city" : { - "type" : "string", - "example" : "Baltimore" + "city": { + "type": "string", + "example": "Baltimore" }, - "state" : { - "type" : "string", - "example" : "MD" + "state": { + "type": "string", + "example": "MD" }, - "zip" : { - "type" : "string", - "example" : "12345" + "zip": { + "type": "string", + "example": "12345" } } }, - "phone" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "example" : 9.87654321E8 + "phone": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "example": 9.87654321E8 }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "email" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "format" : "email", - "example" : "hello@leftorium.com" + "email": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "format": "email", + "example": "hello@leftorium.com" }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "UserID" : { - "type" : "string", - "format" : "uuid", - "example" : "abafa852-ecd0-4d57-9083-85f4dfd9c402" + "UserID": { + "type": "string", + "format": "uuid", + "example": "abafa852-ecd0-4d57-9083-85f4dfd9c402" }, - "entities" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "", - "title" : "" - } ] + "entities": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "", + "title": "" + } + ] } } } } } }, - "responses" : { - "201" : { - "description" : "contact created" + "responses": { + "201": { + "description": "contact created" }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "get" : { - "tags" : [ "contact" ], - "summary" : "returns all, or searched for, system contacts", - "description" : "By passing in the appropriate options, you can search for\navailable contacts in the system\n", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - }, { - "in" : "query", - "name" : "type", - "schema" : { - "type" : "string", - "example" : "email" - }, - "description" : "The type of field you are searching on" - }, { - "in" : "query", - "name" : "value", - "schema" : { - "type" : "string", - "example" : "ned.flanders@leftorium.com" - }, - "description" : "The value you are searching for" - } ], - "responses" : { - "200" : { - "description" : "search results matching criteria", - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "properties" : { - "_meta" : { - "type" : "object", - "properties" : { - "total" : { - "type" : "number", - "example" : 1 + "get": { + "tags": [ + "contact" + ], + "summary": "returns all, or searched for, system contacts", + "description": "By passing in the appropriate options, you can search for\navailable contacts in the system\n", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + }, + { + "in": "query", + "name": "type", + "schema": { + "type": "string", + "example": "email" + }, + "description": "The type of field you are searching on" + }, + { + "in": "query", + "name": "value", + "schema": { + "type": "string", + "example": "ned.flanders@leftorium.com" + }, + "description": "The value you are searching for" + } + ], + "responses": { + "200": { + "description": "search results matching criteria", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "_meta": { + "type": "object", + "properties": { + "total": { + "type": "number", + "example": 1 } } }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ContactItem" + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContactItem" } } } @@ -1144,125 +1262,134 @@ } } }, - "400" : { - "description" : "Invalid input" + "400": { + "description": "Invalid input" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } }, - "put" : { - "tags" : [ "contact" ], - "summary" : "updates any single system contact", - "description" : "By sending a valid payload you can update a contact.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "id" ], - "properties" : { - "id" : { - "type" : "string", - "format" : "uuid", - "example" : "05533f95-b440-4f9d-876d-653636dce0c8" + "put": { + "tags": [ + "contact" + ], + "summary": "updates any single system contact", + "description": "By sending a valid payload you can update a contact.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "example": "05533f95-b440-4f9d-876d-653636dce0c8" }, - "name" : { - "type" : "string", - "example" : "The Leftorium" + "name": { + "type": "string", + "example": "The Leftorium" }, - "address" : { - "type" : "object", - "properties" : { - "street" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "123 Anyplace St." + "address": { + "type": "object", + "properties": { + "street": { + "type": "array", + "items": { + "type": "string", + "example": "123 Anyplace St." } }, - "city" : { - "type" : "string", - "example" : "Baltimore" + "city": { + "type": "string", + "example": "Baltimore" }, - "state" : { - "type" : "string", - "example" : "MD" + "state": { + "type": "string", + "example": "MD" }, - "zip" : { - "type" : "string", - "example" : "12345" + "zip": { + "type": "string", + "example": "12345" } } }, - "phone" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "example" : 9.87654321E8 + "phone": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "example": 9.87654321E8 }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "email" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "format" : "email", - "example" : "hello@leftorium.com" + "email": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "format": "email", + "example": "hello@leftorium.com" }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "UserID" : { - "type" : "string", - "format" : "uuid", - "example" : "abafa852-ecd0-4d57-9083-85f4dfd9c402" + "UserID": { + "type": "string", + "format": "uuid", + "example": "abafa852-ecd0-4d57-9083-85f4dfd9c402" }, - "entities" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "", - "title" : "" - } ] + "entities": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "", + "title": "" + } + ] }, - "attributes" : { - "type" : "object", - "properties" : { - "notes" : { - "type" : "string", - "example" : "Neighbor" + "attributes": { + "type": "object", + "properties": { + "notes": { + "type": "string", + "example": "Neighbor" } } } @@ -1271,50 +1398,54 @@ } } }, - "responses" : { - "200" : { - "description" : "contact updated" + "responses": { + "200": { + "description": "contact updated" }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/contact/send" : { - "post" : { - "tags" : [ "contact" ], - "summary" : "sends a check-in email to all contacts", - "description" : "By sending a request to this endpoint, you can send an email to a single contact or all contacts based on entity or contact id. By sending entity ids you will send an email to each contact associated with each entity id passed. By passed contact ids you will send an email to each contact for each entity they are associated with. By passing nothing you will send an email to every contact and every association.", - "parameters" : [ { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "properties" : { - "relationshipTitle" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "Primary Contact" + "/contact/send": { + "post": { + "tags": [ + "contact" + ], + "summary": "sends a check-in email to all contacts", + "description": "By sending a request to this endpoint, you can send an email to a single contact or all contacts based on entity or contact id. By sending entity ids you will send an email to each contact associated with each entity id passed. By passed contact ids you will send an email to each contact for each entity they are associated with. By passing nothing you will send an email to every contact and every association.", + "parameters": [ + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "relationshipTitle": { + "type": "array", + "items": { + "type": "string", + "example": "Primary Contact" } } } @@ -1322,517 +1453,679 @@ } } }, - "responses" : { - "200" : { - "description" : "contacts emailed" + "responses": { + "200": { + "description": "contacts emailed", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "results": { + "type": "object", + "properties": { + "total": { + "type": "number", + "example": 1 + }, + "message": { + "type": "string", + "example": "Contacts emailed" + } + } + } + } + } + } + } }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/contact/{contact_id}" : { - "get" : { - "tags" : [ "contact" ], - "summary" : "returns a single system contact", - "description" : "By passing the contact id, you can lookup a contact.", - "parameters" : [ { - "in" : "path", - "name" : "contact_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the contact" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "the contact object", - "content" : { - "session/json" : { - "schema" : { - "$ref" : "#/components/schemas/ContactItem" + "/contact/send/{type}/{id}": { + "post": { + "tags": [ + "contact" + ], + "summary": "sends a check-in email to all contacts", + "description": "By sending a request to this endpoint, you can send an email to a single contact or all contacts based on entity or contact id. By sending entity ids you will send an email to each contact associated with each entity id passed. By passed contact ids you will send an email to each contact for each entity they are associated with. By passing nothing you will send an email to every contact and every association.", + "parameters": [ + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the entity" + }, + { + "in": "path", + "name": "type", + "schema": { + "type": "string", + "example": "entity" + }, + "required": true, + "description": "type of the id" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": {} + } + } + } + }, + "responses": { + "200": { + "description": "contact emailed", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "results": { + "type": "object", + "properties": { + "total": { + "type": "number", + "example": 1 + }, + "message": { + "type": "string", + "example": "Contact email sent" + } + } + } + } } } } }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" + } + } + } + }, + "/contact/{contact_id}": { + "get": { + "tags": [ + "contact" + ], + "summary": "returns a single system contact", + "description": "By passing the contact id, you can lookup a contact.", + "parameters": [ + { + "in": "path", + "name": "contact_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the contact" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "the contact object", + "content": { + "session/json": { + "schema": { + "$ref": "#/components/schemas/ContactItem" + } + } + } + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized" + }, + "500": { + "description": "Server error" } } }, - "delete" : { - "tags" : [ "contact" ], - "summary" : "deletes a single system contact", - "description" : "By sending a valid payload you can delete a user.", - "parameters" : [ { - "in" : "path", - "name" : "contact_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "the id of the contact to delete." - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "contact_id deleted" - }, - "400" : { - "description" : "Bad Request" - }, - "401" : { - "description" : "Unauthorized" - }, - "500" : { - "description" : "Server error" + "delete": { + "tags": [ + "contact" + ], + "summary": "deletes a single system contact", + "description": "By sending a valid payload you can delete a user.", + "parameters": [ + { + "in": "path", + "name": "contact_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "the id of the contact to delete." + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "contact_id deleted" + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized" + }, + "500": { + "description": "Server error" } } } }, - "/contact/link/{contact_id}" : { - "post" : { - "tags" : [ "contact" ], - "summary" : "links a contact with a list of given entities", - "description" : "By passing the contact id and list of entities, you can link the contact to each entity.", - "parameters" : [ { - "in" : "path", - "name" : "contact_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the contact" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "entities" ], - "properties" : { - "entities" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "", - "title" : "" - } ] + "/contact/link/{contact_id}": { + "post": { + "tags": [ + "contact" + ], + "summary": "links a contact with a list of given entities", + "description": "By passing the contact id and list of entities, you can link the contact to each entity.", + "parameters": [ + { + "in": "path", + "name": "contact_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the contact" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "entities" + ], + "properties": { + "entities": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "", + "title": "" + } + ] } } } } } }, - "responses" : { - "200" : { - "description" : "Successful/already exists" + "responses": { + "200": { + "description": "Successful/already exists" }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/contact/unlink/{contact_id}" : { - "post" : { - "tags" : [ "contact" ], - "summary" : "unlinks a contact from a list of given entities", - "description" : "By passing the contact id and list of entities, you can unlink the contact from each entity.", - "parameters" : [ { - "in" : "path", - "name" : "contact_id", - "schema" : { - "type" : "string", - "format" : "uuid" - }, - "required" : true, - "description" : "id of the contact" - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "requestBody" : { - "description" : "The body of the payload", - "required" : true, - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "required" : [ "entities" ], - "properties" : { - "entities" : { - "type" : "string", - "example" : [ { - "id" : "" - }, { - "id" : "" - } ] + "/contact/unlink/{contact_id}": { + "post": { + "tags": [ + "contact" + ], + "summary": "unlinks a contact from a list of given entities", + "description": "By passing the contact id and list of entities, you can unlink the contact from each entity.", + "parameters": [ + { + "in": "path", + "name": "contact_id", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true, + "description": "id of the contact" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "requestBody": { + "description": "The body of the payload", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "entities" + ], + "properties": { + "entities": { + "type": "string", + "example": [ + { + "id": "" + }, + { + "id": "" + } + ] } } } } } }, - "responses" : { - "200" : { - "description" : "Successful/already exists" + "responses": { + "200": { + "description": "Successful/already exists" }, - "400" : { - "description" : "Bad Request" + "400": { + "description": "Bad Request" }, - "401" : { - "description" : "Unauthorized" + "401": { + "description": "Unauthorized" }, - "500" : { - "description" : "Server error" + "500": { + "description": "Server error" } } } }, - "/csv/{model_type}" : { - "get" : { - "tags" : [ "csv" ], - "summary" : "returns a comma separated list of the model_type requested", - "description" : "By passing the model_type, you are returned a comma separated list of that model_type. Valid model types are Entity, EntityContact, and Contact.", - "parameters" : [ { - "in" : "path", - "name" : "model_type", - "schema" : { - "type" : "string" - }, - "required" : true, - "description" : "type of model you want a csv data dump for. Options are Contact, Entity, and EntityContact." - }, { - "in" : "header", - "name" : "token", - "required" : false, - "deprecated" : true, - "schema" : { - "type" : "string", - "example" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" - } - } ], - "responses" : { - "200" : { - "description" : "the csv data dump with column headers" - }, - "401" : { - "description" : "Unauthorized" - }, - "422" : { - "description" : "Invalid input" - }, - "500" : { - "description" : "Server error" + "/csv/{model_type}": { + "get": { + "tags": [ + "csv" + ], + "summary": "returns a comma separated list of the model_type requested", + "description": "By passing the model_type, you are returned a comma separated list of that model_type. Valid model types are Entity, EntityContact, and Contact.", + "parameters": [ + { + "in": "path", + "name": "model_type", + "schema": { + "type": "string" + }, + "required": true, + "description": "type of model you want a csv data dump for. Options are Contact, Entity, and EntityContact." + }, + { + "in": "query", + "name": "filter", + "schema": { + "type": "string", + "example": "Ned Flanders" + }, + "description": "The name filter of field you are searching on" + }, + { + "in": "header", + "name": "token", + "required": false, + "deprecated": true, + "schema": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE1ODA3NTM0MDUsImV4cCI6MTU4MDgzOTgwNX0.Q6W7Vo6By35yjZBeLKkk96s8LyqIE2G39AG1H3LRD9M" + } + } + ], + "responses": { + "200": { + "description": "the csv data dump with column headers" + }, + "401": { + "description": "Unauthorized" + }, + "422": { + "description": "Invalid input" + }, + "500": { + "description": "Server error" } } } } }, - "components" : { - "securitySchemes" : { - "bearerAuth" : { - "type" : "http", - "scheme" : "bearer", - "bearerFormat" : "JWT" + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" } }, - "schemas" : { - "HealthcheckItem" : { - "type" : "object", - "required" : [ "uptime", "environment", "version", "requestId" ], - "properties" : { - "uptime" : { - "type" : "string", - "example" : "42:42:42" - }, - "environment" : { - "type" : "string", - "example" : "dev" - }, - "version" : { - "type" : "string", - "example" : "0.0.1" - }, - "requestId" : { - "type" : "string", - "format" : "uuid", - "example" : "602e1bd9-3eb1-4a26-a0d1-6bf08e8c0a66" + "schemas": { + "HealthcheckItem": { + "type": "object", + "required": [ + "uptime", + "environment", + "version", + "requestId" + ], + "properties": { + "uptime": { + "type": "string", + "example": "42:42:42" + }, + "environment": { + "type": "string", + "example": "dev" + }, + "version": { + "type": "string", + "example": "0.0.1" + }, + "requestId": { + "type": "string", + "format": "uuid", + "example": "602e1bd9-3eb1-4a26-a0d1-6bf08e8c0a66" } } }, - "UserItem" : { - "type" : "object", - "required" : [ "email" ], - "properties" : { - "id" : { - "type" : "string", - "format" : "uuid", - "example" : "4d9721a2-07f8-45ac-9570-682f4774cfa5" - }, - "email" : { - "type" : "string", - "format" : "email", - "example" : "homer.simpson@sfpp.com" - }, - "displayNamme" : { - "type" : "string", - "example" : "Homer Simpson" - }, - "phone" : { - "type" : "string", - "example" : "1234567890" - }, - "attributes" : { - "type" : "string", - "example" : null - }, - "createdAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" - }, - "updatedAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" - }, - "roles" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "user" + "UserItem": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "example": "4d9721a2-07f8-45ac-9570-682f4774cfa5" + }, + "email": { + "type": "string", + "format": "email", + "example": "homer.simpson@sfpp.com" + }, + "displayNamme": { + "type": "string", + "example": "Homer Simpson" + }, + "phone": { + "type": "string", + "example": "1234567890" + }, + "attributes": { + "type": "string", + "example": null + }, + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" + }, + "roles": { + "type": "array", + "items": { + "type": "string", + "example": "user" } } } }, - "EntityItem" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "string", - "format" : "uuid", - "example" : "c2fb852c-17fd-4e2b-9ea4-78128af9a5e9" - }, - "name" : { - "type" : "string", - "example" : "The Leftorium" - }, - "type" : { - "type" : "string", - "example" : "Test" - }, - "address" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "array", - "items" : { - "type" : "string", - "example" : "123 Anyplace St." + "EntityItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "example": "c2fb852c-17fd-4e2b-9ea4-78128af9a5e9" + }, + "name": { + "type": "string", + "example": "The Leftorium" + }, + "type": { + "type": "string", + "example": "Test" + }, + "address": { + "type": "object", + "properties": { + "address": { + "type": "array", + "items": { + "type": "string", + "example": "123 Anyplace St." } }, - "city" : { - "type" : "string", - "example" : "Baltimore" + "city": { + "type": "string", + "example": "Baltimore" }, - "state" : { - "type" : "string", - "example" : "MD" + "state": { + "type": "string", + "example": "MD" }, - "zip" : { - "type" : "string", - "example" : "12345" + "zip": { + "type": "string", + "example": "12345" } } }, - "checkIn" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "updatedAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "checkIn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" }, - "status" : { - "type" : "string", - "example" : "Safe" + "status": { + "type": "string", + "example": "Safe" }, - "UserId" : { - "type" : "string", - "format" : "uuid", - "example" : "4d9721a2-07f8-45ac-9570-682f4774cfa5" + "UserId": { + "type": "string", + "format": "uuid", + "example": "4d9721a2-07f8-45ac-9570-682f4774cfa5" }, - "ContactId" : { - "type" : "string", - "format" : "uuid", - "example" : "4d9721a2-07f8-45ac-9570-682f4774cfa5" + "ContactId": { + "type": "string", + "format": "uuid", + "example": "4d9721a2-07f8-45ac-9570-682f4774cfa5" }, - "questionnaire" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "number", - "example" : 1 + "questionnaire": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 }, - "question1" : { - "type" : "string", - "example" : "They have left handed can openers" + "question1": { + "type": "string", + "example": "They have left handed can openers" }, - "question2" : { - "type" : "boolean", - "example" : false + "question2": { + "type": "boolean", + "example": false } } }, - "notes" : { - "type" : "string", - "example" : "Everything is okilly dokilly" + "notes": { + "type": "string", + "example": "Everything is okilly dokilly" } } } }, - "description" : { - "type" : "string", - "example" : "Everything for the left handed man, woman, and child!" + "description": { + "type": "string", + "example": "Everything for the left handed man, woman, and child!" }, - "createdAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" }, - "updatedAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" } } }, - "ContactItem" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "string", - "format" : "uuid", - "example" : "abafa852-ecd0-4d57-9083-85f4dfd9c402" - }, - "UserID" : { - "type" : "string", - "format" : "uuid", - "example" : "abafa852-ecd0-4d57-9083-85f4dfd9c402" - }, - "EntityId" : { - "type" : "string", - "format" : "uuid", - "example" : "c2fb852c-17fd-4e2b-9ea4-78128af9a5e9" - }, - "name" : { - "type" : "string", - "example" : "Ned Flanders" - }, - "phone" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "example" : 6.54987321E8 + "ContactItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "example": "abafa852-ecd0-4d57-9083-85f4dfd9c402" + }, + "UserID": { + "type": "string", + "format": "uuid", + "example": "abafa852-ecd0-4d57-9083-85f4dfd9c402" + }, + "EntityId": { + "type": "string", + "format": "uuid", + "example": "c2fb852c-17fd-4e2b-9ea4-78128af9a5e9" + }, + "name": { + "type": "string", + "example": "Ned Flanders" + }, + "phone": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "example": 6.54987321E8 }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "email" : { - "type" : "array", - "items" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string", - "format" : "email", - "example" : "ned.flanders@leftorium.com" + "email": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "format": "email", + "example": "ned.flanders@leftorium.com" }, - "isPrimary" : { - "type" : "boolean", - "example" : true + "isPrimary": { + "type": "boolean", + "example": true } } } }, - "createdAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" }, - "updatedAt" : { - "type" : "string", - "format" : "date-time", - "example" : "2020-01-21T13:45:52.348Z" + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2020-01-21T13:45:52.348Z" } } }