Skip to content

Commit a0e0d8b

Browse files
committed
fix: return existing application instead of throwing an error
1 parent dfa1ca3 commit a0e0d8b

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

docs/swagger.yaml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ paths:
487487
$ref: "#/definitions/ApplyCopilotOpportunity"
488488
responses:
489489
"200":
490-
description: "The copilot opportunity"
490+
description: "The copilot opportunity application"
491491
schema:
492-
$ref: "#/definitions/CopilotOpportunity"
492+
$ref: "#/definitions/CopilotOpportunityApplication"
493493
"401":
494494
description: "Unauthorized"
495495
schema:
@@ -6013,6 +6013,46 @@ definitions:
60136013
format: int64
60146014
description: READ-ONLY. User that last updated this task
60156015
readOnly: true
6016+
CopilotOpportunityApplication:
6017+
type: object
6018+
properties:
6019+
id:
6020+
description: unique identifier
6021+
type: integer
6022+
format: int64
6023+
notes:
6024+
description: notes regarding the application
6025+
type: string
6026+
opportunityId:
6027+
description: copilot request id
6028+
type: integer
6029+
createdAt:
6030+
type: string
6031+
description: Datetime (GMT) when task was created
6032+
readOnly: true
6033+
createdBy:
6034+
type: integer
6035+
format: int64
6036+
description: READ-ONLY. User who created this task
6037+
readOnly: true
6038+
updatedAt:
6039+
type: string
6040+
description: READ-ONLY. Datetime (GMT) when task was updated
6041+
readOnly: true
6042+
updatedBy:
6043+
type: integer
6044+
format: int64
6045+
description: READ-ONLY. User that last updated this task
6046+
readOnly: true
6047+
deletedAt:
6048+
type: string
6049+
description: READ-ONLY. Datetime (GMT) when task was deleted
6050+
readOnly: true
6051+
deletedBy:
6052+
type: integer
6053+
format: int64
6054+
description: READ-ONLY. User that deleted this task
6055+
readOnly: true
60166056
Project:
60176057
type: object
60186058
properties:

src/routes/copilotOpportunityApply/create.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ module.exports = [
6060
});
6161

6262
if (existingApplication) {
63-
const err = new Error('User already applied for this opportunity');
64-
err.status = 400;
65-
return next(err);
63+
res.status(200).json(existingApplication);
64+
return Promise.resolve();
6665
}
6766

6867
return models.CopilotApplication.create(data)

0 commit comments

Comments
 (0)