Introduced the `InvoiceAttachment` entity and its relationship with `ZugferdInvoice` to manage extracted invoice attachments. Updated `AppDbContext` and added a migration to create the `InvoiceAttachments` table with cascading delete behavior and an index for optimized queries. Enhanced the UI to display attachments in `Details.cshtml`, including file type icons, file size, and extraction date. Added a new `ViewAttachment` page to render or download attachments based on their type, with support for XML, plain text, images, and downloads. Implemented `AttachmentViewerService` to determine viewer types and MIME types for attachments. Registered the service in the DI container. Updated `Upload.cshtml.cs` to save extracted attachments to the database. Improved user experience with syntax highlighting for XML files and appropriate messages for unsupported file types.
142 lines
5.0 KiB
C#
142 lines
5.0 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using DXApp.TemplateKitProject.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace DXApp.TemplateKitProject.Migrations
|
|
{
|
|
[DbContext(typeof(AppDbContext))]
|
|
[Migration("20260602123528_AddInvoiceAttachments")]
|
|
partial class AddInvoiceAttachments
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "8.0.8")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("DXApp.TemplateKitProject.Models.InvoiceAttachment", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("ExtractedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<long>("FileSizeBytes")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<bool>("IsZugferdXml")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("OriginalFileName")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("SavedFilePath")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("ZugferdInvoiceId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ZugferdInvoiceId")
|
|
.HasDatabaseName("IX_InvoiceAttachments_ZugferdInvoiceId");
|
|
|
|
b.ToTable("InvoiceAttachments");
|
|
});
|
|
|
|
modelBuilder.Entity("DXApp.TemplateKitProject.Models.ZugferdInvoice", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("BuyerName")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("CurrencyCode")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("GuidelineId")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("Iban")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTime>("ImportedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("InvoiceDate")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("InvoiceNumber")
|
|
.HasColumnType("nvarchar(450)");
|
|
|
|
b.Property<string>("RawXml")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("ResultFilePath")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("SellerName")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("SellerTaxId")
|
|
.HasColumnType("nvarchar(450)");
|
|
|
|
b.Property<string>("SourceType")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<decimal>("TaxAmount")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal>("TotalAmount")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ImportedAt")
|
|
.HasDatabaseName("IX_ZugferdInvoices_ImportedAt");
|
|
|
|
b.HasIndex("InvoiceNumber", "SellerTaxId")
|
|
.HasDatabaseName("IX_ZugferdInvoices_InvoiceNumber_SellerTaxId");
|
|
|
|
b.ToTable("ZugferdInvoices");
|
|
});
|
|
|
|
modelBuilder.Entity("DXApp.TemplateKitProject.Models.InvoiceAttachment", b =>
|
|
{
|
|
b.HasOne("DXApp.TemplateKitProject.Models.ZugferdInvoice", "ZugferdInvoice")
|
|
.WithMany("Attachments")
|
|
.HasForeignKey("ZugferdInvoiceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("ZugferdInvoice");
|
|
});
|
|
|
|
modelBuilder.Entity("DXApp.TemplateKitProject.Models.ZugferdInvoice", b =>
|
|
{
|
|
b.Navigation("Attachments");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|