From 37117ec44d210916da7d03d5515090a752a4ed08 Mon Sep 17 00:00:00 2001 From: Ted Wollman <25165500+TheTedder@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:41:07 -0400 Subject: [PATCH] Set UpdatedAt, not just DeletedAt. --- LeaderboardBackend.Test/Leaderboards.cs | 4 +- LeaderboardBackend/openapi.json | 68 ++++++++++++------------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/LeaderboardBackend.Test/Leaderboards.cs b/LeaderboardBackend.Test/Leaderboards.cs index 87d8feb1..11281414 100644 --- a/LeaderboardBackend.Test/Leaderboards.cs +++ b/LeaderboardBackend.Test/Leaderboards.cs @@ -597,12 +597,14 @@ await FluentActions.Awaiting(() => _apiClient.Delete( public async Task DeleteLeaderboard_AlreadyDeleted() { ApplicationContext context = _factory.Services.CreateScope().ServiceProvider.GetRequiredService(); + Instant now = _clock.GetCurrentInstant(); Leaderboard lb = new() { Name = "The Elder Scrolls V: Skyrim", Slug = "tesv-skyrim", - DeletedAt = _clock.GetCurrentInstant() + UpdatedAt = now, + DeletedAt = now }; context.Leaderboards.Add(lb); diff --git a/LeaderboardBackend/openapi.json b/LeaderboardBackend/openapi.json index 5c11d372..c6434a82 100644 --- a/LeaderboardBackend/openapi.json +++ b/LeaderboardBackend/openapi.json @@ -664,13 +664,13 @@ } } }, - "/leaderboard/{id}": { - "delete": { + "/leaderboard/{id}/restore": { + "put": { "tags": [ "Leaderboards" ], - "summary": "Deletes a leaderboard. This request is restricted to Administrators.", - "operationId": "deleteLeaderboard", + "summary": "Restores a deleted leaderboard.", + "operationId": "restoreLeaderboard", "parameters": [ { "name": "id", @@ -696,17 +696,24 @@ "500": { "description": "Internal Server Error" }, - "204": { - "description": "No Content" + "200": { + "description": "The restored `Leaderboard`s view model.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LeaderboardViewModel" + } + } + } }, "401": { "description": "Unauthorized" }, "403": { - "description": "Forbidden" + "description": "The requesting `User` is unauthorized to restore `Leaderboard`s." }, "404": { - "description": "The leaderboard does not exist (Not Found) or was already deleted (Already Deleted).\nUse the title field of the response to differentiate between the two cases if necessary.", + "description": "The `Leaderboard` was not found, or it wasn't deleted in the first place. Includes a field, `title`, which will be \"Not Found\" in the former case, and \"Not Deleted\" in the latter.", "content": { "application/json": { "schema": { @@ -714,17 +721,27 @@ } } } + }, + "409": { + "description": "Another `Leaderboard` with the same slug has been created since, and therefore can't be restored. Will include the conflicting board in the response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LeaderboardViewModel" + } + } + } } } } }, - "/leaderboard/{id}/restore": { - "put": { + "/leaderboard/{id}": { + "delete": { "tags": [ "Leaderboards" ], - "summary": "Restores a deleted leaderboard.", - "operationId": "restoreLeaderboard", + "summary": "Deletes a leaderboard. This request is restricted to Administrators.", + "operationId": "deleteLeaderboard", "parameters": [ { "name": "id", @@ -750,24 +767,17 @@ "500": { "description": "Internal Server Error" }, - "200": { - "description": "The restored `Leaderboard`s view model.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LeaderboardViewModel" - } - } - } + "204": { + "description": "No Content" }, "401": { "description": "Unauthorized" }, "403": { - "description": "The requesting `User` is unauthorized to restore `Leaderboard`s." + "description": "Forbidden" }, "404": { - "description": "The `Leaderboard` was not found, or it wasn't deleted in the first place. Includes a field, `title`, which will be \"Not Found\" in the former case, and \"Not Deleted\" in the latter.", + "description": "The leaderboard does not exist (Not Found) or was already deleted (Already Deleted).\nUse the title field of the response to differentiate between the two cases if necessary.", "content": { "application/json": { "schema": { @@ -775,16 +785,6 @@ } } } - }, - "409": { - "description": "Another `Leaderboard` with the same slug has been created since, and therefore can't be restored. Will include the conflicting board in the response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LeaderboardViewModel" - } - } - } } } } @@ -1610,4 +1610,4 @@ "Bearer": [ ] } ] -} +} \ No newline at end of file