Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c1936a

Browse files
authored
Merge pull request #12 from vanyachernov/supplements/AD-02
AD-02: Set up Order entity. Ref to Scope
2 parents d3934d2 + e549d0a commit 1c1936a

File tree

8 files changed

+376
-14
lines changed

8 files changed

+376
-14
lines changed

Topers.DataAccess.Postgres/Configurations/GoodConfiguration.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,5 @@ public void Configure(EntityTypeBuilder<GoodEntity> builder)
1717
.HasMany(g => g.Scopes)
1818
.WithOne(s => s.Good)
1919
.HasForeignKey(s => s.GoodId);
20-
builder
21-
.HasMany(g => g.OrderDetails)
22-
.WithOne(d => d.Good)
23-
.HasForeignKey(d => d.GoodId);
2420
}
2521
}

Topers.DataAccess.Postgres/Configurations/OrderDetailsConfiguration.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public void Configure(EntityTypeBuilder<OrderDetailsEntity> builder)
1515
.HasForeignKey(d => d.OrderId);
1616
builder
1717
.HasOne(d => d.Good)
18-
.WithMany(g => g.OrderDetails)
18+
.WithMany(o => o.OrderDetails)
1919
.HasForeignKey(d => d.GoodId);
20+
2021
}
2122
}

Topers.DataAccess.Postgres/Entities/GoodEntity.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,4 @@ public class GoodEntity
3434
/// Gets or sets a good scopes collection.
3535
/// </summary>
3636
public ICollection<GoodScopeEntity> Scopes { get; set; } = [];
37-
38-
/// <summary>
39-
/// Gets or sets an order details about good.
40-
/// </summary>
41-
public ICollection<OrderDetailsEntity>? OrderDetails { get; set; } = [];
4237
}

Topers.DataAccess.Postgres/Entities/GoodScopeEntity.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@ public class GoodScopeEntity
4343
/// Gets or sets a good image file.
4444
/// </summary>
4545
public IFormFile? ImageFile { get; set; }
46+
47+
/// <summary>
48+
/// Gets or sets an order details about good.
49+
/// </summary>
50+
public ICollection<OrderDetailsEntity>? OrderDetails { get; set; } = [];
4651
}

Topers.DataAccess.Postgres/Entities/OrderDetailsEntity.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Topers.Core.Models;
2+
13
namespace Topers.DataAccess.Postgres.Entities;
24

35
/// <summary>
@@ -28,7 +30,7 @@ public class OrderDetailsEntity
2830
/// <summary>
2931
/// Gets or sets a good.
3032
/// </summary>
31-
public GoodEntity Good { get; set; } = null!;
33+
public GoodScopeEntity Good { get; set; } = null!;
3234

3335
/// <summary>
3436
/// Gets or sets a good quantity.

Topers.DataAccess.Postgres/Migrations/20240721171553_UpdateScopeRef.Designer.cs

Lines changed: 318 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)