Skip to content

Commit

Permalink
fix: revert changes to accept DELETE method
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopacheco1 committed Sep 27, 2024
1 parent 457f061 commit 96cd1b1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
69 changes: 34 additions & 35 deletions src/main/openapi/daam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,72 +85,65 @@ paths:
security:
- daam_auth:
- read:applications
/api/v1/applications/{id}/save-forms-and-duos:
post:
summary: save application forms and duos
operationId: save_application_forms_and_duos_v1
delete:
summary: Delete application
operationId: delete_application_v1
tags:
- "application-command"
parameters:
- name: id
in: path
description: ID of application to update
description: ID of application to delete
required: true
schema:
type: integer
format: int64
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SaveFormsAndDuos"
responses:
"204":
description: Successful Response (no content)
"404":
description: Application not found
"403":
description: Application does not belong to applicant
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"403":
description: Application does not belong to applicant
"404":
description: Application not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"409":
description: Application not in submittable state
description: Application not in draft state
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
security:
- daam_auth:
- write:applications
/api/v1/applications/{id}/submit:
- read:applications
/api/v1/applications/{id}/save-forms-and-duos:
post:
summary: Submit application
operationId: submit_application_v1
summary: save application forms and duos
operationId: save_application_forms_and_duos_v1
tags:
- "application-command"
parameters:
- name: id
in: path
description: ID of application to submit
description: ID of application to update
required: true
schema:
type: integer
format: int64
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SaveFormsAndDuos"
responses:
"204":
description: Successful Response (no content)
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"404":
description: Application not found
content:
Expand All @@ -169,29 +162,28 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"

security:
- daam_auth:
- write:applications
/api/v1/applications/{id}/delete:
/api/v1/applications/{id}/submit:
post:
summary: Delete application
operationId: delete_application_v1
summary: Submit application
operationId: submit_application_v1
tags:
- "application-command"
parameters:
- name: id
in: path
description: ID of application to delete
description: ID of application to submit
required: true
schema:
type: integer
format: int64
responses:
"204":
description: Successful Response (no content)
"403":
description: Application does not belong to applicant
"400":
description: Bad Request
content:
application/json:
schema:
Expand All @@ -202,15 +194,22 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"403":
description: Application does not belong to applicant
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"409":
description: Application not in draft state
description: Application not in submittable state
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"

security:
- daam_auth:
- read:applications
- write:applications
/api/v1/applications/create:
post:
summary: Create application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void cannot_delete_application_when_not_same_applicant() {
.auth()
.oauth2(getAccessToken("jdoe"))
.when()
.post("/api/v1/applications/1/delete")
.delete("/api/v1/applications/1")
.then()
.statusCode(403)
.body("title", equalTo("User Not Applicant"));
Expand All @@ -55,7 +55,7 @@ void cannot_delete_application_when_not_draft() {
.auth()
.oauth2(getAccessToken("alice"))
.when()
.post("/api/v1/applications/2/delete")
.delete("/api/v1/applications/2")
.then()
.statusCode(409)
.body("title", equalTo("Application Not In Correct State"))
Expand All @@ -67,7 +67,7 @@ void cannot_delete_application_when_not_draft() {
void cannot_delete_application_when_anonymous_request() {
given()
.when()
.post("/api/v1/applications/1/delete")
.delete("/api/v1/applications/1")
.then()
.statusCode(401);
}
Expand Down

0 comments on commit 96cd1b1

Please sign in to comment.