Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/jobs/utils/job-context

lib/jobs/utils/job-context

Defines types and helper functions for managing the context object passed to job handlers.

This module provides a standardized structure (JobHandlerContext) for the context object that job handlers receive. It includes TypeScript interfaces for various job payloads and helper functions to safely extract necessary information like the Payload instance and job-specific inputs from the context. This ensures consistency and robustness in how jobs are executed.

Interfaces

FileParsingJobPayload

Properties

input

input: object

importJobId

importJobId: number

filePath

filePath: string

fileType

fileType: "csv" | "xlsx"


BatchProcessingJobPayload

Properties

input

input: object

importJobId

importJobId: number

batchNumber

batchNumber: number

batchData

batchData: Record<string, unknown>[]


GeocodingBatchJobPayload

Properties

input

input: object

importJobId

importJobId: number

eventIds?

optional eventIds: number[]

batchNumber?

optional batchNumber: number


EventCreationJobPayload

Properties

input

input: object

importJobId

importJobId: number

processedData

processedData: Record<string, unknown>[]

batchNumber

batchNumber: number

Type Aliases

JobHandlerContext<T>

JobHandlerContext<T> = object

Type Parameters

T

T = unknown

Indexable

[key: string]: unknown

Properties

input?

optional input: T

job?

optional job: object

Index Signature

[key: string]: unknown

id

id: string | number

taskStatus?

optional taskStatus: Record<string, unknown>

req?

optional req: object

Index Signature

[key: string]: unknown

payload

payload: Payload

payload?

optional payload: Payload

Functions

extractFileParsingContext()

extractFileParsingContext(context): object

Parameters

context

JobHandlerContext

Returns

object

payload

payload: BasePayload

input

input: object

input.importJobId

importJobId: number

input.filePath

filePath: string

input.fileType

fileType: "csv" | "xlsx"


extractEventCreationContext()

extractEventCreationContext(context): object

Parameters

context

JobHandlerContext

Returns

object

payload

payload: BasePayload

input

input: object

input.importJobId

importJobId: number

input.processedData

processedData: Record<string, unknown>[]

input.batchNumber

batchNumber: number

Last updated on