food-market/src/food-market.infrastructure/Persistence/Migrations/20260427010000_Phase4_EmployeesAndRoles.Designer.cs
nns 33234f5e44
Some checks failed
CI / POS (WPF, Windows) (push) Waiting to run
Docker API / Build + push API (push) Waiting to run
Docker API / Deploy API on stage (push) Blocked by required conditions
CI / Backend (.NET 8) (push) Successful in 42s
CI / Web (React + Vite) (push) Has been cancelled
feat(domain): Employee, EmployeeRole, RolePermissions entities + migration
Базовый каркас модуля «Сотрудники и Роли» (по образу МойСклад):

Domain:
- Employee — сотрудник организации (UserId nullable: запись может
  существовать без логина), ФИО + Position + Email/Phone + Role + IsActive
  + FiredAt + RetailPointAssignments.
- EmployeeRole — роль с IsSystem флагом и owned RolePermissions.
- RolePermissions — 21 булев флаг по группам (Каталог/Закупки/Продажи/
  Контрагенты/Отчёты/Настройки) + helper All() для админа.
- EmployeeRetailPointAssignment — ассоциация сотрудника с RetailPoint
  (для роли Кассир — к каким кассам привязан).

Infrastructure:
- OrganizationsHrConfigurations с OwnsOne(...).ToJson("permissions")
  для permissions — JSONB-колонка вместо отдельной таблицы.
- DbSet<EmployeeRole/Employee/EmployeeRetailPointAssignment>.
- Уникальные индексы: (OrgId, RoleName), (OrgId, UserId) с filter
  WHERE UserId IS NOT NULL, (EmployeeId, RetailPointId).

Migration Phase4_EmployeesAndRoles создаёт три таблицы. Сидер
системных ролей и привязка существующего admin'а к Employee —
следующим коммитом, контроллеры и UI — далее.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 12:00:30 +05:00

2002 lines
74 KiB
C#

// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using foodmarket.Infrastructure.Persistence;
#nullable disable
namespace foodmarket.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260427010000_Phase4_EmployeesAndRoles")]
partial class Phase4_EmployeesAndRoles
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("public")
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", "public");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<string>("ApplicationType")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("ClientId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("ClientSecret")
.HasColumnType("text");
b.Property<string>("ClientType")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("ConsentType")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("DisplayName")
.HasColumnType("text");
b.Property<string>("DisplayNames")
.HasColumnType("text");
b.Property<string>("JsonWebKeySet")
.HasColumnType("text");
b.Property<string>("Permissions")
.HasColumnType("text");
b.Property<string>("PostLogoutRedirectUris")
.HasColumnType("text");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<string>("RedirectUris")
.HasColumnType("text");
b.Property<string>("Requirements")
.HasColumnType("text");
b.Property<string>("Settings")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("OpenIddictApplications", "public");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<string>("ApplicationId")
.HasColumnType("text");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<string>("Scopes")
.HasColumnType("text");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("character varying(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OpenIddictAuthorizations", "public");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Descriptions")
.HasColumnType("text");
b.Property<string>("DisplayName")
.HasColumnType("text");
b.Property<string>("DisplayNames")
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<string>("Resources")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("OpenIddictScopes", "public");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property<string>("ApplicationId")
.HasColumnType("text");
b.Property<string>("AuthorizationId")
.HasColumnType("text");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Payload")
.HasColumnType("text");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<DateTime?>("RedemptionDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("ReferenceId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("character varying(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("AuthorizationId");
b.HasIndex("ReferenceId")
.IsUnique();
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OpenIddictTokens", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Counterparty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.HasColumnType("text");
b.Property<string>("BankAccount")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("BankName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Bik")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<string>("Bin")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<string>("ContactPerson")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<Guid?>("CountryId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Iin")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<string>("LegalName")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Notes")
.HasColumnType("text");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<string>("Phone")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("TaxNumber")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CountryId");
b.HasIndex("OrganizationId", "Bin");
b.HasIndex("OrganizationId", "Name");
b.ToTable("counterparties", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Country", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("DefaultCurrencyId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("VatRate")
.HasPrecision(5, 2)
.HasColumnType("numeric(5,2)");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.HasIndex("DefaultCurrencyId");
b.ToTable("countries", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Currency", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(3)
.HasColumnType("character varying(3)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("MinorUnit")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(5)
.HasColumnType("character varying(5)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("currencies", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.PriceType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsRequired")
.HasColumnType("boolean");
b.Property<bool>("IsRetail")
.HasColumnType("boolean");
b.Property<bool>("IsSystem")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrganizationId", "Name")
.IsUnique();
b.ToTable("price_types", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Product", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Article")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<Guid?>("CountryOfOriginId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("DefaultSupplierId")
.HasColumnType("uuid");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<bool>("IsMarked")
.HasColumnType("boolean");
b.Property<bool>("IsService")
.HasColumnType("boolean");
b.Property<int>("Packaging")
.HasColumnType("boolean");
b.Property<decimal?>("MaxStock")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<decimal?>("MinStock")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductGroupId")
.HasColumnType("uuid");
b.Property<decimal>("Cost")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("LastSupplyAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("PurchaseCurrencyId")
.HasColumnType("uuid");
b.Property<decimal?>("ReferencePrice")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("ReferencePriceUpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("UnitOfMeasureId")
.HasColumnType("uuid");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("Vat")
.HasPrecision(5, 2)
.HasColumnType("numeric(5,2)");
b.Property<bool>("VatEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.HasKey("Id");
b.HasIndex("CountryOfOriginId");
b.HasIndex("DefaultSupplierId");
b.HasIndex("ProductGroupId");
b.HasIndex("PurchaseCurrencyId");
b.HasIndex("UnitOfMeasureId");
b.HasIndex("OrganizationId", "Article");
b.HasIndex("OrganizationId", "Name");
b.HasIndex("OrganizationId", "ProductGroupId");
b.ToTable("products", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductBarcode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsPrimary")
.HasColumnType("boolean");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("OrganizationId", "Code")
.IsUnique();
b.ToTable("product_barcodes", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("MarkupPercent")
.HasPrecision(5, 2)
.HasColumnType("numeric(5,2)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid?>("ParentId")
.HasColumnType("uuid");
b.Property<string>("Path")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("OrganizationId", "ParentId");
b.HasIndex("OrganizationId", "Path");
b.ToTable("product_groups", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductImage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsMain")
.HasColumnType("boolean");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.HasKey("Id");
b.HasIndex("ProductId");
b.ToTable("product_images", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductPrice", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CurrencyId")
.HasColumnType("uuid");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("PriceTypeId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("PriceTypeId");
b.HasIndex("ProductId", "PriceTypeId")
.IsUnique();
b.ToTable("product_prices", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.RetailPoint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.HasColumnType("text");
b.Property<string>("Code")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FiscalRegNumber")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("FiscalSerial")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<string>("Phone")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<Guid>("StoreId")
.HasColumnType("uuid");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("StoreId");
b.HasIndex("OrganizationId", "Name");
b.ToTable("retail_points", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Store", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.HasColumnType("text");
b.Property<string>("Code")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsMain")
.HasColumnType("boolean");
b.Property<string>("ManagerName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<string>("Phone")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrganizationId", "Name");
b.ToTable("stores", "public");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.UnitOfMeasure", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrganizationId", "Code")
.IsUnique();
b.ToTable("units_of_measure", "public");
});
modelBuilder.Entity("foodmarket.Domain.Inventory.Stock", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<decimal>("Quantity")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<decimal>("ReservedQuantity")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<Guid>("StoreId")
.HasColumnType("uuid");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("StoreId");
b.HasIndex("OrganizationId", "StoreId");
b.HasIndex("OrganizationId", "ProductId", "StoreId")
.IsUnique();
b.ToTable("stocks", "public");
});
modelBuilder.Entity("foodmarket.Domain.Inventory.StockMovement", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("CreatedByUserId")
.HasColumnType("uuid");
b.Property<Guid?>("DocumentId")
.HasColumnType("uuid");
b.Property<string>("DocumentNumber")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("DocumentType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Notes")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<DateTime>("OccurredAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<decimal>("Quantity")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<Guid>("StoreId")
.HasColumnType("uuid");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<decimal?>("UnitCost")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("StoreId");
b.HasIndex("DocumentType", "DocumentId");
b.HasIndex("OrganizationId", "ProductId", "OccurredAt");
b.HasIndex("OrganizationId", "StoreId", "OccurredAt");
b.ToTable("stock_movements", "public");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.Organization", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.HasColumnType("text");
b.Property<bool>("AllowFractionalPrices")
.HasColumnType("boolean");
b.Property<string>("Bin")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("character varying(2)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasColumnType("text");
b.Property<Guid?>("DefaultCurrencyId")
.HasColumnType("uuid");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("MoySkladToken")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("MultiCurrencyEnabled")
.HasColumnType("boolean");
b.Property<bool>("ShowCountryOfOriginOnProduct")
.HasColumnType("boolean");
b.Property<bool>("ShowDescriptionOnProduct")
.HasColumnType("boolean");
b.Property<bool>("ShowMarkedOnProduct")
.HasColumnType("boolean");
b.Property<bool>("ShowReferencePriceOnProduct")
.HasColumnType("boolean");
b.Property<bool>("ShowMinMaxStock")
.HasColumnType("boolean");
b.Property<bool>("ShowServiceOnProduct")
.HasColumnType("boolean");
b.Property<bool>("ShowVatEnabledOnProduct")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Phone")
.HasColumnType("text");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("DefaultCurrencyId");
b.HasIndex("Name");
b.ToTable("organizations", "public");
});
modelBuilder.Entity("foodmarket.Domain.Purchases.Supply", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CurrencyId")
.HasColumnType("uuid");
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<string>("Notes")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("Number")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<DateTime?>("PostedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("PostedByUserId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<Guid>("StoreId")
.HasColumnType("uuid");
b.Property<Guid>("SupplierId")
.HasColumnType("uuid");
b.Property<decimal>("Total")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("StoreId");
b.HasIndex("SupplierId");
b.HasIndex("OrganizationId", "Date");
b.HasIndex("OrganizationId", "Number")
.IsUnique();
b.HasIndex("OrganizationId", "Status");
b.HasIndex("OrganizationId", "SupplierId");
b.ToTable("supplies", "public");
});
modelBuilder.Entity("foodmarket.Domain.Purchases.SupplyLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("LineTotal")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<decimal>("Quantity")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<bool>("RetailPriceManuallyOverridden")
.HasColumnType("boolean");
b.Property<decimal?>("RetailPriceOverride")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<Guid>("SupplyId")
.HasColumnType("uuid");
b.Property<decimal>("UnitPrice")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("SupplyId");
b.HasIndex("OrganizationId", "ProductId");
b.ToTable("supply_lines", "public");
});
modelBuilder.Entity("foodmarket.Domain.Sales.RetailSale", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid?>("CashierUserId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CurrencyId")
.HasColumnType("uuid");
b.Property<Guid?>("CustomerId")
.HasColumnType("uuid");
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("DiscountTotal")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<string>("Notes")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("Number")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<decimal>("PaidCard")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<decimal>("PaidCash")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<int>("Payment")
.HasColumnType("integer");
b.Property<DateTime?>("PostedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("PostedByUserId")
.HasColumnType("uuid");
b.Property<Guid?>("RetailPointId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<Guid>("StoreId")
.HasColumnType("uuid");
b.Property<decimal>("Subtotal")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<decimal>("Total")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("CustomerId");
b.HasIndex("RetailPointId");
b.HasIndex("StoreId");
b.HasIndex("OrganizationId", "CashierUserId");
b.HasIndex("OrganizationId", "Date");
b.HasIndex("OrganizationId", "Number")
.IsUnique();
b.HasIndex("OrganizationId", "Status");
b.ToTable("retail_sales", "public");
});
modelBuilder.Entity("foodmarket.Domain.Sales.RetailSaleLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("Discount")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<decimal>("LineTotal")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<Guid>("OrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<decimal>("Quantity")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<Guid>("RetailSaleId")
.HasColumnType("uuid");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<decimal>("UnitPrice")
.HasPrecision(18, 4)
.HasColumnType("numeric(18,4)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("VatPercent")
.HasPrecision(5, 2)
.HasColumnType("numeric(5,2)");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("RetailSaleId");
b.HasIndex("OrganizationId", "ProductId");
b.ToTable("retail_sale_lines", "public");
});
modelBuilder.Entity("foodmarket.Infrastructure.Identity.Role", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<Guid?>("OrganizationId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("roles", "public");
});
modelBuilder.Entity("foodmarket.Infrastructure.Identity.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<DateTime?>("LastLoginAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<Guid?>("OrganizationId")
.HasColumnType("uuid");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("users", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("foodmarket.Infrastructure.Identity.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("foodmarket.Infrastructure.Identity.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("foodmarket.Infrastructure.Identity.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("foodmarket.Infrastructure.Identity.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("foodmarket.Infrastructure.Identity.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("foodmarket.Infrastructure.Identity.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Authorizations")
.HasForeignKey("ApplicationId");
b.Navigation("Application");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Tokens")
.HasForeignKey("ApplicationId");
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
.WithMany("Tokens")
.HasForeignKey("AuthorizationId");
b.Navigation("Application");
b.Navigation("Authorization");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Counterparty", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Country", "Country")
.WithMany()
.HasForeignKey("CountryId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Country");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Product", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Country", "CountryOfOrigin")
.WithMany()
.HasForeignKey("CountryOfOriginId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.Counterparty", "DefaultSupplier")
.WithMany()
.HasForeignKey("DefaultSupplierId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.ProductGroup", "ProductGroup")
.WithMany()
.HasForeignKey("ProductGroupId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.Currency", "PurchaseCurrency")
.WithMany()
.HasForeignKey("PurchaseCurrencyId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.UnitOfMeasure", "UnitOfMeasure")
.WithMany()
.HasForeignKey("UnitOfMeasureId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CountryOfOrigin");
b.Navigation("DefaultSupplier");
b.Navigation("ProductGroup");
b.Navigation("PurchaseCurrency");
b.Navigation("UnitOfMeasure");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductBarcode", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany("Barcodes")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductGroup", b =>
{
b.HasOne("foodmarket.Domain.Catalog.ProductGroup", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Parent");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductImage", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany("Images")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductPrice", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.PriceType", "PriceType")
.WithMany()
.HasForeignKey("PriceTypeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany("Prices")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Currency");
b.Navigation("PriceType");
b.Navigation("Product");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.RetailPoint", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Store", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Store");
});
modelBuilder.Entity("foodmarket.Domain.Inventory.Stock", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Store", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Store");
});
modelBuilder.Entity("foodmarket.Domain.Inventory.StockMovement", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Store", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Product");
b.Navigation("Store");
});
modelBuilder.Entity("foodmarket.Domain.Purchases.Supply", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Store", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Counterparty", "Supplier")
.WithMany()
.HasForeignKey("SupplierId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Currency");
b.Navigation("Store");
b.Navigation("Supplier");
});
modelBuilder.Entity("foodmarket.Domain.Purchases.SupplyLine", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Purchases.Supply", "Supply")
.WithMany("Lines")
.HasForeignKey("SupplyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Supply");
});
modelBuilder.Entity("foodmarket.Domain.Sales.RetailSale", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Catalog.Counterparty", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.RetailPoint", "RetailPoint")
.WithMany()
.HasForeignKey("RetailPointId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("foodmarket.Domain.Catalog.Store", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Currency");
b.Navigation("Customer");
b.Navigation("RetailPoint");
b.Navigation("Store");
});
modelBuilder.Entity("foodmarket.Domain.Sales.RetailSaleLine", b =>
{
b.HasOne("foodmarket.Domain.Catalog.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("foodmarket.Domain.Sales.RetailSale", "RetailSale")
.WithMany("Lines")
.HasForeignKey("RetailSaleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("RetailSale");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Navigation("Authorizations");
b.Navigation("Tokens");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Navigation("Tokens");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.Product", b =>
{
b.Navigation("Barcodes");
b.Navigation("Images");
b.Navigation("Prices");
});
modelBuilder.Entity("foodmarket.Domain.Catalog.ProductGroup", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("foodmarket.Domain.Purchases.Supply", b =>
{
b.Navigation("Lines");
});
modelBuilder.Entity("foodmarket.Domain.Sales.RetailSale", b =>
{
b.Navigation("Lines");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.EmployeeRole", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("uuid");
b.Property<Guid>("OrganizationId").HasColumnType("uuid");
b.Property<string>("Name").IsRequired().HasMaxLength(100).HasColumnType("character varying(100)");
b.Property<string>("Description").HasMaxLength(500).HasColumnType("character varying(500)");
b.Property<bool>("IsSystem").HasColumnType("boolean");
b.Property<int>("SortOrder").HasColumnType("integer");
b.Property<DateTime>("CreatedAt").HasColumnType("timestamp with time zone");
b.Property<DateTime?>("UpdatedAt").HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrganizationId", "Name").IsUnique();
b.ToTable("employee_roles", "public");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.EmployeeRole", b =>
{
b.OwnsOne("foodmarket.Domain.Organizations.RolePermissions", "Permissions", o =>
{
o.Property<Guid>("EmployeeRoleId").HasColumnType("uuid");
o.Property<bool>("ProductsView").HasColumnType("boolean");
o.Property<bool>("ProductsEdit").HasColumnType("boolean");
o.Property<bool>("ProductsDelete").HasColumnType("boolean");
o.Property<bool>("ProductGroupsManage").HasColumnType("boolean");
o.Property<bool>("PriceTypesManage").HasColumnType("boolean");
o.Property<bool>("SuppliesView").HasColumnType("boolean");
o.Property<bool>("SuppliesEdit").HasColumnType("boolean");
o.Property<bool>("SuppliesPost").HasColumnType("boolean");
o.Property<bool>("SuppliesDelete").HasColumnType("boolean");
o.Property<bool>("RetailSalesOperate").HasColumnType("boolean");
o.Property<bool>("RetailSalesRefund").HasColumnType("boolean");
o.Property<bool>("CounterpartiesView").HasColumnType("boolean");
o.Property<bool>("CounterpartiesEdit").HasColumnType("boolean");
o.Property<bool>("ReportsView").HasColumnType("boolean");
o.Property<bool>("StocksView").HasColumnType("boolean");
o.Property<bool>("OrgSettingsManage").HasColumnType("boolean");
o.Property<bool>("EmployeesManage").HasColumnType("boolean");
o.Property<bool>("RolesManage").HasColumnType("boolean");
o.Property<bool>("StoresManage").HasColumnType("boolean");
o.Property<bool>("RetailPointsManage").HasColumnType("boolean");
o.HasKey("EmployeeRoleId");
o.ToJson("permissions");
o.WithOwner().HasForeignKey("EmployeeRoleId");
});
b.Navigation("Permissions");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.Employee", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("uuid");
b.Property<Guid>("OrganizationId").HasColumnType("uuid");
b.Property<Guid?>("UserId").HasColumnType("uuid");
b.Property<string>("LastName").IsRequired().HasMaxLength(100).HasColumnType("character varying(100)");
b.Property<string>("FirstName").IsRequired().HasMaxLength(100).HasColumnType("character varying(100)");
b.Property<string>("MiddleName").HasMaxLength(100).HasColumnType("character varying(100)");
b.Property<string>("Position").HasMaxLength(150).HasColumnType("character varying(150)");
b.Property<string>("Email").HasMaxLength(200).HasColumnType("character varying(200)");
b.Property<string>("Phone").HasMaxLength(50).HasColumnType("character varying(50)");
b.Property<Guid>("RoleId").HasColumnType("uuid");
b.Property<bool>("IsActive").HasColumnType("boolean");
b.Property<DateTime?>("FiredAt").HasColumnType("timestamp with time zone");
b.Property<DateTime>("CreatedAt").HasColumnType("timestamp with time zone");
b.Property<DateTime?>("UpdatedAt").HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("OrganizationId", "LastName");
b.HasIndex("OrganizationId", "UserId").IsUnique().HasFilter("\"UserId\" IS NOT NULL");
b.ToTable("employees", "public");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.Employee", b =>
{
b.HasOne("foodmarket.Domain.Organizations.EmployeeRole", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Role");
b.Navigation("RetailPointAssignments");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.EmployeeRetailPointAssignment", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("uuid");
b.Property<Guid>("OrganizationId").HasColumnType("uuid");
b.Property<Guid>("EmployeeId").HasColumnType("uuid");
b.Property<Guid>("RetailPointId").HasColumnType("uuid");
b.Property<DateTime>("CreatedAt").HasColumnType("timestamp with time zone");
b.Property<DateTime?>("UpdatedAt").HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("EmployeeId", "RetailPointId").IsUnique();
b.ToTable("employee_retail_point_assignments", "public");
});
modelBuilder.Entity("foodmarket.Domain.Organizations.EmployeeRetailPointAssignment", b =>
{
b.HasOne("foodmarket.Domain.Organizations.Employee", "Employee")
.WithMany("RetailPointAssignments")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
});
#pragma warning restore 612, 618
}
}
}