Initial implementation of voice works scanning.
This commit is contained in:
25
JSMR.Application/Scanning/Contracts/DLSiteWork.cs
Normal file
25
JSMR.Application/Scanning/Contracts/DLSiteWork.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace JSMR.Application.Scanning.Contracts;
|
||||
|
||||
public class DLSiteWork
|
||||
{
|
||||
public DLSiteWorkType WorkType { get; set; }
|
||||
public DLSiteWorkCategory Category { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public string? ProductUrl { get; set; }
|
||||
public string? ProductId { get; set; }
|
||||
public DateOnly? AnnouncedDate { get; set; }
|
||||
public DateTime? ExpectedDate { get; set; }
|
||||
public DateTime? SalesDate { get; set; }
|
||||
public int? Downloads { get; set; }
|
||||
public byte? StarRating { get; set; }
|
||||
public int? Votes { get; set; }
|
||||
public string? Maker { get; set; }
|
||||
public string? MakerId { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public ICollection<string> Genres { get; set; } = [];
|
||||
public ICollection<string> Tags { get; set; } = [];
|
||||
public ICollection<string> Creators { get; set; } = [];
|
||||
public string? ImageUrl { get; set; }
|
||||
public string? SmallImageUrl { get; set; }
|
||||
public string? Type { get; set; }
|
||||
}
|
||||
13
JSMR.Application/Scanning/Contracts/DLSiteWorkCategory.cs
Normal file
13
JSMR.Application/Scanning/Contracts/DLSiteWorkCategory.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace JSMR.Application.Scanning.Contracts;
|
||||
|
||||
public enum DLSiteWorkCategory
|
||||
{
|
||||
Unknown,
|
||||
VoiceASMR,
|
||||
Manga,
|
||||
RPG,
|
||||
Video,
|
||||
Adventure,
|
||||
Simulation,
|
||||
CG
|
||||
}
|
||||
7
JSMR.Application/Scanning/Contracts/DLSiteWorkType.cs
Normal file
7
JSMR.Application/Scanning/Contracts/DLSiteWorkType.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace JSMR.Application.Scanning.Contracts;
|
||||
|
||||
public enum DLSiteWorkType
|
||||
{
|
||||
Released,
|
||||
Announced
|
||||
}
|
||||
8
JSMR.Application/Scanning/Ports/IVoiceWorksScanner.cs
Normal file
8
JSMR.Application/Scanning/Ports/IVoiceWorksScanner.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
|
||||
namespace JSMR.Application.Scanning.Ports;
|
||||
|
||||
public interface IVoiceWorksScanner
|
||||
{
|
||||
Task<IReadOnlyList<DLSiteWork>> ScanPageAsync(ScanVoiceWorksRequest request, CancellationToken cancellationToken = default);
|
||||
}
|
||||
26
JSMR.Application/Scanning/ScanVoiceWorksHandler.cs
Normal file
26
JSMR.Application/Scanning/ScanVoiceWorksHandler.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
|
||||
namespace JSMR.Application.Scanning;
|
||||
|
||||
public sealed class ScanVoiceWorksHandler(IVoiceWorksScanner scanner)
|
||||
{
|
||||
//public async Task<ScanVoiceWorksResponse> HandleAsync(ScanVoiceWorksRequest request, CancellationToken cancellationToken)
|
||||
//{
|
||||
// var works = await scanner.ScanPageAsync(request, cancellationToken);
|
||||
|
||||
// if (works.Count == 0)
|
||||
// return new ScanVoiceWorksResponse();
|
||||
|
||||
// var ingests = works.Select(VoiceWorkIngest.From).ToList();
|
||||
// var upsert = await _writer.UpsertAsync(ingests, ct);
|
||||
|
||||
// // only update search text for affected rows
|
||||
// await _search.UpdateAsync(upsert.AffectedVoiceWorkIds, ct);
|
||||
|
||||
// return new ScanVoiceWorksResponse
|
||||
// {
|
||||
// Inserted = upsert.Inserted,
|
||||
// Updated = upsert.Updated
|
||||
// };
|
||||
//}
|
||||
}
|
||||
5
JSMR.Application/Scanning/ScanVoiceWorksRequest.cs
Normal file
5
JSMR.Application/Scanning/ScanVoiceWorksRequest.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using JSMR.Application.Common;
|
||||
|
||||
namespace JSMR.Application.Scanning;
|
||||
|
||||
public sealed record ScanVoiceWorksRequest(int PageNumber, int PageSize, Locale Locale);
|
||||
7
JSMR.Application/Scanning/ScanVoiceWorksResponse.cs
Normal file
7
JSMR.Application/Scanning/ScanVoiceWorksResponse.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace JSMR.Application.Scanning;
|
||||
|
||||
public sealed class ScanVoiceWorksResponse
|
||||
{
|
||||
public int Inserted { get; init; }
|
||||
public int Updated { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user