38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using FictionArchive.Service.NovelService.Models.Enums;
|
|
using FictionArchive.Service.NovelService.Models.IntegrationEvents;
|
|
using FictionArchive.Service.NovelService.Models.Localization;
|
|
using FictionArchive.Service.NovelService.Models.Novels;
|
|
using FictionArchive.Service.NovelService.Models.SourceAdapters;
|
|
using FictionArchive.Service.NovelService.Services;
|
|
using FictionArchive.Service.NovelService.Services.SourceAdapters;
|
|
using FictionArchive.Service.Shared.Services.EventBus;
|
|
using HotChocolate.Authorization;
|
|
using HotChocolate.Types;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FictionArchive.Service.NovelService.GraphQL;
|
|
|
|
public class Mutation
|
|
{
|
|
[Authorize]
|
|
public async Task<NovelUpdateRequestedEvent> ImportNovel(string novelUrl, NovelUpdateService service)
|
|
{
|
|
return await service.QueueNovelImport(novelUrl);
|
|
}
|
|
|
|
[Authorize]
|
|
public async Task<ChapterPullRequestedEvent> FetchChapterContents(uint novelId,
|
|
uint chapterNumber,
|
|
NovelUpdateService service)
|
|
{
|
|
return await service.QueueChapterPull(novelId, chapterNumber);
|
|
}
|
|
|
|
[Error<KeyNotFoundException>]
|
|
[Authorize]
|
|
public async Task<bool> DeleteNovel(uint novelId, NovelUpdateService service)
|
|
{
|
|
await service.DeleteNovel(novelId);
|
|
return true;
|
|
}
|
|
} |