Stabilize logging, correlation IDs, service-account Jira auth, and direct approver reminder DMs while splitting the monolith into focused modules with Compose-based deployment. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
858 B
JavaScript
23 lines
858 B
JavaScript
export function validateJiraWebhook(body) {
|
|
if (!body || typeof body !== 'object') {
|
|
return { valid: false, error: 'Payload must be a JSON object' };
|
|
}
|
|
if (!body.issue?.key || typeof body.issue.key !== 'string') {
|
|
return { valid: false, error: 'Missing or invalid issue.key' };
|
|
}
|
|
if (!body.issue.fields || typeof body.issue.fields !== 'object') {
|
|
return { valid: false, error: 'Missing issue.fields' };
|
|
}
|
|
return { valid: true, issueKey: body.issue.key };
|
|
}
|
|
|
|
export function validateSupportWebhook(body) {
|
|
const base = validateJiraWebhook(body);
|
|
if (!base.valid) {
|
|
return base;
|
|
}
|
|
if (!body.webhookEvent || typeof body.webhookEvent !== 'string') {
|
|
return { valid: false, error: 'Missing or invalid webhookEvent' };
|
|
}
|
|
return { valid: true, issueKey: base.issueKey };
|
|
}
|