Tints the folder name and its guide line; picked from a swatch row in the folder settings.
32 lines
1.4 KiB
C#
32 lines
1.4 KiB
C#
using ClaudeDo.Data.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace ClaudeDo.Data.Configuration;
|
|
|
|
public class ListFolderEntityConfiguration : IEntityTypeConfiguration<ListFolderEntity>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ListFolderEntity> builder)
|
|
{
|
|
builder.ToTable("list_folders");
|
|
|
|
builder.HasKey(f => f.Id);
|
|
builder.Property(f => f.Id).HasColumnName("id");
|
|
builder.Property(f => f.Name).HasColumnName("name").IsRequired();
|
|
builder.Property(f => f.CreatedAt).HasColumnName("created_at").IsRequired();
|
|
builder.Property(f => f.Icon).HasColumnName("icon");
|
|
builder.Property(f => f.Color).HasColumnName("color");
|
|
builder.Property(f => f.SortOrder).HasColumnName("sort_order").IsRequired().HasDefaultValue(0);
|
|
builder.Property(f => f.IsCollapsed).HasColumnName("is_collapsed").IsRequired().HasDefaultValue(false);
|
|
builder.Property(f => f.ParentFolderId).HasColumnName("parent_folder_id");
|
|
|
|
builder.HasIndex(f => f.SortOrder).HasDatabaseName("idx_list_folders_sort");
|
|
builder.HasIndex(f => f.ParentFolderId).HasDatabaseName("idx_list_folders_parent");
|
|
|
|
builder.HasOne<ListFolderEntity>()
|
|
.WithMany()
|
|
.HasForeignKey(f => f.ParentFolderId)
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
}
|
|
}
|