Ajout client au seed (paul@exemple.com Qwerty123!)

This commit is contained in:
Victor Turgeon 2022-11-07 22:50:41 -05:00
parent a3537c0a0f
commit 53551ea846
4 changed files with 1582 additions and 14 deletions

View File

@ -373,9 +373,13 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
#region Users
// Source: Notre TP Web 4DW.
//RolesID
string AdministrateurID = "c9e08b20-d8a5-473f-9f52-572eb23c12af";
string ClientID = "1b7b9c55-c746-493a-a24f-3d5ca937298e";
//UsersID
string AdminID = "ecf7503a-591c-454e-a824-048e10bd0474";
string PaulID = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09";
InventoryUser admin = new InventoryUser() {
FirstName = "Roger",
@ -387,9 +391,20 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
Email = "admin@admin.com"
};
InventoryUser paul = new InventoryUser() {
FirstName = "Paul",
LastName = "A.",
NormalizedUserName = "PASLA",
UserName = "PasLa",
Id = PaulID,
NormalizedEmail = "PAUL@EXEMPLE.COM",
Email = "paul@exemple.com"
};
admin.PasswordHash = new PasswordHasher<InventoryUser>().HashPassword(admin, "Qwerty123!");
modelBuilder.Entity<InventoryUser>().HasData(admin);
paul.PasswordHash = new PasswordHasher<InventoryUser>().HashPassword(paul, "Qwerty123!");
modelBuilder.Entity<InventoryUser>().HasData(admin, paul);
modelBuilder.Entity<IdentityRole>().HasData(
new IdentityRole { Id = AdministrateurID, Name = "Administrateur", NormalizedName = "ADMINISTRATEUR" },
@ -398,7 +413,8 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
modelBuilder.Entity<IdentityUserRole<string>>().HasData(
new IdentityUserRole<string> { RoleId = AdministrateurID, UserId = AdminID },
new IdentityUserRole<string> { RoleId = ClientID, UserId = AdminID }
new IdentityUserRole<string> { RoleId = ClientID, UserId = AdminID },
new IdentityUserRole<string> { RoleId = ClientID, UserId = PaulID }
);
#endregion
@ -423,6 +439,17 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
PostalCode = "H0H0H0",
Province = "QC",
Country = "Canada",
},
new {
Id = 3,
CivicNumber = 69,
Appartment = "A",
Street = "Rue PSPP",
City = "Saint-Québec",
PostalCode = "H0H0H0",
Province = "QC",
Country = "Canada",
InventoryUserId = PaulID,
}
);
#endregion
@ -495,7 +522,18 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
PurchaseDate = DateTime.Now,
ShippingAddressId = 2,
Status = InvoiceModel.InStates.Confirmed,
}
},
new {
Id = 7,
EmailAddress = "paul@exemple.com",
FirstName = "Paul",
LastName = "A.",
LinkedAccountId = PaulID,
PhoneNumber = "111-111-1111",
PurchaseDate = DateTime.Now,
ShippingAddressId = 3,
Status = InvoiceModel.InStates.Shipping,
}
);
modelBuilder.Entity<InvoiceModel.ProductInvoice>().HasData(
@ -605,6 +643,20 @@ Pikachu is also the starter Pokémon of Pokémon Rumble Blast and Pokémon Rumbl
ProductId = 20,
Quantity = (uint)4,
InvoiceModelId = 6
},
// invoice 7
new {
Id = 17,
ProductId = 1,
Quantity = (uint)1,
InvoiceModelId = 7
},
new {
Id = 18,
ProductId = 15,
Quantity = (uint)2,
InvoiceModelId = 7
}
);
#endregion

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,202 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GrossesMitainesAPI.Migrations
{
public partial class invoiceClient : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "1b7b9c55-c746-493a-a24f-3d5ca937298e",
column: "ConcurrencyStamp",
value: "31012aa2-ebcf-493a-bc1c-2066d47dd333");
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9e08b20-d8a5-473f-9f52-572eb23c12af",
column: "ConcurrencyStamp",
value: "b110abae-bf70-453d-93d4-a3b0d74f9491");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "ecf7503a-591c-454e-a824-048e10bd0474",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "d6f87641-e92e-44f6-a26c-3539ccc0b374", "AQAAAAEAACcQAAAAEGleiGV7pLvmGVcR9JU/Yc8Oo/+8CGFU2ZDvWJnonvm5/XbCOHsIwWHvAB3GCpiZJA==", "719b228c-6b86-4193-b994-365aaf1d19fc" });
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[] { "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", 0, "989931b3-2a7b-44db-8e22-308d2270442c", "paul@exemple.com", false, "Paul", "A.", false, null, "PAUL@EXEMPLE.COM", "PASLA", "AQAAAAEAACcQAAAAEPffpp6X7ztCzWieTbiRInK5P/1AZx6Pdy1tUbTQS5GXLWGcZzhqlzaB8QGlwkJzDw==", null, false, "6bbc335f-1307-40eb-8533-694a608937de", false, "PasLa" });
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 1,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9693));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 2,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9731));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 3,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9733));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 4,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9735));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 5,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9736));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 6,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9738));
migrationBuilder.InsertData(
table: "Addresses",
columns: new[] { "Id", "Appartment", "City", "CivicNumber", "Country", "InventoryUserId", "PostalCode", "Province", "Street" },
values: new object[] { 3, "A", "Saint-Québec", 69, "Canada", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", "H0H0H0", "QC", "Rue PSPP" });
migrationBuilder.InsertData(
table: "AspNetUserRoles",
columns: new[] { "RoleId", "UserId" },
values: new object[] { "1b7b9c55-c746-493a-a24f-3d5ca937298e", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09" });
migrationBuilder.InsertData(
table: "Invoices",
columns: new[] { "Id", "EmailAddress", "FirstName", "LastName", "LinkedAccountId", "PhoneNumber", "PurchaseDate", "ShippingAddressId", "Status" },
values: new object[] { 7, "paul@exemple.com", "Paul", "A.", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", "111-111-1111", new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9740), 3, 3 });
migrationBuilder.InsertData(
table: "ProductInvoice",
columns: new[] { "Id", "InvoiceModelId", "ProductId", "Quantity" },
values: new object[] { 17, 7, 1, 1L });
migrationBuilder.InsertData(
table: "ProductInvoice",
columns: new[] { "Id", "InvoiceModelId", "ProductId", "Quantity" },
values: new object[] { 18, 7, 15, 2L });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "1b7b9c55-c746-493a-a24f-3d5ca937298e", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09" });
migrationBuilder.DeleteData(
table: "ProductInvoice",
keyColumn: "Id",
keyValue: 17);
migrationBuilder.DeleteData(
table: "ProductInvoice",
keyColumn: "Id",
keyValue: 18);
migrationBuilder.DeleteData(
table: "Invoices",
keyColumn: "Id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "Addresses",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "af9178c8-1a02-4ff8-bc0a-c8248dad6e09");
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "1b7b9c55-c746-493a-a24f-3d5ca937298e",
column: "ConcurrencyStamp",
value: "8b05058e-1c97-4021-a485-6987e774c877");
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9e08b20-d8a5-473f-9f52-572eb23c12af",
column: "ConcurrencyStamp",
value: "e5b77c04-830f-4c19-ad44-6c9e5a508efb");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "ecf7503a-591c-454e-a824-048e10bd0474",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "af3a641d-8fe8-45c3-8e36-fdfbef10659a", "AQAAAAEAACcQAAAAEL/k0+c61dX1YPgqHrr6wmVSZNJzoqveJzr8IxjVSSL3W+GSsqOXft+hVLXozCnqVg==", "8ac35276-f8dc-4de4-826f-ea2996e09f2c" });
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 1,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6619));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 2,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6655));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 3,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6658));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 4,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6659));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 5,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6661));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 6,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6663));
}
}
}

View File

@ -101,7 +101,7 @@ namespace GrossesMitainesAPI.Migrations
{
Id = "ecf7503a-591c-454e-a824-048e10bd0474",
AccessFailedCount = 0,
ConcurrencyStamp = "af3a641d-8fe8-45c3-8e36-fdfbef10659a",
ConcurrencyStamp = "d6f87641-e92e-44f6-a26c-3539ccc0b374",
Email = "admin@admin.com",
EmailConfirmed = false,
FirstName = "Roger",
@ -109,11 +109,29 @@ namespace GrossesMitainesAPI.Migrations
LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN",
PasswordHash = "AQAAAAEAACcQAAAAEL/k0+c61dX1YPgqHrr6wmVSZNJzoqveJzr8IxjVSSL3W+GSsqOXft+hVLXozCnqVg==",
PasswordHash = "AQAAAAEAACcQAAAAEGleiGV7pLvmGVcR9JU/Yc8Oo/+8CGFU2ZDvWJnonvm5/XbCOHsIwWHvAB3GCpiZJA==",
PhoneNumberConfirmed = false,
SecurityStamp = "8ac35276-f8dc-4de4-826f-ea2996e09f2c",
SecurityStamp = "719b228c-6b86-4193-b994-365aaf1d19fc",
TwoFactorEnabled = false,
UserName = "Admin"
},
new
{
Id = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
AccessFailedCount = 0,
ConcurrencyStamp = "989931b3-2a7b-44db-8e22-308d2270442c",
Email = "paul@exemple.com",
EmailConfirmed = false,
FirstName = "Paul",
LastName = "A.",
LockoutEnabled = false,
NormalizedEmail = "PAUL@EXEMPLE.COM",
NormalizedUserName = "PASLA",
PasswordHash = "AQAAAAEAACcQAAAAEPffpp6X7ztCzWieTbiRInK5P/1AZx6Pdy1tUbTQS5GXLWGcZzhqlzaB8QGlwkJzDw==",
PhoneNumberConfirmed = false,
SecurityStamp = "6bbc335f-1307-40eb-8533-694a608937de",
TwoFactorEnabled = false,
UserName = "PasLa"
});
});
@ -186,6 +204,18 @@ namespace GrossesMitainesAPI.Migrations
PostalCode = "H0H0H0",
Province = "QC",
Street = "Rue MikeWard"
},
new
{
Id = 3,
Appartment = "A",
City = "Saint-Québec",
CivicNumber = 69,
Country = "Canada",
InventoryUserId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
PostalCode = "H0H0H0",
Province = "QC",
Street = "Rue PSPP"
});
});
@ -244,7 +274,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6619),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9693),
ShippingAddressId = 1,
Status = 0
},
@ -256,7 +286,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6655),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9731),
ShippingAddressId = 1,
Status = 1
},
@ -268,7 +298,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6658),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9733),
ShippingAddressId = 1,
Status = 3
},
@ -280,7 +310,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6659),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9735),
ShippingAddressId = 1,
Status = 4
},
@ -292,7 +322,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6661),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9736),
ShippingAddressId = 1,
Status = 5
},
@ -303,9 +333,21 @@ namespace GrossesMitainesAPI.Migrations
FirstName = "Jérémy",
LastName = "Le Petit",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 35, 25, 783, DateTimeKind.Local).AddTicks(6663),
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9738),
ShippingAddressId = 2,
Status = 0
},
new
{
Id = 7,
EmailAddress = "paul@exemple.com",
FirstName = "Paul",
LastName = "A.",
LinkedAccountId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9740),
ShippingAddressId = 3,
Status = 3
});
});
@ -446,6 +488,20 @@ namespace GrossesMitainesAPI.Migrations
InvoiceModelId = 6,
ProductId = 20,
Quantity = 4L
},
new
{
Id = 17,
InvoiceModelId = 7,
ProductId = 1,
Quantity = 1L
},
new
{
Id = 18,
InvoiceModelId = 7,
ProductId = 15,
Quantity = 2L
});
});
@ -954,14 +1010,14 @@ namespace GrossesMitainesAPI.Migrations
new
{
Id = "c9e08b20-d8a5-473f-9f52-572eb23c12af",
ConcurrencyStamp = "e5b77c04-830f-4c19-ad44-6c9e5a508efb",
ConcurrencyStamp = "b110abae-bf70-453d-93d4-a3b0d74f9491",
Name = "Administrateur",
NormalizedName = "ADMINISTRATEUR"
},
new
{
Id = "1b7b9c55-c746-493a-a24f-3d5ca937298e",
ConcurrencyStamp = "8b05058e-1c97-4021-a485-6987e774c877",
ConcurrencyStamp = "31012aa2-ebcf-493a-bc1c-2066d47dd333",
Name = "Client",
NormalizedName = "CLIENT"
});
@ -1063,6 +1119,11 @@ namespace GrossesMitainesAPI.Migrations
{
UserId = "ecf7503a-591c-454e-a824-048e10bd0474",
RoleId = "1b7b9c55-c746-493a-a24f-3d5ca937298e"
},
new
{
UserId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
RoleId = "1b7b9c55-c746-493a-a24f-3d5ca937298e"
});
});