Skip to content

Commit 2021065

Browse files
committed
Revert out-of-scope controller/frontend API change
1 parent c0d55ac commit 2021065

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

Backend/Controllers/WordController.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,12 @@ public async Task<IActionResult> UpdateWord(
248248
}
249249

250250
/// <summary> Restore a deleted <see cref="Word"/>. </summary>
251+
/// <returns> bool: true if restored; false if already in frontier. </returns>
251252
[HttpGet("restore/{wordId}", Name = "RestoreWord")]
252-
[ProducesResponseType(StatusCodes.Status200OK)]
253-
[ProducesResponseType(StatusCodes.Status400BadRequest)]
253+
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
254254
[ProducesResponseType(StatusCodes.Status403Forbidden)]
255+
[ProducesResponseType(StatusCodes.Status404NotFound)]
256+
255257
public async Task<IActionResult> RestoreWord(string projectId, string wordId)
256258
{
257259
using var activity = OtelService.StartActivityWithTag(otelTagName, "restoring a word");
@@ -260,8 +262,12 @@ public async Task<IActionResult> RestoreWord(string projectId, string wordId)
260262
{
261263
return Forbid();
262264
}
265+
if (await _wordRepo.GetWord(projectId, wordId) is null)
266+
{
267+
return NotFound();
268+
}
263269

264-
return await _wordService.RestoreFrontierWords(projectId, [wordId]) ? Ok() : BadRequest();
270+
return Ok(await _wordService.RestoreFrontierWords(projectId, [wordId]));
265271
}
266272

267273
/// <summary> Revert words from a dictionary of word ids (key: to revert to; value: from frontier). </summary>

src/api/api/word-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ export const WordApiFp = function (configuration?: Configuration) {
10411041
wordId: string,
10421042
options?: any
10431043
): Promise<
1044-
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>
1044+
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<boolean>
10451045
> {
10461046
const localVarAxiosArgs = await localVarAxiosParamCreator.restoreWord(
10471047
projectId,
@@ -1315,7 +1315,7 @@ export const WordApiFactory = function (
13151315
projectId: string,
13161316
wordId: string,
13171317
options?: any
1318-
): AxiosPromise<void> {
1318+
): AxiosPromise<boolean> {
13191319
return localVarFp
13201320
.restoreWord(projectId, wordId, options)
13211321
.then((request) => request(axios, basePath));

0 commit comments

Comments
 (0)