Fix SQL join type mismatch (application_id varchar vs id bigint) and add is_api field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-04 01:14:46 +01:00
parent 68649b0073
commit 5aa7559d43
2 changed files with 9 additions and 5 deletions

View File

@@ -58,6 +58,7 @@ function rowToDeployment(row: Record<string, unknown>): Deployment {
git_commit_sha: (row.commit as string) || undefined, git_commit_sha: (row.commit as string) || undefined,
commit_message: (row.commit_message as string) || undefined, commit_message: (row.commit_message as string) || undefined,
is_webhook: row.is_webhook as boolean | undefined, is_webhook: row.is_webhook as boolean | undefined,
is_api: row.is_api as boolean | undefined,
logs: (row.logs as string) || undefined, logs: (row.logs as string) || undefined,
duration, duration,
}; };
@@ -69,7 +70,7 @@ export async function fetchDeployments(limit = 50): Promise<Deployment[]> {
SELECT SELECT
q.deployment_uuid, q.deployment_uuid,
a.uuid AS application_uuid, a.uuid AS application_uuid,
a.name AS application_name, COALESCE(q.application_name, a.name) AS application_name,
a.fqdn AS application_fqdn, a.fqdn AS application_fqdn,
q.status, q.status,
q.created_at, q.created_at,
@@ -77,9 +78,10 @@ export async function fetchDeployments(limit = 50): Promise<Deployment[]> {
a.git_branch, a.git_branch,
q.commit, q.commit,
q.commit_message, q.commit_message,
q.is_webhook q.is_webhook,
q.is_api
FROM application_deployment_queues q FROM application_deployment_queues q
LEFT JOIN applications a ON a.id = q.application_id LEFT JOIN applications a ON a.id = q.application_id::bigint
ORDER BY q.created_at DESC ORDER BY q.created_at DESC
LIMIT $1 LIMIT $1
`, [limit]); `, [limit]);
@@ -106,7 +108,7 @@ export async function fetchDeploymentDetail(uuid: string): Promise<Deployment |
SELECT SELECT
q.deployment_uuid, q.deployment_uuid,
a.uuid AS application_uuid, a.uuid AS application_uuid,
a.name AS application_name, COALESCE(q.application_name, a.name) AS application_name,
a.fqdn AS application_fqdn, a.fqdn AS application_fqdn,
q.status, q.status,
q.created_at, q.created_at,
@@ -115,9 +117,10 @@ export async function fetchDeploymentDetail(uuid: string): Promise<Deployment |
q.commit, q.commit,
q.commit_message, q.commit_message,
q.is_webhook, q.is_webhook,
q.is_api,
q.logs q.logs
FROM application_deployment_queues q FROM application_deployment_queues q
LEFT JOIN applications a ON a.id = q.application_id LEFT JOIN applications a ON a.id = q.application_id::bigint
WHERE q.deployment_uuid = $1 WHERE q.deployment_uuid = $1
`, [uuid]); `, [uuid]);

View File

@@ -13,6 +13,7 @@ export interface Deployment {
git_commit_sha?: string; git_commit_sha?: string;
commit_message?: string; commit_message?: string;
is_webhook?: boolean; is_webhook?: boolean;
is_api?: boolean;
logs?: string; logs?: string;
// Computed fields // Computed fields
duration?: number; // in seconds duration?: number; // in seconds