Fixed error with group creation
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using BeReadyBackend.Models;
|
||||
using BeReadyBackend.Repositories;
|
||||
using BeReadyBackend.Services;
|
||||
using BeReadyBackend.Specifications.Groups;
|
||||
using BeReadyBackend.Specifications.Users;
|
||||
using FastEndpoints;
|
||||
using Group = BeReadyBackend.Models.Group;
|
||||
@@ -54,6 +55,6 @@ public class CreateGroupEndpoint(
|
||||
group.UserGroups?.Add(userGroup);
|
||||
|
||||
await userGroupsRepository.AddRangeAsync(group.UserGroups!, ct);
|
||||
await Send.NoContentAsync(ct);
|
||||
await Send.OkAsync(await groupsRepository.ProjectToSingleAsync<GetGroupDto>(new GetGroupByIdSpec(group.Id), ct), ct);
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,8 @@ public class EntityToDtoMappings : Profile
|
||||
.ForMember(dest => dest.Users, opt => opt.MapFrom(src => src.UserGroups))
|
||||
.ForMember(dest => dest.Messages, opt => opt.MapFrom(src => src.Messages));
|
||||
|
||||
CreateMap<Group, GetGroupDto>();
|
||||
|
||||
CreateMap<Message, GetMessageDto>()
|
||||
.ForMember(dest => dest.Username, opt => opt.MapFrom(src => src.User!.Username));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user