Skip to content

Commit

Permalink
fix: change method from delete to post for deleting drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
admy7 committed Sep 26, 2024
1 parent 1e718b7 commit ff8a17d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 39 deletions.
69 changes: 35 additions & 34 deletions src/main/openapi/daam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,65 +85,72 @@ paths:
security:
- daam_auth:
- read:applications
delete:
summary: Delete application
operationId: delete_application_v1
/api/v1/applications/{id}/save-forms-and-duos:
post:
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 delete
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)
"403":
description: Application does not belong to applicant
"404":
description: Application not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"404":
description: Application not found
"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
/api/v1/applications/{id}/save-forms-and-duos:
- write:applications
/api/v1/applications/{id}/submit:
post:
summary: save application forms and duos
operationId: save_application_forms_and_duos_v1
summary: Submit application
operationId: submit_application_v1
tags:
- "application-command"
parameters:
- name: id
in: path
description: ID of application to update
description: ID of application to submit
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 @@ -162,28 +169,29 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"

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

security:
- daam_auth:
- write:applications
- read:applications
/api/v1/applications/create:
post:
summary: Create application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void can_delete_draft_application() {
.auth()
.oauth2(getAccessToken("alice"))
.when()
.delete("/api/v1/applications/1")
.post("/api/v1/applications/1/delete")
.then()
.statusCode(204);
}
Expand All @@ -30,7 +30,7 @@ void cannot_delete_application_when_not_found() {
.auth()
.oauth2(getAccessToken("alice"))
.when()
.delete("/api/v1/applications/12345")
.post("/api/v1/applications/12345/delete")
.then()
.statusCode(404)
.body("title", equalTo("Application Not Found"))
Expand All @@ -43,7 +43,7 @@ void cannot_delete_application_when_not_same_applicant() {
.auth()
.oauth2(getAccessToken("jdoe"))
.when()
.delete("/api/v1/applications/1")
.post("/api/v1/applications/1/delete")
.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()
.delete("/api/v1/applications/2")
.post("/api/v1/applications/2/delete")
.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()
.delete("/api/v1/applications/1")
.post("/api/v1/applications/1/delete")
.then()
.statusCode(401);
}
Expand Down

0 comments on commit ff8a17d

Please sign in to comment.