Need comments, dedicated dtos, and redo migration order.
This commit is contained in:
parent
87b0d6a769
commit
4073ffef66
1 changed files with 4 additions and 4 deletions
|
|
@ -19,8 +19,7 @@ namespace API.Controllers;
|
||||||
/// The endpoint to interface with Koreader's Progress Sync plugin.
|
/// The endpoint to interface with Koreader's Progress Sync plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Koreader uses a different form of athentication. It stores the user name
|
/// Koreader uses a different form of authentication. It stores the username and password in headers.
|
||||||
/// and password in headers.
|
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <see cref="https://github.com/koreader/koreader/blob/master/plugins/kosync.koplugin/KOSyncClient.lua"/>
|
/// <see cref="https://github.com/koreader/koreader/blob/master/plugins/kosync.koplugin/KOSyncClient.lua"/>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -55,6 +54,7 @@ public class KoreaderController : BaseApiController
|
||||||
{
|
{
|
||||||
var userId = await GetUserId(apiKey);
|
var userId = await GetUserId(apiKey);
|
||||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
|
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
|
||||||
|
if (user == null) return Unauthorized();
|
||||||
|
|
||||||
return Ok(new { username = user.UserName });
|
return Ok(new { username = user.UserName });
|
||||||
}
|
}
|
||||||
|
|
@ -66,12 +66,12 @@ public class KoreaderController : BaseApiController
|
||||||
_logger.LogDebug("Koreader sync progress: {Progress}", request.Progress);
|
_logger.LogDebug("Koreader sync progress: {Progress}", request.Progress);
|
||||||
var userId = await GetUserId(apiKey);
|
var userId = await GetUserId(apiKey);
|
||||||
await _koreaderService.SaveProgress(request, userId);
|
await _koreaderService.SaveProgress(request, userId);
|
||||||
|
|
||||||
return Ok(new { document = request.Document, timestamp = DateTime.UtcNow });
|
return Ok(new { document = request.Document, timestamp = DateTime.UtcNow });
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{apiKey}/syncs/progress/{ebookHash}")]
|
[HttpGet("{apiKey}/syncs/progress/{ebookHash}")]
|
||||||
public async Task<IActionResult> GetProgress(string apiKey, string ebookHash)
|
public async Task<ActionResult<KoreaderBookDto>> GetProgress(string apiKey, string ebookHash)
|
||||||
{
|
{
|
||||||
var userId = await GetUserId(apiKey);
|
var userId = await GetUserId(apiKey);
|
||||||
var response = await _koreaderService.GetProgress(ebookHash, userId);
|
var response = await _koreaderService.GetProgress(ebookHash, userId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue