Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
docs(openapi): publish the group response schemas
Yudhi Armyndharisbc56765fd835
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c9507375a..926e1bd3c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- **The eighteen group endpoints now publish the shape of what they return** — the whole module documented statuses and prose but not one response schema, so the committed OpenAPI snapshot had nothing to diff for any of it; the per-participant `results` array that an add/remove/promote/demote returns, and the fact that a partial refusal is reported inside a `200` rather than as an error, are now in the contract instead of only in a sentence.- **Fourteen more boolean environment variables are now validated at boot** — they are read with a bare `=== 'true'` / `!== 'false'` comparison, so a spelling like `DATABASE_SSL=require` silently configured the opposite of what was asked for; `DATABASE_SSL` in particular read as OFF and sent credentials in plaintext to a server the operator believed was TLS-protected. Only `true`/`false` (or blank) are accepted now, so a deployment using another spelling will fail startup until it is corrected. `MCP_READONLY` and `PUPPETEER_HEADLESS` stay tolerant deliberately — both fail toward the safe state.- **The API description now documents the two statuses middleware returns before routing** — `415` for a compressed request body and `503` with `Retry-After` when too much body data is already in flight, neither of which appeared anywhere in the OpenAPI document despite applying to every operation.- **The Helm chart now states the reason `replicaCount` must stay 1 that actually applies today** — the warning described two pods corrupting shared session auth, which a session lease and per-pod volumes already prevent, so an operator acting on it would mitigate the wrong thing.diff --git a/openapi.json b/openapi.jsonindex 5ca4ec9a9..f1f34cdc8 100644--- a/openapi.json+++ b/openapi.json@@ -3899,7 +3899,14 @@],"responses": {"200": {- "description": "What the invite discloses about the group"+ "description": "What the invite discloses about the group",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupJoinInfoDto"+ }+ }+ }},"400": {"description": "Session not started, or no code supplied"@@ -3939,7 +3946,14 @@],"responses": {"200": {- "description": "Group details with participants"+ "description": "Group details with participants",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupInfoDto"+ }+ }+ }},"404": {"description": "Group not found"@@ -3977,7 +3991,14 @@},"responses": {"200": {- "description": "Joined the group"+ "description": "Joined the group",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupJoinedResponseDto"+ }+ }+ }},"400": {"description": "Invalid or expired invite code, or session is not started"@@ -4014,7 +4035,14 @@],"responses": {"200": {- "description": "Group settings"+ "description": "Group settings",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupSettingsResponseDto"+ }+ }+ }},"404": {"description": "Group not found"@@ -4059,7 +4087,14 @@},"responses": {"200": {- "description": "Group settings updated"+ "description": "Group settings updated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }},"400": {"description": "No setting provided, or a value is not a boolean"@@ -4106,7 +4141,14 @@},"responses": {"201": {- "description": "Group created"+ "description": "Group created",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupSummaryDto"+ }+ }+ }}},"summary": "Create a new group",@@ -4150,7 +4192,14 @@},"responses": {"200": {- "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)"+ "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ParticipantsOperationResponseDto"+ }+ }+ }}},"summary": "Add participants to a group",@@ -4192,7 +4241,14 @@},"responses": {"200": {- "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)"+ "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ParticipantsOperationResponseDto"+ }+ }+ }}},"summary": "Remove participants from a group",@@ -4236,7 +4292,14 @@},"responses": {"200": {- "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)"+ "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ParticipantsOperationResponseDto"+ }+ }+ }}},"summary": "Promote participants to admin",@@ -4280,7 +4343,14 @@},"responses": {"200": {- "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)"+ "description": "Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ParticipantsOperationResponseDto"+ }+ }+ }}},"summary": "Demote participants from admin",@@ -4324,7 +4394,14 @@},"responses": {"200": {- "description": "Subject updated"+ "description": "Subject updated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }},"403": {"description": "The engine refused the change — admin rights are required"@@ -4371,7 +4448,14 @@},"responses": {"200": {- "description": "Description updated"+ "description": "Description updated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }},"403": {"description": "The engine refused the change — admin rights are required"@@ -4408,7 +4492,14 @@],"responses": {"200": {- "description": "Left the group"+ "description": "Left the group",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }}},"summary": "Leave a group",@@ -4442,7 +4533,14 @@],"responses": {"200": {- "description": "Picture URL, or null when the group has none"+ "description": "Picture URL, or null when the group has none",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupPictureResponseDto"+ }+ }+ }}},"summary": "Get the group's picture URL",@@ -4484,7 +4582,14 @@},"responses": {"200": {- "description": "Group picture updated"+ "description": "Group picture updated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }},"400": {"description": "Session not active, or neither url nor base64 supplied"@@ -4522,7 +4627,14 @@],"responses": {"200": {- "description": "Group picture removed"+ "description": "Group picture removed",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupAckResponseDto"+ }+ }+ }},"403": {"description": "The engine refused the change — admin rights required"@@ -4559,7 +4671,14 @@],"responses": {"200": {- "description": "Group invite code"+ "description": "Group invite code",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupInviteCodeResponseDto"+ }+ }+ }},"403": {"description": "The engine refused the request — admin rights required for this group"@@ -4599,7 +4718,14 @@],"responses": {"200": {- "description": "New invite code generated"+ "description": "New invite code generated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GroupInviteCodeRevokedResponseDto"+ }+ }+ }},"403": {"description": "The engine refused the request — admin rights required for this group"@@ -9279,6 +9405,173 @@"firstName"]},+ "GroupJoinInfoDto": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Group id.",+ "example": "[email protected]"+ },+ "name": {+ "type": "string",+ "description": "Group subject.",+ "example": "Engineering"+ },+ "description": {+ "type": "string",+ "description": "Group description.",+ "example": "Release coordination"+ },+ "owner": {+ "type": "string",+ "description": "Owner id in the engine's native format.",+ "example": "[email protected]"+ },+ "createdAt": {+ "type": "number",+ "description": "Unix SECONDS the group was created.",+ "example": 1786000000+ },+ "participantCount": {+ "type": "number",+ "description": "Member count, when disclosed.",+ "example": 42+ }+ },+ "required": [+ "id",+ "name"+ ]+ },+ "GroupParticipantDto": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Participant id in the engine's native format.",+ "example": "[email protected]"+ },+ "number": {+ "type": "string",+ "description": "MSISDN digits, without a leading + or separators.",+ "example": "628123456789"+ },+ "name": {+ "type": "string",+ "description": "Display name, when the engine reports one.",+ "example": "Ada Lovelace"+ },+ "isAdmin": {+ "type": "boolean",+ "description": "Whether the participant is a group admin.",+ "example": false+ },+ "isSuperAdmin": {+ "type": "boolean",+ "description": "Whether the participant created the group.",+ "example": false+ }+ },+ "required": [+ "id",+ "number",+ "isAdmin",+ "isSuperAdmin"+ ]+ },+ "GroupInfoDto": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Group id.",+ "example": "[email protected]"+ },+ "name": {+ "type": "string",+ "description": "Group subject.",+ "example": "Engineering"+ },+ "participantsCount": {+ "type": "number",+ "description": "Member count, when the engine reports it.",+ "example": 42+ },+ "isAdmin": {+ "type": "boolean",+ "description": "Whether this account is an admin of the group.",+ "example": true+ },+ "linkedParentJID": {+ "type": "string",+ "nullable": true,+ "description": "JID of the parent community, or null when the group is standalone.",+ "example": null+ },+ "description": {+ "type": "string",+ "description": "Group description.",+ "example": "Release coordination"+ },+ "owner": {+ "type": "string",+ "description": "Owner id in the engine's native format.",+ "example": "[email protected]"+ },+ "createdAt": {+ "type": "number",+ "description": "Unix SECONDS the group was created.",+ "example": 1786000000+ },+ "participants": {+ "description": "Members of the group.",+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/GroupParticipantDto"+ }+ },+ "isReadOnly": {+ "type": "boolean",+ "description": "Whether this account can no longer post (left or removed).",+ "example": false+ },+ "isAnnounce": {+ "type": "boolean",+ "description": "Engine-reported announce flag.",+ "example": false+ },+ "announce": {+ "type": "boolean",+ "description": "Only admins may send messages.",+ "example": false+ },+ "locked": {+ "type": "boolean",+ "description": "Only admins may edit subject, description and picture.",+ "example": false+ },+ "ephemeralSeconds": {+ "type": "number",+ "description": "Disappearing-messages timer in seconds; 0 or absent means off.",+ "example": 0+ },+ "memberAddMode": {+ "type": "string",+ "enum": [+ "all",+ "admins"+ ],+ "description": "Who may add participants. Absent when the engine did not report it.",+ "example": "admins"+ }+ },+ "required": [+ "id",+ "name",+ "participants"+ ]+ },"JoinGroupDto": {"type": "object","properties": {@@ -9292,6 +9585,54 @@"inviteCode"]},+ "GroupJoinedResponseDto": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean",+ "description": "Always true — a failure is reported as a non-2xx status.",+ "example": true+ },+ "groupId": {+ "type": "string",+ "description": "Id of the group that was joined.",+ "example": "[email protected]"+ }+ },+ "required": [+ "success",+ "groupId"+ ]+ },+ "GroupSettingsResponseDto": {+ "type": "object",+ "properties": {+ "announce": {+ "type": "boolean",+ "description": "Only admins may send messages.",+ "example": false+ },+ "locked": {+ "type": "boolean",+ "description": "Only admins may edit subject, description and picture.",+ "example": false+ },+ "ephemeralSeconds": {+ "type": "number",+ "description": "Disappearing-messages timer in seconds. Absent when the engine did not report it.",+ "example": 0+ },+ "memberAddMode": {+ "type": "string",+ "enum": [+ "all",+ "admins"+ ],+ "description": "Who may add participants. Absent when the engine did not report it.",+ "example": "admins"+ }+ }+ },"GroupSettingsDto": {"type": "object","properties": {@@ -9318,6 +9659,25 @@}}},+ "GroupAckResponseDto": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean",+ "description": "Always true — a failure is reported as a non-2xx status, not as false.",+ "example": true+ },+ "message": {+ "type": "string",+ "description": "Human-readable confirmation of what was done.",+ "example": "Group subject updated"+ }+ },+ "required": [+ "success",+ "message"+ ]+ },"CreateGroupDto": {"type": "object","properties": {@@ -9340,6 +9700,41 @@"participants"]},+ "GroupSummaryDto": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Group id.",+ "example": "[email protected]"+ },+ "name": {+ "type": "string",+ "description": "Group subject.",+ "example": "Engineering"+ },+ "participantsCount": {+ "type": "number",+ "description": "Member count, when the engine reports it.",+ "example": 42+ },+ "isAdmin": {+ "type": "boolean",+ "description": "Whether this account is an admin of the group.",+ "example": true+ },+ "linkedParentJID": {+ "type": "string",+ "nullable": true,+ "description": "JID of the parent community, or null when the group is standalone.",+ "example": null+ }+ },+ "required": [+ "id",+ "name"+ ]+ },"ParticipantsDto": {"type": "object","properties": {@@ -9356,6 +9751,62 @@"participants"]},+ "ParticipantOperationResultDto": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Neutral participant id the outcome belongs to.",+ "example": "[email protected]"+ },+ "success": {+ "type": "boolean",+ "description": "True only when the engine confirmed the change for this participant.",+ "example": true+ },+ "status": {+ "type": "number",+ "description": "The engine's own status code, when it gave one.",+ "example": 200+ },+ "message": {+ "type": "string",+ "description": "Engine-reported reason, when it gave one.",+ "example": "ok"+ }+ },+ "required": [+ "id",+ "success"+ ]+ },+ "ParticipantsOperationResponseDto": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean",+ "description": "Always true — a failure is reported as a non-2xx status, not as false.",+ "example": true+ },+ "message": {+ "type": "string",+ "description": "Human-readable confirmation of what was done.",+ "example": "Group subject updated"+ },+ "results": {+ "description": "One entry per requested participant.",+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ParticipantOperationResultDto"+ }+ }+ },+ "required": [+ "success",+ "message",+ "results"+ ]+ },"GroupSubjectDto": {"type": "object","properties": {@@ -9382,6 +9833,20 @@"description"]},+ "GroupPictureResponseDto": {+ "type": "object",+ "properties": {+ "url": {+ "type": "string",+ "nullable": true,+ "description": "Group picture URL, or null when the group has none.",+ "example": "https://pps.whatsapp.net/v/t61.24694-24/12345_678_910_n.jpg"+ }+ },+ "required": [+ "url"+ ]+ },"SetGroupPictureDto": {"type": "object","properties": {@@ -9401,6 +9866,50 @@}}},+ "GroupInviteCodeResponseDto": {+ "type": "object",+ "properties": {+ "inviteCode": {+ "type": "string",+ "description": "The invite code on its own.",+ "example": "GTvX9c8H8l718ewOH22Zk5"+ },+ "inviteLink": {+ "type": "string",+ "description": "The same code as a joinable link.",+ "example": "https://chat.whatsapp.com/GTvX9c8H8l718ewOH22Zk5"+ }+ },+ "required": [+ "inviteCode",+ "inviteLink"+ ]+ },+ "GroupInviteCodeRevokedResponseDto": {+ "type": "object",+ "properties": {+ "inviteCode": {+ "type": "string",+ "description": "The invite code on its own.",+ "example": "GTvX9c8H8l718ewOH22Zk5"+ },+ "inviteLink": {+ "type": "string",+ "description": "The same code as a joinable link.",+ "example": "https://chat.whatsapp.com/GTvX9c8H8l718ewOH22Zk5"+ },+ "message": {+ "type": "string",+ "description": "Confirmation that the previous code was revoked.",+ "example": "Invite code revoked and new one generated"+ }+ },+ "required": [+ "inviteCode",+ "inviteLink",+ "message"+ ]+ },"SetProfileNameDto": {"type": "object","properties": {diff --git a/src/modules/group/dto/group-response.dto.ts b/src/modules/group/dto/group-response.dto.tsnew file mode 100644index 000000000..4dc64bdcc--- /dev/null+++ b/src/modules/group/dto/group-response.dto.ts@@ -0,0 +1,200 @@+import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';++/**+ * Response shapes for the group routes. These describe what the handlers already return — the+ * payload is the raw handler value, not an envelope — so that a change to the shape shows up as a+ * diff in the committed OpenAPI snapshot instead of reaching clients unannounced.+ *+ * Decorated properties deliberately avoid named utility types (`Record<…>` and friends):+ * emitDecoratorMetadata wraps a named type in a runtime `typeof X !== "undefined" && X` guard whose+ * other arm can never execute, which shows up as an uncoverable branch.+ */+export class GroupParticipantDto {+ @ApiProperty({ description: "Participant id in the engine's native format.", example: '[email protected]' })+ id!: string;++ @ApiProperty({ description: 'MSISDN digits, without a leading + or separators.', example: '628123456789' })+ number!: string;++ @ApiPropertyOptional({ description: 'Display name, when the engine reports one.', example: 'Ada Lovelace' })+ name?: string;++ @ApiProperty({ description: 'Whether the participant is a group admin.', example: false })+ isAdmin!: boolean;++ @ApiProperty({ description: 'Whether the participant created the group.', example: false })+ isSuperAdmin!: boolean;+}++export class GroupSummaryDto {+ @ApiProperty({ description: 'Group id.', example: '[email protected]' })+ id!: string;++ @ApiProperty({ description: 'Group subject.', example: 'Engineering' })+ name!: string;++ @ApiPropertyOptional({ description: 'Member count, when the engine reports it.', example: 42 })+ participantsCount?: number;++ @ApiPropertyOptional({ description: 'Whether this account is an admin of the group.', example: true })+ isAdmin?: boolean;++ @ApiPropertyOptional({+ type: String,+ nullable: true,+ description: 'JID of the parent community, or null when the group is standalone.',+ example: null,+ })+ linkedParentJID?: string | null;+}++export class GroupInfoDto extends GroupSummaryDto {+ @ApiPropertyOptional({ description: 'Group description.', example: 'Release coordination' })+ description?: string;++ @ApiPropertyOptional({ description: "Owner id in the engine's native format.", example: '[email protected]' })+ owner?: string;++ @ApiPropertyOptional({ description: 'Unix SECONDS the group was created.', example: 1786000000 })+ createdAt?: number;++ @ApiProperty({ type: [GroupParticipantDto], description: 'Members of the group.' })+ participants!: GroupParticipantDto[];++ @ApiPropertyOptional({ description: 'Whether this account can no longer post (left or removed).', example: false })+ isReadOnly?: boolean;++ @ApiPropertyOptional({ description: 'Engine-reported announce flag.', example: false })+ isAnnounce?: boolean;++ @ApiPropertyOptional({ description: 'Only admins may send messages.', example: false })+ announce?: boolean;++ @ApiPropertyOptional({ description: 'Only admins may edit subject, description and picture.', example: false })+ locked?: boolean;++ @ApiPropertyOptional({ description: 'Disappearing-messages timer in seconds; 0 or absent means off.', example: 0 })+ ephemeralSeconds?: number;++ @ApiPropertyOptional({+ enum: ['all', 'admins'],+ description: 'Who may add participants. Absent when the engine did not report it.',+ example: 'admins',+ })+ memberAddMode?: string;+}++/**+ * What an invite code discloses BEFORE joining. Deliberately not GroupInfoDto: a non-member has no+ * participant list, so WhatsApp discloses at most a count — an empty array would read as "this+ * group has no members", a different and wrong claim.+ */+export class GroupJoinInfoDto {+ @ApiProperty({ description: 'Group id.', example: '[email protected]' })+ id!: string;++ @ApiProperty({ description: 'Group subject.', example: 'Engineering' })+ name!: string;++ @ApiPropertyOptional({ description: 'Group description.', example: 'Release coordination' })+ description?: string;++ @ApiPropertyOptional({ description: "Owner id in the engine's native format.", example: '[email protected]' })+ owner?: string;++ @ApiPropertyOptional({ description: 'Unix SECONDS the group was created.', example: 1786000000 })+ createdAt?: number;++ @ApiPropertyOptional({ description: 'Member count, when disclosed.', example: 42 })+ participantCount?: number;+}++export class GroupSettingsResponseDto {+ @ApiPropertyOptional({ description: 'Only admins may send messages.', example: false })+ announce?: boolean;++ @ApiPropertyOptional({ description: 'Only admins may edit subject, description and picture.', example: false })+ locked?: boolean;++ @ApiPropertyOptional({+ description: 'Disappearing-messages timer in seconds. Absent when the engine did not report it.',+ example: 0,+ })+ ephemeralSeconds?: number;++ @ApiPropertyOptional({+ enum: ['all', 'admins'],+ description: 'Who may add participants. Absent when the engine did not report it.',+ example: 'admins',+ })+ memberAddMode?: string;+}++export class GroupAckResponseDto {+ @ApiProperty({ description: 'Always true — a failure is reported as a non-2xx status, not as false.', example: true })+ success!: boolean;++ @ApiProperty({ description: 'Human-readable confirmation of what was done.', example: 'Group subject updated' })+ message!: string;+}++/**+ * Per-participant outcome of a membership write. Engines that report per-participant results map+ * them verbatim; engines that only confirm the batch report one success entry per requested id — so+ * a `success: true` here does not always mean the engine spoke about THAT participant individually.+ */+export class ParticipantOperationResultDto {+ @ApiProperty({ description: 'Neutral participant id the outcome belongs to.', example: '[email protected]' })+ id!: string;++ @ApiProperty({ description: 'True only when the engine confirmed the change for this participant.', example: true })+ success!: boolean;++ @ApiPropertyOptional({ description: "The engine's own status code, when it gave one.", example: 200 })+ status?: number;++ @ApiPropertyOptional({ description: 'Engine-reported reason, when it gave one.', example: 'ok' })+ message?: string;+}++export class ParticipantsOperationResponseDto extends GroupAckResponseDto {+ @ApiProperty({ type: [ParticipantOperationResultDto], description: 'One entry per requested participant.' })+ results!: ParticipantOperationResultDto[];+}++export class GroupJoinedResponseDto {+ @ApiProperty({ description: 'Always true — a failure is reported as a non-2xx status.', example: true })+ success!: boolean;++ @ApiProperty({ description: 'Id of the group that was joined.', example: '[email protected]' })+ groupId!: string;+}++export class GroupPictureResponseDto {+ @ApiProperty({+ type: String,+ nullable: true,+ description: 'Group picture URL, or null when the group has none.',+ example: 'https://pps.whatsapp.net/v/t61.24694-24/12345_678_910_n.jpg',+ })+ url!: string | null;+}++export class GroupInviteCodeResponseDto {+ @ApiProperty({ description: 'The invite code on its own.', example: 'GTvX9c8H8l718ewOH22Zk5' })+ inviteCode!: string;++ @ApiProperty({+ description: 'The same code as a joinable link.',+ example: 'https://chat.whatsapp.com/GTvX9c8H8l718ewOH22Zk5',+ })+ inviteLink!: string;+}++export class GroupInviteCodeRevokedResponseDto extends GroupInviteCodeResponseDto {+ @ApiProperty({+ description: 'Confirmation that the previous code was revoked.',+ example: 'Invite code revoked and new one generated',+ })+ message!: string;+}diff --git a/src/modules/group/group.controller.ts b/src/modules/group/group.controller.tsindex 237d2045f..e933d0339 100644--- a/src/modules/group/group.controller.ts+++ b/src/modules/group/group.controller.ts@@ -12,6 +12,18 @@ import {} from './dto/group.dto';import { RequireRole } from '../auth/decorators/auth.decorators';import { ApiKeyRole } from '../auth/entities/api-key.entity';+import {+ GroupAckResponseDto,+ GroupInfoDto,+ GroupInviteCodeResponseDto,+ GroupInviteCodeRevokedResponseDto,+ GroupJoinInfoDto,+ GroupJoinedResponseDto,+ GroupPictureResponseDto,+ GroupSettingsResponseDto,+ GroupSummaryDto,+ ParticipantsOperationResponseDto,+} from './dto/group-response.dto';// Reading an invite code is admin-only, but the groups list returns every group the account// belongs to whatever its role — so these two statuses apply to ids the caller was just given.@@ -41,7 +53,7 @@ export class GroupController {})@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiQuery({ name: 'code', description: 'Group invite code (the part after the invite link)' })- @ApiResponse({ status: 200, description: 'What the invite discloses about the group' })+ @ApiResponse({ status: 200, description: 'What the invite discloses about the group', type: GroupJoinInfoDto })@ApiResponse({ status: 400, description: 'Session not started, or no code supplied' })@ApiResponse({ status: 404, description: 'No such invite — invalid, expired or revoked' })async joinInfo(@Param('sessionId') sessionId: string, @Query('code') code: string) {@@ -52,7 +64,7 @@ export class GroupController {@ApiOperation({ summary: 'Get detailed group info' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID (e.g., [email protected])' })- @ApiResponse({ status: 200, description: 'Group details with participants' })+ @ApiResponse({ status: 200, description: 'Group details with participants', type: GroupInfoDto })@ApiResponse({ status: 404, description: 'Group not found' })async findOne(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {return this.groupService.getGroupInfo(sessionId, groupId);@@ -64,7 +76,7 @@ export class GroupController {@ApiOperation({ summary: 'Join a group via invite code' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiBody({ type: JoinGroupDto })- @ApiResponse({ status: 200, description: 'Joined the group' })+ @ApiResponse({ status: 200, description: 'Joined the group', type: GroupJoinedResponseDto })@ApiResponse({ status: 400, description: 'Invalid or expired invite code, or session is not started' })async join(@Param('sessionId') sessionId: string, @Body() dto: JoinGroupDto) {const groupId = await this.groupService.joinGroupViaInviteCode(sessionId, dto.inviteCode);@@ -75,7 +87,7 @@ export class GroupController {@ApiOperation({ summary: 'Get group settings (announce / locked / ephemeral timer)' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Group settings' })+ @ApiResponse({ status: 200, description: 'Group settings', type: GroupSettingsResponseDto })@ApiResponse({ status: 404, description: 'Group not found' })async getSettings(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {return this.groupService.getGroupSettings(sessionId, groupId);@@ -87,7 +99,7 @@ export class GroupController {@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })@ApiBody({ type: GroupSettingsDto })- @ApiResponse({ status: 200, description: 'Group settings updated' })+ @ApiResponse({ status: 200, description: 'Group settings updated', type: GroupAckResponseDto })@ApiResponse({ status: 400, description: 'No setting provided, or a value is not a boolean' })@ApiResponse({ status: 403, description: 'The engine refused the change (the account is not a group admin)' })@ApiResponse({ status: 404, description: 'Group not found' })@@ -106,7 +118,7 @@ export class GroupController {@ApiOperation({ summary: 'Create a new group' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiBody({ type: CreateGroupDto })- @ApiResponse({ status: 201, description: 'Group created' })+ @ApiResponse({ status: 201, description: 'Group created', type: GroupSummaryDto })async create(@Param('sessionId') sessionId: string, @Body() dto: CreateGroupDto) {return this.groupService.createGroup(sessionId, dto.name, dto.participants);}@@ -121,6 +133,7 @@ export class GroupController {status: 200,description:'Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)',+ type: ParticipantsOperationResponseDto,})@HttpCode(HttpStatus.OK)async addParticipants(@@ -142,6 +155,7 @@ export class GroupController {status: 200,description:'Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)',+ type: ParticipantsOperationResponseDto,})async removeParticipants(@Param('sessionId') sessionId: string,@@ -162,6 +176,7 @@ export class GroupController {status: 200,description:'Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)',+ type: ParticipantsOperationResponseDto,})@HttpCode(HttpStatus.OK)async promoteParticipants(@@ -183,6 +198,7 @@ export class GroupController {status: 200,description:'Participants processed — `results` carries the per-participant outcome (a partial refusal does not fail the batch; a total refusal is an error)',+ type: ParticipantsOperationResponseDto,})@HttpCode(HttpStatus.OK)async demoteParticipants(@@ -200,7 +216,7 @@ export class GroupController {@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })@ApiBody({ type: GroupSubjectDto })- @ApiResponse({ status: 200, description: 'Subject updated' })+ @ApiResponse({ status: 200, description: 'Subject updated', type: GroupAckResponseDto })@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights are required' })async setSubject(@Param('sessionId') sessionId: string,@@ -217,7 +233,7 @@ export class GroupController {@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })@ApiBody({ type: GroupDescriptionDto })- @ApiResponse({ status: 200, description: 'Description updated' })+ @ApiResponse({ status: 200, description: 'Description updated', type: GroupAckResponseDto })@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights are required' })async setDescription(@Param('sessionId') sessionId: string,@@ -233,7 +249,7 @@ export class GroupController {@ApiOperation({ summary: 'Leave a group' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Left the group' })+ @ApiResponse({ status: 200, description: 'Left the group', type: GroupAckResponseDto })@HttpCode(HttpStatus.OK)async leave(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {await this.groupService.leaveGroup(sessionId, groupId);@@ -246,7 +262,11 @@ export class GroupController {@ApiOperation({ summary: "Get the group's picture URL" })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Picture URL, or null when the group has none' })+ @ApiResponse({+ status: 200,+ description: 'Picture URL, or null when the group has none',+ type: GroupPictureResponseDto,+ })async getPicture(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {return { url: await this.groupService.getGroupPicture(sessionId, groupId) };}@@ -257,7 +277,7 @@ export class GroupController {@ApiOperation({ summary: "Set the group's picture" })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Group picture updated' })+ @ApiResponse({ status: 200, description: 'Group picture updated', type: GroupAckResponseDto })@ApiResponse({ status: 400, description: 'Session not active, or neither url nor base64 supplied' })@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights required' })async setPicture(@@ -275,7 +295,7 @@ export class GroupController {@ApiOperation({ summary: "Remove the group's picture" })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Group picture removed' })+ @ApiResponse({ status: 200, description: 'Group picture removed', type: GroupAckResponseDto })@ApiResponse({ status: 403, description: 'The engine refused the change — admin rights required' })async deletePicture(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {await this.groupService.deleteGroupPicture(sessionId, groupId);@@ -286,7 +306,7 @@ export class GroupController {@ApiOperation({ summary: 'Get group invite code/link' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'Group invite code' })+ @ApiResponse({ status: 200, description: 'Group invite code', type: GroupInviteCodeResponseDto })@ApiResponse({ status: 403, description: INVITE_CODE_403 })@ApiResponse({ status: 503, description: INVITE_CODE_503 })async getInviteCode(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {@@ -303,7 +323,7 @@ export class GroupController {@ApiOperation({ summary: 'Revoke group invite code and generate new one' })@ApiParam({ name: 'sessionId', description: 'Session ID' })@ApiParam({ name: 'groupId', description: 'Group ID' })- @ApiResponse({ status: 200, description: 'New invite code generated' })+ @ApiResponse({ status: 200, description: 'New invite code generated', type: GroupInviteCodeRevokedResponseDto })@ApiResponse({ status: 403, description: INVITE_CODE_403 })@ApiResponse({ status: 503, description: INVITE_CODE_503 })async revokeInviteCode(@Param('sessionId') sessionId: string, @Param('groupId') groupId: string) {