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

feat: specs for post spender/expenses/bulk #579

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
101 changes: 101 additions & 0 deletions reference/spender.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added source_account_id, advance_wallet_id, and is_reimbursable: because we want to support the payment mode to be updated in bulk(that would require these keys).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IGNORE the above comment: these keys are now removed ref

expense_add_comment_action_in:
type: object
required:
Expand Down Expand Up @@ -9157,6 +9205,59 @@ 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
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:
Expand Down
49 changes: 49 additions & 0 deletions src/components/schemas/expense.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/spender/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ paths:
$ref: 'paths/[email protected]'
/spender/expenses:
$ref: 'paths/[email protected]'
/spender/expenses/bulk:
$ref: 'paths/spender@[email protected]'
/spender/expenses/add_comment:
$ref: 'paths/spender@expenses@add_comment.yaml'
/spender/expenses/attach_receipt:
Expand Down
52 changes: 52 additions & 0 deletions src/spender/paths/spender@[email protected]
Original file line number Diff line number Diff line change
@@ -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'
Loading