Skip to content

Commit

Permalink
PR #3 MODINVOICE-17 Define APIs
Browse files Browse the repository at this point in the history
MODINVOICE-17 Define APIs
  • Loading branch information
Varun Javalkar authored Mar 20, 2019
2 parents c2da9c0 + d0f48c1 commit ab647e6
Show file tree
Hide file tree
Showing 12 changed files with 530 additions and 146 deletions.
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[submodule "ramls/raml-util"]
path = ramls/raml-util
url = https://github.com/folio-org/raml
branch = raml1.0
path = ramls/raml-util
url = https://github.com/folio-org/raml
branch = raml1.0
[submodule "ramls/acq-models"]
path = ramls/acq-models
url = https://github.com/folio-org/acq-models.git
14 changes: 6 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
buildMvn {
publishModDescriptor = false
publishAPI = false
mvnDeploy = false
runLintRamlCop = false
publishModDescriptor = 'yes'
publishAPI = 'yes'
mvnDeploy = 'yes'
runLintRamlCop = 'yes'

doDocker = {
buildJavaDocker {
publishMaster = 'no'
healthChk = 'no'
publishMaster = 'yes'
healthChk = 'yes'
healthChkCmd = 'curl -sS --fail -o /dev/null http://localhost:8081/apidocs/ || exit 1'
}
}
}


2 changes: 1 addition & 1 deletion descriptors/DeploymentDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"srvcId": "${artifactId}-${version}",
"nodeId": "localhost",
"descriptor": {
"exec": "java -Dport=%p -jar ../${artifactId}/target/${artifactId}-fat.jar -Dhttp.port=%p embed_postgres=true"
"exec": "java -Dport=%p -jar ../${artifactId}/target/${artifactId}-fat.jar -Dhttp.port=%p"
}
}
139 changes: 108 additions & 31 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,69 @@
"handlers": [
{
"methods": ["GET"],
"pathPattern": "/invoice",
"permissionsRequired": ["invoice.collection.get"]
"pathPattern": "/invoice/invoices",
"permissionsRequired": ["invoice.invoices.collection.get"]
},
{
"methods": ["POST"],
"pathPattern": "/invoice",
"permissionsRequired": ["invoice.item.post"]
"pathPattern": "/invoice/invoices",
"permissionsRequired": ["invoice.invoices.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.get"]
"pathPattern": "/invoice/invoices/{id}",
"permissionsRequired": ["invoice.invoices.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.put"]
"pathPattern": "/invoice/invoices/{id}",
"permissionsRequired": ["invoice.invoices.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.delete"]
}
"pathPattern": "/invoice/invoices/{id}",
"permissionsRequired": ["invoice.invoices.item.delete"]
},
{
"methods": ["GET"],
"pathPattern": "/invoice/invoice-lines",
"permissionsRequired": ["invoice.invoice-lines.collection.get"]
},
{
"methods": ["POST"],
"pathPattern": "/invoice/invoice-lines",
"permissionsRequired": ["invoice.invoice-lines.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/invoice/invoice-lines/{id}",
"permissionsRequired": ["invoice.invoice-lines.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/invoice/invoice-lines/{id}",
"permissionsRequired": ["invoice.invoice-lines.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/invoice/invoice-lines/{id}",
"permissionsRequired": ["invoice.invoice-lines.item.delete"]
},
{
"methods": ["GET"],
"pathPattern": "/invoice/invoice-number",
"permissionsRequired": ["invoice.invoice-number.item.get"]
},
{
"methods": ["POST"],
"pathPattern": "/invoice/invoice-number/validate",
"permissionsRequired": ["invoice.invoice-number.item.post"]
}
]
},
{
"id": "_tenant",
"version": "1.0",
"version": "1.2",
"interfaceType": "system",
"handlers": [
{
Expand All @@ -56,40 +91,82 @@
],
"permissionSets": [
{
"permissionName": "invoice.collection.get",
"displayName": "Invoice - get invoice collection",
"description": "Get invoice collection"
"permissionName": "invoice.invoices.collection.get",
"displayName": "Invoice - get collection of Invoice",
"description": "Get collection of Invoice"
},
{
"permissionName": "invoice.item.get",
"displayName": "Invoice - get individual invoice",
"description": "Get individual pet"
"permissionName": "invoice.invoices.item.get",
"displayName": "Invoice - get an existing Invoice",
"description": "Get an existing Invoice"
},
{
"permissionName": "invoice.item.post",
"displayName": "Invoice - create invoice",
"description": "Create invoice"
"permissionName": "invoice.invoices.item.post",
"displayName": "Invoice - create a new Invoice",
"description": "Create a new invoice"
},
{
"permissionName": "invoice.item.put",
"permissionName": "invoice.invoices.item.put",
"displayName": "Invoice - modify invoice",
"description": "Modify invoice"
"description": "Modify an existing Invoice"
},
{
"permissionName": "invoice.invoices.item.delete",
"displayName": "Invoice - delete an existing Invoice",
"description": "Delete an existing Invoice"
},
{
"permissionName": "invoice.item.delete",
"displayName": "Invoice - delete invoice",
"description": "Delete invoice"
"permissionName": "invoice.invoice-lines.collection.get",
"displayName": "Invoice Line - get collection of Invoice lines",
"description": "Get collection of Invoice lines"
},
{
"permissionName": "invoice.invoice-lines.item.get",
"displayName": "Invoice - get an existing Invoice line",
"description": "Get an existing Invoice line"
},
{
"permissionName": "invoice.invoice-lines.item.post",
"displayName": "Invoice - create a new Invoice line",
"description": "Create a new Invoice line"
},
{
"permissionName": "invoice.invoice-lines.item.put",
"displayName": "Invoice - modify an existing Invoice line",
"description": "Modify an existing Invoice line"
},
{
"permissionName": "invoice.invoice-lines.item.delete",
"displayName": "Invoice - delete an existing Invoice line",
"description": "Delete an existing Invoice line"
},
{
"permissionName": "invoice.invoice-number.item.get",
"displayName": "Invoice - generate a Invoice Number",
"description": "Generate a Invoice Number"
},
{
"permissionName": "invoice.invoice-number.item.post",
"displayName": "Invoice - validate a Invoice Number",
"description": "Validate a Invoice Number"
},
{
"permissionName": "invoice.all",
"displayName": "Invoice module - all permissions",
"description": "Entire set of permissions needed to use the invoice module",
"subPermissions": [
"invoice.collection.get",
"invoice.item.get",
"invoice.item.post",
"invoice.item.put",
"invoice.item.delete"
"invoice.invoices.collection.get",
"invoice.invoices.item.get",
"invoice.invoices.item.post",
"invoice.invoices.item.put",
"invoice.invoices.item.delete",
"invoice.invoice-lines.collection.get",
"invoice.invoice-lines.item.get",
"invoice.invoice-lines.item.post",
"invoice.invoice-lines.item.put",
"invoice.invoice-lines.item.delete",
"invoice.invoice-number.item.get",
"invoice.invoice-number.item.post"
],
"visible": false
}
Expand Down
1 change: 1 addition & 0 deletions ramls/acq-models
Submodule acq-models added at bd0d3e
17 changes: 0 additions & 17 deletions ramls/invoice.json

This file was deleted.

125 changes: 100 additions & 25 deletions ramls/invoice.raml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ documentation:
content: This documents the API calls that can be made to manage invoices

types:
invoice: !include invoice.json
invoiceCollection: !include ./invoiceCollection.json
invoice: !include acq-models/mod-invoice-storage/schemas/invoice.json
invoiceCollection: !include acq-models/mod-invoice-storage/schemas/invoice_collection.json
invoiceLine: !include acq-models/mod-invoice-storage/schemas/invoice_line.json
invoiceLineCollection: !include acq-models/mod-invoice-storage/schemas/invoice_line_collection.json
errors: !include raml-util/schemas/errors.schema
UUID:
type: string
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$

traits:
validate: !include raml-util/traits/validation.raml
Expand All @@ -23,30 +28,100 @@ traits:
resourceTypes:
collection: !include raml-util/rtypes/collection.raml
collection-item: !include raml-util/rtypes/item-collection.raml
get-only: !include raml-util/rtypes/get-only.raml

/invoices:
displayName: Invoice
description: Invoice
type:
collection:
schemaCollection: invoiceCollection
schemaItem: invoice
exampleCollection: !include examples/invoiceCollection.sample
exampleItem: !include examples/invoice.sample

post:
is: [validate]
get:
is: [
pageable,
validate
]
/{id}:
/invoice:
/invoices:
displayName: Invoice
description: Get, Delete or Update a specific invoice
description: Manage Invoices
type:
collection:
schemaCollection: invoiceCollection
schemaItem: invoice
exampleCollection: !include acq-models/mod-invoice-storage/examples/invoice_collection.sample
exampleItem: !include acq-models/mod-invoice-storage/examples/invoice.sample

post:
description: Post invoice and number of invoice lines;
is: [validate]
get:
is: [ pageable, validate ]
/{id}:
displayName: Invoice
description: Get, Delete or Update a specific invoice
type:
collection-item:
schema: invoice
exampleItem: !include examples/invoice.sample
get:
description: Return an invoice with given {id}
put:
is: [validate]
delete:
description: Delete an invoice with given {id}
/invoice-lines:
displayName: Invoice Lines
description: Manage Invoice lines
type:
collection:
schemaCollection: invoiceLineCollection
schemaItem: invoiceLine
exampleCollection: !include acq-models/mod-invoice-storage/examples/invoice_line_collection.sample
exampleItem: !include acq-models/mod-invoice-storage/examples/invoice_line.sample
is: [validate]
get:
is: [ pageable, validate ]
post:
description: Post an invoice lines to corresponding invoice
/{id}:
displayName: Invoice Line
description: Manage invoice line by id
uriParameters:
id:
description: The UUID of a invoice line
type: UUID
type:
collection-item:
exampleItem: !include acq-models/mod-invoice-storage/examples/invoice_line.sample
schema: invoiceLine
is: [validate]
get:
description: Return an invoice line with given {id}
put:
description: Update an invoice line with given {id}
delete:
description: Delete an invoice line with given {id}
/invoice-number:
displayName: Invoice Number
description: Manage Invoice Number
type:
collection-item:
schema: invoice
exampleItem: !include examples/invoice.sample
put:
get-only:
schema: invoiceCollection
exampleCollection: !include acq-models/mod-invoice-storage/examples/invoice_collection.sample
get:
description: Get system generated Invoice Number
is: [validate]
/validate:
displayName: Invoice Number Validation
post:
description: validate if Invoice Number is unique and matches the pattern specified
is: [validate, language]
body:
application/json:
responses:
204:
description: "Valid Invoice Number"
400:
description: "Bad request, e.g. existing Invoice Number. Details of the error provided in the response."
body:
application/json:
example:
strict: false
value: !include raml-util/examples/errors.sample
500:
description: "Internal server error, e.g. due to misconfiguration"
body:
application/json:
example:
strict: false
value: !include raml-util/examples/errors.sample
Loading

0 comments on commit ab647e6

Please sign in to comment.