-
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.
[Quotations management][Duy] Update database
- Add QuotationRevision - Remove ProductDetailQuotation
- Loading branch information
Showing
13 changed files
with
108 additions
and
69 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 |
11 changes: 0 additions & 11 deletions
11
Domus.DAL/Implementations/ProductDetailQuotationRepository.cs
This file was deleted.
Oops, something went wrong.
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
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
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>(); | ||
} |