Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Jan 18, 2025
1 parent 66ee912 commit 5a3bca4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions app/Http/Controllers/API/v1/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,12 @@ public function show(int $id): StatusResource {
* }
* )
*/
public function destroy(string|int $statusId): JsonResponse {
public function destroy(string|int $statusIdOrUuid): JsonResponse {
try {
//TODO: check scope for write-statuses

if (is_numeric($statusId)) { //TODO: remove this after uuid migration done
$status = Status::findOrFail($statusId);
if (is_numeric($statusIdOrUuid)) { //TODO: remove this after uuid migration done
$status = Status::findOrFail($statusIdOrUuid);
} else {
$status = Status::where('uuid', $statusId)->firstOrFail();
$status = Status::where('uuid', $statusIdOrUuid)->firstOrFail();
}
$this->authorize('delete', $status);
$status->delete();
Expand Down
2 changes: 1 addition & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
Route::get('dashboard/future', [StatusController::class, 'getFutureCheckins']);
});
Route::group(['middleware' => ['scope:write-statuses']], static function() {
Route::delete('status/{id}', [StatusController::class, 'destroy'])->whereNumber('id');
Route::delete('status/{id}', [StatusController::class, 'destroy']);
Route::put('status/{id}', [StatusController::class, 'update']);
Route::post('status/{statusId}/tags', [StatusTagController::class, 'store']);
Route::put('status/{statusId}/tags/{tagKey}', [StatusTagController::class, 'update']);
Expand Down

0 comments on commit 5a3bca4

Please sign in to comment.