Skip to content

Commit

Permalink
Updated OCR Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
umerfaruk committed Jan 23, 2024
1 parent f11fbf8 commit dde1b9f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Inshapardaz.Api/Controllers/BookPageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ public async Task<IActionResult> GetPagesByBook(int libraryId,

[HttpPost("libraries/{libraryId}/books/{bookId}/pages/{sequenceNumber}/ocr", Name = nameof(BookPageController.OcrPage))]
[Authorize(Role.Admin, Role.LibraryAdmin, Role.Writer)]
public async Task<IActionResult> OcrPage(int libraryId, int bookId, int sequenceNumber, [FromBody] string apiKey, CancellationToken token = default(CancellationToken))
public async Task<IActionResult> OcrPage(int libraryId, int bookId, int sequenceNumber, [FromBody] OcrRequest ocrRequest, CancellationToken token = default(CancellationToken))
{
var request = new BookPageOcrRequest(libraryId, bookId, sequenceNumber, apiKey);
var request = new BookPageOcrRequest(libraryId, bookId, sequenceNumber, ocrRequest.Key);
await _commandProcessor.SendAsync(request, cancellationToken: token);

return Ok();
Expand Down
2 changes: 1 addition & 1 deletion src/Inshapardaz.Api/Views/FileView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public class FileView : ViewWithLinks

public DateTime DateCreated { get; set; }
}
}
}
10 changes: 10 additions & 0 deletions src/Inshapardaz.Api/Views/OcrRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;

namespace Inshapardaz.Api.Views
{
public class OcrRequest
{
[Required]
public string Key { get; set; }
}
}
5 changes: 3 additions & 2 deletions src/Inshapardaz.Api/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "None",
"Paramore": "Information"
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information",
"Paramore": "Error"
}
},
"AppSettings": {
Expand Down

0 comments on commit dde1b9f

Please sign in to comment.