Skip to content

Commit

Permalink
feat: Dismiss duplicates bulk endpoint in platform (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhavmansuriya40 authored Nov 2, 2023
1 parent 9d3586c commit e11650e
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
102 changes: 102 additions & 0 deletions reference/spender.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6192,6 +6192,53 @@ components:
- 12423
description: |
List of IDs of expense fields which are mandatory but are missing.
spender_expense_dismiss_duplicates_in:
type: object
required:
- id
- duplicate_expense_ids
additionalProperties: false
properties:
id:
$ref: '#/components/schemas/id_string'
duplicate_expense_ids:
type: array
nullable: false
items:
$ref: '#/components/schemas/id_string'
example:
- txwoirwlwwg
- txwlgwkgw42
description: |
List of expense IDs that needs to be dismissed as a duplicate from the target expense
bulk_error:
type: object
properties:
error:
type: string
example: BulkError
message:
type: string
nullable: true
data:
type: array
items:
type: object
properties:
row:
type: integer
description: |
This holds the info of which row contains bad data.
key:
oneOf:
- type: string
- type: integer
description: |
This helps in identifying the error by unique key.
message:
type: string
description: |
This explains what the error is in `human readable` text
parameters:
q:
in: query
Expand Down Expand Up @@ -8521,3 +8568,58 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/404'
/spender/expenses/dismiss_duplicates/bulk:
post:
tags:
- Expenses
summary: Dismiss Duplicate expenses
description: |
This API helps dismissing similar expenses as a duplicates.
operationId: dismiss_duplicates_bulk_post
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/spender_expense_dismiss_duplicates_in'
responses:
'200':
description: OK
'400':
description: Bad request
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/bulk_error'
- type: object
properties:
error:
type: string
nullable: true
message:
type: string
nullable: true
data:
type: string
nullable: true
'401':
description: Unauthorised request
content:
application/json:
schema:
$ref: '#/components/schemas/401'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/403'
17 changes: 17 additions & 0 deletions src/components/schemas/expense.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1474,3 +1474,20 @@ expense_check_mandatory_fields_in:
allOf:
- $ref: ./expense.yaml#/spender_expense_check_mandatory_fields_in

spender_expense_dismiss_duplicates_in:
type: object
required:
- id
- duplicate_expense_ids
additionalProperties: False
properties:
id:
$ref: './fields.yaml#/id_string'
duplicate_expense_ids:
type: array
nullable: False
items:
$ref: './fields.yaml#/id_string'
example: ['txwoirwlwwg', 'txwlgwkgw42']
description: |
List of expense IDs that needs to be dismissed as a duplicate from the target expense
2 changes: 2 additions & 0 deletions src/spender/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,5 @@ paths:
$ref: paths/spender@automations@report_submissions@next_at.yaml
/spender/expenses/check_mandatory_fields:
$ref: paths/spender@expenses@check_mandatory_fields.yaml
/spender/expenses/dismiss_duplicates/bulk:
$ref: paths/spender@expenses@dismiss_duplicates@bulk.yaml
56 changes: 56 additions & 0 deletions src/spender/paths/spender@expenses@dismiss_duplicates@bulk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
post:
tags:
- Expenses
summary: Dismiss Duplicate expenses
description: |
This API helps dismissing similar expenses as a duplicates.
operationId: dismiss_duplicates_bulk_post
requestBody:
required: True
content:
application/json:
schema:
type: object
additionalProperties: False
required:
- data
properties:
data:
type: array
items:
$ref: '../../components/schemas/expense.yaml#/spender_expense_dismiss_duplicates_in'
responses:
'200':
description: OK
'400':
description: Bad request
content:
application/json:
schema:
oneOf:
- $ref: '../../components/schemas/bulk_error.yaml'
- type: object
properties:
error:
type: string
nullable: True
message:
type: string
nullable: True
data:
type: string
nullable: True
'401':
description: Unauthorised request
content:
application/json:
schema:
$ref: "../../components/schemas/401.yaml"
'403':
description: Forbidden
content:
application/json:
schema:
$ref: "../../components/schemas/403.yaml"


0 comments on commit e11650e

Please sign in to comment.