Added new parameter uploaded by in documents table

This commit is contained in:
ashutosh.nehete 2025-07-02 09:59:56 +05:30
parent 65da812a97
commit ba1e644fd8
4 changed files with 3497 additions and 2 deletions

View File

@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_UploadedBy_ForeginKey_In_Decuments_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "UploadedById",
table: "Documents",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_Documents_UploadedById",
table: "Documents",
column: "UploadedById");
migrationBuilder.AddForeignKey(
name: "FK_Documents_Employees_UploadedById",
table: "Documents",
column: "UploadedById",
principalTable: "Employees",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Documents_Employees_UploadedById",
table: "Documents");
migrationBuilder.DropIndex(
name: "IX_Documents_UploadedById",
table: "Documents");
migrationBuilder.DropColumn(
name: "UploadedById",
table: "Documents");
}
}
}

View File

@ -752,10 +752,15 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<DateTime>("UploadedAt")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UploadedById")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("UploadedById");
b.ToTable("Documents");
});
@ -2951,7 +2956,13 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "UploadedBy")
.WithMany()
.HasForeignKey("UploadedById");
b.Navigation("Tenant");
b.Navigation("UploadedBy");
});
modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b =>

View File

@ -1,4 +1,7 @@
using Marco.Pms.Model.Utilities;
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.DocumentManager
{
@ -16,10 +19,15 @@ namespace Marco.Pms.Model.DocumentManager
/// </summary>
public string? ThumbS3Key { get; set; }
public string? Base64Data { get; set; }
public string? Base64Data { get; set; } = null;
public long FileSize { get; set; }
public string ContentType { get; set; } = string.Empty;
public Guid? UploadedById { get; set; }
[ValidateNever]
[ForeignKey("UploadedById")]
public Employee? UploadedBy { get; set; }
public DateTime UploadedAt { get; set; }
}
}