Skip to content

refactoring users domain#102

Merged
kaseywright merged 6 commits intomainfrom
refactor/users
Mar 30, 2026
Merged

refactoring users domain#102
kaseywright merged 6 commits intomainfrom
refactor/users

Conversation

@LijuJacob08
Copy link
Copy Markdown
Contributor

Issue #76

@LijuJacob08 LijuJacob08 linked an issue Mar 19, 2026 that may be closed by this pull request
Comment on lines +115 to +155
for (const updatedAssignment of updated) {
const current = currentAssignments.find((a) => a.id === updatedAssignment.id);
if (!current) continue;

if (current.assignedUserId !== assignedUserId) {
assignedUserHistoryRecords.push({
chapterAssignmentId: updatedAssignment.id,
assignedUserId,
role: 'drafter' as const,
status: updatedAssignment.status as ChapterAssignmentStatus,
});
}

if (current.peerCheckerId !== peerCheckerId) {
assignedUserHistoryRecords.push({
chapterAssignmentId: updatedAssignment.id,
assignedUserId: peerCheckerId,
role: 'peer_checker' as const,
status: updatedAssignment.status as ChapterAssignmentStatus,
});
}

if (current.status !== updatedAssignment.status) {
statusHistoryRecords.push({
chapterAssignmentId: updatedAssignment.id,
status: updatedAssignment.status as ChapterAssignmentStatus,
});
}
}

if (assignedUserHistoryRecords.length > 0) {
await tx
.insert(chapter_assignment_assigned_user_history)
.values(assignedUserHistoryRecords);
}

if (statusHistoryRecords.length > 0) {
await tx.insert(chapter_assignment_status_history).values(statusHistoryRecords);
}

return ok(updated.map((a) => a.id));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to use the abstracted logic from the chapter-assignements.service.ts. However, that logic does not exist yet. This PR cannot be merged until this is in-place.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wonderful to see tests for the domain 👍

kaseywright
kaseywright previously approved these changes Mar 30, 2026
@LijuJacob08
Copy link
Copy Markdown
Contributor Author

had renamed files from
user.projects.route.ts->user-projects.route.ts
user.projects.service.ts -> user-projects.service.ts
user.projects.repository.ts -> user-projects.repository.ts
user.projects.types.ts -> user-projects.types.ts
and due to which app.ts was also got updated

@LijuJacob08 LijuJacob08 requested a review from kaseywright March 30, 2026 13:15
@kaseywright kaseywright merged commit 3b07815 into main Mar 30, 2026
1 check passed
@github-actions github-actions bot deleted the refactor/users branch March 30, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#71 subtask - Domain: users + project-users

2 participants