Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oderayi committed Dec 18, 2024
1 parent 84354f3 commit 8c355b5
Show file tree
Hide file tree
Showing 13 changed files with 463 additions and 454 deletions.
12 changes: 6 additions & 6 deletions src/api/bulkQuotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const { kafkaConfig } = new Config()
*/
module.exports = {
/**
* summary: BulkQuotes
* description: The HTTP request POST /bulkQuotes is used to request the creation of a bulk quote for the provided financial transactions in the server.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: BulkQuotes
* description: The HTTP request POST /bulkQuotes is used to request the creation of a bulk quote for the provided financial transactions in the server.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
post: async function BulkQuotes (context, request, h) {
const histTimerEnd = Metrics.getHistogram(
'bulkQuotes_post',
Expand Down
24 changes: 12 additions & 12 deletions src/api/bulkQuotes/{id}.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ const { kafkaConfig } = new Config()
*/
module.exports = {
/**
* summary: getBulkQuotesById
* description: The HTTP request GET /bulkQuotes/<id> is used to get information regarding an earlier created or requested bulk quote. The <id> in the URI should contain the bulkQuoteId that was used for the creation of the bulk quote.
* parameters: Accept
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: getBulkQuotesById
* description: The HTTP request GET /bulkQuotes/<id> is used to get information regarding an earlier created or requested bulk quote. The <id> in the URI should contain the bulkQuoteId that was used for the creation of the bulk quote.
* parameters: Accept
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
get: async function getBulkQuotesById (context, request, h) {
const histTimerEnd = Metrics.getHistogram(
'bulkQuotes_id_get',
Expand All @@ -75,12 +75,12 @@ module.exports = {
}
},
/**
* summary: putBulkQuotesById
* description: The callback PUT /bulkQuotes/<id> is used to inform the client of a requested or created bulk quote. The <id> in the URI should contain the bulkQuoteId that was used for the creation of the bulk quote, or the <id> that was used in the GET /bulkQuotes/<id>.
* parameters: body, Content-Length
* produces: application/json
* responses: 200, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: putBulkQuotesById
* description: The callback PUT /bulkQuotes/<id> is used to inform the client of a requested or created bulk quote. The <id> in the URI should contain the bulkQuoteId that was used for the creation of the bulk quote, or the <id> that was used in the GET /bulkQuotes/<id>.
* parameters: body, Content-Length
* produces: application/json
* responses: 200, 400, 401, 403, 404, 405, 406, 501, 503
*/
put: async function putBulkQuotesById (context, request, h) {
const histTimerEnd = Metrics.getHistogram(
'bulkQuotes_id_put',
Expand Down
16 changes: 8 additions & 8 deletions src/api/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const { kafkaConfig } = new Config()
*/
module.exports = {
/**
* summary: Quotes
* description:
* - The HTTP request POST /quotes is used to request the creation of a quote for the provided financial transaction in the server.
* - The HTTP request `POST /fxQuotes` is used to ask an FXP to provide a quotation for a currency conversion.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: Quotes
* description:
* - The HTTP request POST /quotes is used to request the creation of a quote for the provided financial transaction in the server.
* - The HTTP request `POST /fxQuotes` is used to ask an FXP to provide a quotation for a currency conversion.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
post: async function Quotes (context, request, h) {
const isFX = !!request.payload.conversionRequestId

Expand Down
36 changes: 18 additions & 18 deletions src/api/quotes/{id}.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const { kafkaConfig } = new Config()
*/
module.exports = {
/**
* summary: QuotesById
* description:
* - The HTTP request GET /quotes/<id> is used to get information regarding an earlier created or requested quote. The <id> in the URI should contain the quoteId that was used for the creation of the quote.
* - The HTTP request `GET /fxQuotes/{ID}` is used to request information regarding a request for quotation for a currency conversion which the sender has previously issued. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the quote.
* parameters: Accept
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: QuotesById
* description:
* - The HTTP request GET /quotes/<id> is used to get information regarding an earlier created or requested quote. The <id> in the URI should contain the quoteId that was used for the creation of the quote.
* - The HTTP request `GET /fxQuotes/{ID}` is used to request information regarding a request for quotation for a currency conversion which the sender has previously issued. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the quote.
* parameters: Accept
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
*/
get: async function getQuotesById (context, request, h) {
const isFX = request.headers['content-type'].includes('fxQuotes')

Expand Down Expand Up @@ -84,16 +84,16 @@ module.exports = {
},

/**
* summary: QuotesById and QuotesByIdAndError
* description:
* - The callback PUT /quotes/<id> is used to inform the client of a requested or created quote. The <id> in the URI should contain the quoteId that was used for the creation of the quote, or the <id> that was used in the GET /quotes/<id>GET /quotes/<id>,
* - The callback `PUT /fxQuotes/{ID}` is used to inform the requester about the outcome of a request for quotation for a currency conversion. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the FX quote, or the `{ID}` that was used in the `GET /fxQuotes/{ID}` request.
* - If the server is unable to find or create a quote, or some other processing error occurs, the error callback PUT /quotes/<id>/error is used. The <id> in the URI should contain the quoteId that was used for the creation of the quote, or the <id> that was used in the GET /quotes/<id>.
* - If the FXP is unable to find or create a FX quote, or some other processing error occurs, the error callback `PUT /fxQuotes/{ID}/error` is used. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the FX quote, or the `{ID}` that was used in the `GET /fxQuotes/{ID}` request.
* parameters: body, Content-Length
* produces: application/json
* responses: 200, 400, 401, 403, 404, 405, 406, 501, 503
*/
* summary: QuotesById and QuotesByIdAndError
* description:
* - The callback PUT /quotes/<id> is used to inform the client of a requested or created quote. The <id> in the URI should contain the quoteId that was used for the creation of the quote, or the <id> that was used in the GET /quotes/<id>GET /quotes/<id>,
* - The callback `PUT /fxQuotes/{ID}` is used to inform the requester about the outcome of a request for quotation for a currency conversion. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the FX quote, or the `{ID}` that was used in the `GET /fxQuotes/{ID}` request.
* - If the server is unable to find or create a quote, or some other processing error occurs, the error callback PUT /quotes/<id>/error is used. The <id> in the URI should contain the quoteId that was used for the creation of the quote, or the <id> that was used in the GET /quotes/<id>.
* - If the FXP is unable to find or create a FX quote, or some other processing error occurs, the error callback `PUT /fxQuotes/{ID}/error` is used. The `{ID}` in the URI should contain the `conversionRequestId` that was used for the creation of the FX quote, or the `{ID}` that was used in the `GET /fxQuotes/{ID}` request.
* parameters: body, Content-Length
* produces: application/json
* responses: 200, 400, 401, 403, 404, 405, 406, 501, 503
*/
put: async function putQuotesById (context, request, h) {
const isFX = request.headers['content-type'].includes('fxQuotes')
const isError = !!request.payload.errorInformation
Expand Down
70 changes: 36 additions & 34 deletions src/data/bulkQuotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,27 @@
/* istanbul ignore file */

'use strict'

const Mockgen = require('../../test/util/mockgen.js')

/**
* Operations on /bulkQuotes
*/
module.exports = {
/**
* summary: BulkQuotes
* description: The HTTP request POST /bulkQuotes is used to request the creation of a bulk quote for the provided financial transactions in the server.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
* operationId: BulkQuotes
*/
* summary: BulkQuotes
* description: The HTTP request POST /bulkQuotes is used to request the creation of a bulk quote for the provided financial transactions in the server.
* parameters: body, Accept, Content-Length, Content-Type, Date, X-Forwarded-For, FSPIOP-Source, FSPIOP-Destination, FSPIOP-Encryption, FSPIOP-Signature, FSPIOP-URI, FSPIOP-HTTP-Method
* produces: application/json
* responses: 202, 400, 401, 403, 404, 405, 406, 501, 503
* operationId: BulkQuotes
*/
post: {
202: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -60,9 +62,9 @@ module.exports = {
},
400: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -71,9 +73,9 @@ module.exports = {
},
401: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -82,9 +84,9 @@ module.exports = {
},
403: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -93,9 +95,9 @@ module.exports = {
},
404: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -104,9 +106,9 @@ module.exports = {
},
405: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -115,9 +117,9 @@ module.exports = {
},
406: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -126,9 +128,9 @@ module.exports = {
},
501: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand All @@ -137,9 +139,9 @@ module.exports = {
},
503: function (req, res, callback) {
/**
* Using mock data generator module.
* Replace this by actual data for the api.
*/
* Using mock data generator module.
* Replace this by actual data for the api.
*/
Mockgen().responses({
path: '/bulkQuotes',
operation: 'post',
Expand Down
Loading

0 comments on commit 8c355b5

Please sign in to comment.