From 0725e4f7cf4c6f723264b6d461b91c660d144cb7 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 30 Oct 2022 22:40:03 +0700 Subject: feat: Apiwork --- .../20210517202115_InitialMigration.Designer.cs | 2 +- ...10522165932_RenameNoteToDescription.Designer.cs | 2 +- .../20211002113037_V6Migration.Designer.cs | 2 +- .../20220225143559_GithubUserMappings.Designer.cs | 2 +- .../20220319135910_RenameCreated.Designer.cs | 2 +- .../20220319144958_ModifiedAt.Designer.cs | 2 +- .../Migrations/20220319203018_UserBase.Designer.cs | 2 +- .../Migrations/20220320115601_Update1.Designer.cs | 2 +- ...32220_UpdatedForgotPasswordRequests.Designer.cs | 2 +- .../20220529190359_ApiAccessTokens.Designer.cs | 2 +- .../Migrations/20220530174741_Tenants.Designer.cs | 2 +- .../20220530175322_RemoveUnusedNavs.Designer.cs | 2 +- ...02214238_NullableOptionalBaseFields.Designer.cs | 2 +- .../20220606232346_FleshOutNewModules.Designer.cs | 2 +- .../20220616170311_DataProtectionKeys.Designer.cs | 2 +- .../20220819203816_RemoveGithubUsers.Designer.cs | 2 +- ...030080515_InitialProjectAndCustomer.Designer.cs | 1074 ++++++++++++++++++ .../20221030080515_InitialProjectAndCustomer.cs | 304 ++++++ .../20221030081459_DeletedAt.Designer.cs | 1126 +++++++++++++++++++ .../api/src/Migrations/20221030081459_DeletedAt.cs | 146 +++ .../20221030084716_MinorChanges.Designer.cs | 1126 +++++++++++++++++++ .../src/Migrations/20221030084716_MinorChanges.cs | 105 ++ .../20221030090557_MoreMinorChanges.Designer.cs | 1148 ++++++++++++++++++++ .../Migrations/20221030090557_MoreMinorChanges.cs | 78 ++ .../src/Migrations/AppDbContextModelSnapshot.cs | 658 ++++++++++- 25 files changed, 5778 insertions(+), 19 deletions(-) create mode 100644 code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.Designer.cs create mode 100644 code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.cs create mode 100644 code/api/src/Migrations/20221030081459_DeletedAt.Designer.cs create mode 100644 code/api/src/Migrations/20221030081459_DeletedAt.cs create mode 100644 code/api/src/Migrations/20221030084716_MinorChanges.Designer.cs create mode 100644 code/api/src/Migrations/20221030084716_MinorChanges.cs create mode 100644 code/api/src/Migrations/20221030090557_MoreMinorChanges.Designer.cs create mode 100644 code/api/src/Migrations/20221030090557_MoreMinorChanges.cs (limited to 'code/api/src/Migrations') diff --git a/code/api/src/Migrations/20210517202115_InitialMigration.Designer.cs b/code/api/src/Migrations/20210517202115_InitialMigration.Designer.cs index b6a01ff..da3c3ec 100644 --- a/code/api/src/Migrations/20210517202115_InitialMigration.Designer.cs +++ b/code/api/src/Migrations/20210517202115_InitialMigration.Designer.cs @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20210517202115_InitialMigration")] partial class InitialMigration { diff --git a/code/api/src/Migrations/20210522165932_RenameNoteToDescription.Designer.cs b/code/api/src/Migrations/20210522165932_RenameNoteToDescription.Designer.cs index 368e6b3..28408c7 100644 --- a/code/api/src/Migrations/20210522165932_RenameNoteToDescription.Designer.cs +++ b/code/api/src/Migrations/20210522165932_RenameNoteToDescription.Designer.cs @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20210522165932_RenameNoteToDescription")] partial class RenameNoteToDescription { diff --git a/code/api/src/Migrations/20211002113037_V6Migration.Designer.cs b/code/api/src/Migrations/20211002113037_V6Migration.Designer.cs index 59e6112..50f461e 100644 --- a/code/api/src/Migrations/20211002113037_V6Migration.Designer.cs +++ b/code/api/src/Migrations/20211002113037_V6Migration.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20211002113037_V6Migration")] partial class V6Migration { diff --git a/code/api/src/Migrations/20220225143559_GithubUserMappings.Designer.cs b/code/api/src/Migrations/20220225143559_GithubUserMappings.Designer.cs index 2b95f9d..6c59262 100644 --- a/code/api/src/Migrations/20220225143559_GithubUserMappings.Designer.cs +++ b/code/api/src/Migrations/20220225143559_GithubUserMappings.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220225143559_GithubUserMappings")] partial class GithubUserMappings { diff --git a/code/api/src/Migrations/20220319135910_RenameCreated.Designer.cs b/code/api/src/Migrations/20220319135910_RenameCreated.Designer.cs index 3d57f1a..2f96cdc 100644 --- a/code/api/src/Migrations/20220319135910_RenameCreated.Designer.cs +++ b/code/api/src/Migrations/20220319135910_RenameCreated.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220319135910_RenameCreated")] partial class RenameCreated { diff --git a/code/api/src/Migrations/20220319144958_ModifiedAt.Designer.cs b/code/api/src/Migrations/20220319144958_ModifiedAt.Designer.cs index f75400e..349c4ad 100644 --- a/code/api/src/Migrations/20220319144958_ModifiedAt.Designer.cs +++ b/code/api/src/Migrations/20220319144958_ModifiedAt.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220319144958_ModifiedAt")] partial class ModifiedAt { diff --git a/code/api/src/Migrations/20220319203018_UserBase.Designer.cs b/code/api/src/Migrations/20220319203018_UserBase.Designer.cs index 6c7a76f..c918d3d 100644 --- a/code/api/src/Migrations/20220319203018_UserBase.Designer.cs +++ b/code/api/src/Migrations/20220319203018_UserBase.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220319203018_UserBase")] partial class UserBase { diff --git a/code/api/src/Migrations/20220320115601_Update1.Designer.cs b/code/api/src/Migrations/20220320115601_Update1.Designer.cs index c7463fb..3b6a63a 100644 --- a/code/api/src/Migrations/20220320115601_Update1.Designer.cs +++ b/code/api/src/Migrations/20220320115601_Update1.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220320115601_Update1")] partial class Update1 { diff --git a/code/api/src/Migrations/20220320132220_UpdatedForgotPasswordRequests.Designer.cs b/code/api/src/Migrations/20220320132220_UpdatedForgotPasswordRequests.Designer.cs index 3a18463..8dae7c8 100644 --- a/code/api/src/Migrations/20220320132220_UpdatedForgotPasswordRequests.Designer.cs +++ b/code/api/src/Migrations/20220320132220_UpdatedForgotPasswordRequests.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220320132220_UpdatedForgotPasswordRequests")] partial class UpdatedForgotPasswordRequests { diff --git a/code/api/src/Migrations/20220529190359_ApiAccessTokens.Designer.cs b/code/api/src/Migrations/20220529190359_ApiAccessTokens.Designer.cs index 74f9b40..3dc01a7 100644 --- a/code/api/src/Migrations/20220529190359_ApiAccessTokens.Designer.cs +++ b/code/api/src/Migrations/20220529190359_ApiAccessTokens.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220529190359_ApiAccessTokens")] partial class ApiAccessTokens { diff --git a/code/api/src/Migrations/20220530174741_Tenants.Designer.cs b/code/api/src/Migrations/20220530174741_Tenants.Designer.cs index 678c52d..aadbec9 100644 --- a/code/api/src/Migrations/20220530174741_Tenants.Designer.cs +++ b/code/api/src/Migrations/20220530174741_Tenants.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220530174741_Tenants")] partial class Tenants { diff --git a/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.Designer.cs b/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.Designer.cs index 8fd6b40..f87309f 100644 --- a/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.Designer.cs +++ b/code/api/src/Migrations/20220530175322_RemoveUnusedNavs.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220530175322_RemoveUnusedNavs")] partial class RemoveUnusedNavs { diff --git a/code/api/src/Migrations/20220602214238_NullableOptionalBaseFields.Designer.cs b/code/api/src/Migrations/20220602214238_NullableOptionalBaseFields.Designer.cs index a05b0e4..ddbe9d2 100644 --- a/code/api/src/Migrations/20220602214238_NullableOptionalBaseFields.Designer.cs +++ b/code/api/src/Migrations/20220602214238_NullableOptionalBaseFields.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220602214238_NullableOptionalBaseFields")] partial class NullableOptionalBaseFields { diff --git a/code/api/src/Migrations/20220606232346_FleshOutNewModules.Designer.cs b/code/api/src/Migrations/20220606232346_FleshOutNewModules.Designer.cs index 69d4f7e..5c4d3a3 100644 --- a/code/api/src/Migrations/20220606232346_FleshOutNewModules.Designer.cs +++ b/code/api/src/Migrations/20220606232346_FleshOutNewModules.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220606232346_FleshOutNewModules")] partial class FleshOutNewModules { diff --git a/code/api/src/Migrations/20220616170311_DataProtectionKeys.Designer.cs b/code/api/src/Migrations/20220616170311_DataProtectionKeys.Designer.cs index b333f23..b89e68d 100644 --- a/code/api/src/Migrations/20220616170311_DataProtectionKeys.Designer.cs +++ b/code/api/src/Migrations/20220616170311_DataProtectionKeys.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220616170311_DataProtectionKeys")] partial class DataProtectionKeys { diff --git a/code/api/src/Migrations/20220819203816_RemoveGithubUsers.Designer.cs b/code/api/src/Migrations/20220819203816_RemoveGithubUsers.Designer.cs index 33b5cfd..0ba742c 100644 --- a/code/api/src/Migrations/20220819203816_RemoveGithubUsers.Designer.cs +++ b/code/api/src/Migrations/20220819203816_RemoveGithubUsers.Designer.cs @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] [Migration("20220819203816_RemoveGithubUsers")] partial class RemoveGithubUsers { diff --git a/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.Designer.cs b/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.Designer.cs new file mode 100644 index 0000000..284ea89 --- /dev/null +++ b/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.Designer.cs @@ -0,0 +1,1074 @@ +// +using System; +using IOL.GreatOffice.Api.Data.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + [DbContext(typeof(MainAppDatabase))] + [Migration("20221030080515_InitialProjectAndCustomer")] + partial class InitialProjectAndCustomer + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("GroupsId") + .HasColumnType("uuid") + .HasColumnName("groups_id"); + + b.HasKey("CustomersId", "GroupsId") + .HasName("pk_customer_customer_group"); + + b.HasIndex("GroupsId") + .HasDatabaseName("ix_customer_customer_group_groups_id"); + + b.ToTable("customer_customer_group", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AllowCreate") + .HasColumnType("boolean") + .HasColumnName("allow_create"); + + b.Property("AllowDelete") + .HasColumnType("boolean") + .HasColumnName("allow_delete"); + + b.Property("AllowRead") + .HasColumnType("boolean") + .HasColumnName("allow_read"); + + b.Property("AllowUpdate") + .HasColumnType("boolean") + .HasColumnName("allow_update"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_api_access_tokens"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_api_access_tokens_user_id"); + + b.ToTable("api_access_tokens", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Address1") + .HasColumnType("text") + .HasColumnName("address1"); + + b.Property("Address2") + .HasColumnType("text") + .HasColumnName("address2"); + + b.Property("Country") + .HasColumnType("text") + .HasColumnName("country"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("CustomerNumber") + .HasColumnType("text") + .HasColumnName("customer_number"); + + b.Property("DefaultReference") + .HasColumnType("text") + .HasColumnName("default_reference"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ORGNumber") + .HasColumnType("text") + .HasColumnName("org_number"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("PostalCity") + .HasColumnType("text") + .HasColumnName("postal_city"); + + b.Property("PostalCode") + .HasColumnType("text") + .HasColumnName("postal_code"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("VATNumber") + .HasColumnType("text") + .HasColumnName("vat_number"); + + b.Property("Website") + .HasColumnType("text") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_customers_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_customers_user_id"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("WorkTitle") + .HasColumnType("text") + .HasColumnName("work_title"); + + b.HasKey("Id") + .HasName("pk_customer_contacts"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_contacts_customer_id"); + + b.ToTable("customer_contacts", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("Title") + .HasColumnType("text") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_events"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_events_customer_id"); + + b.ToTable("customer_events", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_groups"); + + b.ToTable("customer_groups", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_forgot_password_requests"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_forgot_password_requests_user_id"); + + b.ToTable("forgot_password_requests", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_projects"); + + b.ToTable("projects", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("Id") + .HasName("pk_project_labels"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_labels_project_id"); + + b.ToTable("project_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_project_member"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_member_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_project_member_user_id"); + + b.ToTable("project_member", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("MasterUserId") + .HasColumnType("uuid") + .HasColumnName("master_user_id"); + + b.Property("MasterUserPassword") + .HasColumnType("text") + .HasColumnName("master_user_password"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_tenants"); + + b.ToTable("tenants", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_categories"); + + b.ToTable("time_categories", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CategoryId") + .HasColumnType("uuid") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_entries"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_time_entries_category_id"); + + b.ToTable("time_entries", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("TimeEntryId") + .HasColumnType("uuid") + .HasColumnName("time_entry_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_labels"); + + b.HasIndex("TimeEntryId") + .HasDatabaseName("ix_time_labels_time_entry_id"); + + b.ToTable("time_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Password") + .HasColumnType("text") + .HasColumnName("password"); + + b.Property("Username") + .HasColumnType("text") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text") + .HasColumnName("friendly_name"); + + b.Property("Xml") + .HasColumnType("text") + .HasColumnName("xml"); + + b.HasKey("Id") + .HasName("pk_data_protection_keys"); + + b.ToTable("data_protection_keys", (string)null); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.Property("TenantsId") + .HasColumnType("uuid") + .HasColumnName("tenants_id"); + + b.Property("UsersId") + .HasColumnType("uuid") + .HasColumnName("users_id"); + + b.HasKey("TenantsId", "UsersId") + .HasName("pk_tenant_user"); + + b.HasIndex("UsersId") + .HasDatabaseName("ix_tenant_user_users_id"); + + b.ToTable("tenant_user", (string)null); + }); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.CustomerGroup", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customer_groups_groups_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_api_access_tokens_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", null) + .WithMany("Customers") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_customers_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "Owner") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_customers_users_user_id"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_contacts_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Events") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_events_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forgot_password_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Labels") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_labels_projects_project_id"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Members") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_member_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_project_member_users_user_id"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .HasConstraintName("fk_time_entries_time_categories_category_id"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeEntry", null) + .WithMany("Labels") + .HasForeignKey("TimeEntryId") + .HasConstraintName("fk_time_labels_time_entries_time_entry_id"); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Tenant", null) + .WithMany() + .HasForeignKey("TenantsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_tenants_tenants_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_users_users_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Events"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Navigation("Customers"); + + b.Navigation("Labels"); + + b.Navigation("Members"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Navigation("Labels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.cs b/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.cs new file mode 100644 index 0000000..8a856cb --- /dev/null +++ b/code/api/src/Migrations/20221030080515_InitialProjectAndCustomer.cs @@ -0,0 +1,304 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + public partial class InitialProjectAndCustomer : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "customer_groups", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + name = table.Column(type: "text", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_groups", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "projects", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + name = table.Column(type: "text", nullable: true), + description = table.Column(type: "text", nullable: true), + start = table.Column(type: "timestamp with time zone", nullable: true), + stop = table.Column(type: "timestamp with time zone", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_projects", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "customers", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + customer_number = table.Column(type: "text", nullable: true), + name = table.Column(type: "text", nullable: true), + description = table.Column(type: "text", nullable: true), + address1 = table.Column(type: "text", nullable: true), + address2 = table.Column(type: "text", nullable: true), + postal_code = table.Column(type: "text", nullable: true), + postal_city = table.Column(type: "text", nullable: true), + country = table.Column(type: "text", nullable: true), + phone = table.Column(type: "text", nullable: true), + email = table.Column(type: "text", nullable: true), + vat_number = table.Column(type: "text", nullable: true), + org_number = table.Column(type: "text", nullable: true), + default_reference = table.Column(type: "text", nullable: true), + website = table.Column(type: "text", nullable: true), + currency = table.Column(type: "text", nullable: true), + project_id = table.Column(type: "uuid", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_customers", x => x.id); + table.ForeignKey( + name: "fk_customers_projects_project_id", + column: x => x.project_id, + principalTable: "projects", + principalColumn: "id"); + table.ForeignKey( + name: "fk_customers_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "project_labels", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + value = table.Column(type: "text", nullable: true), + color = table.Column(type: "text", nullable: true), + project_id = table.Column(type: "uuid", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_project_labels", x => x.id); + table.ForeignKey( + name: "fk_project_labels_projects_project_id", + column: x => x.project_id, + principalTable: "projects", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "project_member", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + project_id = table.Column(type: "uuid", nullable: true), + user_id = table.Column(type: "uuid", nullable: true), + role = table.Column(type: "integer", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_project_member", x => x.id); + table.ForeignKey( + name: "fk_project_member_projects_project_id", + column: x => x.project_id, + principalTable: "projects", + principalColumn: "id"); + table.ForeignKey( + name: "fk_project_member_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "customer_contacts", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + customer_id = table.Column(type: "uuid", nullable: true), + first_name = table.Column(type: "text", nullable: true), + last_name = table.Column(type: "text", nullable: true), + email = table.Column(type: "text", nullable: true), + phone = table.Column(type: "text", nullable: true), + work_title = table.Column(type: "text", nullable: true), + note = table.Column(type: "text", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_contacts", x => x.id); + table.ForeignKey( + name: "fk_customer_contacts_customers_customer_id", + column: x => x.customer_id, + principalTable: "customers", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "customer_customer_group", + columns: table => new + { + customers_id = table.Column(type: "uuid", nullable: false), + groups_id = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_customer_group", x => new { x.customers_id, x.groups_id }); + table.ForeignKey( + name: "fk_customer_customer_group_customer_groups_groups_id", + column: x => x.groups_id, + principalTable: "customer_groups", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_customer_customer_group_customers_customers_id", + column: x => x.customers_id, + principalTable: "customers", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "customer_events", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + customer_id = table.Column(type: "uuid", nullable: true), + title = table.Column(type: "text", nullable: true), + note = table.Column(type: "text", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + deleted = table.Column(type: "boolean", nullable: false), + user_id = table.Column(type: "uuid", nullable: true), + tenant_id = table.Column(type: "uuid", nullable: true), + modified_by_id = table.Column(type: "uuid", nullable: true), + created_by_id = table.Column(type: "uuid", nullable: true), + deleted_by_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_events", x => x.id); + table.ForeignKey( + name: "fk_customer_events_customers_customer_id", + column: x => x.customer_id, + principalTable: "customers", + principalColumn: "id"); + }); + + migrationBuilder.CreateIndex( + name: "ix_customer_contacts_customer_id", + table: "customer_contacts", + column: "customer_id"); + + migrationBuilder.CreateIndex( + name: "ix_customer_customer_group_groups_id", + table: "customer_customer_group", + column: "groups_id"); + + migrationBuilder.CreateIndex( + name: "ix_customer_events_customer_id", + table: "customer_events", + column: "customer_id"); + + migrationBuilder.CreateIndex( + name: "ix_customers_project_id", + table: "customers", + column: "project_id"); + + migrationBuilder.CreateIndex( + name: "ix_customers_user_id", + table: "customers", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_project_labels_project_id", + table: "project_labels", + column: "project_id"); + + migrationBuilder.CreateIndex( + name: "ix_project_member_project_id", + table: "project_member", + column: "project_id"); + + migrationBuilder.CreateIndex( + name: "ix_project_member_user_id", + table: "project_member", + column: "user_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "customer_contacts"); + + migrationBuilder.DropTable( + name: "customer_customer_group"); + + migrationBuilder.DropTable( + name: "customer_events"); + + migrationBuilder.DropTable( + name: "project_labels"); + + migrationBuilder.DropTable( + name: "project_member"); + + migrationBuilder.DropTable( + name: "customer_groups"); + + migrationBuilder.DropTable( + name: "customers"); + + migrationBuilder.DropTable( + name: "projects"); + } + } +} diff --git a/code/api/src/Migrations/20221030081459_DeletedAt.Designer.cs b/code/api/src/Migrations/20221030081459_DeletedAt.Designer.cs new file mode 100644 index 0000000..78f9454 --- /dev/null +++ b/code/api/src/Migrations/20221030081459_DeletedAt.Designer.cs @@ -0,0 +1,1126 @@ +// +using System; +using IOL.GreatOffice.Api.Data.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + [DbContext(typeof(MainAppDatabase))] + [Migration("20221030081459_DeletedAt")] + partial class DeletedAt + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("GroupsId") + .HasColumnType("uuid") + .HasColumnName("groups_id"); + + b.HasKey("CustomersId", "GroupsId") + .HasName("pk_customer_customer_group"); + + b.HasIndex("GroupsId") + .HasDatabaseName("ix_customer_customer_group_groups_id"); + + b.ToTable("customer_customer_group", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AllowCreate") + .HasColumnType("boolean") + .HasColumnName("allow_create"); + + b.Property("AllowDelete") + .HasColumnType("boolean") + .HasColumnName("allow_delete"); + + b.Property("AllowRead") + .HasColumnType("boolean") + .HasColumnName("allow_read"); + + b.Property("AllowUpdate") + .HasColumnType("boolean") + .HasColumnName("allow_update"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_api_access_tokens"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_api_access_tokens_user_id"); + + b.ToTable("api_access_tokens", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Address1") + .HasColumnType("text") + .HasColumnName("address1"); + + b.Property("Address2") + .HasColumnType("text") + .HasColumnName("address2"); + + b.Property("Country") + .HasColumnType("text") + .HasColumnName("country"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("CustomerNumber") + .HasColumnType("text") + .HasColumnName("customer_number"); + + b.Property("DefaultReference") + .HasColumnType("text") + .HasColumnName("default_reference"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ORGNumber") + .HasColumnType("text") + .HasColumnName("org_number"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("PostalCity") + .HasColumnType("text") + .HasColumnName("postal_city"); + + b.Property("PostalCode") + .HasColumnType("text") + .HasColumnName("postal_code"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("VATNumber") + .HasColumnType("text") + .HasColumnName("vat_number"); + + b.Property("Website") + .HasColumnType("text") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_customers_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_customers_user_id"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("WorkTitle") + .HasColumnType("text") + .HasColumnName("work_title"); + + b.HasKey("Id") + .HasName("pk_customer_contacts"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_contacts_customer_id"); + + b.ToTable("customer_contacts", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("Title") + .HasColumnType("text") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_events"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_events_customer_id"); + + b.ToTable("customer_events", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_groups"); + + b.ToTable("customer_groups", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_forgot_password_requests"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_forgot_password_requests_user_id"); + + b.ToTable("forgot_password_requests", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_projects"); + + b.ToTable("projects", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("Id") + .HasName("pk_project_labels"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_labels_project_id"); + + b.ToTable("project_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_project_member"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_member_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_project_member_user_id"); + + b.ToTable("project_member", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("MasterUserId") + .HasColumnType("uuid") + .HasColumnName("master_user_id"); + + b.Property("MasterUserPassword") + .HasColumnType("text") + .HasColumnName("master_user_password"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_tenants"); + + b.ToTable("tenants", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_categories"); + + b.ToTable("time_categories", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CategoryId") + .HasColumnType("uuid") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_entries"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_time_entries_category_id"); + + b.ToTable("time_entries", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("TimeEntryId") + .HasColumnType("uuid") + .HasColumnName("time_entry_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_labels"); + + b.HasIndex("TimeEntryId") + .HasDatabaseName("ix_time_labels_time_entry_id"); + + b.ToTable("time_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Password") + .HasColumnType("text") + .HasColumnName("password"); + + b.Property("Username") + .HasColumnType("text") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text") + .HasColumnName("friendly_name"); + + b.Property("Xml") + .HasColumnType("text") + .HasColumnName("xml"); + + b.HasKey("Id") + .HasName("pk_data_protection_keys"); + + b.ToTable("data_protection_keys", (string)null); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.Property("TenantsId") + .HasColumnType("uuid") + .HasColumnName("tenants_id"); + + b.Property("UsersId") + .HasColumnType("uuid") + .HasColumnName("users_id"); + + b.HasKey("TenantsId", "UsersId") + .HasName("pk_tenant_user"); + + b.HasIndex("UsersId") + .HasDatabaseName("ix_tenant_user_users_id"); + + b.ToTable("tenant_user", (string)null); + }); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.CustomerGroup", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customer_groups_groups_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_api_access_tokens_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", null) + .WithMany("Customers") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_customers_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "Owner") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_customers_users_user_id"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_contacts_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Events") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_events_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forgot_password_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Labels") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_labels_projects_project_id"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Members") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_member_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_project_member_users_user_id"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .HasConstraintName("fk_time_entries_time_categories_category_id"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeEntry", null) + .WithMany("Labels") + .HasForeignKey("TimeEntryId") + .HasConstraintName("fk_time_labels_time_entries_time_entry_id"); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Tenant", null) + .WithMany() + .HasForeignKey("TenantsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_tenants_tenants_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_users_users_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Events"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Navigation("Customers"); + + b.Navigation("Labels"); + + b.Navigation("Members"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Navigation("Labels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/code/api/src/Migrations/20221030081459_DeletedAt.cs b/code/api/src/Migrations/20221030081459_DeletedAt.cs new file mode 100644 index 0000000..8132a6b --- /dev/null +++ b/code/api/src/Migrations/20221030081459_DeletedAt.cs @@ -0,0 +1,146 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + public partial class DeletedAt : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "deleted_at", + table: "users", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "time_labels", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "time_entries", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "time_categories", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "tenants", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "projects", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "project_member", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "project_labels", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "customers", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "customer_groups", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "customer_events", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "customer_contacts", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "deleted_at", + table: "api_access_tokens", + type: "timestamp with time zone", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "deleted_at", + table: "users"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "time_labels"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "time_entries"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "time_categories"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "tenants"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "projects"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "project_member"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "project_labels"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "customers"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "customer_groups"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "customer_events"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "customer_contacts"); + + migrationBuilder.DropColumn( + name: "deleted_at", + table: "api_access_tokens"); + } + } +} diff --git a/code/api/src/Migrations/20221030084716_MinorChanges.Designer.cs b/code/api/src/Migrations/20221030084716_MinorChanges.Designer.cs new file mode 100644 index 0000000..1527d91 --- /dev/null +++ b/code/api/src/Migrations/20221030084716_MinorChanges.Designer.cs @@ -0,0 +1,1126 @@ +// +using System; +using IOL.GreatOffice.Api.Data.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + [DbContext(typeof(MainAppDatabase))] + [Migration("20221030084716_MinorChanges")] + partial class MinorChanges + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("GroupsId") + .HasColumnType("uuid") + .HasColumnName("groups_id"); + + b.HasKey("CustomersId", "GroupsId") + .HasName("pk_customer_customer_group"); + + b.HasIndex("GroupsId") + .HasDatabaseName("ix_customer_customer_group_groups_id"); + + b.ToTable("customer_customer_group", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AllowCreate") + .HasColumnType("boolean") + .HasColumnName("allow_create"); + + b.Property("AllowDelete") + .HasColumnType("boolean") + .HasColumnName("allow_delete"); + + b.Property("AllowRead") + .HasColumnType("boolean") + .HasColumnName("allow_read"); + + b.Property("AllowUpdate") + .HasColumnType("boolean") + .HasColumnName("allow_update"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_api_access_tokens"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_api_access_tokens_user_id"); + + b.ToTable("api_access_tokens", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Address1") + .HasColumnType("text") + .HasColumnName("address1"); + + b.Property("Address2") + .HasColumnType("text") + .HasColumnName("address2"); + + b.Property("Country") + .HasColumnType("text") + .HasColumnName("country"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("CustomerNumber") + .HasColumnType("text") + .HasColumnName("customer_number"); + + b.Property("DefaultReference") + .HasColumnType("text") + .HasColumnName("default_reference"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ORGNumber") + .HasColumnType("text") + .HasColumnName("org_number"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("PostalCity") + .HasColumnType("text") + .HasColumnName("postal_city"); + + b.Property("PostalCode") + .HasColumnType("text") + .HasColumnName("postal_code"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("VATNumber") + .HasColumnType("text") + .HasColumnName("vat_number"); + + b.Property("Website") + .HasColumnType("text") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_customers_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_customers_user_id"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("WorkTitle") + .HasColumnType("text") + .HasColumnName("work_title"); + + b.HasKey("Id") + .HasName("pk_customer_contacts"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_contacts_customer_id"); + + b.ToTable("customer_contacts", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("Title") + .HasColumnType("text") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_events"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_events_customer_id"); + + b.ToTable("customer_events", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_groups"); + + b.ToTable("customer_groups", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_forgot_password_requests"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_forgot_password_requests_user_id"); + + b.ToTable("forgot_password_requests", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_projects"); + + b.ToTable("projects", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("Id") + .HasName("pk_project_labels"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_labels_project_id"); + + b.ToTable("project_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_project_members"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_members_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_project_members_user_id"); + + b.ToTable("project_members", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("MasterUserId") + .HasColumnType("uuid") + .HasColumnName("master_user_id"); + + b.Property("MasterUserPassword") + .HasColumnType("text") + .HasColumnName("master_user_password"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_tenants"); + + b.ToTable("tenants", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_categories"); + + b.ToTable("time_categories", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CategoryId") + .HasColumnType("uuid") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_entries"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_time_entries_category_id"); + + b.ToTable("time_entries", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("TimeEntryId") + .HasColumnType("uuid") + .HasColumnName("time_entry_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_labels"); + + b.HasIndex("TimeEntryId") + .HasDatabaseName("ix_time_labels_time_entry_id"); + + b.ToTable("time_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Password") + .HasColumnType("text") + .HasColumnName("password"); + + b.Property("Username") + .HasColumnType("text") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text") + .HasColumnName("friendly_name"); + + b.Property("Xml") + .HasColumnType("text") + .HasColumnName("xml"); + + b.HasKey("Id") + .HasName("pk_data_protection_keys"); + + b.ToTable("data_protection_keys", (string)null); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.Property("TenantsId") + .HasColumnType("uuid") + .HasColumnName("tenants_id"); + + b.Property("UsersId") + .HasColumnType("uuid") + .HasColumnName("users_id"); + + b.HasKey("TenantsId", "UsersId") + .HasName("pk_tenant_user"); + + b.HasIndex("UsersId") + .HasDatabaseName("ix_tenant_user_users_id"); + + b.ToTable("tenant_user", (string)null); + }); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.CustomerGroup", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customer_groups_groups_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_api_access_tokens_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", null) + .WithMany("Customers") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_customers_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "Owner") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_customers_users_user_id"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_contacts_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Events") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_events_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forgot_password_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Labels") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_labels_projects_project_id"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Members") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_members_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_project_members_users_user_id"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .HasConstraintName("fk_time_entries_time_categories_category_id"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeEntry", null) + .WithMany("Labels") + .HasForeignKey("TimeEntryId") + .HasConstraintName("fk_time_labels_time_entries_time_entry_id"); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Tenant", null) + .WithMany() + .HasForeignKey("TenantsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_tenants_tenants_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_users_users_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Events"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Navigation("Customers"); + + b.Navigation("Labels"); + + b.Navigation("Members"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Navigation("Labels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/code/api/src/Migrations/20221030084716_MinorChanges.cs b/code/api/src/Migrations/20221030084716_MinorChanges.cs new file mode 100644 index 0000000..e708caf --- /dev/null +++ b/code/api/src/Migrations/20221030084716_MinorChanges.cs @@ -0,0 +1,105 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + public partial class MinorChanges : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_project_member_projects_project_id", + table: "project_member"); + + migrationBuilder.DropForeignKey( + name: "fk_project_member_users_user_id", + table: "project_member"); + + migrationBuilder.DropPrimaryKey( + name: "pk_project_member", + table: "project_member"); + + migrationBuilder.RenameTable( + name: "project_member", + newName: "project_members"); + + migrationBuilder.RenameIndex( + name: "ix_project_member_user_id", + table: "project_members", + newName: "ix_project_members_user_id"); + + migrationBuilder.RenameIndex( + name: "ix_project_member_project_id", + table: "project_members", + newName: "ix_project_members_project_id"); + + migrationBuilder.AddPrimaryKey( + name: "pk_project_members", + table: "project_members", + column: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_project_members_projects_project_id", + table: "project_members", + column: "project_id", + principalTable: "projects", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_project_members_users_user_id", + table: "project_members", + column: "user_id", + principalTable: "users", + principalColumn: "id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_project_members_projects_project_id", + table: "project_members"); + + migrationBuilder.DropForeignKey( + name: "fk_project_members_users_user_id", + table: "project_members"); + + migrationBuilder.DropPrimaryKey( + name: "pk_project_members", + table: "project_members"); + + migrationBuilder.RenameTable( + name: "project_members", + newName: "project_member"); + + migrationBuilder.RenameIndex( + name: "ix_project_members_user_id", + table: "project_member", + newName: "ix_project_member_user_id"); + + migrationBuilder.RenameIndex( + name: "ix_project_members_project_id", + table: "project_member", + newName: "ix_project_member_project_id"); + + migrationBuilder.AddPrimaryKey( + name: "pk_project_member", + table: "project_member", + column: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_project_member_projects_project_id", + table: "project_member", + column: "project_id", + principalTable: "projects", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_project_member_users_user_id", + table: "project_member", + column: "user_id", + principalTable: "users", + principalColumn: "id"); + } + } +} diff --git a/code/api/src/Migrations/20221030090557_MoreMinorChanges.Designer.cs b/code/api/src/Migrations/20221030090557_MoreMinorChanges.Designer.cs new file mode 100644 index 0000000..ff1dfb2 --- /dev/null +++ b/code/api/src/Migrations/20221030090557_MoreMinorChanges.Designer.cs @@ -0,0 +1,1148 @@ +// +using System; +using IOL.GreatOffice.Api.Data.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + [DbContext(typeof(MainAppDatabase))] + [Migration("20221030090557_MoreMinorChanges")] + partial class MoreMinorChanges + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("GroupsId") + .HasColumnType("uuid") + .HasColumnName("groups_id"); + + b.HasKey("CustomersId", "GroupsId") + .HasName("pk_customer_customer_group"); + + b.HasIndex("GroupsId") + .HasDatabaseName("ix_customer_customer_group_groups_id"); + + b.ToTable("customer_customer_group", (string)null); + }); + + modelBuilder.Entity("CustomerProject", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("ProjectsId") + .HasColumnType("uuid") + .HasColumnName("projects_id"); + + b.HasKey("CustomersId", "ProjectsId") + .HasName("pk_customer_project"); + + b.HasIndex("ProjectsId") + .HasDatabaseName("ix_customer_project_projects_id"); + + b.ToTable("customer_project", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("AllowCreate") + .HasColumnType("boolean") + .HasColumnName("allow_create"); + + b.Property("AllowDelete") + .HasColumnType("boolean") + .HasColumnName("allow_delete"); + + b.Property("AllowRead") + .HasColumnType("boolean") + .HasColumnName("allow_read"); + + b.Property("AllowUpdate") + .HasColumnType("boolean") + .HasColumnName("allow_update"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("expiry_date"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_api_access_tokens"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_api_access_tokens_user_id"); + + b.ToTable("api_access_tokens", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Address1") + .HasColumnType("text") + .HasColumnName("address1"); + + b.Property("Address2") + .HasColumnType("text") + .HasColumnName("address2"); + + b.Property("Country") + .HasColumnType("text") + .HasColumnName("country"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("CustomerNumber") + .HasColumnType("text") + .HasColumnName("customer_number"); + + b.Property("DefaultReference") + .HasColumnType("text") + .HasColumnName("default_reference"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ORGNumber") + .HasColumnType("text") + .HasColumnName("org_number"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("PostalCity") + .HasColumnType("text") + .HasColumnName("postal_city"); + + b.Property("PostalCode") + .HasColumnType("text") + .HasColumnName("postal_code"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("VATNumber") + .HasColumnType("text") + .HasColumnName("vat_number"); + + b.Property("Website") + .HasColumnType("text") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_customers_user_id"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("WorkTitle") + .HasColumnType("text") + .HasColumnName("work_title"); + + b.HasKey("Id") + .HasName("pk_customer_contacts"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_contacts_customer_id"); + + b.ToTable("customer_contacts", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("Title") + .HasColumnType("text") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_events"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_events_customer_id"); + + b.ToTable("customer_events", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_groups"); + + b.ToTable("customer_groups", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_forgot_password_requests"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_forgot_password_requests_user_id"); + + b.ToTable("forgot_password_requests", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_projects"); + + b.ToTable("projects", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("Id") + .HasName("pk_project_labels"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_labels_project_id"); + + b.ToTable("project_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_project_members"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_members_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_project_members_user_id"); + + b.ToTable("project_members", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ContactEmail") + .HasColumnType("text") + .HasColumnName("contact_email"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("MasterUserId") + .HasColumnType("uuid") + .HasColumnName("master_user_id"); + + b.Property("MasterUserPassword") + .HasColumnType("text") + .HasColumnName("master_user_password"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_tenants"); + + b.ToTable("tenants", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_categories"); + + b.ToTable("time_categories", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CategoryId") + .HasColumnType("uuid") + .HasColumnName("category_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_entries"); + + b.HasIndex("CategoryId") + .HasDatabaseName("ix_time_entries_category_id"); + + b.ToTable("time_entries", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("TimeEntryId") + .HasColumnType("uuid") + .HasColumnName("time_entry_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_time_labels"); + + b.HasIndex("TimeEntryId") + .HasDatabaseName("ix_time_labels_time_entry_id"); + + b.ToTable("time_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Password") + .HasColumnType("text") + .HasColumnName("password"); + + b.Property("Username") + .HasColumnType("text") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text") + .HasColumnName("friendly_name"); + + b.Property("Xml") + .HasColumnType("text") + .HasColumnName("xml"); + + b.HasKey("Id") + .HasName("pk_data_protection_keys"); + + b.ToTable("data_protection_keys", (string)null); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.Property("TenantsId") + .HasColumnType("uuid") + .HasColumnName("tenants_id"); + + b.Property("UsersId") + .HasColumnType("uuid") + .HasColumnName("users_id"); + + b.HasKey("TenantsId", "UsersId") + .HasName("pk_tenant_user"); + + b.HasIndex("UsersId") + .HasDatabaseName("ix_tenant_user_users_id"); + + b.ToTable("tenant_user", (string)null); + }); + + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.CustomerGroup", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customer_groups_groups_id"); + }); + + modelBuilder.Entity("CustomerProject", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_project_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", null) + .WithMany() + .HasForeignKey("ProjectsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_project_projects_projects_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_api_access_tokens_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "Owner") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_customers_users_user_id"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_contacts_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Events") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_events_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_forgot_password_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Labels") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_labels_projects_project_id"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Members") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_members_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_project_members_users_user_id"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .HasConstraintName("fk_time_entries_time_categories_category_id"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeEntry", null) + .WithMany("Labels") + .HasForeignKey("TimeEntryId") + .HasConstraintName("fk_time_labels_time_entries_time_entry_id"); + }); + + modelBuilder.Entity("TenantUser", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Tenant", null) + .WithMany() + .HasForeignKey("TenantsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_tenants_tenants_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", null) + .WithMany() + .HasForeignKey("UsersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_tenant_user_users_users_id"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Events"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Navigation("Labels"); + + b.Navigation("Members"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => + { + b.Navigation("Labels"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs b/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs new file mode 100644 index 0000000..5ebd664 --- /dev/null +++ b/code/api/src/Migrations/20221030090557_MoreMinorChanges.cs @@ -0,0 +1,78 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IOL.GreatOffice.Api.Migrations +{ + public partial class MoreMinorChanges : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_customers_projects_project_id", + table: "customers"); + + migrationBuilder.DropIndex( + name: "ix_customers_project_id", + table: "customers"); + + migrationBuilder.DropColumn( + name: "project_id", + table: "customers"); + + migrationBuilder.CreateTable( + name: "customer_project", + columns: table => new + { + customers_id = table.Column(type: "uuid", nullable: false), + projects_id = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_customer_project", x => new { x.customers_id, x.projects_id }); + table.ForeignKey( + name: "fk_customer_project_customers_customers_id", + column: x => x.customers_id, + principalTable: "customers", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_customer_project_projects_projects_id", + column: x => x.projects_id, + principalTable: "projects", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "ix_customer_project_projects_id", + table: "customer_project", + column: "projects_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "customer_project"); + + migrationBuilder.AddColumn( + name: "project_id", + table: "customers", + type: "uuid", + nullable: true); + + migrationBuilder.CreateIndex( + name: "ix_customers_project_id", + table: "customers", + column: "project_id"); + + migrationBuilder.AddForeignKey( + name: "fk_customers_projects_project_id", + table: "customers", + column: "project_id", + principalTable: "projects", + principalColumn: "id"); + } + } +} diff --git a/code/api/src/Migrations/AppDbContextModelSnapshot.cs b/code/api/src/Migrations/AppDbContextModelSnapshot.cs index cc4bf72..7a534ad 100644 --- a/code/api/src/Migrations/AppDbContextModelSnapshot.cs +++ b/code/api/src/Migrations/AppDbContextModelSnapshot.cs @@ -1,6 +1,6 @@ // using System; -using IOL.GreatOffice.Api.Data; +using IOL.GreatOffice.Api.Data.Database; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -10,18 +10,56 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace IOL.GreatOffice.Api.Migrations { - [DbContext(typeof(AppDbContext))] + [DbContext(typeof(MainAppDatabase))] partial class AppDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.7") + .HasAnnotation("ProductVersion", "6.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("GroupsId") + .HasColumnType("uuid") + .HasColumnName("groups_id"); + + b.HasKey("CustomersId", "GroupsId") + .HasName("pk_customer_customer_group"); + + b.HasIndex("GroupsId") + .HasDatabaseName("ix_customer_customer_group_groups_id"); + + b.ToTable("customer_customer_group", (string)null); + }); + + modelBuilder.Entity("CustomerProject", b => + { + b.Property("CustomersId") + .HasColumnType("uuid") + .HasColumnName("customers_id"); + + b.Property("ProjectsId") + .HasColumnType("uuid") + .HasColumnName("projects_id"); + + b.HasKey("CustomersId", "ProjectsId") + .HasName("pk_customer_project"); + + b.HasIndex("ProjectsId") + .HasDatabaseName("ix_customer_project_projects_id"); + + b.ToTable("customer_project", (string)null); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => { b.Property("Id") @@ -53,6 +91,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("ExpiryDate") .HasColumnType("timestamp with time zone") .HasColumnName("expiry_date"); @@ -74,6 +116,315 @@ namespace IOL.GreatOffice.Api.Migrations b.ToTable("api_access_tokens", (string)null); }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Address1") + .HasColumnType("text") + .HasColumnName("address1"); + + b.Property("Address2") + .HasColumnType("text") + .HasColumnName("address2"); + + b.Property("Country") + .HasColumnType("text") + .HasColumnName("country"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("CustomerNumber") + .HasColumnType("text") + .HasColumnName("customer_number"); + + b.Property("DefaultReference") + .HasColumnType("text") + .HasColumnName("default_reference"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("ORGNumber") + .HasColumnType("text") + .HasColumnName("org_number"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("PostalCity") + .HasColumnType("text") + .HasColumnName("postal_city"); + + b.Property("PostalCode") + .HasColumnType("text") + .HasColumnName("postal_code"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("VATNumber") + .HasColumnType("text") + .HasColumnName("vat_number"); + + b.Property("Website") + .HasColumnType("text") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_customers_user_id"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Email") + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("FirstName") + .HasColumnType("text") + .HasColumnName("first_name"); + + b.Property("LastName") + .HasColumnType("text") + .HasColumnName("last_name"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("Phone") + .HasColumnType("text") + .HasColumnName("phone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("WorkTitle") + .HasColumnType("text") + .HasColumnName("work_title"); + + b.HasKey("Id") + .HasName("pk_customer_contacts"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_contacts_customer_id"); + + b.ToTable("customer_contacts", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("CustomerId") + .HasColumnType("uuid") + .HasColumnName("customer_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Note") + .HasColumnType("text") + .HasColumnName("note"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("Title") + .HasColumnType("text") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_events"); + + b.HasIndex("CustomerId") + .HasDatabaseName("ix_customer_events_customer_id"); + + b.ToTable("customer_events", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_customer_groups"); + + b.ToTable("customer_groups", (string)null); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => { b.Property("Id") @@ -98,6 +449,182 @@ namespace IOL.GreatOffice.Api.Migrations b.ToTable("forgot_password_requests", (string)null); }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Start") + .HasColumnType("timestamp with time zone") + .HasColumnName("start"); + + b.Property("Stop") + .HasColumnType("timestamp with time zone") + .HasColumnName("stop"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_projects"); + + b.ToTable("projects", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Color") + .HasColumnType("text") + .HasColumnName("color"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedById") + .HasColumnType("uuid") + .HasColumnName("created_by_id"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("DeletedById") + .HasColumnType("uuid") + .HasColumnName("deleted_by_id"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedById") + .HasColumnType("uuid") + .HasColumnName("modified_by_id"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("tenant_id"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.Property("Value") + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("Id") + .HasName("pk_project_labels"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_labels_project_id"); + + b.ToTable("project_labels", (string)null); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Deleted") + .HasColumnType("boolean") + .HasColumnName("deleted"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ProjectId") + .HasColumnType("uuid") + .HasColumnName("project_id"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_project_members"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_project_members_project_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_project_members_user_id"); + + b.ToTable("project_members", (string)null); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Tenant", b => { b.Property("Id") @@ -121,6 +648,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("DeletedById") .HasColumnType("uuid") .HasColumnName("deleted_by_id"); @@ -186,6 +717,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("DeletedById") .HasColumnType("uuid") .HasColumnName("deleted_by_id"); @@ -239,6 +774,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("DeletedById") .HasColumnType("uuid") .HasColumnName("deleted_by_id"); @@ -303,6 +842,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("DeletedById") .HasColumnType("uuid") .HasColumnName("deleted_by_id"); @@ -355,6 +898,10 @@ namespace IOL.GreatOffice.Api.Migrations .HasColumnType("boolean") .HasColumnName("deleted"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("deleted_at"); + b.Property("Email") .HasColumnType("text") .HasColumnName("email"); @@ -427,6 +974,40 @@ namespace IOL.GreatOffice.Api.Migrations b.ToTable("tenant_user", (string)null); }); + modelBuilder.Entity("CustomerCustomerGroup", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.CustomerGroup", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_customer_group_customer_groups_groups_id"); + }); + + modelBuilder.Entity("CustomerProject", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", null) + .WithMany() + .HasForeignKey("CustomersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_project_customers_customers_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", null) + .WithMany() + .HasForeignKey("ProjectsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_customer_project_projects_projects_id"); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ApiAccessToken", b => { b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") @@ -437,6 +1018,36 @@ namespace IOL.GreatOffice.Api.Migrations b.Navigation("User"); }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "Owner") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_customers_users_user_id"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerContact", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_contacts_customers_customer_id"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.CustomerEvent", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Customer", "Customer") + .WithMany("Events") + .HasForeignKey("CustomerId") + .HasConstraintName("fk_customer_events_customers_customer_id"); + + b.Navigation("Customer"); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ForgotPasswordRequest", b => { b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") @@ -449,6 +1060,33 @@ namespace IOL.GreatOffice.Api.Migrations b.Navigation("User"); }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectLabel", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Labels") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_labels_projects_project_id"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.ProjectMember", b => + { + b.HasOne("IOL.GreatOffice.Api.Data.Database.Project", "Project") + .WithMany("Members") + .HasForeignKey("ProjectId") + .HasConstraintName("fk_project_members_projects_project_id"); + + b.HasOne("IOL.GreatOffice.Api.Data.Database.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_project_members_users_user_id"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => { b.HasOne("IOL.GreatOffice.Api.Data.Database.TimeCategory", "Category") @@ -484,6 +1122,20 @@ namespace IOL.GreatOffice.Api.Migrations .HasConstraintName("fk_tenant_user_users_users_id"); }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Events"); + }); + + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.Project", b => + { + b.Navigation("Labels"); + + b.Navigation("Members"); + }); + modelBuilder.Entity("IOL.GreatOffice.Api.Data.Database.TimeEntry", b => { b.Navigation("Labels"); -- cgit v1.3