feat(tasks): persist task deadlines

This commit is contained in:
aj
2026-08-13 16:40:12 -04:00
parent d12839d6ba
commit cc63c456bf
10 changed files with 354 additions and 0 deletions
@@ -0,0 +1,267 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TaskTracker.Infrastructure.Data;
#nullable disable
namespace TaskTracker.Infrastructure.Migrations
{
[DbContext(typeof(TaskTrackerDbContext))]
[Migration("20260813203936_AddTaskDueAt")]
partial class AddTaskDueAt
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("TaskTracker.Core.Entities.AppMapping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Category")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("FriendlyName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("MatchType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Pattern")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Id");
b.ToTable("AppMappings");
b.HasData(
new
{
Id = 1,
Category = "Engineering",
FriendlyName = "SolidWorks",
MatchType = "ProcessName",
Pattern = "SLDWORKS"
},
new
{
Id = 2,
Category = "Email",
FriendlyName = "Outlook",
MatchType = "ProcessName",
Pattern = "OUTLOOK"
},
new
{
Id = 3,
Category = "General",
FriendlyName = "Notepad",
MatchType = "ProcessName",
Pattern = "notepad"
},
new
{
Id = 4,
Category = "LaserCutting",
FriendlyName = "PEP System",
MatchType = "UrlContains",
Pattern = "pep"
},
new
{
Id = 5,
Category = "Engineering",
FriendlyName = "SolidWorks",
MatchType = "TitleContains",
Pattern = "solidworks"
});
});
modelBuilder.Entity("TaskTracker.Core.Entities.ContextEvent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AppName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Source")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("Timestamp")
.HasColumnType("datetime2");
b.Property<string>("Url")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<string>("WindowTitle")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<int?>("WorkTaskId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Timestamp");
b.HasIndex("WorkTaskId");
b.ToTable("ContextEvents");
});
modelBuilder.Entity("TaskTracker.Core.Entities.TaskNote", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("WorkTaskId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkTaskId");
b.ToTable("Notes");
});
modelBuilder.Entity("TaskTracker.Core.Entities.WorkTask", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime?>("CompletedAt")
.HasColumnType("datetime2");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<DateTimeOffset?>("DueAt")
.HasColumnType("datetimeoffset");
b.Property<int?>("EstimatedMinutes")
.HasColumnType("int");
b.Property<int?>("ParentTaskId")
.HasColumnType("int");
b.Property<DateTime?>("StartedAt")
.HasColumnType("datetime2");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Id");
b.HasIndex("DueAt");
b.HasIndex("ParentTaskId");
b.ToTable("Tasks");
});
modelBuilder.Entity("TaskTracker.Core.Entities.ContextEvent", b =>
{
b.HasOne("TaskTracker.Core.Entities.WorkTask", "WorkTask")
.WithMany("ContextEvents")
.HasForeignKey("WorkTaskId");
b.Navigation("WorkTask");
});
modelBuilder.Entity("TaskTracker.Core.Entities.TaskNote", b =>
{
b.HasOne("TaskTracker.Core.Entities.WorkTask", "WorkTask")
.WithMany("Notes")
.HasForeignKey("WorkTaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WorkTask");
});
modelBuilder.Entity("TaskTracker.Core.Entities.WorkTask", b =>
{
b.HasOne("TaskTracker.Core.Entities.WorkTask", "ParentTask")
.WithMany("SubTasks")
.HasForeignKey("ParentTaskId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("ParentTask");
});
modelBuilder.Entity("TaskTracker.Core.Entities.WorkTask", b =>
{
b.Navigation("ContextEvents");
b.Navigation("Notes");
b.Navigation("SubTasks");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskTracker.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTaskDueAt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTimeOffset>(
name: "DueAt",
table: "Tasks",
type: "datetimeoffset",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Tasks_DueAt",
table: "Tasks",
column: "DueAt");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Tasks_DueAt",
table: "Tasks");
migrationBuilder.DropColumn(
name: "DueAt",
table: "Tasks");
}
}
}
@@ -189,6 +189,9 @@ namespace TaskTracker.Infrastructure.Migrations
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<DateTimeOffset?>("DueAt")
.HasColumnType("datetimeoffset");
b.Property<int?>("EstimatedMinutes")
.HasColumnType("int");
@@ -210,6 +213,8 @@ namespace TaskTracker.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("DueAt");
b.HasIndex("ParentTaskId");
b.ToTable("Tasks");