apps/gateway/src/services/job-repository.ts
Metadata
- Purpose: Gateway service module implementing business logic or integrations.
- Domain:
applications - Language:
ts - Bytes: 5834
- Lines: 184
- Content hash (short):
ad13b603 - Source (start): apps/gateway/src/services/job-repository.ts:1
- Source (end): apps/gateway/src/services/job-repository.ts:184
Indexed Symbols
rowToJob(line 40, function) - Implements row to job for service-layer operations.createBackgroundJob(line 59, function) - Implements create background job for service-layer operations.listBackgroundJobs(line 72, function) - Implements list background jobs for service-layer operations.reserveQueuedJobs(line 86, function) - Implements reserve queued jobs for service-layer operations.markBackgroundJobStatus(line 119, function) - Implements mark background job status for service-layer operations.listFailedBackgroundJobs(line 134, function) - Implements list failed background jobs for service-layer operations.retryBackgroundJob(line 165, function) - Implements retry background job for service-layer operations.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { randomUUID } from "node:crypto";
import { query } from "./postgres.js";
type JobStatus = "queued" | "running" | "succeeded" | "failed";
export type BackgroundJob = {
id: string;
workspaceId: string;
jobType: string;
status: JobStatus;
payload: unknown;
createdAt: string;
updatedAt: string;
queuedAt: string;
startedAt?: string;
completedAt?: string;
errorCode?: string;
errorMessage?: string;
artifactUrl?: string;
retryCount: number;
};
type BackgroundJobRow = {
id: string;
workspace_id: string;