65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
|
|
using TeamUp.SharedKernel.Domain;
|
||
|
|
|
||
|
|
namespace TeamUp.Modules.OrgBoard.Domain;
|
||
|
|
|
||
|
|
/// <summary>A board task. Humans and AI share this one model — the assignee is a member or an agent.</summary>
|
||
|
|
internal sealed class WorkItem : Entity
|
||
|
|
{
|
||
|
|
public Guid TeamId { get; private set; }
|
||
|
|
public string Title { get; private set; } = null!;
|
||
|
|
public string? Description { get; private set; }
|
||
|
|
public WorkItemType Type { get; private set; }
|
||
|
|
public WorkItemStatus Status { get; private set; }
|
||
|
|
public AssigneeKind AssigneeKind { get; private set; }
|
||
|
|
public Guid? AssigneeId { get; private set; }
|
||
|
|
public Guid? ParentId { get; private set; }
|
||
|
|
public Guid CreatedByMemberId { get; private set; }
|
||
|
|
public DateTimeOffset CreatedAtUtc { get; private set; }
|
||
|
|
public DateTimeOffset UpdatedAtUtc { get; private set; }
|
||
|
|
|
||
|
|
private WorkItem()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public WorkItem(
|
||
|
|
Guid teamId,
|
||
|
|
string title,
|
||
|
|
string? description,
|
||
|
|
WorkItemType type,
|
||
|
|
Guid createdByMemberId,
|
||
|
|
DateTimeOffset nowUtc,
|
||
|
|
Guid? parentId = null)
|
||
|
|
{
|
||
|
|
TeamId = teamId;
|
||
|
|
Title = title;
|
||
|
|
Description = description;
|
||
|
|
Type = type;
|
||
|
|
Status = WorkItemStatus.Backlog;
|
||
|
|
AssigneeKind = AssigneeKind.Unassigned;
|
||
|
|
CreatedByMemberId = createdByMemberId;
|
||
|
|
ParentId = parentId;
|
||
|
|
CreatedAtUtc = nowUtc;
|
||
|
|
UpdatedAtUtc = nowUtc;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void MoveTo(WorkItemStatus status, DateTimeOffset nowUtc)
|
||
|
|
{
|
||
|
|
Status = status;
|
||
|
|
UpdatedAtUtc = nowUtc;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void AssignToMember(Guid memberId, DateTimeOffset nowUtc)
|
||
|
|
{
|
||
|
|
AssigneeKind = AssigneeKind.Member;
|
||
|
|
AssigneeId = memberId;
|
||
|
|
UpdatedAtUtc = nowUtc;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Unassign(DateTimeOffset nowUtc)
|
||
|
|
{
|
||
|
|
AssigneeKind = AssigneeKind.Unassigned;
|
||
|
|
AssigneeId = null;
|
||
|
|
UpdatedAtUtc = nowUtc;
|
||
|
|
}
|
||
|
|
}
|