Ignore:
Timestamp:
03/24/26 22:13:36 (3 months ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Children:
7fbb91c
Parents:
acf690c
Message:

Fixed reading lists,comments and likes

Location:
ChapterX.Application
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChapterX.Application/Likes/Commands/AddHandler.cs

    racf690c r73b69b2  
    2121            {
    2222                UserId = request.UserId,
    23                 StoryId = request.ChapterId,
     23                StoryId = request.StoryId,
    2424                CreatedAt = DateTime.UtcNow
    2525            };
  • ChapterX.Application/Likes/Commands/AddRequest.cs

    racf690c r73b69b2  
    33namespace ChapterX.Application.Likes.Commands
    44{
    5     public record AddRequest(int UserId, int ChapterId) : IRequest<AddResponse>;
     5    public record AddRequest(int UserId, int StoryId) : IRequest<AddResponse>;
    66}
  • ChapterX.Application/Notification/Commands/AddHandler.cs

    racf690c r73b69b2  
    2222                Content = request.Content,
    2323                IsRead = false,
    24                 CreatedAt = DateTime.UtcNow
     24                CreatedAt = DateTime.UtcNow,
     25                RecipientUserId = request.RecipientUserId,
     26                Type = request.Type,
     27                Link = request.Link,
    2528            };
    2629
  • ChapterX.Application/Notification/Commands/AddRequest.cs

    racf690c r73b69b2  
    33namespace ChapterX.Application.Notification.Commands
    44{
    5     public record AddRequest(string Content) : IRequest<AddResponse>;
     5    public record AddRequest(string Content, int? RecipientUserId = null, string? Type = null, string? Link = null) : IRequest<AddResponse>;
    66}
  • ChapterX.Application/Story/Commands/AddHandler.cs

    racf690c r73b69b2  
    88    {
    99        private readonly IStoryRepository _storyRepository;
     10        private readonly IGenreRepository _genreRepository;
     11        private readonly IHasGenreRepository _hasGenreRepository;
    1012        private readonly ILogger<AddHandler> _logger;
    1113
    12         public AddHandler(IStoryRepository storyRepository, ILogger<AddHandler> logger)
     14        public AddHandler(IStoryRepository storyRepository, IGenreRepository genreRepository, IHasGenreRepository hasGenreRepository, ILogger<AddHandler> logger)
    1315        {
    1416            _storyRepository = storyRepository;
     17            _genreRepository = genreRepository;
     18            _hasGenreRepository = hasGenreRepository;
    1519            _logger = logger;
    1620        }
     
    3135            await _storyRepository.AddAsync(story, cancellationToken);
    3236
     37            foreach (var genreName in request.Genres ?? [])
     38            {
     39                var genre = await _genreRepository.GetByNameAsync(genreName, cancellationToken);
     40                if (genre == null) continue;
     41                await _hasGenreRepository.AddAsync(new Domain.Entities.HasGenre { StoryId = story.Id, GenreId = genre.Id }, cancellationToken);
     42            }
     43
    3344            return new AddResponse(story.Id);
    3445        }
  • ChapterX.Application/Story/Commands/AddRequest.cs

    racf690c r73b69b2  
    33namespace ChapterX.Application.Story.Commands
    44{
    5     public record AddRequest(bool MatureContent, string ShortDescription, string? Image, string Content, int UserId) : IRequest<AddResponse>;
     5    public record AddRequest(bool MatureContent, string ShortDescription, string? Image, string Content, int UserId, List<string> Genres) : IRequest<AddResponse>;
    66}
Note: See TracChangeset for help on using the changeset viewer.