-
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More cleanup, handling edge cases, and todos for original creator.
- Loading branch information
1 parent
9893c9f
commit 231db28
Showing
7 changed files
with
115 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace API.DTOs.Koreader; | ||
|
||
public class KoreaderProgressUpdateDto | ||
{ | ||
public string Document { get; set; } | ||
public DateTime Timestamp { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using API.DTOs.Koreader; | ||
|
||
namespace API.Helpers.Builders; | ||
|
||
public class KoreaderBookDtoBuilder : IEntityBuilder<KoreaderBookDto> | ||
{ | ||
private readonly KoreaderBookDto _dto; | ||
public KoreaderBookDto Build() => _dto; | ||
|
||
public KoreaderBookDtoBuilder(string documentHash) | ||
{ | ||
_dto = new KoreaderBookDto() | ||
{ | ||
Document = documentHash, | ||
Device = "Kavita" | ||
}; | ||
} | ||
|
||
public KoreaderBookDtoBuilder WithDocument(string documentHash) | ||
{ | ||
_dto.Document = documentHash; | ||
return this; | ||
} | ||
|
||
public KoreaderBookDtoBuilder WithProgress(string progress) | ||
{ | ||
_dto.Progress = progress; | ||
return this; | ||
} | ||
|
||
public KoreaderBookDtoBuilder WithPercentage(int? pageNum, int pages) | ||
{ | ||
_dto.Percentage = (pageNum ?? 0) / (float) pages; | ||
return this; | ||
} | ||
|
||
public KoreaderBookDtoBuilder WithDeviceId(string installId, int userId) | ||
{ | ||
_dto.Device_id = installId; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters