From 9514c5e23ff0178fcbe640f4b7f80c2d98c4b13d Mon Sep 17 00:00:00 2001 From: Prabhakar Mishra Date: Thu, 5 Dec 2024 17:00:42 +0530 Subject: [PATCH 1/3] feat: specs for post spender/expenses/bulk --- reference/spender.yaml | 105 +++++++++++++++++++ src/components/schemas/expense.yaml | 49 +++++++++ src/spender/openapi.yaml | 2 + src/spender/paths/spender@expenses@bulk.yaml | 52 +++++++++ 4 files changed, 208 insertions(+) create mode 100644 src/spender/paths/spender@expenses@bulk.yaml diff --git a/reference/spender.yaml b/reference/spender.yaml index 95cc4bb33..e2265813c 100644 --- a/reference/spender.yaml +++ b/reference/spender.yaml @@ -2450,6 +2450,54 @@ components: - ROUND_TRIP - NO_DEDUCTION - null + spender_expenses_in: + type: array + additionalProperties: false + items: + type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/id_string' + description: | + This id is provided by Fyle to identify an object + merchant: + $ref: '#/components/schemas/merchant' + purpose: + type: string + example: Team lunch + cost_center_id: + allOf: + - $ref: '#/components/schemas/fk_integer' + nullable: true + example: 1049 + category_id: + allOf: + - $ref: '#/components/schemas/fk_integer' + nullable: true + example: 49058 + project_id: + allOf: + - $ref: '#/components/schemas/fk_integer' + nullable: true + example: 92895 + source_account_id: + allOf: + - $ref: '#/components/schemas/fk_string' + example: acwbl222wlg + advance_wallet_id: + allOf: + - $ref: '#/components/schemas/fk_string' + nullable: true + example: advwrlAGwjr2 + is_billable: + $ref: '#/components/schemas/is_billable' + is_reimbursable: + $ref: '#/components/schemas/is_reimbursable' + custom_fields: + $ref: '#/components/schemas/custom_fields' expense_add_comment_action_in: type: object required: @@ -9157,6 +9205,63 @@ paths: application/json: schema: $ref: '#/components/schemas/403' + /spender/expenses/bulk: + post: + tags: + - Expenses + summary: Update expenses in bulk + description: | + Update expenses in bulk. + operationId: expenses_post_bulk + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/spender_expenses_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/expense_out' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400' + '401': + description: Unauthorized request + content: + application/json: + schema: + $ref: '#/components/schemas/401' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/403' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/404' + + + /spender/expenses/add_comment: post: tags: diff --git a/src/components/schemas/expense.yaml b/src/components/schemas/expense.yaml index d2028bbaa..db0e01fe9 100644 --- a/src/components/schemas/expense.yaml +++ b/src/components/schemas/expense.yaml @@ -917,6 +917,55 @@ expenses_in: The expense amount which is added or modified by admin or approver. example: 1900 +spender_expenses_in: + type: array + additionalProperties: false + items: + type: object + required: + - id + properties: + id: + allOf: + - $ref: './fields.yaml#/id_string' + description: | + This id is provided by Fyle to identify an object + merchant: + $ref: './fields.yaml#/merchant' + purpose: + type: string + example: Team lunch + cost_center_id: + allOf: + - $ref: './fields.yaml#/fk_integer' + nullable: true + example: 1049 + category_id: + allOf: + - $ref: './fields.yaml#/fk_integer' + nullable: true + example: 49058 + project_id: + allOf: + - $ref: './fields.yaml#/fk_integer' + nullable: true + example: 92895 + source_account_id: + allOf: + - $ref: './fields.yaml#/fk_string' + example: acwbl222wlg + advance_wallet_id: + allOf: + - $ref: './fields.yaml#/fk_string' + nullable: true + example: advwrlAGwjr2 + is_billable: + $ref: './fields.yaml#/is_billable' + is_reimbursable: + $ref: './fields.yaml#/is_reimbursable' + custom_fields: + $ref: './fields.yaml#/custom_fields' + admin_expense_in: type: object additionalProperties: false diff --git a/src/spender/openapi.yaml b/src/spender/openapi.yaml index 3204ac7b7..f16b4df6c 100644 --- a/src/spender/openapi.yaml +++ b/src/spender/openapi.yaml @@ -118,6 +118,8 @@ paths: $ref: 'paths/spender@departments.yaml' /spender/expenses: $ref: 'paths/spender@expenses.yaml' + /spender/expenses/bulk: + $ref: 'paths/spender@expenses@bulk.yaml' /spender/expenses/add_comment: $ref: 'paths/spender@expenses@add_comment.yaml' /spender/expenses/attach_receipt: diff --git a/src/spender/paths/spender@expenses@bulk.yaml b/src/spender/paths/spender@expenses@bulk.yaml new file mode 100644 index 000000000..c896f7446 --- /dev/null +++ b/src/spender/paths/spender@expenses@bulk.yaml @@ -0,0 +1,52 @@ +post: + tags: + - Expenses + summary: Update expenses in bulk + description: | + Update expenses in bulk. + operationId: expenses_post_bulk + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + $ref: '../../components/schemas/expense.yaml#/spender_expenses_in' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '../../components/schemas/expense.yaml#/expense_out' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '../../components/schemas/400.yaml' + '401': + description: Unauthorized request + content: + application/json: + schema: + $ref: '../../components/schemas/401.yaml' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '../../components/schemas/403.yaml' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '../../components/schemas/404.yaml' From a9f199cfeb260edb4ee113379266cec32f67737a Mon Sep 17 00:00:00 2001 From: Siva Date: Thu, 5 Dec 2024 11:39:36 +0000 Subject: [PATCH 2/3] Auto generate API docs --- reference/spender.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/reference/spender.yaml b/reference/spender.yaml index e2265813c..1010ce57d 100644 --- a/reference/spender.yaml +++ b/reference/spender.yaml @@ -2497,7 +2497,7 @@ components: is_reimbursable: $ref: '#/components/schemas/is_reimbursable' custom_fields: - $ref: '#/components/schemas/custom_fields' + $ref: '#/components/schemas/custom_fields' expense_add_comment_action_in: type: object required: @@ -9219,7 +9219,6 @@ paths: application/json: schema: type: object - additionalProperties: false properties: data: $ref: '#/components/schemas/spender_expenses_in' @@ -9259,9 +9258,6 @@ paths: application/json: schema: $ref: '#/components/schemas/404' - - - /spender/expenses/add_comment: post: tags: From 584262d5475f1fd4724b9a2674da45969b25ea12 Mon Sep 17 00:00:00 2001 From: Prabhakar Mishra Date: Fri, 6 Dec 2024 09:32:02 +0530 Subject: [PATCH 3/3] removed support for payment mode --- reference/spender.yaml | 11 ----------- src/components/schemas/expense.yaml | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/reference/spender.yaml b/reference/spender.yaml index 1010ce57d..6914f51b8 100644 --- a/reference/spender.yaml +++ b/reference/spender.yaml @@ -2483,19 +2483,8 @@ components: - $ref: '#/components/schemas/fk_integer' nullable: true example: 92895 - source_account_id: - allOf: - - $ref: '#/components/schemas/fk_string' - example: acwbl222wlg - advance_wallet_id: - allOf: - - $ref: '#/components/schemas/fk_string' - nullable: true - example: advwrlAGwjr2 is_billable: $ref: '#/components/schemas/is_billable' - is_reimbursable: - $ref: '#/components/schemas/is_reimbursable' custom_fields: $ref: '#/components/schemas/custom_fields' expense_add_comment_action_in: diff --git a/src/components/schemas/expense.yaml b/src/components/schemas/expense.yaml index db0e01fe9..ff451cb96 100644 --- a/src/components/schemas/expense.yaml +++ b/src/components/schemas/expense.yaml @@ -950,19 +950,8 @@ spender_expenses_in: - $ref: './fields.yaml#/fk_integer' nullable: true example: 92895 - source_account_id: - allOf: - - $ref: './fields.yaml#/fk_string' - example: acwbl222wlg - advance_wallet_id: - allOf: - - $ref: './fields.yaml#/fk_string' - nullable: true - example: advwrlAGwjr2 is_billable: $ref: './fields.yaml#/is_billable' - is_reimbursable: - $ref: './fields.yaml#/is_reimbursable' custom_fields: $ref: './fields.yaml#/custom_fields'