Skip to content

feat(work-logs): expose team_id / teamId - #10

Merged
thinkclay merged 1 commit into
mainfrom
feat/work-logs-team-id
Jul 30, 2026
Merged

thinkclay merged 1 commit into
mainfrom
feat/work-logs-team-id

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Work logs now carry a real team association. core.work_logs.team_id landed in UNI-Construct migration 339; before it, team attribution was a [team:slug] prefix inside the free-text description — unindexable, unjoinable, and it corrupted the text a human reads.

Changes

Four type additions, no behaviour change:

Type Field
WorkLog team_id: string | null — the row as the API returns it
ListWorkLogsParams teamId?: string — filter a listing to one team
CreateWorkLogParams teamId?: string | null
UpdateWorkLogParams teamId?: string | null — null clears the association

Nullable throughout: a log need not belong to a team, and the column is ON DELETE SET NULL so removing a team doesn't destroy work history.

Why now

Needed by Unicorn/UNI-Construct#425, where the server side is already deployed. The API accepts and returns the field today, so without these types callers type-error on something that works at runtime.

Verified against the live endpoint: a log created with teamId persists it, and GET /v1/work-logs?teamId=… narrowed a 28-log listing to the 10 belonging to that team with a single distinct team_id.

Notes

No CHANGELOG entry — the file stops at 0.3.0 (Feb 2026) while releases are at v1.12.0, so it isn't maintained and a lone entry would be misleading. Happy to add one if you'd rather restart it.

After merge, UNI-Construct needs a submodule pointer bump to pick this up; its dist is currently rebuilt locally.

Work logs now carry a real team association. `core.work_logs.team_id` landed
in UNI-Construct migration 339; before it, team attribution was a
`[team:slug]` prefix inside the free-text description, which meant it could
not be indexed, joined, or filtered, and it corrupted the text a human reads.

Four additions, no behaviour change:
  - `WorkLog.team_id`               the row as the API returns it
  - `ListWorkLogsParams.teamId`     filter a listing to one team
  - `CreateWorkLogParams.teamId`    set it on create
  - `UpdateWorkLogParams.teamId`    nullable, so a caller can clear it

Nullable throughout: a log need not belong to a team, and the column is
ON DELETE SET NULL so removing a team does not destroy work history.

Needed by Scaffald/SaaS#425. Without it, callers type-error on the
field the API already accepts.
@thinkclay
thinkclay merged commit f812738 into main Jul 30, 2026
@thinkclay
thinkclay deleted the feat/work-logs-team-id branch July 30, 2026 06:10
thinkclay added a commit to Scaffald/SaaS that referenced this pull request Jul 30, 2026
Scaffald/sdk#10 is merged, so packages/sdk moves 28edf5fcd..f8127382a.

This is what makes #425 portable: the dist here was previously rebuilt from
an unmerged local branch, so the field type-checked on this machine and
nowhere else. Verified after the bump that dogfood-log.ts, phase2-seed.ts
and scf-core all type-check against the merged commit rather than a local
build.

Note the built declarations put these types in the shared
dist/prerequisites-*.d.ts chunk and re-export them, so grepping
dist/index.d.ts for a new field finds nothing — that is tsup splitting, not
a missing type.
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.

1 participant