From 15e5793d6e95f6879e825ef14887a0fb1ca24d6f Mon Sep 17 00:00:00 2001 From: ilyasBozdemir Date: Mon, 29 Apr 2024 13:54:09 +0300 Subject: [PATCH] Add report loss, damage, and renew book commands Implement commands, validators, responses, and handlers for reporting loss, damage, and renewing books. Replace BookStock with BookEntry for managing book entries. Ensure proper entity configurations and relationships. --- .../GetAllBorrowsQueryRequestValidator.cs | 16 +- .../GetBorrowByIdQueryRequestValidator.cs | 12 +- .../RenewBorrowCommandRequestValidator.cs | 14 + ...ReportDamageBookCommandRequestValidator.cs | 13 + .../Handlers/GiveBorrowCommandHandler.cs | 8 +- .../Handlers/RenewBorrowCommandHandler.cs | 46 ++ .../ReportDamageBookCommandHandler.cs | 39 ++ .../Handlers/ReportLossBookCommandHandler.cs | 44 ++ .../Handlers/TakeBorrowCommandHandler.cs | 1 + .../Requests/RenewBorrowCommandRequest.cs | 9 + .../ReportDamageBookCommandRequest.cs | 10 + .../Requests/ReportLossBookCommandRequest.cs | 8 + .../Responses/RenewBorrowCommandResponse.cs | 6 + .../ReportDamageBookCommandResponse.cs | 4 + .../ReportLossBookCommandResponse.cs | 4 + .../Requests/GetAllBorrowsQueryRequest.cs | 2 +- .../Requests/GetBorrowByIdQueryRequest.cs | 2 +- .../Entities/Library/Book.cs | 4 +- .../Entities/Library/BookEntry.cs | 20 + .../Entities/Library/BorrowLend.cs | 9 +- .../Enums/BookStatus.cs | 10 + .../Enums/BorrowLendType.cs | 3 + .../Enums/BorrowStatus.cs | 17 +- .../BookCompartmentConfiguration.cs | 21 + .../BookConfiguration.cs | 6 + .../BookEntryConfiguration.cs | 14 + .../ShelfConfiguration.cs | 21 + .../Data/SeedData.cs | 42 +- ...r.cs => 20240429105114_mig001.Designer.cs} | 529 ++++++++++++------ ...500_mig001.cs => 20240429105114_mig001.cs} | 303 +++++++--- .../AppIdentityDbContextModelSnapshot.cs | 527 +++++++++++------ .../Controllers/v1/BorrowLendsController.cs | 119 +++- README.md | 3 +- 33 files changed, 1410 insertions(+), 476 deletions(-) create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/RenewBorrowCommandRequestValidator.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/ReportDamageBookCommandRequestValidator.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/RenewBorrowCommandHandler.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportDamageBookCommandHandler.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportLossBookCommandHandler.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/RenewBorrowCommandRequest.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportDamageBookCommandRequest.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportLossBookCommandRequest.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/RenewBorrowCommandResponse.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportDamageBookCommandResponse.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportLossBookCommandResponse.cs create mode 100644 LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BookEntry.cs create mode 100644 LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookCompartmentConfiguration.cs create mode 100644 LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookEntryConfiguration.cs create mode 100644 LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/ShelfConfiguration.cs rename LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/{20240428152500_mig001.Designer.cs => 20240429105114_mig001.Designer.cs} (79%) rename LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/{20240428152500_mig001.cs => 20240429105114_mig001.cs} (78%) diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetAllBorrowsQueryRequestValidator.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetAllBorrowsQueryRequestValidator.cs index 925195c..4fc0f02 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetAllBorrowsQueryRequestValidator.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetAllBorrowsQueryRequestValidator.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using LibraryTrackingApp.Application.Features.BorrowLend.Queries.Requests; -namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator +namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator; + + +public class GetAllBorrowsQueryRequestValidator : AbstractValidator { - internal class GetAllBorrowsQueryRequestValidator + public GetAllBorrowsQueryRequestValidator() { + } -} +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetBorrowByIdQueryRequestValidator.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetBorrowByIdQueryRequestValidator.cs index 1b51d96..5743478 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetBorrowByIdQueryRequestValidator.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/GetBorrowByIdQueryRequestValidator.cs @@ -1,12 +1,14 @@ -using System; +using LibraryTrackingApp.Application.Features.BorrowLend.Queries.Requests; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator +namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator; + + +public class GetBorrowByIdQueryRequestValidator : AbstractValidator { - internal class GetBorrowByIdQueryRequestValidator - { - } + } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/RenewBorrowCommandRequestValidator.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/RenewBorrowCommandRequestValidator.cs new file mode 100644 index 0000000..2e7d82d --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/RenewBorrowCommandRequestValidator.cs @@ -0,0 +1,14 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; + + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator; + + +public class RenewBorrowCommandRequestValidator : AbstractValidator +{ + public RenewBorrowCommandRequestValidator() + { + RuleFor(x => x.BorrowId).NotEmpty().WithMessage("BorrowId boş olamaz."); + RuleFor(x => x.RenewalDurationInDays).NotEmpty().GreaterThan(0).WithMessage("Yenileme süresi boş olamaz ve 0'dan büyük olmalıdır."); + } +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/ReportDamageBookCommandRequestValidator.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/ReportDamageBookCommandRequestValidator.cs new file mode 100644 index 0000000..451c6c8 --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Behaviors/Validator/ReportDamageBookCommandRequestValidator.cs @@ -0,0 +1,13 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; + + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Behaviors.Validator; + +public class ReportDamageBookCommandRequestValidator : AbstractValidator +{ + public ReportDamageBookCommandRequestValidator() + { + RuleFor(x => x.BorrowId).NotEmpty().WithMessage("BorrowId boş olamaz."); + RuleFor(x => x.DamageDescription).NotEmpty().WithMessage("Hasar açıklaması boş olamaz."); + } +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/GiveBorrowCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/GiveBorrowCommandHandler.cs index 558d983..824cae4 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/GiveBorrowCommandHandler.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/GiveBorrowCommandHandler.cs @@ -85,7 +85,7 @@ CancellationToken cancellationToken if (!existingBook || !existingMember || !existingStaff) { - return new () + return new() { StatusCode = (int)HttpStatusCode.BadRequest, Success = false, @@ -118,7 +118,7 @@ CancellationToken cancellationToken if (givenBookResult) { - return new () + return new() { StatusCode = (int)HttpStatusCode.OK, Success = true, @@ -127,7 +127,7 @@ CancellationToken cancellationToken } else { - return new () + return new() { StatusCode = (int)HttpStatusCode.BadRequest, Success = true, @@ -137,7 +137,7 @@ CancellationToken cancellationToken } else { - return new () + return new() { StatusCode = stockDecreaseResponse.StatusCode, Success = stockDecreaseResponse.Success, diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/RenewBorrowCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/RenewBorrowCommandHandler.cs new file mode 100644 index 0000000..ad41114 --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/RenewBorrowCommandHandler.cs @@ -0,0 +1,46 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; +using LibraryTrackingApp.Application.Interfaces.UnitOfWork; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Handlers; + +public class RenewBorrowCommandHandler + : IRequestHandler +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMediator _mediator; + private readonly IMapper _mapper; + + public RenewBorrowCommandHandler( + IUnitOfWork unitOfWork, + IMapper mapper, + IMediator mediator + ) + { + _unitOfWork = unitOfWork; + _mediator = mediator; + _mapper = mapper; + } + + //yazılcak daha burası + + public async Task Handle( + RenewBorrowCommandRequest request, + CancellationToken cancellationToken + ) + { + try + { + return new() { }; + } + catch (Exception ex) + { + return new() + { + StatusCode = 500, + Success = false, + StateMessages = new[] { $"Bir hata oluştu: {ex.Message}" } + }; + } + } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportDamageBookCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportDamageBookCommandHandler.cs new file mode 100644 index 0000000..5c042dd --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportDamageBookCommandHandler.cs @@ -0,0 +1,39 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; +using LibraryTrackingApp.Application.Interfaces.UnitOfWork; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Handlers; + +public class ReportDamageBookCommandHandler + : IRequestHandler +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMediator _mediator; + private readonly IMapper _mapper; + + public ReportDamageBookCommandHandler( + IUnitOfWork unitOfWork, + IMapper mapper, + IMediator mediator + ) + { + _unitOfWork = unitOfWork; + _mediator = mediator; + _mapper = mapper; + } + + public async Task Handle( + ReportDamageBookCommandRequest request, + CancellationToken cancellationToken + ) + { + var response = new ReportDamageBookCommandResponse + { + StatusCode = 200, + Success = true, + StateMessages = new string[] { "Hasar raporu başarıyla oluşturuldu." } + }; + + return response; + } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportLossBookCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportLossBookCommandHandler.cs new file mode 100644 index 0000000..8c9bdbd --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/ReportLossBookCommandHandler.cs @@ -0,0 +1,44 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; +using LibraryTrackingApp.Application.Interfaces.UnitOfWork; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Handlers; + +public class ReportLossBookCommandHandler + : IRequestHandler +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMediator _mediator; + private readonly IMapper _mapper; + + public ReportLossBookCommandHandler( + IUnitOfWork unitOfWork, + IMapper mapper, + IMediator mediator + ) + { + _unitOfWork = unitOfWork; + _mediator = mediator; + _mapper = mapper; + } + + public async Task Handle( + ReportLossBookCommandRequest request, + CancellationToken cancellationToken + ) + { + try + { + return new() { }; + } + catch (Exception ex) + { + return new() + { + StatusCode = 500, + Success = false, + StateMessages = new[] { $"Bir hata oluştu: {ex.Message}" } + }; + } + } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/TakeBorrowCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/TakeBorrowCommandHandler.cs index 4527efc..3eeb294 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/TakeBorrowCommandHandler.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Handlers/TakeBorrowCommandHandler.cs @@ -67,6 +67,7 @@ CancellationToken cancellationToken { borrowedBook.LateDurationInDays = (int?) (borrowedBook.ReturnDate - borrowedBook.DueDate)?.TotalDays; + borrowedBook.BorrowStatus = BorrowStatus.DelayedReturn; } else { diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/RenewBorrowCommandRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/RenewBorrowCommandRequest.cs new file mode 100644 index 0000000..7934387 --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/RenewBorrowCommandRequest.cs @@ -0,0 +1,9 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; + +public class RenewBorrowCommandRequest : IRequest +{ + public Guid BorrowId { get; set; } + public int RenewalDurationInDays { get; set; } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportDamageBookCommandRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportDamageBookCommandRequest.cs new file mode 100644 index 0000000..29cfd4a --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportDamageBookCommandRequest.cs @@ -0,0 +1,10 @@ + +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; + +public class ReportDamageBookCommandRequest : IRequest +{ + public Guid BorrowId { get; set; } + public string DamageDescription { get; set; } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportLossBookCommandRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportLossBookCommandRequest.cs new file mode 100644 index 0000000..fb303f9 --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Requests/ReportLossBookCommandRequest.cs @@ -0,0 +1,8 @@ +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; + +public class ReportLossBookCommandRequest : IRequest +{ + public Guid BookId { get; set; } +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/RenewBorrowCommandResponse.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/RenewBorrowCommandResponse.cs new file mode 100644 index 0000000..a857f6d --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/RenewBorrowCommandResponse.cs @@ -0,0 +1,6 @@ +using LibraryTrackingApp.Application.Shared.Wrappers.Results; + + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; + +public class RenewBorrowCommandResponse : CommandResult { } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportDamageBookCommandResponse.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportDamageBookCommandResponse.cs new file mode 100644 index 0000000..2ecab9b --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportDamageBookCommandResponse.cs @@ -0,0 +1,4 @@ +using LibraryTrackingApp.Application.Shared.Wrappers.Results; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; +public class ReportDamageBookCommandResponse : CommandResult { } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportLossBookCommandResponse.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportLossBookCommandResponse.cs new file mode 100644 index 0000000..5232e3d --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Commands/Responses/ReportLossBookCommandResponse.cs @@ -0,0 +1,4 @@ +using LibraryTrackingApp.Application.Shared.Wrappers.Results; + +namespace LibraryTrackingApp.Application.Features.BorrowLend.Commands.Responses; +public class ReportLossBookCommandResponse : CommandResult { } \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetAllBorrowsQueryRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetAllBorrowsQueryRequest.cs index f203458..ce01639 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetAllBorrowsQueryRequest.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetAllBorrowsQueryRequest.cs @@ -6,7 +6,7 @@ namespace LibraryTrackingApp.Application.Features.BorrowLend.Queries.Requests { - internal class GetAllBorrowsQueryRequest + public class GetAllBorrowsQueryRequest { } } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetBorrowByIdQueryRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetBorrowByIdQueryRequest.cs index d1d1c83..881414a 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetBorrowByIdQueryRequest.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/BorrowLend/Queries/Requests/GetBorrowByIdQueryRequest.cs @@ -6,7 +6,7 @@ namespace LibraryTrackingApp.Application.Features.BorrowLend.Queries.Requests { - internal class GetBorrowByIdQueryRequest + public class GetBorrowByIdQueryRequest { } } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/Book.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/Book.cs index e701015..61bd206 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/Book.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/Book.cs @@ -8,9 +8,7 @@ public class Book : BaseEntity, IAuditable public Guid AuthorId { get; set; } public Guid LibraryBranchId { get; set; } public Guid BookStockId { get; set; } - public Guid BorrowId { get; set; } - public string BookNumber { get; set; } public string Title { get; set; } public string ISBN { get; set; } public string Description { get; set; } @@ -36,4 +34,6 @@ public class Book : BaseEntity, IAuditable public ICollection Authors { get; set; } public ICollection BookStocks { get; set; } public ICollection Borrows { get; set; } + public ICollection BookEntries { get; set; } + } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BookEntry.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BookEntry.cs new file mode 100644 index 0000000..31be56a --- /dev/null +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BookEntry.cs @@ -0,0 +1,20 @@ +namespace LibraryTrackingApp.Domain.Entities.Library; + + +//bookstock tablosu kalkıcaktır. stokları teker teker aynı kitapta da verilen numaralar ile ayırarak burda da bunu girerek +// yapılcaktır stok adedi bu şekilde olucaktır. +public class BookEntry : BaseEntity, IAuditable +{ + public Guid Id { get; set; } + public Guid BookId { get; set; } + public string BookNumber { get; set; } + public BookStatus BookStatus { get; set; } + public BookFormat BookFormat { get; set; } + public BookLanguage BookLanguage { get; set; } + public bool IsAvailable { get; set; } + + public DateTime EntryDate { get; set; } + public DateTime LastModified { get; set; } + + public Book Book { get; set; } +} diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BorrowLend.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BorrowLend.cs index 7083362..010a033 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BorrowLend.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Entities/Library/BorrowLend.cs @@ -15,14 +15,13 @@ public class BorrowLend : BaseEntity, IAuditable public Guid MemberId { get; set; } public Guid LenderId { get; set; } public DateTime BorrowDate { get; set; } - public DateTime DueDate { get; set; } + public DateTime DueDate { get; set; } + public DateTime? ReturnDate { get; set; } public BorrowStatus BorrowStatus { get; set; } + public bool HasFee { get; set; } public decimal FeeAmount { get; set; } - public TimeSpan TimeElapsedSinceBorrowDate => DateTime.Now - BorrowDate; - - - public DateTime? ReturnDate { get; set; } + public bool? IsLate { get; set; } public int? LateDurationInDays { get; set; } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BookStatus.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BookStatus.cs index 8c7e93e..f9f73e8 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BookStatus.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BookStatus.cs @@ -15,4 +15,14 @@ public enum BookStatus /// Kitap pasif durumda. /// Inactive = 1 << 1, // 2 + + /// + /// Kitap hasarlı durumda. + /// + Damaged = 1 << 2, // 4 + + /// + /// Kitap kayıp durumda. + /// + Lost = 1 << 3, // 8 } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowLendType.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowLendType.cs index 9fab259..112b064 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowLendType.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowLendType.cs @@ -4,6 +4,9 @@ public enum BorrowLendType { Taken, Given, + Renewed, + Damaged, + Lost, FetchedSingle, FetchedAll, } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowStatus.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowStatus.cs index 3c9d07e..6f49675 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowStatus.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Domain/Enums/BorrowStatus.cs @@ -16,28 +16,35 @@ public enum BorrowStatus /// Returned = 1 << 2, + + /// + /// Gecikmeli iade. + /// + DelayedReturn = 1 << 3, + /// /// Süresi doldu. /// - Expired = 1 << 3, + Expired = 1 << 4,// ödünç kitap sonucları için , bgservices ile duedate ile datetime.now kontrol ettirip o an expired olarak işaretlenmesi de yapılabliir + /// /// İptal edildi. /// - Cancelled = 1 << 4, + Cancelled = 1 << 5, /// /// Kayıp. /// - Losted = 1 << 5, + Losted = 1 << 6, /// /// Hasarlı. /// - Damaged = 1 << 6, + Damaged = 1 << 7, /// /// Askıya alındı. /// - OnHold = 1 << 7 + OnHold = 1 << 8 } diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookCompartmentConfiguration.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookCompartmentConfiguration.cs new file mode 100644 index 0000000..996d57b --- /dev/null +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookCompartmentConfiguration.cs @@ -0,0 +1,21 @@ +using LibraryTrackingApp.Domain.Entities.Library; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + + +namespace LibraryTrackingApp.Persistence.Configurations.EntityTypeConfiguration; + +public class BookCompartmentConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(name: "BookCompartments", schema: "lm");// LibraryManagement + + + builder.HasKey(bc => bc.Id); + + builder.Property(bc => bc.Name) + .IsRequired() + .HasMaxLength(100); + + } +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookConfiguration.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookConfiguration.cs index 17f42e3..bbb3ebe 100644 --- a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookConfiguration.cs +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookConfiguration.cs @@ -41,6 +41,12 @@ public void Configure(EntityTypeBuilder builder) // Book - Borrows ilişkisi builder.HasMany(b => b.Borrows).WithOne(br => br.Book).HasForeignKey(br => br.BookId); + //BookEntry ile olan ilişkiyi tanımlama + builder.HasMany(b => b.BookEntries) + .WithOne(be => be.Book) + .HasForeignKey(be => be.BookId) + .OnDelete(DeleteBehavior.Cascade); + // Book - Tags ilişkisi builder .HasMany(b => b.Tags) diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookEntryConfiguration.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookEntryConfiguration.cs new file mode 100644 index 0000000..8c6c2db --- /dev/null +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/BookEntryConfiguration.cs @@ -0,0 +1,14 @@ +using LibraryTrackingApp.Domain.Entities.Library; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace LibraryTrackingApp.Persistence.Configurations.EntityTypeConfiguration; + +public class BookEntryConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(be => be.Id); + + builder.Property(be => be.EntryDate).IsRequired(); + } +} diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/ShelfConfiguration.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/ShelfConfiguration.cs new file mode 100644 index 0000000..62762f6 --- /dev/null +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Configurations/EntityTypeConfiguration/ShelfConfiguration.cs @@ -0,0 +1,21 @@ +using LibraryTrackingApp.Domain.Entities.Library; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + + +namespace LibraryTrackingApp.Persistence.Configurations.EntityTypeConfiguration; + +public class ShelfConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(name: "Shelves", schema: "lm");// LibraryManagement + + builder.HasKey(s => s.Id); + + builder.Property(s => s.Name) + .IsRequired() + .HasMaxLength(100); + + + } +} \ No newline at end of file diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Data/SeedData.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Data/SeedData.cs index 6b684b8..46f90a2 100644 --- a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Data/SeedData.cs +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Data/SeedData.cs @@ -3,6 +3,9 @@ namespace LibraryTrackingApp.Persistence.Data; + +// SeedData bu sınıfla beraber 1-1 1-n n-n gibi ilişkilerde güncellemelerden sonra düzelmemiş yerler kalabilir bunlar zamanla düzeltilcektir. + public static class SeedData { public static void Seed(ModelBuilder modelBuilder) @@ -215,7 +218,6 @@ public static void Seed(ModelBuilder modelBuilder) }; var bookStockId = Guid.NewGuid(); - var bookBorrowId = Guid.NewGuid(); var harryPotterBook = new Book { @@ -225,8 +227,6 @@ public static void Seed(ModelBuilder modelBuilder) PublisherId = bloomsburyPublishingPublisher.Id, AuthorId = jKRowlingAuthor.Id, BookStockId= bookStockId, - BorrowId= bookBorrowId, - BookNumber="A1", Title = "Harry Potter and the Philosopher's Stone", ISBN = "9781408855652", Description = @@ -449,27 +449,49 @@ public static void Seed(ModelBuilder modelBuilder) LibraryBranchId = mainBranch.Id }; - + var borrow = new BorrowLend { - Id = bookBorrowId, + Id = Guid.NewGuid(), MemberId = member1.Id, BookId = harryPotterBook.Id, LenderId = staff.Id, - BorrowDate = DateTime.Now, - DueDate = DateTime.Now.AddDays(14), + BorrowDate = DateTime.Now - TimeSpan.FromDays(10), BorrowStatus = BorrowStatus.Borrowed, CreatedById = systemUser.Id, CreatedDateUnix = BaseEntity.ToUnixTimestamp(DateTime.Now), LastModifiedById = systemUser.Id }; - borrow.ReturnDate = DateTime.Now.AddMinutes(10); + borrow.DueDate = DateTime.Now;//zamanında iade için + borrow.ReturnDate = DateTime.Now; borrow.BorrowStatus = BorrowStatus.Returned; borrow.IsLate = borrow.ReturnDate > borrow.DueDate; - borrow.LateDurationInDays = borrow.IsLate == true ? (int?)(borrow.ReturnDate - borrow.DueDate)?.TotalDays : null; + borrow.LateDurationInDays = borrow.IsLate == true ? (int?)(borrow.ReturnDate - borrow.DueDate)?.TotalDays : 0; + + + + var borrow2 = new BorrowLend// gecikmeli iade için + { + Id = Guid.NewGuid(), + MemberId = member2.Id, + BookId = harryPotterBook.Id, + LenderId = staff.Id, + BorrowDate = DateTime.Now - TimeSpan.FromDays(10), + BorrowStatus = BorrowStatus.Borrowed, + CreatedById = systemUser.Id, + CreatedDateUnix = BaseEntity.ToUnixTimestamp(DateTime.Now), + LastModifiedById = systemUser.Id + }; + + borrow2.DueDate = DateTime.Now - TimeSpan.FromDays(1); + borrow2.ReturnDate = DateTime.Now; + borrow2.BorrowStatus = BorrowStatus.DelayedReturn; + + borrow2.IsLate = borrow2.ReturnDate > borrow2.DueDate; + borrow2.LateDurationInDays = borrow2.IsLate == true ? (int?)(borrow2.ReturnDate - borrow2.DueDate)?.TotalDays : 0; @@ -485,7 +507,7 @@ public static void Seed(ModelBuilder modelBuilder) SeedEntities(modelBuilder, harryPotterBook); SeedEntities(modelBuilder, harryPotterTag1, harryPotterTag2, harryPotterTag3); SeedEntities(modelBuilder, member1, member2); - SeedEntities(modelBuilder, borrow); + SeedEntities(modelBuilder, borrow, borrow2); SeedEntities(modelBuilder, staff); SeedEntities(modelBuilder, bookStock); diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.Designer.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.Designer.cs similarity index 79% rename from LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.Designer.cs rename to LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.Designer.cs index 6dac449..d54fe30 100644 --- a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.Designer.cs +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.Designer.cs @@ -12,7 +12,7 @@ namespace LibraryTrackingApp.Persistence.Migrations { [DbContext(typeof(AppIdentityDbContext))] - [Migration("20240428152500_mig001")] + [Migration("20240429105114_mig001")] partial class mig001 { /// @@ -42,8 +42,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - AuthorId = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + AuthorId = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }); }); @@ -64,13 +64,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - TagId = new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + TagId = new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }, new { - TagId = new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + TagId = new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }); }); @@ -91,13 +91,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - MemberId = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab") + MemberId = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631") }, new { - MemberId = new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab") + MemberId = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631") }); }); @@ -266,29 +266,29 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("5f21b5c9-1c31-44a5-a953-f1493717f2ba"), - ConcurrencyStamp = "778c282f-f4ab-40ab-9903-4f5f99354d46", + Id = new Guid("5ad3b527-d475-445b-a9b0-a6462f7cd987"), + ConcurrencyStamp = "93a13c75-620d-4510-ad7d-d0b91ee0a2f0", Name = "system", NormalizedName = "SYSTEM" }, new { - Id = new Guid("8dd459f0-af81-4fee-8124-f367b14d390c"), - ConcurrencyStamp = "bcf80ab8-c7f8-4d57-b688-185254d4351f", + Id = new Guid("d541ad6c-d990-4160-b430-c4ed048242a5"), + ConcurrencyStamp = "339f4420-bf36-42f1-a167-a67a7312611f", Name = "Admin", NormalizedName = "ADMIN" }, new { - Id = new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555"), - ConcurrencyStamp = "5b6be477-5e0a-4326-8509-316c9d2ec81a", + Id = new Guid("b966a17e-8090-4061-bb79-f811020145dd"), + ConcurrencyStamp = "dcd0ec78-61d1-41f1-816b-4d6fa7856a8f", Name = "Staff", NormalizedName = "STAFF" }, new { - Id = new Guid("e3bee32c-8bc8-459f-bdc7-c4dc27ff3343"), - ConcurrencyStamp = "16676b45-b01d-46b7-827b-e5ce43dce976", + Id = new Guid("dab47e78-67e8-4b99-baa0-031b37e43b57"), + ConcurrencyStamp = "9b74dc13-3ae0-407f-ba96-ccd99502b8a1", Name = "Member", NormalizedName = "MEMBER" }); @@ -411,11 +411,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + Id = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), AccessFailedCount = 0, Address = "123 System St.", BirthDate = new DateTime(1980, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "277f19e3-2a41-4b21-9011-45e275398fc9", + ConcurrencyStamp = "6db92d3b-8b49-424d-86a1-0ed7e1db1652", CreatedById = new Guid("00000000-0000-0000-0000-000000000000"), CreatedDateUnix = 0L, Email = "system@domain.com", @@ -428,7 +428,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) Name = "System", NormalizedEmail = "SYSTEM@DOMAIN.COM", NormalizedUserName = "SYSTEM", - PasswordHash = "AQAAAAIAAYagAAAAEPSBwkzx4B2FBOO2TMY1CmOTm8Hbx4Kkhx1jQ+cbXX0RawEL+fokxKfzfiTjdUvQ7w==", + PasswordHash = "AQAAAAIAAYagAAAAECY88merkbGr1WK1Y3uo+BD5yd7s3l6bBfJ9ESjJVvlD6oJ33Rr2ZLpRqpnfpiK7Vg==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -438,24 +438,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), + Id = new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), AccessFailedCount = 0, Address = "456 Admin St.", BirthDate = new DateTime(1985, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "fde1ecf3-1d5c-4b2a-9bb2-48ccb0487a8e", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "60a3ae43-ac5e-4c6d-aaca-5c4ef8f8b64e", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "admin@example.com", EmailConfirmed = true, Gender = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Admin", NormalizedEmail = "ADMIN@EXAMPLE.COM", NormalizedUserName = "ADMIN@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEHkA/to6jUewOwYD8nDuRDn32jZFwDmDRSJD6wIojiW/uCVrIS/ljZFwm12MePq/0w==", + PasswordHash = "AQAAAAIAAYagAAAAEArkj6N65dBOXg7veenD4YPpcr1PNEOPSTUlld5nkkS+wU0MwtcmRVSsK6yB5atsig==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -465,24 +465,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("05c67957-851a-45ff-aa71-17c19117135c"), + Id = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), AccessFailedCount = 0, Address = "789 Employee St.", BirthDate = new DateTime(1990, 10, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "7c0dd22b-bd17-4dbd-a9df-366a2462ebbf", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "70525978-70f4-4c26-8269-f12c77c6b50b", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "employee1@example.com", EmailConfirmed = true, Gender = 1, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Employee", NormalizedEmail = "EMPLOYEE1@EXAMPLE.COM", NormalizedUserName = "EMPLOYEE1@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEPyJjMH2xm3l4fO0wrq3cW/opMDAVTxxphZEWMA77coyuuilw1p73KridrZRwBkIyQ==", + PasswordHash = "AQAAAAIAAYagAAAAELdxogC/bcwLrivYLnqbTKIjp/H1jaWT4XMTOUFLCmYnHG2vX39q9h2rWQFU1hEbhA==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -492,24 +492,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("54db8065-ac01-416a-b5f3-b696e153e066"), + Id = new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca"), AccessFailedCount = 0, Address = "123 Main Street", BirthDate = new DateTime(1990, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "631e6db1-e797-480e-8759-2bc2a4011b95", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "240a9024-0c8e-4c92-8401-cc6b9e1134c1", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "john.doe@example.com", EmailConfirmed = true, Gender = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "John", NormalizedEmail = "JOHN.DOE@EXAMPLE.COM", NormalizedUserName = "JOHN.DOE@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAENXGYARWgiVjj4PUgnZGYo+yYYsYr+IOHAYWnt7Ck257H+y4fJUDsK2fSSxDUdEGbw==", + PasswordHash = "AQAAAAIAAYagAAAAEM5ai2wz1GK/Fh3tE0TY0xFlbNR1CFfoJPpY5bklnVuvGzZnFVrdA46pqz8cyoo55w==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -519,24 +519,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090"), + Id = new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c"), AccessFailedCount = 0, Address = "456 Oak Street", BirthDate = new DateTime(1985, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "42199153-6623-4a71-b123-aecae5e8146f", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "fb4f5583-ab84-402f-a947-6b4c50226c1d", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "jane.smith@example.com", EmailConfirmed = true, Gender = 1, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Jane", NormalizedEmail = "JANE.SMITH@EXAMPLE.COM", NormalizedUserName = "JANE.SMITH@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEH0Zc4xoOCN7ayCdq6eeO3mL9ekFKBwuJc5riA8wwtW0mBOvy119Lfs2FfY7ho+Vow==", + PasswordHash = "AQAAAAIAAYagAAAAEAG2aeEHR3NtH4IMc5GBO9+PxAEKCW3gMo6u2siRyGvv5ST2XQWqDJRgPbgN+FqZ6g==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -713,15 +713,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), + Id = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), Biography = "Joanne Rowling, better known by her pen name J.K. Rowling, is a British author, philanthropist, film producer, television producer, and screenwriter. She is best known for writing the Harry Potter fantasy series.", BirthDate = new DateTime(1965, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Country = "United Kingdom", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "J.K.", Surname = "Rowling" }); @@ -739,6 +739,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("AuthorId") .HasColumnType("uniqueidentifier"); + b.Property("BookCompartmentId") + .HasColumnType("uniqueidentifier"); + b.Property("BookFormat") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -747,10 +750,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("BookNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("BookStatus") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -758,9 +757,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("BookStockId") .HasColumnType("uniqueidentifier"); - b.Property("BorrowId") - .HasColumnType("uniqueidentifier"); - b.Property("CoverImageUrl") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -830,6 +826,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("BookCompartmentId"); + b.HasIndex("FavoriteListId"); b.HasIndex("GenreId"); @@ -849,33 +847,132 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - AuthorId = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), + Id = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + AuthorId = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), BookFormat = "PrintedBook", BookLanguage = "English", - BookNumber = "A1", BookStatus = "Active", - BookStockId = new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), - BorrowId = new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), + BookStockId = new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), CoverImageUrl = "https://m.media-amazon.com/images/I/81q77Q39nEL._SY385_.jpg", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Description = "Harry Potter has never even heard of Hogwarts when the letters start dropping on the doormat at number four, Privet Drive. Addressed in green ink on yellowish parchment with a purple seal, they are swiftly confiscated by his grisly aunt and uncle. Then, on Harry's eleventh birthday, a great beetle-eyed giant of a man called Rubeus Hagrid bursts in with some astonishing news: Harry Potter is a wizard, and he has a place at Hogwarts School of Witchcraft and Wizardry. An incredible adventure is about to begin!", - GenreId = new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), + GenreId = new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), ISBN = "9781408855652", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsFeatured = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OriginalPublicationDate = new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), PageCount = 352, PublicationDate = new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), - PublisherId = new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), + PublisherId = new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), Title = "Harry Potter and the Philosopher's Stone" }); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ShelfId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ShelfId"); + + b.ToTable("BookCompartments", "lm"); + }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BookFormat") + .HasColumnType("int"); + + b.Property("BookId") + .HasColumnType("uniqueidentifier"); + + b.Property("BookLanguage") + .HasColumnType("int"); + + b.Property("BookNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("BookStatus") + .HasColumnType("int"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("EntryDate") + .HasColumnType("datetime2"); + + b.Property("IsAvailable") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("BookId"); + + b.ToTable("BookEntry"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookGenre", b => { b.Property("Id") @@ -917,24 +1014,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsActive = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Fantasy" }, new { - Id = new Guid("ca1c300a-1e3f-468b-bf9c-958e2d8646be"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("00191e89-4992-4fd5-aae9-73797b1ccc76"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsActive = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Adventure" }); }); @@ -998,14 +1095,14 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), + Id = new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), Address = "50 Bedford Square, London, England", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Email = "info@bloomsbury.com", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Bloomsbury Publishing", PhoneNumber = "+44 (0)20 7631 5600", Website = "https://www.bloomsbury.com/" @@ -1102,13 +1199,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Quantity = 100 }); }); @@ -1156,35 +1253,35 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Hogwarts" }, new { - Id = new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Harry Potter" }, new { - Id = new Guid("adc919af-06be-4c13-822e-780da2e32996"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("238d37b1-41c2-470c-ae0a-6a47c7a17842"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Quidditch" }); }); @@ -1267,22 +1364,43 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - BorrowDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5917), + Id = new Guid("f0eac556-a732-47d7-8a0a-30bace0331f2"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + BorrowDate = new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1228), BorrowStatus = "Returned", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, - DueDate = new DateTime(2024, 5, 12, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5918), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + DueDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245), FeeAmount = 0m, HasFee = false, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsLate = false, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LenderId = new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), - MemberId = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), - ReturnDate = new DateTime(2024, 4, 28, 18, 35, 0, 460, DateTimeKind.Local).AddTicks(5928) + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LateDurationInDays = 0, + LenderId = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), + MemberId = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), + ReturnDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245) + }, + new + { + Id = new Guid("3b565299-2fdc-490c-a700-4a0cca5cc877"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + BorrowDate = new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1268), + BorrowStatus = "DelayedReturn", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + DueDate = new DateTime(2024, 4, 28, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1295), + FeeAmount = 0m, + HasFee = false, + IsDeleted = false, + IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), + IsLate = true, + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LateDurationInDays = 1, + LenderId = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), + MemberId = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), + ReturnDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1306) }); }); @@ -1340,93 +1458,93 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("259561f5-d40c-4956-9676-ed90bb8aeb82"), + Id = new Guid("889b3e3a-176c-41c5-a09e-e0e5d2c8065b"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("2c91ac06-c143-42f3-8dcb-657c56673d8d"), + Id = new Guid("366adfd4-877c-4b48-af6b-a1d8064520fc"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("287b544f-ba14-4ae2-b8a4-1170f786cb1b"), + Id = new Guid("e5efdaf7-d680-4733-9554-82ecf5cb1445"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("54678360-a567-446b-810e-def90bf74996"), + Id = new Guid("f075bd9f-5a05-40d0-91d7-63a279baa5b6"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("eabbafb7-b5e9-4e12-aa77-d01cae543ef9"), + Id = new Guid("1ec6b73a-487c-4dfd-8280-2939d0417327"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("88e3a14b-050c-4cd0-8f74-68728b13a51d"), + Id = new Guid("45ce0949-c5ae-412c-9157-d28060cc9229"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("8e4d174b-8c86-4e46-ad57-eb9359a70eeb"), + Id = new Guid("2107ba2f-cb43-4de6-9d7b-e6d40be6c766"), ClosingTime = new TimeSpan(0, 0, 0, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 0, 0, 0, 0) }); }); @@ -1537,16 +1655,16 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + Id = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), Address = "123 Ana Cadde", BookId = new Guid("00000000-0000-0000-0000-000000000000"), BranchHourId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Description = "Bu bir örnek kütüphane şubesidir.", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LibraryBranchId = new Guid("00000000-0000-0000-0000-000000000000"), LibraryTransactionId = new Guid("00000000-0000-0000-0000-000000000000"), MemberId = new Guid("00000000-0000-0000-0000-000000000000"), @@ -1683,47 +1801,47 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), + Id = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), BorrowId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, ExtensionDurationInDays = 7, Gender = "Male", HasPenalty = false, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsExtensionAllowed = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), MaxLateReturnsAllowed = 3, MemberType = "Adult", - MembershipDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5858), + MembershipDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1165), NumberOfLateReturns = 0, Occupation = "Software Engineer", PenaltyDurationInDays = 0, - UserId = new Guid("54db8065-ac01-416a-b5f3-b696e153e066") + UserId = new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca") }, new { - Id = new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4"), + Id = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), BorrowId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, ExtensionDurationInDays = 0, Gender = "Female", HasPenalty = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsExtensionAllowed = false, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), MaxLateReturnsAllowed = 3, MemberType = "Teacher", - MembershipDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5865), + MembershipDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1171), NumberOfLateReturns = 2, Occupation = "Teacher", PenaltyDurationInDays = 7, - UserId = new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090") + UserId = new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c") }); }); @@ -1762,6 +1880,43 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("ReadingLists", "lm"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Shelf", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Shelves", "lm"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Staff", b => { b.Property("Id") @@ -1826,19 +1981,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), + Id = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), Address = "Employee Address", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, - EmploymentDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5910), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + EmploymentDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1220), IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsFullTime = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), Phone = "+905553331122", Salary = 3000.00m, - UserId = new Guid("05c67957-851a-45ff-aa71-17c19117135c") + UserId = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9") }); }); @@ -1963,13 +2118,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasData( new { - UserId = new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), - RoleId = new Guid("8dd459f0-af81-4fee-8124-f367b14d390c") + UserId = new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), + RoleId = new Guid("d541ad6c-d990-4160-b430-c4ed048242a5") }, new { - UserId = new Guid("05c67957-851a-45ff-aa71-17c19117135c"), - RoleId = new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555") + UserId = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), + RoleId = new Guid("b966a17e-8090-4061-bb79-f811020145dd") }); }); @@ -2046,6 +2201,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Book", b => { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", null) + .WithMany("Books") + .HasForeignKey("BookCompartmentId"); + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.FavoriteList", null) .WithMany("FavoriteBooks") .HasForeignKey("FavoriteListId"); @@ -2079,6 +2238,24 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("Publisher"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Shelf", null) + .WithMany("Compartments") + .HasForeignKey("ShelfId"); + }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookEntry", b => + { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Book", "Book") + .WithMany("BookEntries") + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Book"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookStock", b => { b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Book", "Book") @@ -2243,11 +2420,18 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Book", b => { + b.Navigation("BookEntries"); + b.Navigation("BookStocks"); b.Navigation("Borrows"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.Navigation("Books"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookGenre", b => { b.Navigation("Books"); @@ -2283,6 +2467,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Navigation("Books"); }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Shelf", b => + { + b.Navigation("Compartments"); + }); #pragma warning restore 612, 618 } } diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.cs similarity index 78% rename from LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.cs rename to LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.cs index ac6a917..792224a 100644 --- a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240428152500_mig001.cs +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/20240429105114_mig001.cs @@ -324,6 +324,26 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_Scopes", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Shelves", + schema: "lm", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + LastModifiedById = table.Column(type: "uniqueidentifier", nullable: false), + IsDeletedById = table.Column(type: "uniqueidentifier", nullable: false), + CreatedDateUnix = table.Column(type: "bigint", nullable: false), + LastModifiedDateUnix = table.Column(type: "bigint", nullable: true), + DeletedDateUnix = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shelves", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AspNetRoles", columns: table => new @@ -543,33 +563,13 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "Books", + name: "BookCompartments", schema: "lm", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - GenreId = table.Column(type: "uniqueidentifier", nullable: false), - PublisherId = table.Column(type: "uniqueidentifier", nullable: false), - AuthorId = table.Column(type: "uniqueidentifier", nullable: false), - LibraryBranchId = table.Column(type: "uniqueidentifier", nullable: false), - BookStockId = table.Column(type: "uniqueidentifier", nullable: false), - BorrowId = table.Column(type: "uniqueidentifier", nullable: false), - BookNumber = table.Column(type: "nvarchar(max)", nullable: false), - Title = table.Column(type: "nvarchar(450)", nullable: false), - ISBN = table.Column(type: "nvarchar(450)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: false), - CoverImageUrl = table.Column(type: "nvarchar(max)", nullable: false), - PageCount = table.Column(type: "int", nullable: false), - AudioFilePath = table.Column(type: "nvarchar(max)", nullable: true), - FilePath = table.Column(type: "nvarchar(max)", nullable: true), - PublicationDate = table.Column(type: "datetime2", nullable: false), - OriginalPublicationDate = table.Column(type: "datetime2", nullable: false), - BookStatus = table.Column(type: "nvarchar(max)", nullable: false), - BookFormat = table.Column(type: "nvarchar(max)", nullable: false), - BookLanguage = table.Column(type: "nvarchar(max)", nullable: false), - IsFeatured = table.Column(type: "bit", nullable: false), - FavoriteListId = table.Column(type: "uniqueidentifier", nullable: true), - ReadingListId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ShelfId = table.Column(type: "uniqueidentifier", nullable: true), CreatedById = table.Column(type: "uniqueidentifier", nullable: false), LastModifiedById = table.Column(type: "uniqueidentifier", nullable: false), IsDeletedById = table.Column(type: "uniqueidentifier", nullable: false), @@ -580,39 +580,12 @@ protected override void Up(MigrationBuilder migrationBuilder) }, constraints: table => { - table.PrimaryKey("PK_Books", x => x.Id); - table.ForeignKey( - name: "FK_Books_BookGenres_GenreId", - column: x => x.GenreId, - principalSchema: "lm", - principalTable: "BookGenres", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + table.PrimaryKey("PK_BookCompartments", x => x.Id); table.ForeignKey( - name: "FK_Books_BookPublishers_PublisherId", - column: x => x.PublisherId, + name: "FK_BookCompartments_Shelves_ShelfId", + column: x => x.ShelfId, principalSchema: "lm", - principalTable: "BookPublishers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Books_FavoriteLists_FavoriteListId", - column: x => x.FavoriteListId, - principalSchema: "lm", - principalTable: "FavoriteLists", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Books_LibraryBranches_LibraryBranchId", - column: x => x.LibraryBranchId, - principalSchema: "lm", - principalTable: "LibraryBranches", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Books_ReadingLists_ReadingListId", - column: x => x.ReadingListId, - principalSchema: "lm", - principalTable: "ReadingLists", + principalTable: "Shelves", principalColumn: "Id"); }); @@ -728,6 +701,85 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Books", + schema: "lm", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + GenreId = table.Column(type: "uniqueidentifier", nullable: false), + PublisherId = table.Column(type: "uniqueidentifier", nullable: false), + AuthorId = table.Column(type: "uniqueidentifier", nullable: false), + LibraryBranchId = table.Column(type: "uniqueidentifier", nullable: false), + BookStockId = table.Column(type: "uniqueidentifier", nullable: false), + Title = table.Column(type: "nvarchar(450)", nullable: false), + ISBN = table.Column(type: "nvarchar(450)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: false), + CoverImageUrl = table.Column(type: "nvarchar(max)", nullable: false), + PageCount = table.Column(type: "int", nullable: false), + AudioFilePath = table.Column(type: "nvarchar(max)", nullable: true), + FilePath = table.Column(type: "nvarchar(max)", nullable: true), + PublicationDate = table.Column(type: "datetime2", nullable: false), + OriginalPublicationDate = table.Column(type: "datetime2", nullable: false), + BookStatus = table.Column(type: "nvarchar(max)", nullable: false), + BookFormat = table.Column(type: "nvarchar(max)", nullable: false), + BookLanguage = table.Column(type: "nvarchar(max)", nullable: false), + IsFeatured = table.Column(type: "bit", nullable: false), + BookCompartmentId = table.Column(type: "uniqueidentifier", nullable: true), + FavoriteListId = table.Column(type: "uniqueidentifier", nullable: true), + ReadingListId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + LastModifiedById = table.Column(type: "uniqueidentifier", nullable: false), + IsDeletedById = table.Column(type: "uniqueidentifier", nullable: false), + CreatedDateUnix = table.Column(type: "bigint", nullable: false), + LastModifiedDateUnix = table.Column(type: "bigint", nullable: true), + DeletedDateUnix = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Books", x => x.Id); + table.ForeignKey( + name: "FK_Books_BookCompartments_BookCompartmentId", + column: x => x.BookCompartmentId, + principalSchema: "lm", + principalTable: "BookCompartments", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Books_BookGenres_GenreId", + column: x => x.GenreId, + principalSchema: "lm", + principalTable: "BookGenres", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Books_BookPublishers_PublisherId", + column: x => x.PublisherId, + principalSchema: "lm", + principalTable: "BookPublishers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Books_FavoriteLists_FavoriteListId", + column: x => x.FavoriteListId, + principalSchema: "lm", + principalTable: "FavoriteLists", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Books_LibraryBranches_LibraryBranchId", + column: x => x.LibraryBranchId, + principalSchema: "lm", + principalTable: "LibraryBranches", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Books_ReadingLists_ReadingListId", + column: x => x.ReadingListId, + principalSchema: "lm", + principalTable: "ReadingLists", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "BookAuthors", schema: "lm", @@ -755,6 +807,39 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "BookEntry", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + BookId = table.Column(type: "uniqueidentifier", nullable: false), + BookNumber = table.Column(type: "nvarchar(max)", nullable: false), + BookStatus = table.Column(type: "int", nullable: false), + BookFormat = table.Column(type: "int", nullable: false), + BookLanguage = table.Column(type: "int", nullable: false), + IsAvailable = table.Column(type: "bit", nullable: false), + EntryDate = table.Column(type: "datetime2", nullable: false), + LastModified = table.Column(type: "datetime2", nullable: false), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + LastModifiedById = table.Column(type: "uniqueidentifier", nullable: false), + IsDeletedById = table.Column(type: "uniqueidentifier", nullable: false), + CreatedDateUnix = table.Column(type: "bigint", nullable: false), + LastModifiedDateUnix = table.Column(type: "bigint", nullable: true), + DeletedDateUnix = table.Column(type: "bigint", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BookEntry", x => x.Id); + table.ForeignKey( + name: "FK_BookEntry_Books_BookId", + column: x => x.BookId, + principalSchema: "lm", + principalTable: "Books", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "BookStocks", schema: "lm", @@ -821,10 +906,10 @@ protected override void Up(MigrationBuilder migrationBuilder) LenderId = table.Column(type: "uniqueidentifier", nullable: false), BorrowDate = table.Column(type: "datetime2", nullable: false), DueDate = table.Column(type: "datetime2", nullable: false), + ReturnDate = table.Column(type: "datetime2", nullable: true), BorrowStatus = table.Column(type: "nvarchar(max)", nullable: false), HasFee = table.Column(type: "bit", nullable: false), FeeAmount = table.Column(type: "decimal(18,2)", nullable: false), - ReturnDate = table.Column(type: "datetime2", nullable: true), IsLate = table.Column(type: "bit", nullable: true), LateDurationInDays = table.Column(type: "int", nullable: true), CreatedById = table.Column(type: "uniqueidentifier", nullable: false), @@ -866,10 +951,10 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "AppUserId", "ConcurrencyStamp", "Name", "NormalizedName" }, values: new object[,] { - { new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555"), null, "5b6be477-5e0a-4326-8509-316c9d2ec81a", "Staff", "STAFF" }, - { new Guid("5f21b5c9-1c31-44a5-a953-f1493717f2ba"), null, "778c282f-f4ab-40ab-9903-4f5f99354d46", "system", "SYSTEM" }, - { new Guid("8dd459f0-af81-4fee-8124-f367b14d390c"), null, "bcf80ab8-c7f8-4d57-b688-185254d4351f", "Admin", "ADMIN" }, - { new Guid("e3bee32c-8bc8-459f-bdc7-c4dc27ff3343"), null, "16676b45-b01d-46b7-827b-e5ce43dce976", "Member", "MEMBER" } + { new Guid("5ad3b527-d475-445b-a9b0-a6462f7cd987"), null, "93a13c75-620d-4510-ad7d-d0b91ee0a2f0", "system", "SYSTEM" }, + { new Guid("b966a17e-8090-4061-bb79-f811020145dd"), null, "dcd0ec78-61d1-41f1-816b-4d6fa7856a8f", "Staff", "STAFF" }, + { new Guid("d541ad6c-d990-4160-b430-c4ed048242a5"), null, "339f4420-bf36-42f1-a167-a67a7312611f", "Admin", "ADMIN" }, + { new Guid("dab47e78-67e8-4b99-baa0-031b37e43b57"), null, "9b74dc13-3ae0-407f-ba96-ccd99502b8a1", "Member", "MEMBER" } }); migrationBuilder.InsertData( @@ -877,18 +962,18 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "AccessFailedCount", "Address", "BirthDate", "ConcurrencyStamp", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "Email", "EmailConfirmed", "Gender", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "LockoutEnabled", "LockoutEnd", "Name", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "ProfilePicture", "RefreshToken", "RefreshTokenEndDate", "SecurityStamp", "Surname", "TwoFactorEnabled", "UserName" }, values: new object[,] { - { new Guid("05c67957-851a-45ff-aa71-17c19117135c"), 0, "789 Employee St.", new DateTime(1990, 10, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), "7c0dd22b-bd17-4dbd-a9df-366a2462ebbf", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 0L, null, "employee1@example.com", true, 1, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, false, null, "Employee", "EMPLOYEE1@EXAMPLE.COM", "EMPLOYEE1@EXAMPLE.COM", "AQAAAAIAAYagAAAAEPyJjMH2xm3l4fO0wrq3cW/opMDAVTxxphZEWMA77coyuuilw1p73KridrZRwBkIyQ==", null, false, new byte[0], null, null, "", "One", false, "employee1@example.com" }, - { new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090"), 0, "456 Oak Street", new DateTime(1985, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), "42199153-6623-4a71-b123-aecae5e8146f", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 0L, null, "jane.smith@example.com", true, 1, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, false, null, "Jane", "JANE.SMITH@EXAMPLE.COM", "JANE.SMITH@EXAMPLE.COM", "AQAAAAIAAYagAAAAEH0Zc4xoOCN7ayCdq6eeO3mL9ekFKBwuJc5riA8wwtW0mBOvy119Lfs2FfY7ho+Vow==", null, false, new byte[0], null, null, "", "Smith", false, "jane.smith@example.com" }, - { new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), 0, "456 Admin St.", new DateTime(1985, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), "fde1ecf3-1d5c-4b2a-9bb2-48ccb0487a8e", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 0L, null, "admin@example.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, false, null, "Admin", "ADMIN@EXAMPLE.COM", "ADMIN@EXAMPLE.COM", "AQAAAAIAAYagAAAAEHkA/to6jUewOwYD8nDuRDn32jZFwDmDRSJD6wIojiW/uCVrIS/ljZFwm12MePq/0w==", null, false, new byte[0], null, null, "", "Admin", false, "admin@example.com" }, - { new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 0, "123 System St.", new DateTime(1980, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "277f19e3-2a41-4b21-9011-45e275398fc9", new Guid("00000000-0000-0000-0000-000000000000"), 0L, null, "system@domain.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), null, false, null, "System", "SYSTEM@DOMAIN.COM", "SYSTEM", "AQAAAAIAAYagAAAAEPSBwkzx4B2FBOO2TMY1CmOTm8Hbx4Kkhx1jQ+cbXX0RawEL+fokxKfzfiTjdUvQ7w==", null, false, new byte[0], null, null, "", "Admin", false, "system" }, - { new Guid("54db8065-ac01-416a-b5f3-b696e153e066"), 0, "123 Main Street", new DateTime(1990, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), "631e6db1-e797-480e-8759-2bc2a4011b95", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 0L, null, "john.doe@example.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, false, null, "John", "JOHN.DOE@EXAMPLE.COM", "JOHN.DOE@EXAMPLE.COM", "AQAAAAIAAYagAAAAENXGYARWgiVjj4PUgnZGYo+yYYsYr+IOHAYWnt7Ck257H+y4fJUDsK2fSSxDUdEGbw==", null, false, new byte[0], null, null, "", "Doe", false, "john.doe@example.com" } + { new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), 0, "789 Employee St.", new DateTime(1990, 10, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), "70525978-70f4-4c26-8269-f12c77c6b50b", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 0L, null, "employee1@example.com", true, 1, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, false, null, "Employee", "EMPLOYEE1@EXAMPLE.COM", "EMPLOYEE1@EXAMPLE.COM", "AQAAAAIAAYagAAAAELdxogC/bcwLrivYLnqbTKIjp/H1jaWT4XMTOUFLCmYnHG2vX39q9h2rWQFU1hEbhA==", null, false, new byte[0], null, null, "", "One", false, "employee1@example.com" }, + { new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 0, "123 System St.", new DateTime(1980, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "6db92d3b-8b49-424d-86a1-0ed7e1db1652", new Guid("00000000-0000-0000-0000-000000000000"), 0L, null, "system@domain.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), null, false, null, "System", "SYSTEM@DOMAIN.COM", "SYSTEM", "AQAAAAIAAYagAAAAECY88merkbGr1WK1Y3uo+BD5yd7s3l6bBfJ9ESjJVvlD6oJ33Rr2ZLpRqpnfpiK7Vg==", null, false, new byte[0], null, null, "", "Admin", false, "system" }, + { new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca"), 0, "123 Main Street", new DateTime(1990, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), "240a9024-0c8e-4c92-8401-cc6b9e1134c1", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 0L, null, "john.doe@example.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, false, null, "John", "JOHN.DOE@EXAMPLE.COM", "JOHN.DOE@EXAMPLE.COM", "AQAAAAIAAYagAAAAEM5ai2wz1GK/Fh3tE0TY0xFlbNR1CFfoJPpY5bklnVuvGzZnFVrdA46pqz8cyoo55w==", null, false, new byte[0], null, null, "", "Doe", false, "john.doe@example.com" }, + { new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), 0, "456 Admin St.", new DateTime(1985, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), "60a3ae43-ac5e-4c6d-aaca-5c4ef8f8b64e", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 0L, null, "admin@example.com", true, 0, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, false, null, "Admin", "ADMIN@EXAMPLE.COM", "ADMIN@EXAMPLE.COM", "AQAAAAIAAYagAAAAEArkj6N65dBOXg7veenD4YPpcr1PNEOPSTUlld5nkkS+wU0MwtcmRVSsK6yB5atsig==", null, false, new byte[0], null, null, "", "Admin", false, "admin@example.com" }, + { new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c"), 0, "456 Oak Street", new DateTime(1985, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), "fb4f5583-ab84-402f-a947-6b4c50226c1d", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 0L, null, "jane.smith@example.com", true, 1, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, false, null, "Jane", "JANE.SMITH@EXAMPLE.COM", "JANE.SMITH@EXAMPLE.COM", "AQAAAAIAAYagAAAAEAG2aeEHR3NtH4IMc5GBO9+PxAEKCW3gMo6u2siRyGvv5ST2XQWqDJRgPbgN+FqZ6g==", null, false, new byte[0], null, null, "", "Smith", false, "jane.smith@example.com" } }); migrationBuilder.InsertData( schema: "lm", table: "Authors", columns: new[] { "Id", "Biography", "BirthDate", "Country", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "Name", "Surname" }, - values: new object[] { new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), "Joanne Rowling, better known by her pen name J.K. Rowling, is a British author, philanthropist, film producer, television producer, and screenwriter. She is best known for writing the Harry Potter fantasy series.", new DateTime(1965, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "United Kingdom", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "J.K.", "Rowling" }); + values: new object[] { new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), "Joanne Rowling, better known by her pen name J.K. Rowling, is a British author, philanthropist, film producer, television producer, and screenwriter. She is best known for writing the Harry Potter fantasy series.", new DateTime(1965, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "United Kingdom", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "J.K.", "Rowling" }); migrationBuilder.InsertData( schema: "lm", @@ -896,15 +981,15 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "IsActive", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "Name" }, values: new object[,] { - { new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, true, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Fantasy" }, - { new Guid("ca1c300a-1e3f-468b-bf9c-958e2d8646be"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, true, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Adventure" } + { new Guid("00191e89-4992-4fd5-aae9-73797b1ccc76"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, true, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Adventure" }, + { new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, true, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Fantasy" } }); migrationBuilder.InsertData( schema: "lm", table: "BookPublishers", columns: new[] { "Id", "Address", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "Email", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "Name", "PhoneNumber", "Website" }, - values: new object[] { new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), "50 Bedford Square, London, England", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, "info@bloomsbury.com", false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Bloomsbury Publishing", "+44 (0)20 7631 5600", "https://www.bloomsbury.com/" }); + values: new object[] { new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), "50 Bedford Square, London, England", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, "info@bloomsbury.com", false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Bloomsbury Publishing", "+44 (0)20 7631 5600", "https://www.bloomsbury.com/" }); migrationBuilder.InsertData( schema: "lm", @@ -912,31 +997,31 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "BookId", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "Name" }, values: new object[,] { - { new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Harry Potter" }, - { new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Hogwarts" }, - { new Guid("adc919af-06be-4c13-822e-780da2e32996"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, "Quidditch" } + { new Guid("238d37b1-41c2-470c-ae0a-6a47c7a17842"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Quidditch" }, + { new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Harry Potter" }, + { new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, "Hogwarts" } }); migrationBuilder.InsertData( schema: "lm", table: "LibraryBranches", columns: new[] { "Id", "Address", "BookId", "BranchHourId", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "Description", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "LibraryTransactionId", "MemberId", "Name", "PhoneNumber", "StaffId" }, - values: new object[] { new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), "123 Ana Cadde", new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, "Bu bir örnek kütüphane şubesidir.", false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), "Örnek Kütüphane Şubesi", "123-456-7890", new Guid("00000000-0000-0000-0000-000000000000") }); + values: new object[] { new Guid("282ac419-5495-4e92-a109-b51055b8b631"), "123 Ana Cadde", new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, "Bu bir örnek kütüphane şubesidir.", false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("00000000-0000-0000-0000-000000000000"), "Örnek Kütüphane Şubesi", "123-456-7890", new Guid("00000000-0000-0000-0000-000000000000") }); migrationBuilder.InsertData( table: "AspNetUserRoles", columns: new[] { "RoleId", "UserId", "Discriminator" }, values: new object[,] { - { new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555"), new Guid("05c67957-851a-45ff-aa71-17c19117135c"), "AppUserRole" }, - { new Guid("8dd459f0-af81-4fee-8124-f367b14d390c"), new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), "AppUserRole" } + { new Guid("b966a17e-8090-4061-bb79-f811020145dd"), new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), "AppUserRole" }, + { new Guid("d541ad6c-d990-4160-b430-c4ed048242a5"), new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), "AppUserRole" } }); migrationBuilder.InsertData( schema: "lm", table: "Books", - columns: new[] { "Id", "AudioFilePath", "AuthorId", "BookFormat", "BookLanguage", "BookNumber", "BookStatus", "BookStockId", "BorrowId", "CoverImageUrl", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "Description", "FavoriteListId", "FilePath", "GenreId", "ISBN", "IsDeleted", "IsDeletedById", "IsFeatured", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "OriginalPublicationDate", "PageCount", "PublicationDate", "PublisherId", "ReadingListId", "Title" }, - values: new object[] { new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), null, new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), "PrintedBook", "English", "A1", "Active", new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), "https://m.media-amazon.com/images/I/81q77Q39nEL._SY385_.jpg", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, "Harry Potter has never even heard of Hogwarts when the letters start dropping on the doormat at number four, Privet Drive. Addressed in green ink on yellowish parchment with a purple seal, they are swiftly confiscated by his grisly aunt and uncle. Then, on Harry's eleventh birthday, a great beetle-eyed giant of a man called Rubeus Hagrid bursts in with some astonishing news: Harry Potter is a wizard, and he has a place at Hogwarts School of Witchcraft and Wizardry. An incredible adventure is about to begin!", null, null, new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), "9781408855652", false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), 352, new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), null, "Harry Potter and the Philosopher's Stone" }); + columns: new[] { "Id", "AudioFilePath", "AuthorId", "BookCompartmentId", "BookFormat", "BookLanguage", "BookStatus", "BookStockId", "CoverImageUrl", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "Description", "FavoriteListId", "FilePath", "GenreId", "ISBN", "IsDeleted", "IsDeletedById", "IsFeatured", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "OriginalPublicationDate", "PageCount", "PublicationDate", "PublisherId", "ReadingListId", "Title" }, + values: new object[] { new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), null, new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), null, "PrintedBook", "English", "Active", new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), "https://m.media-amazon.com/images/I/81q77Q39nEL._SY385_.jpg", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, "Harry Potter has never even heard of Hogwarts when the letters start dropping on the doormat at number four, Privet Drive. Addressed in green ink on yellowish parchment with a purple seal, they are swiftly confiscated by his grisly aunt and uncle. Then, on Harry's eleventh birthday, a great beetle-eyed giant of a man called Rubeus Hagrid bursts in with some astonishing news: Harry Potter is a wizard, and he has a place at Hogwarts School of Witchcraft and Wizardry. An incredible adventure is about to begin!", null, null, new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), "9781408855652", false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), 352, new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), null, "Harry Potter and the Philosopher's Stone" }); migrationBuilder.InsertData( schema: "lm", @@ -944,13 +1029,13 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "ClosingTime", "CreatedById", "CreatedDateUnix", "DayOfWeek", "DeletedDateUnix", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "OpeningTime" }, values: new object[,] { - { new Guid("259561f5-d40c-4956-9676-ed90bb8aeb82"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) }, - { new Guid("287b544f-ba14-4ae2-b8a4-1170f786cb1b"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) }, - { new Guid("2c91ac06-c143-42f3-8dcb-657c56673d8d"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) }, - { new Guid("54678360-a567-446b-810e-def90bf74996"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) }, - { new Guid("88e3a14b-050c-4cd0-8f74-68728b13a51d"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) }, - { new Guid("8e4d174b-8c86-4e46-ad57-eb9359a70eeb"), new TimeSpan(0, 0, 0, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 0, 0, 0, 0) }, - { new Guid("eabbafb7-b5e9-4e12-aa77-d01cae543ef9"), new TimeSpan(0, 17, 30, 0, 0), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new TimeSpan(0, 8, 0, 0, 0) } + { new Guid("1ec6b73a-487c-4dfd-8280-2939d0417327"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) }, + { new Guid("2107ba2f-cb43-4de6-9d7b-e6d40be6c766"), new TimeSpan(0, 0, 0, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 0, 0, 0, 0) }, + { new Guid("366adfd4-877c-4b48-af6b-a1d8064520fc"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) }, + { new Guid("45ce0949-c5ae-412c-9157-d28060cc9229"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) }, + { new Guid("889b3e3a-176c-41c5-a09e-e0e5d2c8065b"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) }, + { new Guid("e5efdaf7-d680-4733-9554-82ecf5cb1445"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) }, + { new Guid("f075bd9f-5a05-40d0-91d7-63a279baa5b6"), new TimeSpan(0, 17, 30, 0, 0), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, 0, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new TimeSpan(0, 8, 0, 0, 0) } }); migrationBuilder.InsertData( @@ -959,27 +1044,27 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "BorrowId", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "ExtensionDurationInDays", "Gender", "HasPenalty", "IsDeleted", "IsDeletedById", "IsExtensionAllowed", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "MaxLateReturnsAllowed", "MemberType", "MembershipDate", "NumberOfLateReturns", "Occupation", "PenaltyDurationInDays", "UserId" }, values: new object[,] { - { new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, 7, "Male", false, false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), 3, "Adult", new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5858), 0, "Software Engineer", 0, new Guid("54db8065-ac01-416a-b5f3-b696e153e066") }, - { new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, 0, "Female", true, false, new Guid("00000000-0000-0000-0000-000000000000"), false, new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), 3, "Teacher", new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5865), 2, "Teacher", 7, new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090") } + { new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, 0, "Female", true, false, new Guid("00000000-0000-0000-0000-000000000000"), false, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), 3, "Teacher", new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1171), 2, "Teacher", 7, new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c") }, + { new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, 7, "Male", false, false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), 3, "Adult", new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1165), 0, "Software Engineer", 0, new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca") } }); migrationBuilder.InsertData( schema: "lm", table: "Staffs", columns: new[] { "Id", "Address", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "EmploymentDate", "IsDeleted", "IsDeletedById", "IsFullTime", "LastModifiedById", "LastModifiedDateUnix", "LibraryBranchId", "Phone", "Salary", "UserId" }, - values: new object[] { new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), "Employee Address", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5910), false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), "+905553331122", 3000.00m, new Guid("05c67957-851a-45ff-aa71-17c19117135c") }); + values: new object[] { new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), "Employee Address", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1220), false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, new Guid("282ac419-5495-4e92-a109-b51055b8b631"), "+905553331122", 3000.00m, new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9") }); migrationBuilder.InsertData( schema: "lm", table: "BookAuthors", columns: new[] { "AuthorId", "BookId" }, - values: new object[] { new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") }); + values: new object[] { new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }); migrationBuilder.InsertData( schema: "lm", table: "BookStocks", columns: new[] { "Id", "BookId", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "IsDeleted", "IsDeletedById", "LastModifiedById", "LastModifiedDateUnix", "Quantity" }, - values: new object[] { new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, 100 }); + values: new object[] { new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, false, new Guid("00000000-0000-0000-0000-000000000000"), new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, 100 }); migrationBuilder.InsertData( schema: "lm", @@ -987,15 +1072,19 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "BookId", "TagId" }, values: new object[,] { - { new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21") }, - { new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b") } + { new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9") }, + { new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45") } }); migrationBuilder.InsertData( schema: "lm", table: "BorrowLends", columns: new[] { "Id", "BookId", "BorrowDate", "BorrowStatus", "CreatedById", "CreatedDateUnix", "DeletedDateUnix", "DueDate", "FeeAmount", "HasFee", "IsDeleted", "IsDeletedById", "IsLate", "LastModifiedById", "LastModifiedDateUnix", "LateDurationInDays", "LenderId", "MemberId", "ReturnDate" }, - values: new object[] { new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5917), "Returned", new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), 1714328700L, null, new DateTime(2024, 5, 12, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5918), 0m, false, false, new Guid("00000000-0000-0000-0000-000000000000"), false, new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), null, null, new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), new DateTime(2024, 4, 28, 18, 35, 0, 460, DateTimeKind.Local).AddTicks(5928) }); + values: new object[,] + { + { new Guid("3b565299-2fdc-490c-a700-4a0cca5cc877"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1268), "DelayedReturn", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, new DateTime(2024, 4, 28, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1295), 0m, false, false, new Guid("00000000-0000-0000-0000-000000000000"), true, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, 1, new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1306) }, + { new Guid("f0eac556-a732-47d7-8a0a-30bace0331f2"), new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1228), "Returned", new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), 1714398673L, null, new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245), 0m, false, false, new Guid("00000000-0000-0000-0000-000000000000"), false, new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), null, 0, new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245) } + }); migrationBuilder.InsertData( schema: "lm", @@ -1003,8 +1092,8 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "LibraryBranchId", "MemberId" }, values: new object[,] { - { new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new Guid("c8cdaba4-8d50-47ce-b901-02535538794b") }, - { new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4") } + { new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6") }, + { new Guid("282ac419-5495-4e92-a109-b51055b8b631"), new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786") } }); migrationBuilder.CreateIndex( @@ -1063,6 +1152,17 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "BookAuthors", column: "BookId"); + migrationBuilder.CreateIndex( + name: "IX_BookCompartments_ShelfId", + schema: "lm", + table: "BookCompartments", + column: "ShelfId"); + + migrationBuilder.CreateIndex( + name: "IX_BookEntry_BookId", + table: "BookEntry", + column: "BookId"); + migrationBuilder.CreateIndex( name: "IX_BookPublishers_Email", schema: "lm", @@ -1076,6 +1176,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "BookPublishers", column: "Name"); + migrationBuilder.CreateIndex( + name: "IX_Books_BookCompartmentId", + schema: "lm", + table: "Books", + column: "BookCompartmentId"); + migrationBuilder.CreateIndex( name: "IX_Books_FavoriteListId", schema: "lm", @@ -1258,6 +1364,9 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "BookAuthors", schema: "lm"); + migrationBuilder.DropTable( + name: "BookEntry"); + migrationBuilder.DropTable( name: "BookReviews", schema: "lm"); @@ -1325,6 +1434,10 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "Scopes", schema: "identity"); + migrationBuilder.DropTable( + name: "BookCompartments", + schema: "lm"); + migrationBuilder.DropTable( name: "BookGenres", schema: "lm"); @@ -1347,6 +1460,10 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Shelves", + schema: "lm"); } } } diff --git a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/AppIdentityDbContextModelSnapshot.cs b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/AppIdentityDbContextModelSnapshot.cs index 8efef4d..5b9501a 100644 --- a/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/AppIdentityDbContextModelSnapshot.cs +++ b/LibraryTrackingApp/src/backend/Infrastructure/LibraryTrackingApp.Persistence/Migrations/AppIdentityDbContextModelSnapshot.cs @@ -39,8 +39,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - AuthorId = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + AuthorId = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }); }); @@ -61,13 +61,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - TagId = new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + TagId = new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }, new { - TagId = new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687") + TagId = new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008") }); }); @@ -88,13 +88,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - MemberId = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab") + MemberId = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631") }, new { - MemberId = new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab") + MemberId = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631") }); }); @@ -263,29 +263,29 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("5f21b5c9-1c31-44a5-a953-f1493717f2ba"), - ConcurrencyStamp = "778c282f-f4ab-40ab-9903-4f5f99354d46", + Id = new Guid("5ad3b527-d475-445b-a9b0-a6462f7cd987"), + ConcurrencyStamp = "93a13c75-620d-4510-ad7d-d0b91ee0a2f0", Name = "system", NormalizedName = "SYSTEM" }, new { - Id = new Guid("8dd459f0-af81-4fee-8124-f367b14d390c"), - ConcurrencyStamp = "bcf80ab8-c7f8-4d57-b688-185254d4351f", + Id = new Guid("d541ad6c-d990-4160-b430-c4ed048242a5"), + ConcurrencyStamp = "339f4420-bf36-42f1-a167-a67a7312611f", Name = "Admin", NormalizedName = "ADMIN" }, new { - Id = new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555"), - ConcurrencyStamp = "5b6be477-5e0a-4326-8509-316c9d2ec81a", + Id = new Guid("b966a17e-8090-4061-bb79-f811020145dd"), + ConcurrencyStamp = "dcd0ec78-61d1-41f1-816b-4d6fa7856a8f", Name = "Staff", NormalizedName = "STAFF" }, new { - Id = new Guid("e3bee32c-8bc8-459f-bdc7-c4dc27ff3343"), - ConcurrencyStamp = "16676b45-b01d-46b7-827b-e5ce43dce976", + Id = new Guid("dab47e78-67e8-4b99-baa0-031b37e43b57"), + ConcurrencyStamp = "9b74dc13-3ae0-407f-ba96-ccd99502b8a1", Name = "Member", NormalizedName = "MEMBER" }); @@ -408,11 +408,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + Id = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), AccessFailedCount = 0, Address = "123 System St.", BirthDate = new DateTime(1980, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "277f19e3-2a41-4b21-9011-45e275398fc9", + ConcurrencyStamp = "6db92d3b-8b49-424d-86a1-0ed7e1db1652", CreatedById = new Guid("00000000-0000-0000-0000-000000000000"), CreatedDateUnix = 0L, Email = "system@domain.com", @@ -425,7 +425,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) Name = "System", NormalizedEmail = "SYSTEM@DOMAIN.COM", NormalizedUserName = "SYSTEM", - PasswordHash = "AQAAAAIAAYagAAAAEPSBwkzx4B2FBOO2TMY1CmOTm8Hbx4Kkhx1jQ+cbXX0RawEL+fokxKfzfiTjdUvQ7w==", + PasswordHash = "AQAAAAIAAYagAAAAECY88merkbGr1WK1Y3uo+BD5yd7s3l6bBfJ9ESjJVvlD6oJ33Rr2ZLpRqpnfpiK7Vg==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -435,24 +435,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), + Id = new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), AccessFailedCount = 0, Address = "456 Admin St.", BirthDate = new DateTime(1985, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "fde1ecf3-1d5c-4b2a-9bb2-48ccb0487a8e", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "60a3ae43-ac5e-4c6d-aaca-5c4ef8f8b64e", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "admin@example.com", EmailConfirmed = true, Gender = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Admin", NormalizedEmail = "ADMIN@EXAMPLE.COM", NormalizedUserName = "ADMIN@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEHkA/to6jUewOwYD8nDuRDn32jZFwDmDRSJD6wIojiW/uCVrIS/ljZFwm12MePq/0w==", + PasswordHash = "AQAAAAIAAYagAAAAEArkj6N65dBOXg7veenD4YPpcr1PNEOPSTUlld5nkkS+wU0MwtcmRVSsK6yB5atsig==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -462,24 +462,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("05c67957-851a-45ff-aa71-17c19117135c"), + Id = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), AccessFailedCount = 0, Address = "789 Employee St.", BirthDate = new DateTime(1990, 10, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "7c0dd22b-bd17-4dbd-a9df-366a2462ebbf", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "70525978-70f4-4c26-8269-f12c77c6b50b", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "employee1@example.com", EmailConfirmed = true, Gender = 1, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Employee", NormalizedEmail = "EMPLOYEE1@EXAMPLE.COM", NormalizedUserName = "EMPLOYEE1@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEPyJjMH2xm3l4fO0wrq3cW/opMDAVTxxphZEWMA77coyuuilw1p73KridrZRwBkIyQ==", + PasswordHash = "AQAAAAIAAYagAAAAELdxogC/bcwLrivYLnqbTKIjp/H1jaWT4XMTOUFLCmYnHG2vX39q9h2rWQFU1hEbhA==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -489,24 +489,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("54db8065-ac01-416a-b5f3-b696e153e066"), + Id = new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca"), AccessFailedCount = 0, Address = "123 Main Street", BirthDate = new DateTime(1990, 5, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "631e6db1-e797-480e-8759-2bc2a4011b95", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "240a9024-0c8e-4c92-8401-cc6b9e1134c1", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "john.doe@example.com", EmailConfirmed = true, Gender = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "John", NormalizedEmail = "JOHN.DOE@EXAMPLE.COM", NormalizedUserName = "JOHN.DOE@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAENXGYARWgiVjj4PUgnZGYo+yYYsYr+IOHAYWnt7Ck257H+y4fJUDsK2fSSxDUdEGbw==", + PasswordHash = "AQAAAAIAAYagAAAAEM5ai2wz1GK/Fh3tE0TY0xFlbNR1CFfoJPpY5bklnVuvGzZnFVrdA46pqz8cyoo55w==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -516,24 +516,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) }, new { - Id = new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090"), + Id = new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c"), AccessFailedCount = 0, Address = "456 Oak Street", BirthDate = new DateTime(1985, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), - ConcurrencyStamp = "42199153-6623-4a71-b123-aecae5e8146f", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + ConcurrencyStamp = "fb4f5583-ab84-402f-a947-6b4c50226c1d", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), CreatedDateUnix = 0L, Email = "jane.smith@example.com", EmailConfirmed = true, Gender = 1, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LockoutEnabled = false, Name = "Jane", NormalizedEmail = "JANE.SMITH@EXAMPLE.COM", NormalizedUserName = "JANE.SMITH@EXAMPLE.COM", - PasswordHash = "AQAAAAIAAYagAAAAEH0Zc4xoOCN7ayCdq6eeO3mL9ekFKBwuJc5riA8wwtW0mBOvy119Lfs2FfY7ho+Vow==", + PasswordHash = "AQAAAAIAAYagAAAAEAG2aeEHR3NtH4IMc5GBO9+PxAEKCW3gMo6u2siRyGvv5ST2XQWqDJRgPbgN+FqZ6g==", PhoneNumberConfirmed = false, ProfilePicture = new byte[0], SecurityStamp = "", @@ -710,15 +710,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), + Id = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), Biography = "Joanne Rowling, better known by her pen name J.K. Rowling, is a British author, philanthropist, film producer, television producer, and screenwriter. She is best known for writing the Harry Potter fantasy series.", BirthDate = new DateTime(1965, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Country = "United Kingdom", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "J.K.", Surname = "Rowling" }); @@ -736,6 +736,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("AuthorId") .HasColumnType("uniqueidentifier"); + b.Property("BookCompartmentId") + .HasColumnType("uniqueidentifier"); + b.Property("BookFormat") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -744,10 +747,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("BookNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("BookStatus") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -755,9 +754,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("BookStockId") .HasColumnType("uniqueidentifier"); - b.Property("BorrowId") - .HasColumnType("uniqueidentifier"); - b.Property("CoverImageUrl") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -827,6 +823,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("BookCompartmentId"); + b.HasIndex("FavoriteListId"); b.HasIndex("GenreId"); @@ -846,33 +844,132 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - AuthorId = new Guid("9bd17259-24a1-4fe0-abdc-b70796e8b52f"), + Id = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + AuthorId = new Guid("083ecb57-f36b-4f12-8c77-39d2343dd4a9"), BookFormat = "PrintedBook", BookLanguage = "English", - BookNumber = "A1", BookStatus = "Active", - BookStockId = new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), - BorrowId = new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), + BookStockId = new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), CoverImageUrl = "https://m.media-amazon.com/images/I/81q77Q39nEL._SY385_.jpg", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Description = "Harry Potter has never even heard of Hogwarts when the letters start dropping on the doormat at number four, Privet Drive. Addressed in green ink on yellowish parchment with a purple seal, they are swiftly confiscated by his grisly aunt and uncle. Then, on Harry's eleventh birthday, a great beetle-eyed giant of a man called Rubeus Hagrid bursts in with some astonishing news: Harry Potter is a wizard, and he has a place at Hogwarts School of Witchcraft and Wizardry. An incredible adventure is about to begin!", - GenreId = new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), + GenreId = new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), ISBN = "9781408855652", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsFeatured = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OriginalPublicationDate = new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), PageCount = 352, PublicationDate = new DateTime(1997, 6, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), - PublisherId = new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), + PublisherId = new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), Title = "Harry Potter and the Philosopher's Stone" }); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ShelfId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ShelfId"); + + b.ToTable("BookCompartments", "lm"); + }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BookFormat") + .HasColumnType("int"); + + b.Property("BookId") + .HasColumnType("uniqueidentifier"); + + b.Property("BookLanguage") + .HasColumnType("int"); + + b.Property("BookNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("BookStatus") + .HasColumnType("int"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("EntryDate") + .HasColumnType("datetime2"); + + b.Property("IsAvailable") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("BookId"); + + b.ToTable("BookEntry"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookGenre", b => { b.Property("Id") @@ -914,24 +1011,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("3e3bafdb-3f07-428b-bbf7-00d300996d6d"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("086a66f7-1be6-46cb-a490-7d28badd16a7"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsActive = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Fantasy" }, new { - Id = new Guid("ca1c300a-1e3f-468b-bf9c-958e2d8646be"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("00191e89-4992-4fd5-aae9-73797b1ccc76"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsActive = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Adventure" }); }); @@ -995,14 +1092,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("acc3b4ef-0af1-4603-a520-ab9d1162b825"), + Id = new Guid("f71b05af-21b6-4439-9b4a-9119e1970a8e"), Address = "50 Bedford Square, London, England", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Email = "info@bloomsbury.com", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Bloomsbury Publishing", PhoneNumber = "+44 (0)20 7631 5600", Website = "https://www.bloomsbury.com/" @@ -1099,13 +1196,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("240a693c-b4e9-46f8-a380-9649bf427450"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("e5d6c73a-e865-412c-98d9-e4bfd147784b"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Quantity = 100 }); }); @@ -1153,35 +1250,35 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("7cbe9df9-dca0-4498-921f-2cdc195b655b"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("fb7816ca-3443-422a-a498-5cbbb24bfc45"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Hogwarts" }, new { - Id = new Guid("3dd801ff-debe-45e7-9e41-82082d4b3a21"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("e34fc271-a8f3-48aa-9a7d-d9db8b6ae7a9"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Harry Potter" }, new { - Id = new Guid("adc919af-06be-4c13-822e-780da2e32996"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + Id = new Guid("238d37b1-41c2-470c-ae0a-6a47c7a17842"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), Name = "Quidditch" }); }); @@ -1264,22 +1361,43 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("85eda2ef-0a39-43d8-9413-1c03c734f6cd"), - BookId = new Guid("6da9b541-a7e2-462d-b623-dc1aa6055687"), - BorrowDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5917), + Id = new Guid("f0eac556-a732-47d7-8a0a-30bace0331f2"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + BorrowDate = new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1228), BorrowStatus = "Returned", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, - DueDate = new DateTime(2024, 5, 12, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5918), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + DueDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245), FeeAmount = 0m, HasFee = false, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsLate = false, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LenderId = new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), - MemberId = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), - ReturnDate = new DateTime(2024, 4, 28, 18, 35, 0, 460, DateTimeKind.Local).AddTicks(5928) + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LateDurationInDays = 0, + LenderId = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), + MemberId = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), + ReturnDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1245) + }, + new + { + Id = new Guid("3b565299-2fdc-490c-a700-4a0cca5cc877"), + BookId = new Guid("a56ce706-f92e-4c22-b9ab-b2b2ecd32008"), + BorrowDate = new DateTime(2024, 4, 19, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1268), + BorrowStatus = "DelayedReturn", + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + DueDate = new DateTime(2024, 4, 28, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1295), + FeeAmount = 0m, + HasFee = false, + IsDeleted = false, + IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), + IsLate = true, + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LateDurationInDays = 1, + LenderId = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), + MemberId = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), + ReturnDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1306) }); }); @@ -1337,93 +1455,93 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("259561f5-d40c-4956-9676-ed90bb8aeb82"), + Id = new Guid("889b3e3a-176c-41c5-a09e-e0e5d2c8065b"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("2c91ac06-c143-42f3-8dcb-657c56673d8d"), + Id = new Guid("366adfd4-877c-4b48-af6b-a1d8064520fc"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("287b544f-ba14-4ae2-b8a4-1170f786cb1b"), + Id = new Guid("e5efdaf7-d680-4733-9554-82ecf5cb1445"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("54678360-a567-446b-810e-def90bf74996"), + Id = new Guid("f075bd9f-5a05-40d0-91d7-63a279baa5b6"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("eabbafb7-b5e9-4e12-aa77-d01cae543ef9"), + Id = new Guid("1ec6b73a-487c-4dfd-8280-2939d0417327"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("88e3a14b-050c-4cd0-8f74-68728b13a51d"), + Id = new Guid("45ce0949-c5ae-412c-9157-d28060cc9229"), ClosingTime = new TimeSpan(0, 17, 30, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 8, 0, 0, 0) }, new { - Id = new Guid("8e4d174b-8c86-4e46-ad57-eb9359a70eeb"), + Id = new Guid("2107ba2f-cb43-4de6-9d7b-e6d40be6c766"), ClosingTime = new TimeSpan(0, 0, 0, 0, 0), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, DayOfWeek = 0, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), OpeningTime = new TimeSpan(0, 0, 0, 0, 0) }); }); @@ -1534,16 +1652,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + Id = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), Address = "123 Ana Cadde", BookId = new Guid("00000000-0000-0000-0000-000000000000"), BranchHourId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, Description = "Bu bir örnek kütüphane şubesidir.", IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), LibraryBranchId = new Guid("00000000-0000-0000-0000-000000000000"), LibraryTransactionId = new Guid("00000000-0000-0000-0000-000000000000"), MemberId = new Guid("00000000-0000-0000-0000-000000000000"), @@ -1680,47 +1798,47 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("c8cdaba4-8d50-47ce-b901-02535538794b"), + Id = new Guid("9acc5bc2-c342-4a7d-b9a8-dbc2f93fa786"), BorrowId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, ExtensionDurationInDays = 7, Gender = "Male", HasPenalty = false, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsExtensionAllowed = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), MaxLateReturnsAllowed = 3, MemberType = "Adult", - MembershipDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5858), + MembershipDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1165), NumberOfLateReturns = 0, Occupation = "Software Engineer", PenaltyDurationInDays = 0, - UserId = new Guid("54db8065-ac01-416a-b5f3-b696e153e066") + UserId = new Guid("46236d25-f9e8-4b9e-9577-68cbceedfdca") }, new { - Id = new Guid("f2fb9f79-95ea-4edc-a765-93f5e50e23b4"), + Id = new Guid("74faad27-6421-4829-8b6a-9c6e02bd6fa6"), BorrowId = new Guid("00000000-0000-0000-0000-000000000000"), - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, ExtensionDurationInDays = 0, Gender = "Female", HasPenalty = true, IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsExtensionAllowed = false, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), MaxLateReturnsAllowed = 3, MemberType = "Teacher", - MembershipDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5865), + MembershipDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1171), NumberOfLateReturns = 2, Occupation = "Teacher", PenaltyDurationInDays = 7, - UserId = new Guid("2648d2f6-3d0e-43d5-8ab0-f6961a661090") + UserId = new Guid("a8604411-9fbd-41c0-8cc9-fe2f96e7609c") }); }); @@ -1759,6 +1877,43 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ReadingLists", "lm"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Shelf", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateUnix") + .HasColumnType("bigint"); + + b.Property("DeletedDateUnix") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDeletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedDateUnix") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Shelves", "lm"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Staff", b => { b.Property("Id") @@ -1823,19 +1978,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - Id = new Guid("ca1f12e5-63a5-4dbd-8070-79967002db87"), + Id = new Guid("a94c2719-ea2b-4b0c-be99-fd7268afb2f5"), Address = "Employee Address", - CreatedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - CreatedDateUnix = 1714328700L, - EmploymentDate = new DateTime(2024, 4, 28, 18, 25, 0, 460, DateTimeKind.Local).AddTicks(5910), + CreatedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + CreatedDateUnix = 1714398673L, + EmploymentDate = new DateTime(2024, 4, 29, 13, 51, 13, 966, DateTimeKind.Local).AddTicks(1220), IsDeleted = false, IsDeletedById = new Guid("00000000-0000-0000-0000-000000000000"), IsFullTime = true, - LastModifiedById = new Guid("46e85cb7-93eb-4d8a-84f4-c6ee9d8d1da8"), - LibraryBranchId = new Guid("495c6c35-3ba8-4c36-997c-a9f3a6c8c7ab"), + LastModifiedById = new Guid("44073bfd-0b99-48e7-a951-2c9203e7340e"), + LibraryBranchId = new Guid("282ac419-5495-4e92-a109-b51055b8b631"), Phone = "+905553331122", Salary = 3000.00m, - UserId = new Guid("05c67957-851a-45ff-aa71-17c19117135c") + UserId = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9") }); }); @@ -1960,13 +2115,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasData( new { - UserId = new Guid("4158956f-5ba6-41d1-8cd4-d57311dea737"), - RoleId = new Guid("8dd459f0-af81-4fee-8124-f367b14d390c") + UserId = new Guid("77cf39ea-87a9-481b-929f-9abf80a7c1d7"), + RoleId = new Guid("d541ad6c-d990-4160-b430-c4ed048242a5") }, new { - UserId = new Guid("05c67957-851a-45ff-aa71-17c19117135c"), - RoleId = new Guid("15be1db9-8a32-41f2-bdd4-d0fbc7a9b555") + UserId = new Guid("2e9a9efc-1e1c-4eba-8b03-1dad31d459b9"), + RoleId = new Guid("b966a17e-8090-4061-bb79-f811020145dd") }); }); @@ -2043,6 +2198,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Book", b => { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", null) + .WithMany("Books") + .HasForeignKey("BookCompartmentId"); + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.FavoriteList", null) .WithMany("FavoriteBooks") .HasForeignKey("FavoriteListId"); @@ -2076,6 +2235,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Publisher"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Shelf", null) + .WithMany("Compartments") + .HasForeignKey("ShelfId"); + }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookEntry", b => + { + b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Book", "Book") + .WithMany("BookEntries") + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Book"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookStock", b => { b.HasOne("LibraryTrackingApp.Domain.Entities.Library.Book", "Book") @@ -2240,11 +2417,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Book", b => { + b.Navigation("BookEntries"); + b.Navigation("BookStocks"); b.Navigation("Borrows"); }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookCompartment", b => + { + b.Navigation("Books"); + }); + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.BookGenre", b => { b.Navigation("Books"); @@ -2280,6 +2464,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("Books"); }); + + modelBuilder.Entity("LibraryTrackingApp.Domain.Entities.Library.Shelf", b => + { + b.Navigation("Compartments"); + }); #pragma warning restore 612, 618 } } diff --git a/LibraryTrackingApp/src/backend/Presentation/LibraryTrackingApp.WebApi/Controllers/v1/BorrowLendsController.cs b/LibraryTrackingApp/src/backend/Presentation/LibraryTrackingApp.WebApi/Controllers/v1/BorrowLendsController.cs index df32f1b..5a433ae 100644 --- a/LibraryTrackingApp/src/backend/Presentation/LibraryTrackingApp.WebApi/Controllers/v1/BorrowLendsController.cs +++ b/LibraryTrackingApp/src/backend/Presentation/LibraryTrackingApp.WebApi/Controllers/v1/BorrowLendsController.cs @@ -1,10 +1,20 @@ -using LibraryTrackingApp.Application.Features.Books.Events; -using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; +using LibraryTrackingApp.Application.Features.BorrowLend.Commands.Requests; using LibraryTrackingApp.Application.Features.BorrowLend.Events; using LibraryTrackingApp.Infrastructure.Mvc; namespace LibraryTrackingApp.WebApi.Controllers.v1; + +/* + +daha saglıklı kitap takibi için, +bookstock entity'si kaldırılcaktır. +yerine bookentry gelicektir. + +ve fiş girer gibi tek tek kayıt girilcektir. + + */ + [ApiController] [ApiVersion(ApiVersions.V1)] [Route($"api/v{ApiVersions.V1}/borrow-lends")] @@ -82,6 +92,111 @@ await _mediator.Publish( } + /// + /// Kitabın ödünç süresini uzatmak için istemciden gelen isteği işler. + /// + /// Ödünç süresi uzatılacak kitabın request nesnesi. + /// + /// 200 OK cevabı, işlem başarılı ise; + /// 404 Not Found cevabı, kitap bulunamadığı durumda; + /// 400 Bad Request cevabı, geçersiz kitap işlemi durumunda; + /// 500 Internal Server Error cevabı, bir hata oluştuğunda. + /// + [HttpPost("renew")] + public async Task RenewBook([FromBody] RenewBorrowCommandRequest request) + { + var response = await _mediator.Send(request); + await _mediator.Publish( + new BorrowLendEvent() + { + Errors = response.Success ? null : response.StateMessages, + IsSuccessful = response.Success, + BorrowLendType = LibraryTrackingApp.Domain.Enums.BorrowLendType.Renewed + } + ); + + var responseValue = new + { + IsSuccess = response.Success, + StatusCode = response.StatusCode, + Messages = response.StateMessages.ToArray(), + Data = response.Data, + }; + + return new JsonResult(responseValue) { StatusCode = response.StatusCode }; + } + + + + /// + /// Hasarlı kitap durumunu bildirmek için istemciden gelen isteği işler. + /// + /// Hasarlı kitabın request nesnesi. + /// + /// 200 OK cevabı, işlem başarılı ise; + /// 404 Not Found cevabı, kitap bulunamadığı durumda; + /// 400 Bad Request cevabı, geçersiz kitap işlemi durumunda; + /// 500 Internal Server Error cevabı, bir hata oluştuğunda. + /// + [HttpPost("report-damage")] + public async Task ReportDamage([FromBody] ReportDamageBookCommandRequest request) + { + var response = await _mediator.Send(request); + await _mediator.Publish( + new BorrowLendEvent() + { + Errors = response.Success ? null : response.StateMessages, + IsSuccessful = response.Success, + BorrowLendType = LibraryTrackingApp.Domain.Enums.BorrowLendType.Damaged + } + ); + + var responseValue = new + { + IsSuccess = response.Success, + StatusCode = response.StatusCode, + Messages = response.StateMessages.ToArray(), + Data = response.Data, + }; + + return new JsonResult(responseValue) { StatusCode = response.StatusCode }; + } + + + /// + /// Kayıp kitap durumunu bildirmek için istemciden gelen isteği işler. + /// + /// Kayıp kitabın request nesnesi. + /// + /// 200 OK cevabı, işlem başarılı ise; + /// 404 Not Found cevabı, kitap bulunamadığı durumda; + /// 400 Bad Request cevabı, geçersiz kitap işlemi durumunda; + /// 500 Internal Server Error cevabı, bir hata oluştuğunda. + /// + [HttpPost("report-loss")] + public async Task ReportLoss([FromBody] ReportLossBookCommandRequest request) + { + var response = await _mediator.Send(request); + await _mediator.Publish( + new BorrowLendEvent() + { + Errors = response.Success ? null : response.StateMessages, + IsSuccessful = response.Success, + BorrowLendType = LibraryTrackingApp.Domain.Enums.BorrowLendType.Lost + } + ); + + var responseValue = new + { + IsSuccess = response.Success, + StatusCode = response.StatusCode, + Messages = response.StateMessages.ToArray(), + Data = response.Data, + }; + + return new JsonResult(responseValue) { StatusCode = response.StatusCode }; + } + /// /// Belirli bir ödünç işlemi ID'sine göre ödünç işleminin detaylarını getirir. /// diff --git a/README.md b/README.md index d21c228..bd40b2f 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,9 @@ Uygulama aşağıdaki entiteleri içermektedir: - **BookGenre**: Kitap türlerinin kaydedilmesi. - **Author**: Kitap yazarlarının kaydedilmesi. - **BookPublisher**: Kitap yayınevlerinin kaydedilmesi. -- **BorrowLendBook**: Kitap ödünç alma ve iade işlemlerinin yönetimi. +- **BorrowLend**: Kitap ödünç alma ve iade işlemlerinin yönetimi. - **BookStock**: Kitap stoklarının yönetimi. +- **BookEntry**: Kitaplar için stok entity yerine stok tutması ve kayıt tutması için bunu kullanıcaz ilerde - **BookTag**: Kitapları kategorize etmek için etiketlerin yönetimi. - **FavoriteList**: Kullanıcıların favori listesine kitap eklemesi - **ReadingList**: Kullanıcıların okuma listesine kitap eklemesi.