77 lines
3.0 KiB
C#
77 lines
3.0 KiB
C#
using Modules.Library.Domain.Entities;
|
|
using Modules.Library.Domain.Entities.MediaContent.CommonProperties;
|
|
using Modules.Library.Domain.Entities.MediaContent.Items.Anime;
|
|
using Modules.Library.Domain.Gateways;
|
|
|
|
namespace Modules.Library.Domain.Interactors.MediaContent.Anime.Title;
|
|
|
|
public class CreateInteractor : InteractorBase
|
|
{
|
|
private readonly IAnimeTitleGateway _gateway;
|
|
|
|
public CreateInteractor(IAnimeTitleGateway gateway, ILanguageGateway languageGateway, IGenreGateway genreGateway) : base(gateway, languageGateway, genreGateway)
|
|
{
|
|
this._gateway = gateway;
|
|
}
|
|
|
|
public async Task<Guid> Create(string nameOriginal, Guid nameOriginalLanguageId)
|
|
{
|
|
var entity = new AnimeTitle(nameOriginal, nameOriginalLanguageId);
|
|
return await _gateway.AddAsync(entity);
|
|
}
|
|
|
|
|
|
public async Task AddName(Guid animeTitleId, NameType nameType, Guid languageId, string value)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
await _commonPropertiesService.AddName(title, null, null, nameType, languageId, value);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
internal async Task AddDescription(Guid animeTitleId, Guid languageId, bool isOriginal, string value)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
await _commonPropertiesService.AddDescription(title, null, null, languageId, isOriginal, value);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
internal async Task AddRelatedContent(Guid animeTitleId, string url, MediaInfoType type)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
CommonPropertiesService.AddRelatedContent(title, null, null, url, type);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
internal async Task AddGenreProportion(Guid animeTitleId, Guid genreId, decimal? proportion)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
await _commonPropertiesService.AddGenre(title, null, null, genreId, proportion);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
|
|
internal async Task SetAnnouncementDate(Guid animeTitleId, DateTimeOffset value)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
CommonPropertiesService.SetAnnouncementDate(title, null, null, value);
|
|
OnStructureActionCompleted(title);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
|
|
internal async Task SetEstimatedReleaseDate(Guid animeTitleId, Guid? animeSeasonId, Guid? animeEpisodeId, DateTimeOffset value)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
CommonPropertiesService.SetEstimatedReleaseDate(title, null, null, value);
|
|
OnStructureActionCompleted(title);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
|
|
internal async Task SetReleaseDate(Guid animeTitleId, Guid? animeSeasonId, Guid? animeEpisodeId, DateTimeOffset value)
|
|
{
|
|
var title = await GetTitle(animeTitleId);
|
|
CommonPropertiesService.SetReleaseDate(title, null, null, value);
|
|
OnStructureActionCompleted(title);
|
|
await _gateway.UpdateAsync(title);
|
|
}
|
|
} |