Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODINVOICE-17 Define API #3

Merged
merged 18 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
139 changes: 108 additions & 31 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,64 @@
"handlers": [
{
"methods": ["GET"],
"pathPattern": "/invoice",
"permissionsRequired": ["invoice.collection.get"]
"pathPattern": "/invoicing/invoices",
"permissionsRequired": ["invoicing.collection.get"]
craigmcnally marked this conversation as resolved.
Show resolved Hide resolved
},
{
"methods": ["POST"],
"pathPattern": "/invoice",
"permissionsRequired": ["invoice.item.post"]
"pathPattern": "/invoicing/invoices",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://dev.folio.org/guidelines/naming-conventions/ . According to the naming conventions

The first portion is the exact name of the responsible module (back-end modules drop the mod- prefix).

Should we be renaming the module? or the permissions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't rename the module then permission names will be like:
invoice.invoice.item.post
invoice.invoice-lines.item.post ?

Copy link
Contributor Author

@javalkar-varun javalkar-varun Mar 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this and keep the module name as is:
invoice.item.post
invoice-lines.item.post
invoice-number.item.post
Any thoughts @craigmcnally @piotr-kalashuk ?

Copy link
Contributor

@craigmcnally craigmcnally Mar 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn it, I was unaware of the "exact name of the responsible module" part.

I guess it should be:
invoice.invoices.item.post
invoice.invoice-lines.item.post
etc.

Sorry for the confusion @javalkar-varun I should have known about this convention. Good catch @KVupp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. I have corrected permission names.

"permissionsRequired": ["invoicing.item.post"]
craigmcnally marked this conversation as resolved.
Show resolved Hide resolved
},
{
"methods": ["GET"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.get"]
"pathPattern": "/invoicing/invoices/{id}",
"permissionsRequired": ["invoicing.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.put"]
"pathPattern": "/invoicing/invoices/{id}",
"permissionsRequired": ["invoicing.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/invoice/{id}",
"permissionsRequired": ["invoice.item.delete"]
}
"pathPattern": "/invoicing/invoices/{id}",
"permissionsRequired": ["invoicing.item.delete"]
},
{
"methods": ["GET"],
"pathPattern": "/invoicing/invoice-lines",
"permissionsRequired": ["invoicing.invoice-lines.collection.get"]
},
{
"methods": ["POST"],
"pathPattern": "/invoicing/invoice-lines",
"permissionsRequired": ["invoicing.invoice-lines.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/invoicing/invoice-lines/{id}",
"permissionsRequired": ["invoicing.invoice-lines.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/invoicing/invoice-lines/{id}",
"permissionsRequired": ["invoicing.invoice-lines.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/invoicing/invoice-lines/{id}",
"permissionsRequired": ["invoicing.invoice-lines.item.delete"]
},
{
"methods": ["GET"],
"pathPattern": "/invoicing/invoice-number",
"permissionsRequired": ["invoicing.invoice-number.item.get"]
},
{
"methods": ["POST"],
"pathPattern": "/invoicing/invoice-number/validate",
"permissionsRequired": ["invoicing.invoice-number.item.post"]
}
]
},
{
Expand All @@ -56,40 +91,82 @@
],
"permissionSets": [
{
"permissionName": "invoice.collection.get",
"displayName": "Invoice - get invoice collection",
"description": "Get invoice collection"
"permissionName": "invoicing.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": "invoicing.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": "invoicing.item.post",
"displayName": "Invoice - create a new Invoice",
"description": "Create a new invoice"
},
{
"permissionName": "invoice.item.put",
"permissionName": "invoicing.item.put",
"displayName": "Invoice - modify invoice",
"description": "Modify invoice"
"description": "Modify an existing Invoice"
},
{
"permissionName": "invoicing.item.delete",
"displayName": "Invoice - delete an existing Invoice",
"description": "Delete an existing Invoice"
},
{
"permissionName": "invoicing.invoice-lines.collection.get",
"displayName": "Invoice Line - get collection of Invoice lines",
"description": "Get collection of Invoice lines"
},
{
"permissionName": "invoicing.invoice-lines.item.get",
"displayName": "Invoice - get an existing Invoice line",
"description": "Get an existing Invoice line"
},
{
"permissionName": "invoicing.invoice-lines.item.post",
"displayName": "Invoice - create a new Invoice line",
"description": "Create a new Invoice line"
},
{
"permissionName": "invoice.item.delete",
"displayName": "Invoice - delete invoice",
"description": "Delete invoice"
"permissionName": "invoicing.invoice-lines.item.put",
"displayName": "Invoice - modify an existing Invoice line",
"description": "Modify an existing Invoice line"
},
{
"permissionName": "invoice.all",
"permissionName": "invoicing.invoice-lines.item.delete",
"displayName": "Invoice - delete an existing Invoice line",
"description": "Delete an existing Invoice line"
},
{
"permissionName": "invoicing.invoice-number.item.get",
"displayName": "Invoice - generate a Invoice Number",
"description": "Generate a Invoice Number"
},
{
"permissionName": "invoicing.invoice-number.item.post",
"displayName": "Invoice - validate a Invoice Number",
"description": "Validate a Invoice Number"
},
{
"permissionName": "invoicing.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"
"invoicing.collection.get",
"invoicing.item.get",
"invoicing.item.post",
"invoicing.item.put",
"invoicing.item.delete",
"invoicing.invoice-line.collection.get",
"invoicing.invoice-line.item.get",
"invoicing.invoice-line.item.post",
"invoicing.invoice-line.item.put",
"invoicing.invoice-line.item.delete",
"invoicing.invoice-number.item.get",
"invoicing.invoice-number.item.post"
],
"visible": false
}
Expand Down
1 change: 1 addition & 0 deletions ramls/acq-models
Submodule acq-models added at bd0d3e
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}:
/invoicing:
/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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add pageable to get end point

is: [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