Skip to content

Commit

Permalink
Merge pull request #346 from nci-ats/dev
Browse files Browse the repository at this point in the history
Sprint 7 v0.0.14
  • Loading branch information
shekarpendem authored May 18, 2017
2 parents 9c326e4 + 1112f3b commit 0a49adf
Show file tree
Hide file tree
Showing 23 changed files with 1,009 additions and 405 deletions.
16 changes: 11 additions & 5 deletions dba/seeders/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
require('dotenv').config();

module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.bulkInsert('users', [
{user_name: process.env.ADMINROLE_USER, pass_hash: process.env.ADMINROLE_HASH, user_role: 'admin', created: 'now()', updated: 'now()'},
{user_name: process.env.USERROLE_USER, pass_hash: process.env.USERROLE_HASH, user_role: 'user', created: 'now()', updated: 'now()'}
]);
up: function (queryInterface, Sequelize) {
let userAccounts = [];
if(process.env.ADMINROLE_USER && process.env.ADMINROLE_HASH){
userAccounts.push({user_name: process.env.ADMINROLE_USER, pass_hash: process.env.ADMINROLE_HASH, user_role: 'admin', created: 'now()', updated: 'now()'});
}
if(process.env.USERROLE_USER && process.env.USERROLE_HASH){
userAccounts.push({user_name: process.env.USERROLE_USER, pass_hash: process.env.USERROLE_HASH, user_role: 'user', created: 'now()', updated: 'now()'});
}
if(userAccounts.length > 0){
return queryInterface.bulkInsert('users', userAccounts);
}
},
down: function (queryInterface, Sequelize) {
return queryInterface.bulkDelete('users', [
Expand Down
30 changes: 26 additions & 4 deletions docs/permit-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ These steps define the process for creating a new permit type using Example Perm

"/permits/applications/special-uses/commercial/example-permit/": {
"post": {
"x-validation":{
"$ref":"validation.json#examplePermit"
},
"x-validation":"validation.json#examplePermit",
"parameters": [
{
"in": "formData",
Expand Down Expand Up @@ -96,7 +94,23 @@ These steps define the process for creating a new permit type using Example Perm
"basicField":"securityId",
"default":"",
"fromIntake":false,
"madeOf":["region","forest","district"],
"madeOf":{
"fields":[
{
"fromIntake":true,
"field":"region"
},
{
"fromIntake":true,
"field":"forest"
},
{
"fromIntake":false,
"value":"123"
}
],
"function":"concat"
},
"store":["basic:/application", "basic:/contact/address", "basic:/contact/phone"],
"type" : "string"
},
Expand All @@ -119,6 +133,14 @@ These steps define the process for creating a new permit type using Example Perm

- `store` describes where this field should be stored, either in the middlelayer DB or in the basic API. It can list multiple places to store this field

- `madeOf` describes how to auto-populate the field, if fromIntake is false.
- `fields` lists the fields, and values which are to be used when auto-populating the field.
- `fromIntake` indicates whether this piece of the field is from the intake module or not
- If `fromIntake` is true, `field` is expected in the same object, specifying the field where this part of the field should come from.
- If `fromIntake` is false, `value` is expected in the same object, specifying what value is to be used in this part of the field.
-`function` describes the function that should be used on an array of all indicies of `fields`, current options are `concat` and `contId`.
- To add an option for this field, create a function in basic.js which takes an array as input and outputs a string. Then update the `buildAutoPopulatedFields` function in basic.js by adding a case to the switch/case statement for the name of the newly created function and then a call to that function inside the case statement.

Files:
- `maxSize` is measured in megabytes

Expand Down
77 changes: 57 additions & 20 deletions mocks/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"tags": [
],
"paths": {
"/contact/person/{lastname}/": {
"/contact/lastname/{lastname}": {
"get": {
"tags": [
"Contact Person"
Expand All @@ -31,24 +31,37 @@
"200": {
"description": "Success",
"examples": {
"application/json": {
"contCn": "987654321",
"contId": "1234",
"contName": "Jane Roe",
"application/json": [
{
"contCn": "100000001",
"contId": "LNAME, FNAME",
"contName": "fname lname",
"contactType": "PERSON",
"firstName": "Jane",
"lastName": "Roe",
"firstName": "Fname",
"lastName": "Lname",
"orgCode": null,
"orgType": null,
"personPrefix": "MS",
"securityId": "0000"
}
"securityId": "112233"
},
{
"contCn": "100000002",
"contId": "LNAME2, FNAME2",
"contName": "fname2 lname2",
"contactType": "PERSON",
"firstName": "Fname2",
"lastName": "Lname2",
"orgCode": null,
"orgType": null,
"personPrefix": "MS",
"securityId": "112221"
}]
}
}
}
}
},
"/contact/person/": {
"/contact/person": {
"post": {
"tags": [
"Contact Person"
Expand Down Expand Up @@ -76,7 +89,7 @@
}
}
},
"/contact/orgcode/{orgname}/": {
"/contact/orgcode/{orgname}": {
"get": {
"tags": [
"Contact Organization"
Expand All @@ -99,24 +112,48 @@
"200": {
"description": "Success",
"examples": {
"application/json": {
"contCn": "987654321",
"contId": "1234",
"application/json": [{
"contCn": "200000001",
"contId": "TEMP ORGANIZATION",
"contName": "Acme",
"contactType": "ORGANIZATION",
"firstName": null,
"lastName": null,
"orgCode": "INC",
"orgType": "CORPORATION",
"personPrefix": null,
"securityId": null
}
"securityId": "110022"
},
{
"contCn": "200000002",
"contId": "TEMP ORGANIZATION2",
"contName": "Acme",
"contactType": "ORGANIZATION",
"firstName": null,
"lastName": null,
"orgCode": "INC",
"orgType": "CORPORATION",
"personPrefix": null,
"securityId": "112230"
},
{
"contCn": "200000003",
"contId": "TEMP ORGANIZATION",
"contName": "Acme",
"contactType": "ORGANIZATION",
"firstName": null,
"lastName": null,
"orgCode": "INC",
"orgType": "CORPORATION",
"personPrefix": null,
"securityId": "110024"
}]
}
}
}
}
},
"/contact/orgcode/": {
"/contact/orgcode": {
"post": {
"tags": [
"Contact Organization"
Expand Down Expand Up @@ -147,7 +184,7 @@
}
}
},
"/contact-address/": {
"/contact-address": {
"post": {
"tags": [
"Contact Address"
Expand Down Expand Up @@ -178,7 +215,7 @@
}
}
},
"/contact-phone/": {
"/contact-phone": {
"post": {
"tags": [
"Contact Phone"
Expand Down Expand Up @@ -207,7 +244,7 @@
}
}
},
"/application/": {
"/application": {
"post": {
"tags": [
"Application"
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fs-middlelayer-api",
"version": "0.0.13",
"version": "0.0.14",
"description": "US Forest Service ePermit Middlelayer API",
"engines": {
"node": "6.9.x",
Expand Down
11 changes: 3 additions & 8 deletions src/api.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"swagger": "2.0",
"basePath":"/",
"info": {
"description": "This page is for developers. We built this site entirely off the APIs below and we want to share them with you.",
"version": "0.0.13",
"version": "0.0.14",
"title": "API Documentation for Developers"
},
"tags": [
Expand Down Expand Up @@ -158,9 +157,7 @@
},
"/permits/applications/special-uses/noncommercial/": {
"post": {
"x-validation":{
"$ref":"controllers/validation.json#noncommercialApplication"
},
"x-validation":"controllers/validation.json#noncommercialApplication",
"tags": [
"Noncommercial Permit"
],
Expand Down Expand Up @@ -424,9 +421,7 @@
},
"/permits/applications/special-uses/commercial/temp-outfitters/": {
"post": {
"x-validation":{
"$ref":"controllers/validation.json#tempOutfitterApplication"
},
"x-validation":"controllers/validation.json#tempOutfitterApplication",
"tags": [
"Outfitter and Guide Permit"
],
Expand Down
Loading

0 comments on commit 0a49adf

Please sign in to comment.