-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
📌 Summary
Implement a versioned DocumentType
system to support multi-tenant document templates (e.g. certificates, transcripts, HEARs). Each document type can have multiple versions that apply from a specified time onward. Documents must reference the correct version based on their IssuedTime
.
🧱 Entity: DocumentType
A single table that supports both grouping and versioning via a ParentId
.
Fields:
Id
: Unique identifierTenantId
: Multi-tenancy supportParentId
: Reference to the root version (null
if this is the first version)Name
: Friendly name of the template version (e.g. "Transcript v2")TypeName
: Category (e.g. Certificate, Transcript, Letter)Version
: Version string or numberValidFromTime
: The time this version becomes activeIsActive
: Indicates if the version is enabled for useCreationTime
: Timestamp (via ABPICreationAudited
)
📄 Requirements
- Create
DocumentType
entity usingFullAuditedAggregateRoot<Guid>
andIMultiTenant
- Support self-referencing
ParentId
to model versions under a shared logical group - Ensure
DocumentTypeField
and other related data link to the correct version - Add ability to resolve the correct
DocumentType
for a document usingIssuedTime
- Enforce uniqueness of
(TenantId, ParentId, Version)
if applicable - Seed or create the first version with
ParentId = null
- Add methods in the domain/application layer to:
- Create a new version
- Retrieve current version for a group
- Get all versions by root ID
📦 Example: Document Version Resolution Logic
var applicableVersion = dbContext.DocumentTypes
.Where(dt => dt.ParentId == rootId || dt.Id == rootId)
.Where(dt => dt.ValidFromTime <= document.IssuedTime)
.OrderByDescending(dt => dt.ValidFromTime)
.FirstOrDefault();
Metadata
Metadata
Assignees
Labels
No labels