From 0725e4f7cf4c6f723264b6d461b91c660d144cb7 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 30 Oct 2022 22:40:03 +0700 Subject: feat: Apiwork --- .../src/Migrations/AppDbContextModelSnapshot.cs | 658 ++++++++++++++++++++- 1 file changed, 655 insertions(+), 3 deletions(-) (limited to 'code/api/src/Migrations/AppDbContextModelSnapshot.cs') 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