Bug 25048: Make successful resource deletion return 204
This patch adapts the spec and the controllers so existing routes return 204 and an empty response body when a successful deletion happens. Right now we have a coding guideline but haven't adapted the existing routes. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/*.t => FAIL: Some tests fail 3. Apply this patch 4. Repeat 2. => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
b33d69684f
commit
0bb0b6c7b4
|
|
@ -159,7 +159,7 @@ sub delete {
|
|||
$vendor->delete;
|
||||
|
||||
return $c->render(
|
||||
status => 200,
|
||||
status => 204,
|
||||
openapi => q{}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,10 @@ sub delete {
|
|||
|
||||
return try {
|
||||
$city->delete;
|
||||
return $c->render( status => 200, openapi => "" );
|
||||
return $c->render(
|
||||
status => 204,
|
||||
openapi => q{}
|
||||
);
|
||||
}
|
||||
catch {
|
||||
$c->unhandled_exception($_);
|
||||
|
|
|
|||
|
|
@ -262,7 +262,10 @@ sub delete {
|
|||
return try {
|
||||
$hold->cancel;
|
||||
|
||||
return $c->render( status => 200, openapi => {} );
|
||||
return $c->render(
|
||||
status => 204,
|
||||
openapi => q{}
|
||||
);
|
||||
}
|
||||
catch {
|
||||
$c->unhandled_exception($_);
|
||||
|
|
|
|||
|
|
@ -279,7 +279,10 @@ sub delete {
|
|||
|
||||
# check if loans, reservations, debarrment, etc. before deletion!
|
||||
$patron->delete;
|
||||
return $c->render( status => 200, openapi => {} );
|
||||
return $c->render(
|
||||
status => 204,
|
||||
openapi => q{}
|
||||
);
|
||||
}
|
||||
catch {
|
||||
unless ($patron) {
|
||||
|
|
|
|||
|
|
@ -332,10 +332,7 @@
|
|||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Order deleted",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
"description": "Order deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
|
|
|
|||
|
|
@ -264,11 +264,8 @@
|
|||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Vendor deleted",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
"204": {
|
||||
"description": "Vendor deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
|
|
|
|||
|
|
@ -238,11 +238,8 @@
|
|||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "City deleted",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
"204": {
|
||||
"description": "City deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
|
|
|
|||
|
|
@ -355,11 +355,8 @@
|
|||
],
|
||||
"produces": ["application/json"],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful deletion",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
"204": {
|
||||
"description": "Hold deleted"
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentication required",
|
||||
|
|
|
|||
|
|
@ -669,11 +669,8 @@
|
|||
}],
|
||||
"produces": ["application/json"],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Patron deleted successfully",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
"204": {
|
||||
"description": "Patron deleted"
|
||||
},
|
||||
"400": {
|
||||
"description": "Patron deletion failed",
|
||||
|
|
|
|||
Loading…
Reference in New Issue