From 21129286b4d5b9c8d60639ec48ad1747b61c14fd Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Mon, 10 Aug 2026 20:04:15 +0800 Subject: [PATCH] fix(core-api): capture user_id, and comment on a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #20 took the collection from 7/24 to 13/24. Two collection-side causes remain. Nothing set {{user_id}}. Send Message, Add Participant and Create Read Receipt all address a user by it and failed with "Sender of chat message not found" and "User to add as participant not found". List Available Participants already returns the eligible users and succeeds, so the first is captured from there rather than seeding another fixture. Create Comment posts against a file. A comment belongs to the thing it is about — an order, an issue, a file — and in core-api the commentable resource is a file. {{file_id}} is captured from Upload Base64 File, and the folder ordering already runs Files before Comments, so no resequencing is needed. My two earlier attempts were both wrong. An unresolved {{subject_type}} became a class name: Target class [\Fleetbase\Models\{{subjectType}}] does not exist. and pointing it at the organization hit a scope on a table without the column: SQLSTATE[42S22]: Unknown column 'company_uuid' in 'where clause' Both are the same API defect in different clothes — an unresolvable or unscopeable subject.type reaches the database rather than being rejected as a 422 — and neither should be something the collection has to route around. Co-Authored-By: Claude Opus 5 --- .../List Available Participants.request.yaml | 14 ++++++++++++++ .../Comments/Create Comment.request.yaml | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/postman/collections/Fleetbase Core API/Chat Channels/List Available Participants.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/List Available Participants.request.yaml index 9296f2b..239252b 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/List Available Participants.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/List Available Participants.request.yaml @@ -5,4 +5,18 @@ url: "{{base_url}}/{{namespace}}/chat-channels/available-participants" method: GET queryParams: channel: "{{chat_channel_id}}" +scripts: + - type: afterResponse + code: | + // Send Message, Add Participant and Create Read Receipt all address a user + // by {{user_id}}, which nothing set — they failed with "Sender of chat + // message not found" and "User to add as participant not found". This + // endpoint already returns the users eligible to participate, so take the + // first one rather than seeding a second fixture. + var json_response = pm.response.json(); + let cv = pm.environment; + if (Array.isArray(json_response) && json_response.length) { + cv.set("user_id", json_response[0].id); + } + language: text/javascript order: 1000 diff --git a/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml b/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml index 1b03aba..a243c3e 100644 --- a/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml +++ b/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml @@ -9,8 +9,8 @@ body: { "content": "Example comment", "subject": { - "id": "{{organization_id}}", - "type": "company" + "id": "{{file_id}}", + "type": "file" } }