mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-05 21:12:11 +00:00
feat(work-orders): add Phase 6 completion templates schema and media category
This commit is contained in:
parent
812a5e994c
commit
0ce008e5eb
5 changed files with 155 additions and 4 deletions
|
|
@ -42,6 +42,9 @@ namespace Data.SeaHavenIndustries
|
||||||
.HasIndex(l => new { l.WorkOrderId, l.SourceWeekStart })
|
.HasIndex(l => new { l.WorkOrderId, l.SourceWeekStart })
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
|
builder.Entity<CompletionDocTemplate>()
|
||||||
|
.HasIndex(t => new { t.ServiceKey, t.IsActive });
|
||||||
|
|
||||||
builder.Entity<WorkOrder>()
|
builder.Entity<WorkOrder>()
|
||||||
.Property(w => w.RowVersion)
|
.Property(w => w.RowVersion)
|
||||||
.IsRowVersion();
|
.IsRowVersion();
|
||||||
|
|
@ -80,6 +83,7 @@ namespace Data.SeaHavenIndustries
|
||||||
public DbSet<WorkOrderContacts> WorkOrderContacts { get; set; }
|
public DbSet<WorkOrderContacts> WorkOrderContacts { get; set; }
|
||||||
public DbSet<WorkOrderCategories> workOrderCategories { get; set; }
|
public DbSet<WorkOrderCategories> workOrderCategories { get; set; }
|
||||||
public DbSet<WorkOrderAttachments> workOrderAttachments { get; set; }
|
public DbSet<WorkOrderAttachments> workOrderAttachments { get; set; }
|
||||||
|
public DbSet<CompletionDocTemplate> CompletionDocTemplates { get; set; }
|
||||||
public DbSet<WorkOrderAuditLog> WorkOrderAuditLogs { get; set; }
|
public DbSet<WorkOrderAuditLog> WorkOrderAuditLogs { get; set; }
|
||||||
public DbSet<WorkOrderFieldLock> WorkOrderFieldLocks { get; set; }
|
public DbSet<WorkOrderFieldLock> WorkOrderFieldLocks { get; set; }
|
||||||
public DbSet<WorkOrderWeekRolledLedger> WorkOrderWeekRolledLedgers { get; set; }
|
public DbSet<WorkOrderWeekRolledLedger> WorkOrderWeekRolledLedgers { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Data.SeaHavenIndustries.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Phase6_CompletionSlideOver : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Category",
|
||||||
|
table: "workOrderAttachments",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CompletionDocTemplates",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
ServiceKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
WorkOrderType = table.Column<int>(type: "int", nullable: true),
|
||||||
|
TemplateUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
IsDeleted = table.Column<bool>(type: "bit", nullable: true),
|
||||||
|
createdby = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
DeleterUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
LastModifierUserId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CompletionDocTemplates", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CompletionDocTemplates_ServiceKey_IsActive",
|
||||||
|
table: "CompletionDocTemplates",
|
||||||
|
columns: new[] { "ServiceKey", "IsActive" });
|
||||||
|
|
||||||
|
migrationBuilder.Sql(@"
|
||||||
|
UPDATE workOrders
|
||||||
|
SET DocStatus = 1
|
||||||
|
WHERE DocStatus IS NULL
|
||||||
|
AND SignOffAttachment IS NOT NULL
|
||||||
|
AND LTRIM(RTRIM(SignOffAttachment)) <> '';
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql(@"
|
||||||
|
UPDATE workOrders
|
||||||
|
SET DocStatus = NULL
|
||||||
|
WHERE DocStatus = 1
|
||||||
|
AND SignOffAttachment IS NOT NULL
|
||||||
|
AND LTRIM(RTRIM(SignOffAttachment)) <> '';
|
||||||
|
");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CompletionDocTemplates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Category",
|
||||||
|
table: "workOrderAttachments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -374,6 +374,61 @@ namespace Data.SeaHavenIndustries.Migrations
|
||||||
b.ToTable("Categories", (string)null);
|
b.ToTable("Categories", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Data.SeaHavenIndustries.CompletionDocTemplate", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CreatedDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("DeleterUserId")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DeletionTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<bool>("IsActive")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool?>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastModificationTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("LastModifierUserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ServiceKey")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("TemplateUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("WorkOrderType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("createdby")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ServiceKey", "IsActive")
|
||||||
|
.HasDatabaseName("IX_CompletionDocTemplates_ServiceKey_IsActive");
|
||||||
|
|
||||||
|
b.ToTable("CompletionDocTemplates", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Data.SeaHavenIndustries.Comments", b =>
|
modelBuilder.Entity("Data.SeaHavenIndustries.Comments", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
|
@ -2064,6 +2119,9 @@ namespace Data.SeaHavenIndustries.Migrations
|
||||||
b.Property<string>("Attachments")
|
b.Property<string>("Attachments")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("Category")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime?>("CreatedDate")
|
b.Property<DateTime?>("CreatedDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
|
|
||||||
13
Data.SeaHavenIndustries/Models/CompletionDocTemplate.cs
Normal file
13
Data.SeaHavenIndustries/Models/CompletionDocTemplate.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Data.SeaHavenIndustries.Enums;
|
||||||
|
|
||||||
|
namespace Data.SeaHavenIndustries
|
||||||
|
{
|
||||||
|
public class CompletionDocTemplate : FullAuditEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = "";
|
||||||
|
public string ServiceKey { get; set; } = "";
|
||||||
|
public WorkOrderType? WorkOrderType { get; set; }
|
||||||
|
public string TemplateUrl { get; set; } = "";
|
||||||
|
public bool IsActive { get; set; } = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
using System;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using Data.SeaHavenIndustries.Enums;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
||||||
|
|
||||||
namespace Data.SeaHavenIndustries
|
namespace Data.SeaHavenIndustries
|
||||||
{
|
{
|
||||||
public class WorkOrderAttachments : FullAuditEntity
|
public class WorkOrderAttachments : FullAuditEntity
|
||||||
{
|
{
|
||||||
public string? Attachments { get; set; }
|
public string? Attachments { get; set; }
|
||||||
|
public WorkOrderMediaCategory? Category { get; set; }
|
||||||
public int? WorkorderId { get; set; }
|
public int? WorkorderId { get; set; }
|
||||||
[ForeignKey(nameof(WorkorderId))]
|
[ForeignKey(nameof(WorkorderId))]
|
||||||
public virtual WorkOrder? WorkOrder { get; set; }
|
public virtual WorkOrder? WorkOrder { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue