using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; namespace Faben.Api; public class ApplicationUser : IdentityUser { public string NameSurname { get; set; } public string Company { get; set; } } public class FabenDbContext : IdentityDbContext { public DbSet Categories { get; set; } public DbSet ProductImages { get; set; } public DbSet Products { get; set; } public DbSet ProductBrands { get; set; } public DbSet PriceOfferRequests { get; set; } public FabenDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity(b => { b.HasOne(p => p.Category) .WithMany(p => p.Products) .HasForeignKey(p => p.CategoryId); }); base.OnModelCreating(builder); } } public class Category { public Guid Id { get; set; } public string Name { get; set; } = null!; public string Image { get; set; } = null!; public string SeoFriendlyName { get; set; } = null!; public Category? ParentCategory { get; set; } public Guid? ParentCategoryId { get; set; } public List ChildCategories { get; set; } = new(); public List Products { get; set; } = new(); } public class Product { public Guid Id { get; set; } public string Name { get; set; } = null!; public string SeoFriendlyName { get; set; } = null!; public string? SkuNo { get; set; } = null!; public string? PdfDrawingLink { get; set; } = null!; public string? ThreeDModelLink { get; set; } = null!; public string? Description { get; set; } = null!; public string? About { get; set; } = null!; public Category Category { get; set; } = null!; public Guid CategoryId { get; set; } public List ProductImages { get; set; } = new(); public ProductBrand Brand { get; set; } = null!; public Guid BrandId { get; set; } } public class ProductImage { public Guid Id { get; set; } public string Url { get; set; } = null!; public Guid ProductId { get; set; } public Product Product { get; set; } = null!; } public class ProductBrand { public Guid Id { get; set; } public string Name { get; set; } = null!; public string Image { get; set; } = null!; public string SeoFriendlyName { get; set; } = null!; public List Products { get; set; } = new(); } public class PriceOfferRequest { public Guid Id { get; set; } public DateTimeOffset CreationTime { get; set; } public Guid ProductId { get; set; } public Product Product { get; set; } = null!; public string UserId { get; set; } public ApplicationUser User { get; set; } }