M1: OrgBoard — organizations, teams, seats, the board & cartable
OrgBoard module (references SharedKernel only; RBAC via ICurrentUser/IPermissionService):
- Organization, Team, Seat (human/open/ai), WorkItem (board task: type, status, assignee,
parent) entities; internal OrgBoardDbContext (schema "orgboard") + InitialOrgBoard
migration; design-time factory. (WorkItem avoids the System.Threading.Tasks.Task clash.)
- Endpoints under /api/orgboard, every mutation permission-checked at the scope chain
[team, org]: POST /organizations, POST/GET /teams, POST /tasks, GET /board (columns
backlog->in progress->in review->done), PATCH /tasks/{id}/move, /assign, GET /cartable.
Test isolation: integration tests now use IClassFixture so each class gets its own
pgvector container (the bootstrap-once rule made a shared container collide).
Verified: build green; ArchitectureTests 8/8 (OrgBoard references only SharedKernel);
IntegrationTests 12/12 incl. a new board flow — owner sets up org+team, creates/moves/
assigns a task, sees it on the board and in the cartable; an invited Member can view the
board but is 403'd from creating a team.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
namespace TeamUp.Modules.OrgBoard.Domain;
|
||||
|
||||
/// <summary>The seat-state triad — the load-bearing concept of the UI (human / open / AI).</summary>
|
||||
internal enum SeatState
|
||||
{
|
||||
Human,
|
||||
Open,
|
||||
Ai,
|
||||
}
|
||||
|
||||
internal enum WorkItemType
|
||||
{
|
||||
Spec,
|
||||
Story,
|
||||
Test,
|
||||
Review,
|
||||
Release,
|
||||
}
|
||||
|
||||
/// <summary>The board columns: backlog → in progress → in review → done.</summary>
|
||||
internal enum WorkItemStatus
|
||||
{
|
||||
Backlog,
|
||||
InProgress,
|
||||
InReview,
|
||||
Done,
|
||||
}
|
||||
|
||||
internal enum AssigneeKind
|
||||
{
|
||||
Unassigned,
|
||||
Member,
|
||||
Agent,
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using TeamUp.SharedKernel.Domain;
|
||||
|
||||
namespace TeamUp.Modules.OrgBoard.Domain;
|
||||
|
||||
/// <summary>The company. Its id is the Organization scope that org-level memberships are granted at.</summary>
|
||||
internal sealed class Organization : Entity
|
||||
{
|
||||
public string Name { get; private set; } = null!;
|
||||
public DateTimeOffset CreatedAtUtc { get; private set; }
|
||||
|
||||
private Organization()
|
||||
{
|
||||
}
|
||||
|
||||
public Organization(Guid id, string name, DateTimeOffset createdAtUtc)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
CreatedAtUtc = createdAtUtc;
|
||||
}
|
||||
|
||||
public void Rename(string name) => Name = name;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using TeamUp.SharedKernel.Domain;
|
||||
|
||||
namespace TeamUp.Modules.OrgBoard.Domain;
|
||||
|
||||
/// <summary>A role on a team, in one of three states: human / open / AI. AI seats are configured in M3.</summary>
|
||||
internal sealed class Seat : Entity
|
||||
{
|
||||
public Guid TeamId { get; private set; }
|
||||
public string RoleName { get; private set; } = null!;
|
||||
public SeatState State { get; private set; }
|
||||
public Guid? MemberId { get; private set; }
|
||||
public Guid? AgentId { get; private set; }
|
||||
public DateTimeOffset CreatedAtUtc { get; private set; }
|
||||
|
||||
private Seat()
|
||||
{
|
||||
}
|
||||
|
||||
public Seat(Guid teamId, string roleName, SeatState state, DateTimeOffset createdAtUtc, Guid? memberId = null)
|
||||
{
|
||||
TeamId = teamId;
|
||||
RoleName = roleName;
|
||||
State = state;
|
||||
MemberId = memberId;
|
||||
CreatedAtUtc = createdAtUtc;
|
||||
}
|
||||
|
||||
public void AssignMember(Guid memberId)
|
||||
{
|
||||
MemberId = memberId;
|
||||
AgentId = null;
|
||||
State = SeatState.Human;
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
MemberId = null;
|
||||
AgentId = null;
|
||||
State = SeatState.Open;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using TeamUp.SharedKernel.Domain;
|
||||
|
||||
namespace TeamUp.Modules.OrgBoard.Domain;
|
||||
|
||||
/// <summary>A team within an organization. Team-level memberships are granted at its id (Team scope).</summary>
|
||||
internal sealed class Team : Entity
|
||||
{
|
||||
public Guid OrganizationId { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public DateTimeOffset CreatedAtUtc { get; private set; }
|
||||
|
||||
private Team()
|
||||
{
|
||||
}
|
||||
|
||||
public Team(Guid organizationId, string name, DateTimeOffset createdAtUtc)
|
||||
{
|
||||
OrganizationId = organizationId;
|
||||
Name = name;
|
||||
CreatedAtUtc = createdAtUtc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user