(auth: AuthContext | null, id: string)
| 166 | } |
| 167 | |
| 168 | async regeneratePath(auth: AuthContext | null, id: string): Promise<WebhookUrlResponse> { |
| 169 | const existing = await this.repository.findById(id, { organizationId: auth?.organizationId }); |
| 170 | if (!existing) { |
| 171 | throw new NotFoundException(`Webhook ${id} not found`); |
| 172 | } |
| 173 | |
| 174 | await this.workflowsService.ensureWorkflowAdminAccess(existing.workflowId, auth); |
| 175 | |
| 176 | const newPath = this.generateWebhookPath(); |
| 177 | const updated = await this.repository.update( |
| 178 | id, |
| 179 | { webhookPath: newPath }, |
| 180 | { organizationId: auth?.organizationId }, |
| 181 | ); |
| 182 | |
| 183 | if (!updated) { |
| 184 | throw new NotFoundException(`Webhook ${id} not found`); |
| 185 | } |
| 186 | |
| 187 | this.logger.log(`Regenerated path for webhook ${id}: ${newPath}`); |
| 188 | return { |
| 189 | id: updated.id, |
| 190 | name: updated.name, |
| 191 | webhookPath: updated.webhookPath, |
| 192 | url: this.buildWebhookUrl(updated.webhookPath), |
| 193 | }; |
| 194 | } |
| 195 | |
| 196 | async getUrl(auth: AuthContext | null, id: string): Promise<WebhookUrlResponse> { |
| 197 | const webhook = await this.get(auth, id); |
no test coverage detected