feat(teams): add Team entity foundation (Slice 1/2) #4
Reference in New Issue
Block a user
Delete Branch "feature/add-teams-slice-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds the
Teamentity and the management tab on/peoplewithout touching the existingPerson.department/PersonDepartmentenum. This is Slice 1 of 2 in theadd-teamschained PR. Slice 2 will cut over Person to usePerson.teamIdand drop the enum.What's in
TeamPrisma model (id, name, createdAt, updatedAt) + additivePerson.teamIdFK column.Teamtable, adds a case-insensitive unique index onlower("name"), and adds thePerson.teamIdcolumn. Does not drop thePersonDepartmentenum orPerson.departmentcolumn.src/schemas/team.schema.ts) withtrim().min(1).max(80)validation.TeamService(findAll, findById, findByNameCaseInsensitive, create, update, delete — hard delete).TeamUseCases(list/create/update/delete) with preflight uniqueness checks andP2002mapping.createTeamAction,updateTeamAction,deleteTeamAction,listTeamsAction(ADMIN-gated for write; list open to any authenticated user for the picker)./people?tab=teamswithTeamsTab,TeamListTable,TeamCreateForm,TeamEditFormcomponents.inventory.teams.*in bothen.tsandes.ts.What's out (Slice 2)
Person.departmentwithPerson.teamIdin person forms, list cells, detail views, and person use-cases.PersonDepartmentenum and thePerson.departmentcolumn.inventory.people.departmentsi18n keys.Hard delete decision
Team uses hard delete (no
deletedAt). FKonDelete: SetNullonPerson.teamIdhandles the cascade automatically. If a team is deleted, all linked persons are automatically unassigned.PR chain
feature/add-teams(this PR's base)feature/add-teams-slice-1feature/add-teams-slice-1Verification
bun run test:unitbun run test:integrationbunx tsc --noEmitbunx prisma validatebunx biome check .Diff: ~1,214 insertions, 1 deletion across 22 files.
Related
openspec/changes/add-teams/proposal.mdopenspec/changes/add-teams/specs/team-management.md,openspec/changes/add-teams/specs/person-team.mdopenspec/changes/add-teams/design.mdopenspec/changes/add-teams/tasks.mdPull request closed