Skip to main content

apps/gateway/src/services/job-repository.ts

Metadata

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;