fix(love): use addCollection/createTxCollectionCUD for MeetingMinutes creation
Summary
Fixes #10526. Also related to #8785 and #7303.
After a meeting ends the Room detail view always showed "No meeting minutes" even when MeetingMinutes documents existed in the database. The MeetingMinutesSection.svelte component gates rendering on meetings > 0, but that counter was never incremented because MeetingMinutes were created with createDoc/createTxCreateDoc instead of addCollection/createTxCollectionCUD.
The collection counter trigger in server/middleware/triggers.ts (processCollection) only fires when attachedTo, attachedToClass, and collection are top-level transaction properties — which only TxCollectionCUD provides. createDoc / createTxCreateDoc puts those fields inside attributes (the document data), so the trigger never fires and the Room counter stays at 0.
Changes
models/love/src/index.ts— change@Modelparent fromcore.class.Doc→core.class.AttachedDocsohierarchy.isDerived(love.class.MeetingMinutes, core.class.AttachedDoc)returnstrueplugins/love-resources/src/meetings.ts— replaceclient.createDoc(...)withclient.addCollection(...)for client-side MeetingMinutes creationserver-plugins/love-resources/src/index.ts— wrap thecreateTxCreateDocin acreateTxCollectionCUDso the server-side trigger correctly increments the Room'smeetingscounter
Test plan
- [ ] Start a meeting in a Room, enable transcription, speak for 30+ seconds, then end the meeting
- [ ] Room detail page → "Meeting minutes" section shows the meeting (not "No meeting minutes")
- [ ]
meetingscounter on the Room document increments correctly after each meeting - [ ] Existing MeetingMinutes documents and transcription data are unaffected
- [ ] Office rooms still create MeetingMinutes correctly
- [ ] Collaborators are still attached to newly created MeetingMinutes
Workaround for existing deployments
For self-hosted CockroachDB deployments where the counter is already stuck at 0, run:
UPDATE love
SET data = jsonb_set(COALESCE(data, '{}'::jsonb), '{meetings}', (
SELECT COALESCE(to_jsonb(count(*)), '0'::jsonb)
FROM meeting_minutes
WHERE "attachedTo" = love._id
AND "workspaceId" = love."workspaceId"
)::jsonb)
WHERE _class IN ('love:class:Room', 'love:class:Office');
Connected to Huly®: UBERF-15586
I think the counter is less of a problem. All meeting minutes documents have to be converted to AttachedDoc with proper attachedTo and attachedToClass properties set. We usually do this via migrations.
https://github.com/hcengineering/platform/blob/develop/models/love/src/migration.ts