Skip to content

Commit 9aae38a

Browse files
committed
Add many controller, Dtos, Models
1 parent b19cc7a commit 9aae38a

22 files changed

+1040
-149
lines changed

Infrastructure/Data/Migrations/20210409201510_models-bringup.Designer.cs

+678
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace Infrastructure.Data.Migrations
4+
{
5+
public partial class modelsbringup : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
migrationBuilder.AddColumn<long>(
10+
name: "AccountId",
11+
table: "Orders",
12+
type: "bigint",
13+
nullable: false,
14+
defaultValue: 0L);
15+
16+
migrationBuilder.AddColumn<long>(
17+
name: "AccountId",
18+
table: "LatLngs",
19+
type: "bigint",
20+
nullable: false,
21+
defaultValue: 0L);
22+
23+
migrationBuilder.CreateIndex(
24+
name: "IX_Orders_AccountId",
25+
table: "Orders",
26+
column: "AccountId");
27+
28+
migrationBuilder.CreateIndex(
29+
name: "IX_LatLngs_AccountId",
30+
table: "LatLngs",
31+
column: "AccountId");
32+
33+
migrationBuilder.AddForeignKey(
34+
name: "FK_LatLngs_Accounts_AccountId",
35+
table: "LatLngs",
36+
column: "AccountId",
37+
principalTable: "Accounts",
38+
principalColumn: "Id",
39+
onDelete: ReferentialAction.Cascade);
40+
41+
migrationBuilder.AddForeignKey(
42+
name: "FK_Orders_Accounts_AccountId",
43+
table: "Orders",
44+
column: "AccountId",
45+
principalTable: "Accounts",
46+
principalColumn: "Id",
47+
onDelete: ReferentialAction.Cascade);
48+
}
49+
50+
protected override void Down(MigrationBuilder migrationBuilder)
51+
{
52+
migrationBuilder.DropForeignKey(
53+
name: "FK_LatLngs_Accounts_AccountId",
54+
table: "LatLngs");
55+
56+
migrationBuilder.DropForeignKey(
57+
name: "FK_Orders_Accounts_AccountId",
58+
table: "Orders");
59+
60+
migrationBuilder.DropIndex(
61+
name: "IX_Orders_AccountId",
62+
table: "Orders");
63+
64+
migrationBuilder.DropIndex(
65+
name: "IX_LatLngs_AccountId",
66+
table: "LatLngs");
67+
68+
migrationBuilder.DropColumn(
69+
name: "AccountId",
70+
table: "Orders");
71+
72+
migrationBuilder.DropColumn(
73+
name: "AccountId",
74+
table: "LatLngs");
75+
}
76+
}
77+
}

Infrastructure/Data/Migrations/DodoHackDbContextModelSnapshot.cs

+115-81
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,30 @@ protected override void BuildModel(ModelBuilder modelBuilder)
109109
b.ToTable("AccountToRoles");
110110
});
111111

112-
modelBuilder.Entity("Models.Db.IngredientTemplate", b =>
112+
modelBuilder.Entity("Models.Db.LatLng", b =>
113+
{
114+
b.Property<long>("Id")
115+
.ValueGeneratedOnAdd()
116+
.HasColumnType("bigint")
117+
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
118+
119+
b.Property<long>("AccountId")
120+
.HasColumnType("bigint");
121+
122+
b.Property<float>("Lat")
123+
.HasColumnType("real");
124+
125+
b.Property<float>("Lng")
126+
.HasColumnType("real");
127+
128+
b.HasKey("Id");
129+
130+
b.HasIndex("AccountId");
131+
132+
b.ToTable("LatLngs");
133+
});
134+
135+
modelBuilder.Entity("Models.Db.MenuIngredient", b =>
113136
{
114137
b.Property<long>("Id")
115138
.ValueGeneratedOnAdd()
@@ -132,22 +155,50 @@ protected override void BuildModel(ModelBuilder modelBuilder)
132155
b.ToTable("IngredientTemplates");
133156
});
134157

135-
modelBuilder.Entity("Models.Db.LatLng", b =>
158+
modelBuilder.Entity("Models.Db.MenuProduct", b =>
136159
{
137160
b.Property<long>("Id")
138161
.ValueGeneratedOnAdd()
139162
.HasColumnType("bigint")
140163
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
141164

142-
b.Property<float>("Lat")
165+
b.Property<float>("Price")
143166
.HasColumnType("real");
144167

145-
b.Property<float>("Lng")
168+
b.Property<long>("ProductCategoryId")
169+
.HasColumnType("bigint");
170+
171+
b.Property<long>("ProductPackId")
172+
.HasColumnType("bigint");
173+
174+
b.Property<string>("Title")
175+
.HasColumnType("text");
176+
177+
b.HasKey("Id");
178+
179+
b.HasIndex("ProductCategoryId");
180+
181+
b.HasIndex("ProductPackId");
182+
183+
b.ToTable("ProductTemplates");
184+
});
185+
186+
modelBuilder.Entity("Models.Db.MenuProductPack", b =>
187+
{
188+
b.Property<long>("Id")
189+
.ValueGeneratedOnAdd()
190+
.HasColumnType("bigint")
191+
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
192+
193+
b.Property<float>("Price")
146194
.HasColumnType("real");
147195

196+
b.Property<string>("Title")
197+
.HasColumnType("text");
198+
148199
b.HasKey("Id");
149200

150-
b.ToTable("LatLngs");
201+
b.ToTable("ProductPackTemplates");
151202
});
152203

153204
modelBuilder.Entity("Models.Db.Order", b =>
@@ -157,11 +208,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
157208
.HasColumnType("bigint")
158209
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
159210

211+
b.Property<long>("AccountId")
212+
.HasColumnType("bigint");
213+
160214
b.Property<DateTime>("CreationDateTime")
161215
.HasColumnType("timestamp without time zone");
162216

163217
b.HasKey("Id");
164218

219+
b.HasIndex("AccountId");
220+
165221
b.ToTable("Orders");
166222
});
167223

@@ -257,52 +313,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
257313
b.ToTable("ProductCategories");
258314
});
259315

260-
modelBuilder.Entity("Models.Db.ProductPackTemplate", b =>
261-
{
262-
b.Property<long>("Id")
263-
.ValueGeneratedOnAdd()
264-
.HasColumnType("bigint")
265-
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
266-
267-
b.Property<float>("Price")
268-
.HasColumnType("real");
269-
270-
b.Property<string>("Title")
271-
.HasColumnType("text");
272-
273-
b.HasKey("Id");
274-
275-
b.ToTable("ProductPackTemplates");
276-
});
277-
278-
modelBuilder.Entity("Models.Db.ProductTemplate", b =>
279-
{
280-
b.Property<long>("Id")
281-
.ValueGeneratedOnAdd()
282-
.HasColumnType("bigint")
283-
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
284-
285-
b.Property<float>("Price")
286-
.HasColumnType("real");
287-
288-
b.Property<long>("ProductCategoryId")
289-
.HasColumnType("bigint");
290-
291-
b.Property<long>("ProductPackId")
292-
.HasColumnType("bigint");
293-
294-
b.Property<string>("Title")
295-
.HasColumnType("text");
296-
297-
b.HasKey("Id");
298-
299-
b.HasIndex("ProductCategoryId");
300-
301-
b.HasIndex("ProductPackId");
302-
303-
b.ToTable("ProductTemplates");
304-
});
305-
306316
modelBuilder.Entity("Models.Db.ScheduledWorkSession", b =>
307317
{
308318
b.Property<long>("Id")
@@ -452,67 +462,78 @@ protected override void BuildModel(ModelBuilder modelBuilder)
452462
b.Navigation("Role");
453463
});
454464

455-
modelBuilder.Entity("Models.Db.IngredientTemplate", b =>
465+
modelBuilder.Entity("Models.Db.LatLng", b =>
456466
{
457-
b.HasOne("Models.Db.ProductTemplate", "Product")
458-
.WithMany("Ingredients")
459-
.HasForeignKey("ProductId")
467+
b.HasOne("Models.Db.Account", "Account")
468+
.WithMany("LatLngs")
469+
.HasForeignKey("AccountId")
460470
.OnDelete(DeleteBehavior.Cascade)
461471
.IsRequired();
462472

463-
b.Navigation("Product");
473+
b.Navigation("Account");
464474
});
465475

466-
modelBuilder.Entity("Models.Db.OrderIngredient", b =>
476+
modelBuilder.Entity("Models.Db.MenuIngredient", b =>
467477
{
468-
b.HasOne("Models.Db.OrderProduct", "Product")
478+
b.HasOne("Models.Db.MenuProduct", "MenuProduct")
469479
.WithMany("Ingredients")
470480
.HasForeignKey("ProductId")
471481
.OnDelete(DeleteBehavior.Cascade)
472482
.IsRequired();
473483

474-
b.Navigation("Product");
484+
b.Navigation("MenuProduct");
475485
});
476486

477-
modelBuilder.Entity("Models.Db.OrderProduct", b =>
487+
modelBuilder.Entity("Models.Db.MenuProduct", b =>
478488
{
479489
b.HasOne("Models.Db.ProductCategory", "ProductCategory")
480-
.WithMany("OrderProducts")
490+
.WithMany("ProductTemplates")
481491
.HasForeignKey("ProductCategoryId")
482492
.OnDelete(DeleteBehavior.Cascade)
483493
.IsRequired();
484494

485-
b.HasOne("Models.Db.OrderProductPack", "ProductPack")
495+
b.HasOne("Models.Db.MenuProductPack", "MenuProductPack")
486496
.WithMany("Products")
487497
.HasForeignKey("ProductPackId")
488498
.OnDelete(DeleteBehavior.Cascade)
489499
.IsRequired();
490500

501+
b.Navigation("MenuProductPack");
502+
491503
b.Navigation("ProductCategory");
504+
});
492505

493-
b.Navigation("ProductPack");
506+
modelBuilder.Entity("Models.Db.Order", b =>
507+
{
508+
b.HasOne("Models.Db.Account", "Account")
509+
.WithMany()
510+
.HasForeignKey("AccountId")
511+
.OnDelete(DeleteBehavior.Cascade)
512+
.IsRequired();
513+
514+
b.Navigation("Account");
494515
});
495516

496-
modelBuilder.Entity("Models.Db.OrderProductPack", b =>
517+
modelBuilder.Entity("Models.Db.OrderIngredient", b =>
497518
{
498-
b.HasOne("Models.Db.Order", "Order")
499-
.WithMany("ProductPacks")
500-
.HasForeignKey("OrderId")
519+
b.HasOne("Models.Db.OrderProduct", "Product")
520+
.WithMany("Ingredients")
521+
.HasForeignKey("ProductId")
501522
.OnDelete(DeleteBehavior.Cascade)
502523
.IsRequired();
503524

504-
b.Navigation("Order");
525+
b.Navigation("Product");
505526
});
506527

507-
modelBuilder.Entity("Models.Db.ProductTemplate", b =>
528+
modelBuilder.Entity("Models.Db.OrderProduct", b =>
508529
{
509530
b.HasOne("Models.Db.ProductCategory", "ProductCategory")
510-
.WithMany("ProductTemplates")
531+
.WithMany("OrderProducts")
511532
.HasForeignKey("ProductCategoryId")
512533
.OnDelete(DeleteBehavior.Cascade)
513534
.IsRequired();
514535

515-
b.HasOne("Models.Db.ProductPackTemplate", "ProductPack")
536+
b.HasOne("Models.Db.OrderProductPack", "ProductPack")
516537
.WithMany("Products")
517538
.HasForeignKey("ProductPackId")
518539
.OnDelete(DeleteBehavior.Cascade)
@@ -523,6 +544,17 @@ protected override void BuildModel(ModelBuilder modelBuilder)
523544
b.Navigation("ProductPack");
524545
});
525546

547+
modelBuilder.Entity("Models.Db.OrderProductPack", b =>
548+
{
549+
b.HasOne("Models.Db.Order", "Order")
550+
.WithMany("ProductPacks")
551+
.HasForeignKey("OrderId")
552+
.OnDelete(DeleteBehavior.Cascade)
553+
.IsRequired();
554+
555+
b.Navigation("Order");
556+
});
557+
526558
modelBuilder.Entity("Models.Db.ScheduledWorkSession", b =>
527559
{
528560
b.HasOne("Models.Db.Account", "Account")
@@ -580,6 +612,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
580612

581613
modelBuilder.Entity("Models.Db.Account", b =>
582614
{
615+
b.Navigation("LatLngs");
616+
583617
b.Navigation("Roles");
584618
});
585619

@@ -588,6 +622,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
588622
b.Navigation("Users");
589623
});
590624

625+
modelBuilder.Entity("Models.Db.MenuProduct", b =>
626+
{
627+
b.Navigation("Ingredients");
628+
});
629+
630+
modelBuilder.Entity("Models.Db.MenuProductPack", b =>
631+
{
632+
b.Navigation("Products");
633+
});
634+
591635
modelBuilder.Entity("Models.Db.Order", b =>
592636
{
593637
b.Navigation("ProductPacks");
@@ -610,16 +654,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
610654
b.Navigation("ProductTemplates");
611655
});
612656

613-
modelBuilder.Entity("Models.Db.ProductPackTemplate", b =>
614-
{
615-
b.Navigation("Products");
616-
});
617-
618-
modelBuilder.Entity("Models.Db.ProductTemplate", b =>
619-
{
620-
b.Navigation("Ingredients");
621-
});
622-
623657
modelBuilder.Entity("Models.Db.ScheduledWorkSession", b =>
624658
{
625659
b.Navigation("OpenedWorkSessions");

0 commit comments

Comments
 (0)