Repository navigation
Conversation
Clocking in takes the member's clock-in lock and refuses a second open log (Team6083#144), but the admin log form and the Admin API wrote logs directly. Creating a "Currently in" log for someone already in, or setting a finished log back to "Currently in", left them with two open logs: the home page listed them twice and Clock-out closed only one. A finished log set back to "Currently in" also kept its old clock-out time. Those writes now go through the same lock and check. The form shows the refusal on the status field, and the API answers 409 conflict. An open log has no clock-out time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clocking in takes the member's clock-in lock and refuses a second open log (#144), but the admin log form and the Admin API wrote logs directly:
undefinedleft it unchanged).This PR changes:
writeOpenLog(intimelog-dto.ts) runs the lock, the "already open" check and the write in one transaction, with the same retries as clock-in. Clock-in now uses it too. It coverscreateTimeLog,updateTimeLog(the log being edited doesn't count against itself) and the Admin API's create and update.POST /api/admin/timelogsandPUT /api/admin/timelogs/{id}answer409 conflict; added to the OpenAPI file.Logs saved as Done or Locked don't take the lock, as before.
Evidence
On a local preview, as an admin:
New tests: an admin create (form and API) is refused while the member is in; a finished log can reopen and loses its clock-out time, saving it again is fine, and a second one can't reopen. The existing clock-in tests pass unchanged.
tsc --noEmit, ESLint on the changed files andnpm run buildpass.Merge danger
Door: two-way. No schema change; uses the existing
ClockInLockcollection.Blast radius: clock-in (refactored to share the helper), the admin log form, and the Admin API's time log create and update.
🤖 Generated with Claude Code