Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Application/Folders/Commands/DisableFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<FolderDto> Handle(Command request, CancellationToken cancellationToken)
{
var folder = await _context.Folders
.Include(x => x.Locker)
Comment thread
vzart marked this conversation as resolved.
.ThenInclude(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(f => f.Id.Equals(request.FolderId), cancellationToken);

if (folder is null)
Expand Down
3 changes: 3 additions & 0 deletions src/Application/Folders/Commands/EnableFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<FolderDto> Handle(Command request, CancellationToken cancellationToken)
{
var folder = await _context.Folders
.Include(x => x.Locker)
Comment thread
vzart marked this conversation as resolved.
.ThenInclude(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.FolderId), cancellationToken);

if (folder is null)
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Folders/Commands/RemoveFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public async Task<FolderDto> Handle(Command request, CancellationToken cancellat
{
var folder = await _context.Folders
.Include(x => x.Locker)
.ThenInclude(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.FolderId), cancellationToken);

if (folder is null)
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Folders/Commands/UpdateFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public async Task<FolderDto> Handle(Command request, CancellationToken cancellat
{
var folder = await _context.Folders
.Include(x => x.Locker)
.ThenInclude(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.FolderId), cancellationToken);

if (folder is null)
Expand Down
6 changes: 5 additions & 1 deletion src/Application/Folders/Queries/GetFolderById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public QueryHandler(IApplicationDbContext context, IMapper mapper)

public async Task<FolderDto> Handle(Query request, CancellationToken cancellationToken)
{
var folder = await _context.Folders.FirstOrDefaultAsync(x => x.Id.Equals(request.FolderId), cancellationToken);
var folder = await _context.Folders
.Include(x =>x .Locker)
.ThenInclude(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.FolderId), cancellationToken);

if (folder is null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Lockers/Commands/DisableLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<LockerDto> Handle(Command request, CancellationToken cancellationToken)
{
var locker = await _context.Lockers
.Include(x => x.Room)
Comment thread
vzart marked this conversation as resolved.
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);

if (locker is null)
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Lockers/Commands/EnableLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<LockerDto> Handle(Command request, CancellationToken cancellationToken)
{
var locker = await _context.Lockers
.Include(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);
if (locker is null)
{
Expand Down
1 change: 1 addition & 0 deletions src/Application/Lockers/Commands/RemoveLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public async Task<LockerDto> Handle(Command request, CancellationToken cancellat
{
var locker = await _context.Lockers
.Include(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);

if (locker is null)
Expand Down
6 changes: 4 additions & 2 deletions src/Application/Lockers/Commands/UpdateLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)

public async Task<LockerDto> Handle(Command request, CancellationToken cancellationToken)
{
var locker = await _context.Lockers.Include(x => x.Room).FirstOrDefaultAsync(
x => x.Id.Equals(request.LockerId), cancellationToken);
var locker = await _context.Lockers
.Include(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);

if (locker is null)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Application/Lockers/Queries/GetLockerById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public QueryHandler(IApplicationDbContext context, IMapper mapper)

public async Task<LockerDto> Handle(Query request, CancellationToken cancellationToken)
{
var locker = await _context.Lockers.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);
var locker = await _context.Lockers
.Include(x => x.Room)
.ThenInclude(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.LockerId), cancellationToken);

if (locker is null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Rooms/Commands/DisableRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<RoomDto> Handle(Command request, CancellationToken cancellationToken)
{
var room = await _context.Rooms
.Include(x => x.Department)
.Include(x => x.Staff)
.Include(x => x.Lockers)
.ThenInclude(y => y.Folders)
.FirstOrDefaultAsync(x => x.Id.Equals(request.RoomId), cancellationToken: cancellationToken);
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Rooms/Commands/EnableRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<RoomDto> Handle(Command request, CancellationToken cancellationToken)
{
var room = await _context.Rooms
.Include(x => x.Department)
.Include(x => x.Staff)
.FirstOrDefaultAsync(x => x.Id.Equals(request.RoomId), cancellationToken: cancellationToken);

if (room is null)
Expand Down
1 change: 1 addition & 0 deletions src/Application/Rooms/Commands/RemoveRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<RoomDto> Handle(Command request, CancellationToken cancellationToken)
{
var room = await _context.Rooms
.Include(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.RoomId), cancellationToken: cancellationToken);

if (room is null)
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Rooms/Commands/UpdateRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public CommandHandler(IApplicationDbContext context, IMapper mapper)
public async Task<RoomDto> Handle(Command request, CancellationToken cancellationToken)
{
var room = await _context.Rooms
.Include(x => x.Department)
.Include(x => x.Staff)
.FirstOrDefaultAsync(x => x.Id.Equals(request.RoomId), cancellationToken: cancellationToken);

if (room is null)
Expand Down
1 change: 1 addition & 0 deletions src/Application/Rooms/Queries/GetAllRoomsPaginated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public async Task<PaginatedList<RoomDto>> Handle(Query request, CancellationToke
{
var rooms = _context.Rooms
.Include(x => x.Department)
.Include(x => x.Staff)
.AsQueryable();

if (!(request.SearchTerm is null || request.SearchTerm.Trim().Equals(string.Empty)))
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Rooms/Queries/GetRoomById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public QueryHandler(IApplicationDbContext context, IMapper mapper)
public async Task<RoomDto> Handle(Query request, CancellationToken cancellationToken)
{
var room = await _context.Rooms
.Include(x => x.Department)
.Include(x => x.Staff)
.FirstOrDefaultAsync(x => x.Id.Equals(request.RoomId), cancellationToken: cancellationToken);

if (room is null)
Expand Down
1 change: 1 addition & 0 deletions src/Application/Users/Queries/GetUserById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public QueryHandler(IApplicationDbContext context, IMapper mapper)
public async Task<UserDto> Handle(Query request, CancellationToken cancellationToken)
{
var user = await _context.Users
.Include(x => x.Department)
.FirstOrDefaultAsync(x => x.Id.Equals(request.UserId), cancellationToken: cancellationToken);

if (user is null)
Expand Down