FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE …€¦ · Introduction Application of...
Transcript of FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE …€¦ · Introduction Application of...
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
1
1. Introduction
Application of photo-reports for NGOs and animal welfare about animal abuse. This application
allows submit complaints relying on geo-referenced and time-referenced imagery.
This tool features a significant benefit as a reporting tool as it includes essential information for
the complaint can thrive. This project is part of a real development which will implement the
features listed below plus others that require more time for proper implementation:
management control panel, push notifications, SMS notifications, etc...
1.1 Expected List of Features
Capture images using the mobile camera.
Geo-located photo-complaint.
Time-located photo-complaint.
Ability to add comments to the photo-complaint.
User authentication (JWT).
New user creation.
System roles (Access Control Layer, ACL).
All these features are essential in an application of this type. When making a complaint
referenced visual evidences are a great support.
In addition, the membership system is critical to a correct management of both users and
complaints which need to be submitted / supported by a user registered in the system.
1.2 Technology Overview
Loopback backend over IBM Bluemix Cloud Development Platform.
AngularJS-Ionic frontend (Control Panel-Mobile App).
2. Design and Implementation
2.1 REST API Specification
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
2
2.1.1 REST API Overview
This REST API is developed with Loopback framework and IBM API Connect IBM Bluemix Cloud
Development Platform. The database used is a non-SQL IBM Cloudant.
This REST API have the following endpoints:
GET /Users/{id}/accessTokens/{fk} DELETE /Users/{id}/accessTokens/{fk} PUT /Users/{id}/accessTokens/{fk} GET /Users/{id}/accessTokens POST /Users/{id}/accessTokens DELETE /Users/{id}/accessTokens GET /Users/{id}/accessTokens/count POST /Users PUT /Users PATCH /Users GET /Users POST /Users/replaceOrCreate POST /Users/upsertWithWhere GET /Users/{id}/exists HEAD /Users/{id} GET /Users/{id} DELETE /Users/{id} PUT /Users/{id} PATCH /Users/{id} POST /Users/{id}/replace GET /Users/findOne POST /Users/update GET /Users/count POST /Users/login POST /Users/logout GET /Users/confirm POST /Users/reset POST /Notes PUT /Notes PATCH /Notes
GET /Notes POST /Notes/replaceOrCreate POST /Notes/upsertWithWhere GET /Notes/{id}/exists HEAD /Notes/{id} GET /Notes/{id} DELETE /Notes/{id} PUT /Notes/{id} PATCH /Notes/{id} POST /Notes/{id}/replace GET /Notes/findOne POST /Notes/update GET /Notes/count POST /Complaints PUT /Complaints PATCH /Complaints GET /Complaints POST /Complaints/replaceOrCreate POST /Complaints/upsertWithWhere GET /Complaints/{id}/exists HEAD /Complaints/{id} GET /Complaints/{id} DELETE /Complaints/{id} PUT /Complaints/{id} PATCH /Complaints/{id} POST /Complaints/{id}/replace GET /Complaints/findOne POST /Complaints/update GET /Complaints/count
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
3
2.1.2 In-depth REST API
ATTENTION: Here is the complete definition of the REST API shown. For best viewing you need
to copy the code, paste it into a .json file and import it into http://editor.swagger.io/. You can
also paste the code directly.
{ "paths": {
"/Users/{id}/accessTokens/{fk}": {
"get": {
"tags": [ "User"
],
"summary": "Find a related item by id for accessTokens.",
"operationId": "User.prototype.__findById__accessTokens", "parameters": [
{
"name": "fk",
"in": "path", "description": "Foreign key for accessTokens",
"required": true,
"type": "string",
"format": "JSON" },
{
"name": "id",
"in": "path", "description": "User id",
"required": true,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/AccessToken"
} }
},
"deprecated": false
}, "delete": {
"tags": [
"User"
], "summary": "Delete a related item by id for accessTokens.",
"operationId": "User.prototype.__destroyById__accessTokens",
"parameters": [
{ "name": "fk",
"in": "path",
"description": "Foreign key for accessTokens",
"required": true, "type": "string",
"format": "JSON"
},
{ "name": "id",
"in": "path",
"description": "User id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"204": {
"description": "Request was successful"
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
4
} },
"deprecated": false
},
"put": { "tags": [
"User"
],
"summary": "Update a related item by id for accessTokens.", "operationId": "User.prototype.__updateById__accessTokens",
"parameters": [
{
"name": "fk", "in": "path",
"description": "Foreign key for accessTokens",
"required": true,
"type": "string", "format": "JSON"
},
{
"name": "data", "in": "body",
"required": false,
"schema": {
"$ref": "#/definitions/User" }
},
{
"name": "id", "in": "path",
"description": "User id",
"required": true,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/AccessToken" }
}
},
"deprecated": false }
},
"/Users/{id}/accessTokens": {
"get": { "tags": [
"User"
],
"summary": "Queries accessTokens of User.", "operationId": "User.prototype.__get__accessTokens",
"parameters": [
{
"name": "filter", "in": "query",
"required": false,
"type": "string",
"format": "JSON" },
{
"name": "id",
"in": "path", "description": "User id",
"required": true,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"type": "array",
"items": { "$ref": "#/definitions/AccessToken"
}
}
} },
"deprecated": false
},
"post": { "tags": [
"User"
],
"summary": "Creates a new instance in accessTokens of this model.", "operationId": "User.prototype.__create__accessTokens",
"parameters": [
{
"name": "data", "in": "body",
"required": false,
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
5
"schema": { "$ref": "#/definitions/User"
}
},
{ "name": "id",
"in": "path",
"description": "User id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/AccessToken"
}
}
}, "deprecated": false
},
"delete": {
"tags": [ "User"
],
"summary": "Deletes all accessTokens of this model.",
"operationId": "User.prototype.__delete__accessTokens", "parameters": [
{
"name": "id",
"in": "path", "description": "User id",
"required": true,
"type": "string",
"format": "JSON" }
],
"responses": {
"204": { "description": "Request was successful"
}
},
"deprecated": false }
},
"/Users/{id}/accessTokens/count": {
"get": { "tags": [
"User"
],
"summary": "Counts accessTokens of User.", "operationId": "User.prototype.__count__accessTokens",
"parameters": [
{
"name": "where", "in": "query",
"description": "Criteria to match model instances",
"required": false,
"type": "string", "format": "JSON"
},
{
"name": "id", "in": "path",
"description": "User id",
"required": true,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"type": "object", "properties": {
"count": {
"type": "number",
"format": "double" }
}
}
} },
"deprecated": false
}
}, "/Users": {
"post": {
"tags": [
"User" ],
"summary": "Create a new instance of the model and persist it into the data source.",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
6
"operationId": "User.create", "parameters": [
{
"name": "data",
"in": "body", "description": "Model instance data",
"required": false,
"schema": {
"$ref": "#/definitions/User" }
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/User" }
}
},
"deprecated": false },
"put": {
"tags": [
"User" ],
"summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "User.upsert__put_Users",
"parameters": [ {
"name": "data",
"in": "body",
"description": "Model instance data", "required": false,
"schema": {
"$ref": "#/definitions/User"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/User"
} }
},
"deprecated": false
}, "patch": {
"tags": [
"User"
], "summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "User.upsert__patch_Users",
"parameters": [
{ "name": "data",
"in": "body",
"description": "Model instance data",
"required": false, "schema": {
"$ref": "#/definitions/User"
}
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/User"
}
} },
"deprecated": false
},
"get": { "tags": [
"User"
],
"summary": "Find all instances of the model matched by filter from the data source.", "operationId": "User.find",
"parameters": [
{
"name": "filter", "in": "query",
"description": "Filter defining fields, where, include, order, offset, and limit",
"required": false,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
7
"schema": { "type": "array",
"items": {
"$ref": "#/definitions/User"
} }
}
},
"deprecated": false }
},
"/Users/replaceOrCreate": {
"post": { "tags": [
"User"
],
"summary": "Replace an existing model instance or insert a new one into the data source.", "operationId": "User.replaceOrCreate",
"parameters": [
{
"name": "data", "in": "body",
"description": "Model instance data",
"required": false,
"schema": { "$ref": "#/definitions/User"
}
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/User"
}
}
}, "deprecated": false
}
},
"/Users/upsertWithWhere": { "post": {
"tags": [
"User"
], "summary": "Update an existing model instance or insert a new one into the data source based on the where criteria.",
"operationId": "User.upsertWithWhere",
"parameters": [
{ "name": "where",
"in": "query",
"description": "Criteria to match model instances",
"required": false, "type": "string",
"format": "JSON"
},
{ "name": "data",
"in": "body",
"description": "An object of model property name/value pairs",
"required": false, "schema": {
"$ref": "#/definitions/User"
}
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/User"
}
} },
"deprecated": false
}
}, "/Users/{id}/exists": {
"get": {
"tags": [
"User" ],
"summary": "Check whether a model instance exists in the data source.",
"operationId": "User.exists__get_Users_{id}_exists",
"parameters": [ {
"name": "id",
"in": "path",
"description": "Model id", "required": true,
"type": "string",
"format": "JSON"
} ],
"responses": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
8
"200": { "description": "Request was successful",
"schema": {
"type": "object",
"properties": { "exists": {
"type": "boolean"
}
} }
}
},
"deprecated": false }
},
"/Users/{id}": {
"head": { "tags": [
"User"
],
"summary": "Check whether a model instance exists in the data source.", "operationId": "User.exists__head_Users_{id}",
"parameters": [
{
"name": "id", "in": "path",
"description": "Model id",
"required": true,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"type": "object", "properties": {
"exists": {
"type": "boolean"
} }
}
}
}, "deprecated": false
},
"get": {
"tags": [ "User"
],
"summary": "Find a model instance by {{id}} from the data source.",
"operationId": "User.findById", "parameters": [
{
"name": "id",
"in": "path", "description": "Model id",
"required": true,
"type": "string",
"format": "JSON" },
{
"name": "filter",
"in": "query", "description": "Filter defining fields and include",
"required": false,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/User"
} }
},
"deprecated": false
}, "delete": {
"tags": [
"User"
], "summary": "Delete a model instance by {{id}} from the data source.",
"operationId": "User.deleteById",
"parameters": [
{ "name": "id",
"in": "path",
"description": "Model id",
"required": true, "type": "string",
"format": "JSON"
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
9
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"type": "object"
}
} },
"deprecated": false
},
"put": { "tags": [
"User"
],
"summary": "Patch attributes for a model instance and persist it into the data source.", "operationId": "User.prototype.updateAttributes__put_Users_{id}",
"parameters": [
{
"name": "data", "in": "body",
"description": "An object of model property name/value pairs",
"required": false,
"schema": { "$ref": "#/definitions/User"
}
},
{ "name": "id",
"in": "path",
"description": "User id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/User"
}
}
}, "deprecated": false
},
"patch": {
"tags": [ "User"
],
"summary": "Patch attributes for a model instance and persist it into the data source.",
"operationId": "User.prototype.updateAttributes__patch_Users_{id}", "parameters": [
{
"name": "data",
"in": "body", "description": "An object of model property name/value pairs",
"required": false,
"schema": {
"$ref": "#/definitions/User" }
},
{
"name": "id", "in": "path",
"description": "User id",
"required": true,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/User" }
}
},
"deprecated": false }
},
"/Users/{id}/replace": {
"post": { "tags": [
"User"
],
"summary": "Replace attributes for a model instance and persist it into the data source.", "operationId": "User.replaceById",
"parameters": [
{
"name": "id", "in": "path",
"description": "Model id",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
10
"required": true, "type": "string",
"format": "JSON"
},
{ "name": "data",
"in": "body",
"description": "Model instance data",
"required": false, "schema": {
"$ref": "#/definitions/User"
}
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/User"
}
} },
"deprecated": false
}
}, "/Users/findOne": {
"get": {
"tags": [
"User" ],
"summary": "Find first instance of the model matched by filter from the data source.",
"operationId": "User.findOne",
"parameters": [ {
"name": "filter",
"in": "query",
"description": "Filter defining fields, where, include, order, offset, and limit", "required": false,
"type": "string",
"format": "JSON"
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/User"
}
} },
"deprecated": false
}
}, "/Users/update": {
"post": {
"tags": [
"User" ],
"summary": "Update instances of the model matched by {{where}} from the data source.",
"operationId": "User.updateAll",
"parameters": [ {
"name": "where",
"in": "query",
"description": "Criteria to match model instances", "required": false,
"type": "string",
"format": "JSON"
}, {
"name": "data",
"in": "body",
"description": "An object of model property name/value pairs", "required": false,
"schema": {
"$ref": "#/definitions/User"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"description": "The number of instances updated",
"type": "object" }
}
},
"deprecated": false }
},
"/Users/count": {
"get": { "tags": [
"User"
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
11
], "summary": "Count instances of the model matched by where from the data source.",
"operationId": "User.count",
"parameters": [
{ "name": "where",
"in": "query",
"description": "Criteria to match model instances",
"required": false, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "type": "object",
"properties": {
"count": {
"type": "number", "format": "double"
}
}
} }
},
"deprecated": false
} },
"/Users/login": {
"post": {
"tags": [ "User"
],
"summary": "Login a user with username/email and password.",
"operationId": "User.login", "parameters": [
{
"name": "credentials",
"in": "body", "required": true,
"schema": {
"type": "object"
} },
{
"name": "include",
"in": "query", "description": "Related objects to include in the response. See the description of return value for more details.",
"required": false,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"description": "The response body contains properties of the AccessToken created on login.\nDepending on the value
of `include` parameter, the body may contain additional properties:\n\n\n\n\n\n\n\n - `user` - `U+007BUserU+007D` - Data of the currently logged in\n\nuser. (`include=user`)\n\n\n",
"type": "object"
}
} },
"deprecated": false
}
}, "/Users/logout": {
"post": {
"tags": [
"User" ],
"summary": "Logout a user with access token.",
"operationId": "User.logout",
"parameters": [], "responses": {
"204": {
"description": "Request was successful"
} },
"deprecated": false
}
}, "/Users/confirm": {
"get": {
"tags": [
"User" ],
"summary": "Confirm a user registration with email verification token.",
"operationId": "User.confirm",
"parameters": [ {
"name": "uid",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
12
"in": "query", "required": true,
"type": "string"
},
{ "name": "token",
"in": "query",
"required": true,
"type": "string" },
{
"name": "redirect",
"in": "query", "required": false,
"type": "string"
}
], "responses": {
"204": {
"description": "Request was successful"
} },
"deprecated": false
}
}, "/Users/reset": {
"post": {
"tags": [
"User" ],
"summary": "Reset password for a user with email.",
"operationId": "User.resetPassword",
"parameters": [ {
"name": "options",
"in": "body",
"required": true, "schema": {
"type": "object"
}
} ],
"responses": {
"204": {
"description": "Request was successful" }
},
"deprecated": false
} },
"/Notes": {
"post": {
"tags": [ "Note"
],
"summary": "Create a new instance of the model and persist it into the data source.",
"operationId": "Note.create", "parameters": [
{
"name": "data",
"in": "body", "description": "Model instance data",
"required": false,
"schema": {
"$ref": "#/definitions/Note" }
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note" }
}
},
"deprecated": false },
"put": {
"tags": [
"Note" ],
"summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "Note.upsert__put_Notes",
"parameters": [ {
"name": "data",
"in": "body",
"description": "Model instance data", "required": false,
"schema": {
"$ref": "#/definitions/Note"
} }
],
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
13
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note" }
}
},
"deprecated": false },
"patch": {
"tags": [
"Note" ],
"summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "Note.upsert__patch_Notes",
"parameters": [ {
"name": "data",
"in": "body",
"description": "Model instance data", "required": false,
"schema": {
"$ref": "#/definitions/Note"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note"
} }
},
"deprecated": false
}, "get": {
"tags": [
"Note"
], "summary": "Find all instances of the model matched by filter from the data source.",
"operationId": "Note.find",
"parameters": [
{ "name": "filter",
"in": "query",
"description": "Filter defining fields, where, include, order, offset, and limit",
"required": false, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "type": "array",
"items": {
"$ref": "#/definitions/Note"
} }
}
},
"deprecated": false }
},
"/Notes/replaceOrCreate": {
"post": { "tags": [
"Note"
],
"summary": "Replace an existing model instance or insert a new one into the data source.", "operationId": "Note.replaceOrCreate",
"parameters": [
{
"name": "data", "in": "body",
"description": "Model instance data",
"required": false,
"schema": { "$ref": "#/definitions/Note"
}
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/Note"
}
}
}, "deprecated": false
}
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
14
}, "/Notes/upsertWithWhere": {
"post": {
"tags": [
"Note" ],
"summary": "Update an existing model instance or insert a new one into the data source based on the where criteria.",
"operationId": "Note.upsertWithWhere",
"parameters": [ {
"name": "where",
"in": "query",
"description": "Criteria to match model instances", "required": false,
"type": "string",
"format": "JSON"
}, {
"name": "data",
"in": "body",
"description": "An object of model property name/value pairs", "required": false,
"schema": {
"$ref": "#/definitions/Note"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note"
} }
},
"deprecated": false
} },
"/Notes/{id}/exists": {
"get": {
"tags": [ "Note"
],
"summary": "Check whether a model instance exists in the data source.",
"operationId": "Note.exists__get_Notes_{id}_exists", "parameters": [
{
"name": "id",
"in": "path", "description": "Model id",
"required": true,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"type": "object",
"properties": { "exists": {
"type": "boolean"
}
} }
}
},
"deprecated": false }
},
"/Notes/{id}": {
"head": { "tags": [
"Note"
],
"summary": "Check whether a model instance exists in the data source.", "operationId": "Note.exists__head_Notes_{id}",
"parameters": [
{
"name": "id", "in": "path",
"description": "Model id",
"required": true,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"type": "object", "properties": {
"exists": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
15
"type": "boolean" }
}
}
} },
"deprecated": false
},
"get": { "tags": [
"Note"
],
"summary": "Find a model instance by {{id}} from the data source.", "operationId": "Note.findById",
"parameters": [
{
"name": "id", "in": "path",
"description": "Model id",
"required": true,
"type": "string", "format": "JSON"
},
{
"name": "filter", "in": "query",
"description": "Filter defining fields and include",
"required": false,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note" }
}
},
"deprecated": false },
"delete": {
"tags": [
"Note" ],
"summary": "Delete a model instance by {{id}} from the data source.",
"operationId": "Note.deleteById",
"parameters": [ {
"name": "id",
"in": "path",
"description": "Model id", "required": true,
"type": "string",
"format": "JSON"
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"type": "object"
}
} },
"deprecated": false
},
"put": { "tags": [
"Note"
],
"summary": "Patch attributes for a model instance and persist it into the data source.", "operationId": "Note.prototype.updateAttributes__put_Notes_{id}",
"parameters": [
{
"name": "data", "in": "body",
"description": "An object of model property name/value pairs",
"required": false,
"schema": { "$ref": "#/definitions/Note"
}
},
{ "name": "id",
"in": "path",
"description": "PersistedModel id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
16
"description": "Request was successful", "schema": {
"$ref": "#/definitions/Note"
}
} },
"deprecated": false
},
"patch": { "tags": [
"Note"
],
"summary": "Patch attributes for a model instance and persist it into the data source.", "operationId": "Note.prototype.updateAttributes__patch_Notes_{id}",
"parameters": [
{
"name": "data", "in": "body",
"description": "An object of model property name/value pairs",
"required": false,
"schema": { "$ref": "#/definitions/Note"
}
},
{ "name": "id",
"in": "path",
"description": "PersistedModel id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/Note"
}
}
}, "deprecated": false
}
},
"/Notes/{id}/replace": { "post": {
"tags": [
"Note"
], "summary": "Replace attributes for a model instance and persist it into the data source.",
"operationId": "Note.replaceById",
"parameters": [
{ "name": "id",
"in": "path",
"description": "Model id",
"required": true, "type": "string",
"format": "JSON"
},
{ "name": "data",
"in": "body",
"description": "Model instance data",
"required": false, "schema": {
"$ref": "#/definitions/Note"
}
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/Note"
}
} },
"deprecated": false
}
}, "/Notes/findOne": {
"get": {
"tags": [
"Note" ],
"summary": "Find first instance of the model matched by filter from the data source.",
"operationId": "Note.findOne",
"parameters": [ {
"name": "filter",
"in": "query",
"description": "Filter defining fields, where, include, order, offset, and limit", "required": false,
"type": "string",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
17
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Note"
} }
},
"deprecated": false
} },
"/Notes/update": {
"post": {
"tags": [ "Note"
],
"summary": "Update instances of the model matched by {{where}} from the data source.",
"operationId": "Note.updateAll", "parameters": [
{
"name": "where",
"in": "query", "description": "Criteria to match model instances",
"required": false,
"type": "string",
"format": "JSON" },
{
"name": "data",
"in": "body", "description": "An object of model property name/value pairs",
"required": false,
"schema": {
"$ref": "#/definitions/Note" }
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"description": "The number of instances updated", "type": "object"
}
}
}, "deprecated": false
}
},
"/Notes/count": { "get": {
"tags": [
"Note"
], "summary": "Count instances of the model matched by where from the data source.",
"operationId": "Note.count",
"parameters": [
{ "name": "where",
"in": "query",
"description": "Criteria to match model instances",
"required": false, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "type": "object",
"properties": {
"count": {
"type": "number", "format": "double"
}
}
} }
},
"deprecated": false
} },
"/Complaints": {
"post": {
"tags": [ "Complaint"
],
"summary": "Create a new instance of the model and persist it into the data source.",
"operationId": "Complaint.create", "parameters": [
{
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
18
"name": "data", "in": "body",
"description": "Model instance data",
"required": false,
"schema": { "$ref": "#/definitions/Complaint"
}
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/Complaint"
}
}
}, "deprecated": false
},
"put": {
"tags": [ "Complaint"
],
"summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "Complaint.upsert__put_Complaints", "parameters": [
{
"name": "data",
"in": "body", "description": "Model instance data",
"required": false,
"schema": {
"$ref": "#/definitions/Complaint" }
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint" }
}
},
"deprecated": false },
"patch": {
"tags": [
"Complaint" ],
"summary": "Patch an existing model instance or insert a new one into the data source.",
"operationId": "Complaint.upsert__patch_Complaints",
"parameters": [ {
"name": "data",
"in": "body",
"description": "Model instance data", "required": false,
"schema": {
"$ref": "#/definitions/Complaint"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint"
} }
},
"deprecated": false
}, "get": {
"tags": [
"Complaint"
], "summary": "Find all instances of the model matched by filter from the data source.",
"operationId": "Complaint.find",
"parameters": [
{ "name": "filter",
"in": "query",
"description": "Filter defining fields, where, include, order, offset, and limit",
"required": false, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "type": "array",
"items": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
19
"$ref": "#/definitions/Complaint" }
}
}
}, "deprecated": false
}
},
"/Complaints/replaceOrCreate": { "post": {
"tags": [
"Complaint"
], "summary": "Replace an existing model instance or insert a new one into the data source.",
"operationId": "Complaint.replaceOrCreate",
"parameters": [
{ "name": "data",
"in": "body",
"description": "Model instance data",
"required": false, "schema": {
"$ref": "#/definitions/Complaint"
}
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/Complaint"
}
} },
"deprecated": false
}
}, "/Complaints/upsertWithWhere": {
"post": {
"tags": [
"Complaint" ],
"summary": "Update an existing model instance or insert a new one into the data source based on the where criteria.",
"operationId": "Complaint.upsertWithWhere",
"parameters": [ {
"name": "where",
"in": "query",
"description": "Criteria to match model instances", "required": false,
"type": "string",
"format": "JSON"
}, {
"name": "data",
"in": "body",
"description": "An object of model property name/value pairs", "required": false,
"schema": {
"$ref": "#/definitions/Complaint"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint"
} }
},
"deprecated": false
} },
"/Complaints/{id}/exists": {
"get": {
"tags": [ "Complaint"
],
"summary": "Check whether a model instance exists in the data source.",
"operationId": "Complaint.exists__get_Complaints_{id}_exists", "parameters": [
{
"name": "id",
"in": "path", "description": "Model id",
"required": true,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
20
"type": "object", "properties": {
"exists": {
"type": "boolean"
} }
}
}
}, "deprecated": false
}
},
"/Complaints/{id}": { "head": {
"tags": [
"Complaint"
], "summary": "Check whether a model instance exists in the data source.",
"operationId": "Complaint.exists__head_Complaints_{id}",
"parameters": [
{ "name": "id",
"in": "path",
"description": "Model id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "type": "object",
"properties": {
"exists": {
"type": "boolean" }
}
}
} },
"deprecated": false
},
"get": { "tags": [
"Complaint"
],
"summary": "Find a model instance by {{id}} from the data source.", "operationId": "Complaint.findById",
"parameters": [
{
"name": "id", "in": "path",
"description": "Model id",
"required": true,
"type": "string", "format": "JSON"
},
{
"name": "filter", "in": "query",
"description": "Filter defining fields and include",
"required": false,
"type": "string", "format": "JSON"
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint" }
}
},
"deprecated": false },
"delete": {
"tags": [
"Complaint" ],
"summary": "Delete a model instance by {{id}} from the data source.",
"operationId": "Complaint.deleteById",
"parameters": [ {
"name": "id",
"in": "path",
"description": "Model id", "required": true,
"type": "string",
"format": "JSON"
} ],
"responses": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
21
"200": { "description": "Request was successful",
"schema": {
"type": "object"
} }
},
"deprecated": false
}, "put": {
"tags": [
"Complaint"
], "summary": "Patch attributes for a model instance and persist it into the data source.",
"operationId": "Complaint.prototype.updateAttributes__put_Complaints_{id}",
"parameters": [
{ "name": "data",
"in": "body",
"description": "An object of model property name/value pairs",
"required": false, "schema": {
"$ref": "#/definitions/Complaint"
}
}, {
"name": "id",
"in": "path",
"description": "PersistedModel id", "required": true,
"type": "string",
"format": "JSON"
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"$ref": "#/definitions/Complaint"
}
} },
"deprecated": false
},
"patch": { "tags": [
"Complaint"
],
"summary": "Patch attributes for a model instance and persist it into the data source.", "operationId": "Complaint.prototype.updateAttributes__patch_Complaints_{id}",
"parameters": [
{
"name": "data", "in": "body",
"description": "An object of model property name/value pairs",
"required": false,
"schema": { "$ref": "#/definitions/Complaint"
}
},
{ "name": "id",
"in": "path",
"description": "PersistedModel id",
"required": true, "type": "string",
"format": "JSON"
}
], "responses": {
"200": {
"description": "Request was successful",
"schema": { "$ref": "#/definitions/Complaint"
}
}
}, "deprecated": false
}
},
"/Complaints/{id}/replace": { "post": {
"tags": [
"Complaint"
], "summary": "Replace attributes for a model instance and persist it into the data source.",
"operationId": "Complaint.replaceById",
"parameters": [
{ "name": "id",
"in": "path",
"description": "Model id",
"required": true, "type": "string",
"format": "JSON"
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
22
}, {
"name": "data",
"in": "body",
"description": "Model instance data", "required": false,
"schema": {
"$ref": "#/definitions/Complaint"
} }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint"
} }
},
"deprecated": false
} },
"/Complaints/findOne": {
"get": {
"tags": [ "Complaint"
],
"summary": "Find first instance of the model matched by filter from the data source.",
"operationId": "Complaint.findOne", "parameters": [
{
"name": "filter",
"in": "query", "description": "Filter defining fields, where, include, order, offset, and limit",
"required": false,
"type": "string",
"format": "JSON" }
],
"responses": {
"200": { "description": "Request was successful",
"schema": {
"$ref": "#/definitions/Complaint"
} }
},
"deprecated": false
} },
"/Complaints/update": {
"post": {
"tags": [ "Complaint"
],
"summary": "Update instances of the model matched by {{where}} from the data source.",
"operationId": "Complaint.updateAll", "parameters": [
{
"name": "where",
"in": "query", "description": "Criteria to match model instances",
"required": false,
"type": "string",
"format": "JSON" },
{
"name": "data",
"in": "body", "description": "An object of model property name/value pairs",
"required": false,
"schema": {
"$ref": "#/definitions/Complaint" }
}
],
"responses": { "200": {
"description": "Request was successful",
"schema": {
"description": "The number of instances updated", "type": "object"
}
}
}, "deprecated": false
}
},
"/Complaints/count": { "get": {
"tags": [
"Complaint"
], "summary": "Count instances of the model matched by where from the data source.",
"operationId": "Complaint.count",
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
23
"parameters": [ {
"name": "where",
"in": "query",
"description": "Criteria to match model instances", "required": false,
"type": "string",
"format": "JSON"
} ],
"responses": {
"200": {
"description": "Request was successful", "schema": {
"type": "object",
"properties": {
"count": { "type": "number",
"format": "double"
}
} }
}
},
"deprecated": false }
}
},
"definitions": { "x-any": {
"properties": {}
},
"AccessToken": { "properties": {
"id": {
"type": "string"
}, "ttl": {
"default": 1209600,
"description": "time to live in seconds (2 weeks by default)",
"type": "number", "format": "double"
},
"created": {
"type": "string", "format": "date"
},
"userId": {
"type": "string" }
},
"required": [
"id" ],
"additionalProperties": false
},
"User": { "properties": {
"realm": {
"type": "string"
}, "username": {
"type": "string"
},
"credentials": { "type": "object"
},
"challenges": {
"type": "object" },
"email": {
"type": "string"
}, "emailVerified": {
"type": "boolean"
},
"status": { "type": "string"
},
"created": {
"type": "string", "format": "date"
},
"lastUpdated": {
"type": "string", "format": "date"
},
"id": {
"type": "string" }
},
"required": [
"email" ],
"additionalProperties": false
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
24
}, "Note": {
"properties": {
"content": {
"type": "string" },
"title": {
"type": "string"
}, "id": {
"type": "string"
}
}, "required": [
"title"
],
"additionalProperties": false },
"Complaint": {
"properties": {
"Comment": { "type": "string"
},
"Location": {
"$ref": "#/definitions/GeoPoint" },
"Photo": {
"type": "string"
}, "Time": {
"type": "string",
"format": "date"
}, "id": {
"type": "string"
}
}, "required": [
"Comment",
"Location",
"Photo", "Time"
],
"additionalProperties": false
}, "GeoPoint": {
"properties": {
"lat": {
"type": "number" },
"lng": {
"type": "number"
} }
}
},
"basePath": "/api", "swagger": "2.0",
"info": {
"x-ibm-name": "erzulieapi",
"version": "1.0.0", "title": "ErzulieAPI"
},
"schemes": [
"https" ],
"host": "$(catalog.host)",
"consumes": [
"application/json" ],
"produces": [
"application/json"
], "securityDefinitions": {
"clientIdHeader": {
"type": "apiKey",
"in": "header", "name": "X-IBM-Client-Id"
},
"clientSecretHeader": {
"in": "header", "name": "X-IBM-Client-Secret",
"type": "apiKey"
}
}, "security": [
{
"clientIdHeader": [],
"clientSecretHeader": [] }
],
"x-ibm-configuration": {
"testable": true, "enforced": true,
"cors": {
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
25
"enabled": true },
"catalogs": {
"apic-dev": {
"properties": { "runtime-url": "$(TARGET_URL)"
}
},
"sb": { "properties": {
"runtime-url": "https://apiconnect-b6cf2729-86de-4f30-a5c5-cfa02f905694.erzulie-dev.apic.eu-gb.mybluemix.net",
"invoke-tls-profile": "client:Loopback-client"
} }
},
"assembly": {
"execute": [ {
"invoke": {
"target-url": "$(runtime-url)$(request.path)$(request.search)",
"tls-profile": "$(invoke-tls-profile)" }
}
]
}, "properties": {
"runtime-url": {
"value": "",
"description": "", "encoded": false
},
"invoke-tls-profile": {
"value": "", "description": "",
"encoded": false
}
}, "gateway": "datapower-gateway"
}
}
2.2 Front-end Architecture Design
Both the web application and the mobile application will be alpha versions of the photo-complaint application. In the future they will be migrated to other framework. Probably Angular 2 and Ionic 2 or React and React Native.
These alpha versions will be built using the following technologies:
Mobile App: Ionic, Cordova, AngularJS, Gulp.
Web App: Bootstrap, AngularJS, Gulp.
If time allows both will have unit tests with Karma and Jasmine and E2E test with Protractor.
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
26
The structure of this apps will be the next:
Mobile App Navigation Structure
Web App (Control Panel) Navigation Structure
2.3 Database Schemas, Design and Structure
IBM Cloudant automatically generated Index documents
_design/lb-index-ddoc-ACL
_design/lb-index-ddoc-AccessToken
_design/lb-index-ddoc-Complaint
_design/lb-index-ddoc-Note
_design/lb-index-ddoc-Role
_design/lb-index-ddoc-RoleMapping
_design/lb-index-ddoc-User
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
27
Note Document
Fields:
Content: String
Title: String
Example
{
"_id": "1",
"_rev": "1-25e4e06872eeafb735f2559624a833ec",
"value": {
"rev": "1-25e4e06872eeafb735f2559624a833ec"
},
"key": "1",
"doc": {
"_id": "1",
"_rev": "1-25e4e06872eeafb735f2559624a833ec",
"content": "Prueba",
"title": "Hola",
"ErzulieIndex": "Note"
}
}
Complaint Document
Fields:
Comment: String
Location: Geopoint
Comment: String
Photo: String
Time: Date
Example
{
"_id": "2",
"_rev": "1-ee80fe332485a3a6b9aea86560fa110d",
"value": {
"rev": "1-ee80fe332485a3a6b9aea86560fa110d"
},
"key": "2",
"doc": {
"_id": "2",
"_rev": "1-ee80fe332485a3a6b9aea86560fa110d",
"Comment": "Prueba",
"Location": {
"lat": 0,
"lng": 0
},
Álvaro Domínguez López
FULL STACK DEVELOPMENT SPECIALIZATION CAPSTONE PROJECT: ARCHITECTURE DESIGN AND SOFTWARE STRUCTURE REPORT
28
"Photo": "psxfvondkgrfhiofsjoitjlhgkrtligtjdlkhsyr",
"Time": "1970-01-01T00:00:00.000Z",
"ErzulieIndex": "Complaint"
}
}
2.4 Communication
Structure of the messages to communicate between client and server can be seen in detail
following the steps of point ‘2.1.2 In-depth REST API’ using Swagger.
3. Conclusion
The objective of this project is to build an alpha version with basic functionality of a photo-
complaint app and control panel. In the future the frontend of this application will be migrated
to more modern frameworks. And from that point more advanced features will be added in
order to create an application ready for production phase.
4. References
Swagger – swagger.io
IBM Cloudant – cloudant.com
IBM Bluemix – http://www.ibm.com/cloud-computing/bluemix/es-es/
IBM API Connect Documentation – http://www.ibm.com/support/knowledgecenter/SSMNED