Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(api): declare the 409 three routes can answer

Yudhi Armyndharis4e6de938e8f9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f2b24eb3..c3debb5bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- The Go and Java SDKs can @mention on an audio send. `SendAudioRequest` was flattened off the shared media type and lost the field, so the typed path could not set it while every other client could.
+- Three routes declare the `409` they can answer: a duplicate template name on create or rename, and an integration instance id that already exists. Clients generated from the contract modelled those calls as unable to conflict.
- Plugin config fields bind their caption to the control for every field type, not just booleans. Clicking the caption of a text, number, secret, enum or textarea field focused nothing, and screen readers announced those inputs with no name.
- Dashboard toggles expose an accessible name and, for the message-type and recipient groups, their selected state. Their captions sit outside the control, so a screen reader announced anonymous checkboxes and unlabelled buttons.
- The PostgreSQL signing key is committed instead of fetched during the image build, so the one build input nothing pinned is now reviewable and diffable, and a release build makes one fewer uncached network call.
diff --git a/openapi.json b/openapi.json
index a12442a8f..cca95c915 100644
--- a/openapi.json
+++ b/openapi.json
@@ -3681,6 +3681,9 @@
}
}
}
+ },
+ "409": {
+ "description": "A template with that name already exists for the session"
}
},
"summary": "Create a message template for the session",
@@ -3810,6 +3813,9 @@
},
"404": {
"description": "Template not found"
+ },
+ "409": {
+ "description": "A template with that name already exists for the session"
}
},
"summary": "Update a template",
@@ -9100,6 +9106,9 @@
}
}
}
+ },
+ "409": {
+ "description": "An instance with that id already exists for the plugin"
}
},
"tags": [
diff --git a/src/modules/integration/integration-instance.controller.ts b/src/modules/integration/integration-instance.controller.ts
index f97e426ad..4829fcdd6 100644
--- a/src/modules/integration/integration-instance.controller.ts
+++ b/src/modules/integration/integration-instance.controller.ts
@@ -47,6 +47,7 @@ export class IntegrationInstanceController {
'Instance created. The plaintext ingress secret and verifyToken are revealed once in this response — store them immediately (both masked on every later read).',
type: InstanceView,
})
+ @ApiResponse({ status: 409, description: 'An instance with that id already exists for the plugin' })
async create(
@Param('pluginId') pluginId: string,
@Body() dto: CreateInstanceDto,
diff --git a/src/modules/template/template.controller.ts b/src/modules/template/template.controller.ts
index 17e2a4789..55e1ea788 100644
--- a/src/modules/template/template.controller.ts
+++ b/src/modules/template/template.controller.ts
@@ -16,6 +16,7 @@ export class TemplateController {
@ApiOperation({ summary: 'Create a message template for the session' })
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiResponse({ status: 201, description: 'Template created', type: TemplateResponseDto })
+ @ApiResponse({ status: 409, description: 'A template with that name already exists for the session' })
async create(@Param('sessionId') sessionId: string, @Body() dto: CreateTemplateDto): Promise<Template> {
return this.templateService.create(sessionId, dto);
}
@@ -47,6 +48,7 @@ export class TemplateController {
@ApiParam({ name: 'id', description: 'Template ID' })
@ApiResponse({ status: 200, description: 'Template updated', type: TemplateResponseDto })
@ApiResponse({ status: 404, description: 'Template not found' })
+ @ApiResponse({ status: 409, description: 'A template with that name already exists for the session' })
async update(
@Param('sessionId') sessionId: string,
@Param('id') id: string,