33 lines
944 B
C#
33 lines
944 B
C#
using FictionArchive.Service.NovelService.Services;
|
|
using FictionArchive.Service.Shared.MassTransit.Contracts.Commands;
|
|
using HotChocolate.Authorization;
|
|
using HotChocolate.Types;
|
|
|
|
namespace FictionArchive.Service.NovelService.GraphQL;
|
|
|
|
public class Mutation
|
|
{
|
|
[Authorize]
|
|
public async Task<ImportNovelCommand> ImportNovel(string novelUrl, NovelUpdateService service)
|
|
{
|
|
return await service.QueueNovelImport(novelUrl);
|
|
}
|
|
|
|
[Authorize]
|
|
public async Task<PullChapterContentCommand> FetchChapterContents(
|
|
uint novelId,
|
|
uint volumeId,
|
|
uint chapterOrder,
|
|
NovelUpdateService service)
|
|
{
|
|
return await service.QueueChapterPull(novelId, volumeId, chapterOrder);
|
|
}
|
|
|
|
[Error<KeyNotFoundException>]
|
|
[Authorize]
|
|
public async Task<bool> DeleteNovel(uint novelId, NovelUpdateService service)
|
|
{
|
|
await service.DeleteNovel(novelId);
|
|
return true;
|
|
}
|
|
} |