- Add .NET 8 backend with Clean Architecture - Add React + Vite + TypeScript frontend - Implement authentication with JWT - Implement Azure Blob Storage client - Implement OCR integration - Implement supplier matching service - Implement voucher generation - Implement Fortnox provider - Add unit and integration tests - Add Docker Compose configuration
67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
using InvoiceMaster.Core.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace InvoiceMaster.Infrastructure.Data.Configurations;
|
|
|
|
public class SupplierCacheConfiguration : IEntityTypeConfiguration<SupplierCache>
|
|
{
|
|
public void Configure(EntityTypeBuilder<SupplierCache> builder)
|
|
{
|
|
builder.ToTable("supplier_cache");
|
|
|
|
builder.HasKey(e => e.Id);
|
|
|
|
builder.Property(e => e.SupplierNumber)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
builder.Property(e => e.Name)
|
|
.IsRequired()
|
|
.HasMaxLength(255);
|
|
|
|
builder.Property(e => e.OrganisationNumber)
|
|
.HasMaxLength(20);
|
|
|
|
builder.Property(e => e.Address1)
|
|
.HasMaxLength(255);
|
|
|
|
builder.Property(e => e.Address2)
|
|
.HasMaxLength(255);
|
|
|
|
builder.Property(e => e.Postcode)
|
|
.HasMaxLength(20);
|
|
|
|
builder.Property(e => e.City)
|
|
.HasMaxLength(100);
|
|
|
|
builder.Property(e => e.Country)
|
|
.HasMaxLength(100);
|
|
|
|
builder.Property(e => e.Phone)
|
|
.HasMaxLength(50);
|
|
|
|
builder.Property(e => e.Email)
|
|
.HasMaxLength(255);
|
|
|
|
builder.Property(e => e.BankgiroNumber)
|
|
.HasMaxLength(50);
|
|
|
|
builder.Property(e => e.PlusgiroNumber)
|
|
.HasMaxLength(50);
|
|
|
|
builder.HasIndex(e => new { e.ConnectionId, e.SupplierNumber })
|
|
.IsUnique();
|
|
|
|
builder.HasIndex(e => e.ConnectionId);
|
|
builder.HasIndex(e => e.OrganisationNumber);
|
|
builder.HasIndex(e => e.Name);
|
|
builder.HasIndex(e => e.ExpiresAt);
|
|
|
|
builder.HasOne(e => e.Connection)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.ConnectionId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|