src/jobs/schemas/job.schema.ts
Properties |
| _id |
Type : string
|
Decorators :
@ApiProperty({type: String, description: 'Globally unique identifier of a job.', readOnly: true})
|
|
Defined in src/jobs/schemas/job.schema.ts:23
|
| creationTime |
Type : Date
|
Decorators :
@ApiProperty({description: 'Time when job is created. Format according to chapter 5.6 internet date/time format in RFC 3339. This is handled automatically by mongoose with timestamps flag.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:47
|
| datasetList |
Type : Record<string, >[]
|
Decorators :
@ApiProperty({description: 'Array of objects with keys: pid, files. The value for the pid key defines the dataset ID, the value for the files key is an array of file names. This array is either an empty array, implying that all files within the dataset are selected or an explicit list of dataset-relative file paths, which should be selected.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:72
|
| emailJobInitiator |
Type : string
|
Decorators :
@ApiProperty({description: 'The email of the person initiating the job request.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:31
|
| executionTime |
Type : Date
|
Decorators :
@ApiProperty({description: 'Time when job should be executed. If not specified then the Job will be executed asap. Format according to chapter 5.6 internet date/time format in RFC 3339.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:54
|
| Optional id |
Type : string
|
|
Defined in src/jobs/schemas/job.schema.ts:25
|
| jobParams |
Type : Record<string | >
|
Decorators :
@ApiProperty({description: 'Object of key-value pairs defining job input parameters, e.g. 'destinationPath' for retrieve jobs or 'tapeCopies' for archive jobs.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:61
|
| jobResultObject |
Type : Record<string | >
|
Decorators :
@ApiProperty({description: 'Detailed return value after job is finished.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:76
|
| jobStatusMessage |
Type : string
|
Decorators :
@ApiProperty({description: 'Defines current status of job lifecycle.'})
|
|
Defined in src/jobs/schemas/job.schema.ts:65
|
| type |
Type : string
|
Decorators :
@ApiProperty({description: 'Type of job, e.g. archive, retrieve etc'})
|
|
Defined in src/jobs/schemas/job.schema.ts:40
|
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { ApiProperty } from "@nestjs/swagger";
import { Document } from "mongoose";
import { v4 as uuidv4 } from "uuid";
import { JobType } from "../job-type.enum";
export type JobDocument = Job & Document;
@Schema({
collection: "Job",
timestamps: { createdAt: "creationTime", updatedAt: false },
toJSON: {
getters: true,
},
})
export class Job {
@ApiProperty({
type: String,
description: "Globally unique identifier of a job.",
readOnly: true,
})
@Prop({ type: String, default: () => uuidv4() })
_id: string;
id?: string;
@ApiProperty({
description: "The email of the person initiating the job request.",
})
@Prop({ type: String, required: true })
emailJobInitiator: string;
@ApiProperty({ description: "Type of job, e.g. archive, retrieve etc" })
@Prop({
type: String,
required: true,
enum: [JobType.Archive, JobType.Retrieve, JobType.Public],
default: JobType.Retrieve,
})
type: string;
@ApiProperty({
description:
"Time when job is created. Format according to chapter 5.6 internet date/time format in RFC 3339. This is handled automatically by mongoose with timestamps flag.",
})
@Prop({ type: Date })
creationTime: Date;
@ApiProperty({
description:
"Time when job should be executed. If not specified then the Job will be executed asap. Format according to chapter 5.6 internet date/time format in RFC 3339.",
})
@Prop({ type: Date, required: false })
executionTime: Date;
@ApiProperty({
description:
"Object of key-value pairs defining job input parameters, e.g. 'destinationPath' for retrieve jobs or 'tapeCopies' for archive jobs.",
})
@Prop({ type: Object, required: false })
jobParams: Record<string, unknown>;
@ApiProperty({ description: "Defines current status of job lifecycle." })
@Prop({ type: String, required: false })
jobStatusMessage: string;
@ApiProperty({
description:
"Array of objects with keys: pid, files. The value for the pid key defines the dataset ID, the value for the files key is an array of file names. This array is either an empty array, implying that all files within the dataset are selected or an explicit list of dataset-relative file paths, which should be selected.",
})
@Prop({ type: [Object], required: false })
datasetList: Record<string, unknown>[];
@ApiProperty({ description: "Detailed return value after job is finished." })
@Prop({ type: Object, required: false })
jobResultObject: Record<string, unknown>;
}
export const JobSchema = SchemaFactory.createForClass(Job);
JobSchema.index({ "$**": "text" });