complete login response and user services

master
Amir Hossein Khademi 2023-10-26 01:24:04 +03:30
parent 80d4467c24
commit 4a775c9373
18 changed files with 1414 additions and 56 deletions

View File

@ -24,7 +24,7 @@ public class ShiftController : ICarterModule
group.MapPut("", Put) group.MapPut("", Put)
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapDelete("", Delete) group.MapDelete("{id}", Delete)
.HasApiVersion(1.0); .HasApiVersion(1.0);

View File

@ -19,6 +19,14 @@ public class UserController : ICarterModule
.WithDisplayName("GetOneUser") .WithDisplayName("GetOneUser")
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapGet("/profile", GetUserProfileAsync)
.WithDisplayName("GetUserProfile")
.HasApiVersion(1.0);
group.MapGet("/profile/role", GetUserProfileAsync)
.WithDisplayName("GetUserProfileRoles")
.HasApiVersion(1.0);
group.MapPost("", Post) group.MapPost("", Post)
.HasApiVersion(1.0); .HasApiVersion(1.0);
@ -29,6 +37,9 @@ public class UserController : ICarterModule
.HasApiVersion(1.0); .HasApiVersion(1.0);
} }
public async Task<IResult> GetUserProfileAsync(IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetUserProfileAsync(cancellationToken));
// GET:Get All Entity // GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery]int page, IUserService userService, CancellationToken cancellationToken) public async Task<IResult> GetAllAsync([FromQuery]int page, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetUsersAsync(page,cancellationToken)); => TypedResults.Ok(await userService.GetUsersAsync(page,cancellationToken));

View File

@ -1,4 +1,7 @@
namespace Brizco.Core.CoreServices; using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Mappers;
namespace Brizco.Core.CoreServices;
public class AccountService : IAccountService public class AccountService : IAccountService
{ {
@ -154,26 +157,59 @@ public class AccountService : IAccountService
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken) private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
{ {
AccessToken<ApplicationUserSDto> jwt;
if (user.SelectedComplexUserRoleId != Guid.Empty)
{
var complexUserRole = await _repositoryWrapper.SetRepository<ComplexUserRole>()
.TableNoTracking
.Where(c => c.Id == user.SelectedComplexUserRoleId)
.Select(ComplexUserRoleMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken);
var complexUsers = await _repositoryWrapper.SetRepository<ComplexUser>() var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>()
.TableNoTracking
.Where(c => c.Id == complexUserRole!.ComplexUserId)
.Select(ComplexUserMapper.ProjectToSDto)
.FirstOrDefaultAsync( cancellationToken);
jwt = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user, complexUser!.ComplexId, complexUserRole!.RoleId);
jwt.User.SelectedComplexName = complexUser.ComplexName;
jwt.User.SelectedRoleName = complexUserRole.RoleName;
}
else
{
var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>()
.TableNoTracking .TableNoTracking
.Where(mcu => mcu.UserId == user.Id) .Where(mcu => mcu.UserId == user.Id)
.OrderByDescending(o => o.CreatedAt) .OrderByDescending(o => o.CreatedAt)
.Select(ComplexUserMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);
if(complexUsers == null) if (complexUser == null)
return await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user); return await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
var complexUserRoles = await _repositoryWrapper.SetRepository<ComplexUserRole>() var complexUserRole = await _repositoryWrapper.SetRepository<ComplexUserRole>()
.TableNoTracking .TableNoTracking
.Where(c=>c.ComplexUserId==complexUsers.Id) .Where(c => c.ComplexUserId == complexUser.Id)
.OrderByDescending(o => o.CreatedAt) .OrderByDescending(o => o.CreatedAt)
.Select(ComplexUserRoleMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);
AccessToken<ApplicationUserSDto> jwt;
if (complexUserRoles != null)
jwt = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user, complexUsers.ComplexId, complexUserRoles.RoleId);
if (complexUserRole != null)
{
user.SelectedComplexUserRoleId = complexUserRole.Id;
await _userManager.UpdateAsync(user);
jwt = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user, complexUser.ComplexId, complexUserRole.RoleId);
jwt.User.SelectedComplexName = complexUser.ComplexName;
jwt.User.SelectedRoleName = complexUserRole.RoleName;
}
else else
jwt = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user); jwt = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
}
return jwt; return jwt;
} }

View File

@ -2,6 +2,8 @@
public interface IUserService : IScopedDependency public interface IUserService : IScopedDependency
{ {
Task<ApplicationUserSDto> GetUserProfileAsync(CancellationToken cancellationToken);
Task<List<ComplexUserRoleSDto>> GetUserRolesAsync(CancellationToken cancellationToken);
Task<List<ComplexUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default); Task<List<ComplexUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default);
Task<ApplicationUserSDto> GetUserAsync(Guid userId); Task<ApplicationUserSDto> GetUserAsync(Guid userId);
Task<ApplicationUser> CreateUserAsync(string phoneNumber); Task<ApplicationUser> CreateUserAsync(string phoneNumber);

View File

@ -27,6 +27,69 @@ public class UserService : IUserService
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<ApplicationUserSDto> GetUserProfileAsync(CancellationToken cancellationToken)
{
if (!Guid.TryParse(_currentUserService.UserId, out var userId))
throw new AppException("Wrong Token", ApiResultStatusCode.UnAuthorized);
var user = await _userManager.FindByIdAsync(userId.ToString());
if (user == null)
throw new AppException("User NotFound", ApiResultStatusCode.NotFound);
var response = user.AdaptToSDto();
if (user.SelectedComplexUserRoleId != Guid.Empty)
{
var complexUserRole = await _repositoryWrapper.SetRepository<ComplexUserRole>()
.TableNoTracking
.Where(c => c.Id == user.SelectedComplexUserRoleId)
.Select(ComplexUserRoleMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken);
var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>()
.TableNoTracking
.Where(c => c.Id == complexUserRole!.ComplexUserId)
.Select(ComplexUserMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken);
response.SelectedComplexName = complexUser!.ComplexName;
response.SelectedRoleName = complexUserRole!.RoleName;
}
return response;
}
public async Task<List<ComplexUserRoleSDto>> GetUserRolesAsync(CancellationToken cancellationToken)
{
if (!Guid.TryParse(_currentUserService.UserId, out var userId))
throw new AppException("Wrong Token", ApiResultStatusCode.UnAuthorized);
var user = await _userManager.FindByIdAsync(userId.ToString());
if (user == null)
throw new AppException("User NotFound", ApiResultStatusCode.NotFound);
var response = new List<ComplexUserRoleSDto>();
var complexUsers = await _repositoryWrapper.SetRepository<ComplexUser>()
.TableNoTracking
.Where(mcu => mcu.UserId == user.Id)
.Select(ComplexUserMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
if (complexUsers.Count == 0)
return response;
foreach (var complexUser in complexUsers)
{
var complexUserRoles = await _repositoryWrapper.SetRepository<ComplexUserRole>()
.TableNoTracking
.Where(c => c.ComplexUserId == complexUser.Id)
.Select(ComplexUserRoleMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
foreach (var userRole in complexUserRoles)
{
userRole.ComplexName = complexUser.ComplexName;
response.Add(userRole);
}
}
return response;
}
public async Task<List<ComplexUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default) public async Task<List<ComplexUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default)
{ {
if (_currentUserService.ComplexId.IsNullOrEmpty()) if (_currentUserService.ComplexId.IsNullOrEmpty())

View File

@ -67,7 +67,6 @@
<ItemGroup> <ItemGroup>
<Folder Include="Dtos\LargDtos\" /> <Folder Include="Dtos\LargDtos\" />
<Folder Include="Dtos\ResponseDto\" />
<Folder Include="Dtos\RequestDtos\" /> <Folder Include="Dtos\RequestDtos\" />
<Folder Include="Models\Settings\" /> <Folder Include="Models\Settings\" />
</ItemGroup> </ItemGroup>

View File

@ -3,7 +3,7 @@
namespace Brizco.Domain.CommandQueries.Commands; namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description , List<DayOfWeek> DayOfWeeks) public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description , List<DayOfWeek> DayOfWeeks)
: IRequest<Shift>; : IRequest<ShiftSDto>;
public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks) public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks)
: IRequest<bool>; : IRequest<bool>;

View File

@ -7,8 +7,6 @@ public class ComplexUserRoleSDto : BaseDto<ComplexUserRoleSDto,ComplexUserRole>
public Guid RoleId { get; set; } public Guid RoleId { get; set; }
public Guid ComplexUserId { get; set; } public Guid ComplexUserId { get; set; }
public string RoleName { get; set; } = string.Empty;
public Guid UserId { get; set; } public string ComplexName { get; set; } = string.Empty;
public Guid ComplexId { get; set; }
} }

View File

@ -7,6 +7,9 @@ public class ApplicationUser : IdentityUser<Guid>
public string FirstName { get; set; } = string.Empty; public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty;
public string NationalId { get; set; } = string.Empty; public string NationalId { get; set; } = string.Empty;
public Guid SelectedComplexUserRoleId { get; set; }
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
public Gender Gender { get; set; } public Gender Gender { get; set; }
public SignUpStatus SignUpStatus { get; set; } public SignUpStatus SignUpStatus { get; set; }

View File

@ -2,6 +2,8 @@ using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos; using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex; using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Entities.User;
using Mapster.Models;
namespace Brizco.Domain.Mappers namespace Brizco.Domain.Mappers
{ {
@ -12,7 +14,13 @@ namespace Brizco.Domain.Mappers
return p1 == null ? null : new ComplexUserRole() return p1 == null ? null : new ComplexUserRole()
{ {
ComplexUserId = p1.ComplexUserId, ComplexUserId = p1.ComplexUserId,
ComplexUser = new ComplexUser() {Id = p1.ComplexUserId},
RoleId = p1.RoleId, RoleId = p1.RoleId,
Role = new ApplicationRole()
{
Id = p1.RoleId,
Name = p1.RoleName
},
Id = p1.Id Id = p1.Id
}; };
} }
@ -25,45 +33,75 @@ namespace Brizco.Domain.Mappers
ComplexUserRole result = p3 ?? new ComplexUserRole(); ComplexUserRole result = p3 ?? new ComplexUserRole();
result.ComplexUserId = p2.ComplexUserId; result.ComplexUserId = p2.ComplexUserId;
result.ComplexUser = funcMain1(new Never(), result.ComplexUser, p2);
result.RoleId = p2.RoleId; result.RoleId = p2.RoleId;
result.Role = funcMain2(new Never(), result.Role, p2);
result.Id = p2.Id; result.Id = p2.Id;
return result; return result;
} }
public static Expression<Func<ComplexUserRoleSDto, ComplexUserRole>> ProjectToComplexUserRole => p4 => new ComplexUserRole() public static Expression<Func<ComplexUserRoleSDto, ComplexUserRole>> ProjectToComplexUserRole => p8 => new ComplexUserRole()
{ {
ComplexUserId = p4.ComplexUserId, ComplexUserId = p8.ComplexUserId,
RoleId = p4.RoleId, ComplexUser = new ComplexUser() {Id = p8.ComplexUserId},
Id = p4.Id RoleId = p8.RoleId,
Role = new ApplicationRole()
{
Id = p8.RoleId,
Name = p8.RoleName
},
Id = p8.Id
}; };
public static ComplexUserRoleSDto AdaptToSDto(this ComplexUserRole p5) public static ComplexUserRoleSDto AdaptToSDto(this ComplexUserRole p9)
{ {
return p5 == null ? null : new ComplexUserRoleSDto() return p9 == null ? null : new ComplexUserRoleSDto()
{ {
RoleId = p5.RoleId, RoleId = p9.RoleId,
ComplexUserId = p5.ComplexUserId, ComplexUserId = p9.ComplexUserId,
Id = p5.Id RoleName = p9.Role == null ? null : p9.Role.PersianName,
Id = p9.Id
}; };
} }
public static ComplexUserRoleSDto AdaptTo(this ComplexUserRole p6, ComplexUserRoleSDto p7) public static ComplexUserRoleSDto AdaptTo(this ComplexUserRole p10, ComplexUserRoleSDto p11)
{ {
if (p6 == null) if (p10 == null)
{ {
return null; return null;
} }
ComplexUserRoleSDto result = p7 ?? new ComplexUserRoleSDto(); ComplexUserRoleSDto result = p11 ?? new ComplexUserRoleSDto();
result.RoleId = p6.RoleId; result.RoleId = p10.RoleId;
result.ComplexUserId = p6.ComplexUserId; result.ComplexUserId = p10.ComplexUserId;
result.Id = p6.Id; result.RoleName = p10.Role == null ? null : p10.Role.PersianName;
result.Id = p10.Id;
return result; return result;
} }
public static Expression<Func<ComplexUserRole, ComplexUserRoleSDto>> ProjectToSDto => p8 => new ComplexUserRoleSDto() public static Expression<Func<ComplexUserRole, ComplexUserRoleSDto>> ProjectToSDto => p12 => new ComplexUserRoleSDto()
{ {
RoleId = p8.RoleId, RoleId = p12.RoleId,
ComplexUserId = p8.ComplexUserId, ComplexUserId = p12.ComplexUserId,
Id = p8.Id RoleName = p12.Role.PersianName,
Id = p12.Id
}; };
private static ComplexUser funcMain1(Never p4, ComplexUser p5, ComplexUserRoleSDto p2)
{
ComplexUser result = p5 ?? new ComplexUser();
result.Id = p2.ComplexUserId;
return result;
}
private static ApplicationRole funcMain2(Never p6, ApplicationRole p7, ComplexUserRoleSDto p2)
{
ApplicationRole result = p7 ?? new ApplicationRole();
result.Id = p2.RoleId;
result.Name = p2.RoleName;
return result;
}
} }
} }

View File

@ -63,7 +63,7 @@ namespace Brizco.Domain.Mappers
Description = p11.Description, Description = p11.Description,
StartAt = p11.StartAt, StartAt = p11.StartAt,
EndAt = p11.EndAt, EndAt = p11.EndAt,
Days = funcMain4(p11.Days != null ? p11.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>() : new List<DayOfWeek>()), Days = funcMain4(p11.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>()),
ComplexId = p11.ComplexId, ComplexId = p11.ComplexId,
Id = p11.Id Id = p11.Id
}; };
@ -80,7 +80,7 @@ namespace Brizco.Domain.Mappers
result.Description = p13.Description; result.Description = p13.Description;
result.StartAt = p13.StartAt; result.StartAt = p13.StartAt;
result.EndAt = p13.EndAt; result.EndAt = p13.EndAt;
result.Days = funcMain6(p13.Days != null ? p13.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>() : new List<DayOfWeek>(), result.Days); result.Days = funcMain6(p13.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>(), result.Days);
result.ComplexId = p13.ComplexId; result.ComplexId = p13.ComplexId;
result.Id = p13.Id; result.Id = p13.Id;
return result; return result;
@ -92,7 +92,7 @@ namespace Brizco.Domain.Mappers
Description = p17.Description, Description = p17.Description,
StartAt = p17.StartAt, StartAt = p17.StartAt,
EndAt = p17.EndAt, EndAt = p17.EndAt,
Days = p17.Days != null ? p17.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>() : new List<DayOfWeek>(), Days = p17.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>(),
ComplexId = p17.ComplexId, ComplexId = p17.ComplexId,
Id = p17.Id Id = p17.Id
}; };

View File

@ -9,7 +9,12 @@ public class MapsterRegister : IRegister
public void Register(TypeAdapterConfig config) public void Register(TypeAdapterConfig config)
{ {
config.NewConfig<Shift, ShiftSDto>() config.NewConfig<Shift, ShiftSDto>()
.Map("Days", org => org.Days != null ? org.Days.Select(d=>d.DayOfWeek).ToList() : new List<DayOfWeek>()) .Map("Days", org => org.Days.Select(d=>d.DayOfWeek).ToList())
.TwoWays();
config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>()
.Map("RoleName", org => org.Role!.PersianName)
.TwoWays(); .TwoWays();
config.NewConfig<ComplexUser, ComplexUserSDto>() config.NewConfig<ComplexUser, ComplexUserSDto>()

View File

@ -1,6 +1,6 @@
namespace Brizco.Repository.Handlers.Shift; namespace Brizco.Repository.Handlers.Shift;
public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Domain.Entities.Shift.Shift> public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, ShiftSDto>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
private readonly ICurrentUserService _currentUserService; private readonly ICurrentUserService _currentUserService;
@ -10,7 +10,7 @@ public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Dom
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
_currentUserService = currentUserService; _currentUserService = currentUserService;
} }
public async Task<Domain.Entities.Shift.Shift> Handle(CreateShiftCommand request, CancellationToken cancellationToken) public async Task<ShiftSDto> Handle(CreateShiftCommand request, CancellationToken cancellationToken)
{ {
if (_currentUserService.ComplexId == null) if (_currentUserService.ComplexId == null)
@ -33,7 +33,7 @@ public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Dom
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift); _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
await _repositoryWrapper.CommitAsync(cancellationToken); await _repositoryWrapper.CommitAsync(cancellationToken);
return shift; return shift.AdaptToSDto();
} }
catch (Exception ) catch (Exception )
{ {

View File

@ -16,6 +16,11 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
.Select(ShiftMapper.ProjectToSDto) .Select(ShiftMapper.ProjectToSDto)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
shifts.ForEach(s =>
{
s.Days = s.Days.OrderBy(d=>d).ToList();
});
return shifts; return shifts;
} }
} }

View File

@ -1,4 +1,6 @@
namespace Brizco.Repository.Handlers.Shift; using Brizco.Domain.Entities.Shift;
namespace Brizco.Repository.Handlers.Shift;
public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool> public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool>
{ {
@ -14,7 +16,7 @@ public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, boo
public async Task<bool> Handle(UpdateShiftCommand request, CancellationToken cancellationToken) public async Task<bool> Handle(UpdateShiftCommand request, CancellationToken cancellationToken)
{ {
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>() var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id); .TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken);
if (shift == null) if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound); throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
@ -29,6 +31,26 @@ public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, boo
request.EndAt, request.EndAt,
complexId); complexId);
newShift.Id = request.Id; newShift.Id = request.Id;
var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>()
.TableNoTracking.Where(sd => sd.ShiftId == request.Id)
.ToListAsync(cancellationToken);
foreach (var shiftDay in shiftDays.Where(shiftDay => !request.DayOfWeeks.Contains(shiftDay.DayOfWeek)))
{
_repositoryWrapper.SetRepository<ShiftDay>()
.Delete(shiftDay);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var dayOfWeek in request.DayOfWeeks)
{
var findDay = shiftDays.FirstOrDefault(sf => sf.DayOfWeek == dayOfWeek);
if (findDay != null)
shift.SetDay(dayOfWeek);
}
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>() _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.Update(newShift); .Update(newShift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "SelectedComplexUserRoleId",
schema: "public",
table: "Users",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SelectedComplexUserRoleId",
schema: "public",
table: "Users");
}
}
}

View File

@ -717,6 +717,9 @@ namespace Brizco.Repository.Migrations
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("SelectedComplexUserRoleId")
.HasColumnType("uuid");
b.Property<int>("SignUpStatus") b.Property<int>("SignUpStatus")
.HasColumnType("integer"); .HasColumnType("integer");