-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from SWD392-Domus/feature/quotations-management
Feature/quotations management
- Loading branch information
Showing
22 changed files
with
258 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
DROP TABLE IF EXISTS [ProductDetail_QuotationRevision] | ||
DROP TABLE IF EXISTS [ProductDetail_Quotation] | ||
|
||
CREATE TABLE [QuotationRevision] ( | ||
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, | ||
[QuotationId] UNIQUEIDENTIFIER NOT NULL FOREIGN KEY REFERENCES [Quotation]([Id]), | ||
[Version] INT NOT NULL, | ||
[CreatedAt] DATETIME NOT NULL, | ||
[IsDeleted] BIT NOT NULL | ||
) | ||
GO | ||
|
||
CREATE TABLE [ProductDetail_QuotationRevision] ( | ||
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, | ||
[QuotationRevisionId] UNIQUEIDENTIFIER NOT NULL FOREIGN KEY REFERENCES [QuotationRevision]([Id]), | ||
[ProductDetailId] UNIQUEIDENTIFIER NOT NULL FOREIGN KEY REFERENCES [ProductDetail]([Id]), | ||
[Price] FLOAT NOT NULL, | ||
[MonetaryUnit] NVARCHAR(256) NOT NULL, | ||
[Quantity] FLOAT NOT NULL, | ||
[QuantityType] NVARCHAR(256) NOT NULL, | ||
[IsDeleted] BIT DEFAULT 0 | ||
) | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Domus.DAL/Implementations/ProductDetailQuoationRevisionRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Domus.DAL.Interfaces; | ||
using Domus.Domain.Entities; | ||
|
||
namespace Domus.DAL.Implementations; | ||
|
||
public class ProductDetailQuoationRevisionRepository : GenericRepository<ProductDetailQuotationRevision>, IProductDetailQuotationRevisionRepository | ||
{ | ||
public ProductDetailQuoationRevisionRepository(IAppDbContext dbContext) : base(dbContext) | ||
{ | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
Domus.DAL/Implementations/ProductDetailQuotationRepository.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Domus.DAL.Interfaces; | ||
using Domus.Domain.Entities; | ||
|
||
namespace Domus.DAL.Implementations; | ||
|
||
public class QuotationRevisionRepository : GenericRepository<QuotationRevision>, IQuotationRevisionRepository | ||
{ | ||
public QuotationRevisionRepository(IAppDbContext dbContext) : base(dbContext) | ||
{ | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Domus.DAL/Interfaces/IProductDetailQuotationRevisionRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Domus.Common.Interfaces; | ||
using Domus.Domain.Entities; | ||
|
||
namespace Domus.DAL.Interfaces; | ||
|
||
public interface IProductDetailQuotationRevisionRepository : IGenericRepository<ProductDetailQuotationRevision>, IAutoRegisterable | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Domus.Common.Interfaces; | ||
using Domus.Domain.Entities; | ||
|
||
namespace Domus.DAL.Interfaces; | ||
|
||
public interface IQuotationRevisionRepository : IGenericRepository<QuotationRevision>, IAutoRegisterable | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Domus.Domain/DatabaseMappings/QuotationRevisionModelMapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Domus.Domain.Entities; | ||
using Domus.Domain.Interfaces; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Domus.Domain.DatabaseMappings; | ||
|
||
public class QuotationRevisionModelMapper : IDatabaseModelMapper | ||
{ | ||
public void Map(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<QuotationRevision>(entity => | ||
{ | ||
entity.ToTable("QuotationRevision"); | ||
entity.Property(e => e.Id).ValueGeneratedOnAdd(); | ||
entity.Property(e => e.CreatedAt).HasColumnType("datetime"); | ||
entity.HasOne(d => d.Quotation).WithMany(p => p.QuotationRevisions) | ||
.HasForeignKey(d => d.QuotationId) | ||
.OnDelete(DeleteBehavior.ClientSetNull); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Domus.Domain/Dtos/Quotations/DtoProductDetailQuotationRevision.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Domus.Domain.Dtos.Products; | ||
|
||
namespace Domus.Domain.Dtos.Quotations; | ||
|
||
public class DtoProductDetailQuotationRevision | ||
{ | ||
public string ProductName { get; set; } = null!; | ||
|
||
public double Price { get; set; } | ||
|
||
public string MonetaryUnit { get; set; } = null!; | ||
|
||
public double Quantity { get; set; } | ||
|
||
public string QuantityType { get; set; } = null!; | ||
|
||
public DtoProductDetail Detail { get; set; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Domus.Domain.Entities.Base; | ||
|
||
namespace Domus.Domain.Entities; | ||
|
||
public partial class QuotationRevision : DeletableEntity<Guid> | ||
{ | ||
public Guid QuotationId { get; set; } | ||
public int Version { get; set; } | ||
public DateTime CreatedAt { get; set; } | ||
public virtual Quotation Quotation { get; set; } = null!; | ||
public virtual ICollection<ProductDetailQuotationRevision> ProductDetailQuotationRevisions { get; set; } = new List<ProductDetailQuotationRevision>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.