Skip to content

Commit 938ad67

Browse files
Copilotascott18
andauthored
feat: #505 Add support for date types as primary keys (#587)
--------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com> Co-authored-by: Andrew Scott <andrew.scott@intellitect.com>
1 parent 36ef392 commit 938ad67

30 files changed

Lines changed: 2260 additions & 618 deletions

File tree

docs/stacks/vue/layers/viewmodels.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ An immutable number that is unique among all ViewModel instances, regardless of
6161
Useful for uniquely identifying instances with ``:key="vm.$stableId"`` in a Vue component, especially for instances that lack a primary key.
6262

6363

64-
<Prop def="$primaryKey: string | number" lang="ts" />
64+
<Prop def="$primaryKey: string | number | Date" lang="ts" />
6565

6666
A getter/setter property that wraps the primary key of the model. Used to interact with the primary key of any ViewModel in a polymorphic way.
6767

playground/Coalesce.Domain/AppDbContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class AppDbContext : DbContext, IAuditLogDbContext<AuditLog>
2121
public DbSet<CaseProduct> CaseProducts { get; set; }
2222
public DbSet<ZipCode> ZipCodes { get; set; }
2323
public DbSet<Log> Logs { get; set; }
24+
public DbSet<DateOnlyPk> DateOnlyPks { get; set; }
2425

2526
public DbSet<AuditLog> AuditLogs { get; set; }
2627
public DbSet<AuditLogProperty> AuditLogProperties { get; set; }

playground/Coalesce.Domain/Case.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public enum Statuses
9292
[Read, MaxLength(32)]
9393
public byte[] AttachmentHash { get; set; }
9494
[InternalUse]
95-
public CaseAttachmentContent AttachmentContent { get; set; }
95+
public CaseAttachmentContent AttachmentContent { get; set; }
9696

9797
public class CaseAttachmentContent
9898
{
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
using System.ComponentModel.DataAnnotations.Schema;
4+
5+
namespace Coalesce.Domain;
6+
7+
/// <summary>
8+
/// Entity with DateOnly primary key
9+
/// </summary>
10+
public class DateOnlyPk
11+
{
12+
[Key]
13+
[DatabaseGenerated(DatabaseGeneratedOption.None)]
14+
public DateOnly DateOnlyPkId { get; set; }
15+
16+
public string Name { get; set; } = null!;
17+
}

0 commit comments

Comments
 (0)