@volontariapp/workers 0.1.0-snap-e0dc7be → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,16 +2,10 @@ import { WorkerHost } from '@nestjs/bullmq';
2
2
  import { Logger } from '@volontariapp/logger';
3
3
  import type { Job } from 'bullmq';
4
4
  import type { JobMessagingType, JobRegistry } from '@volontariapp/messaging';
5
- import type { JobAuditRepository } from '../data/index.js';
6
5
  export declare abstract class BaseWorker<K extends JobMessagingType> extends WorkerHost {
7
- protected readonly auditRepo?: JobAuditRepository | undefined;
8
6
  protected readonly logger: Logger;
9
7
  protected readonly workerId: string;
10
- constructor(auditRepo?: JobAuditRepository | undefined);
11
8
  process(job: Job<JobRegistry[K], void, K>, _token?: string): Promise<void>;
12
9
  protected abstract processJob(job: Job<JobRegistry[K], void, K>): Promise<void>;
13
- private recordAuditStart;
14
- private recordAuditSuccess;
15
- private recordAuditFailure;
16
10
  }
17
11
  //# sourceMappingURL=base.worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.worker.d.ts","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,8BAAsB,UAAU,CAAC,CAAC,SAAS,gBAAgB,CAAE,SAAQ,UAAU;IAIjE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB;IAH7D,SAAS,CAAC,QAAQ,CAAC,MAAM,SAAkD;IAC3E,SAAS,CAAC,QAAQ,CAAC,QA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@ -1,23 +1,15 @@
1
1
  import { WorkerHost } from '@nestjs/bullmq';
2
2
  import { Logger } from '@volontariapp/logger';
3
3
  import { hostname } from 'node:os';
4
- import { JobAuditStatus } from '../data/index.js';
5
4
  export class BaseWorker extends WorkerHost {
6
- auditRepo;
7
5
  logger = new Logger({ context: this.constructor.name });
8
6
  workerId = hostname();
9
- constructor(auditRepo) {
10
- super();
11
- this.auditRepo = auditRepo;
12
- }
13
7
  async process(job, _token) {
14
8
  this.logger.info('Processing job', {
15
9
  jobId: job.id,
16
10
  type: job.name,
17
11
  workerId: this.workerId,
18
12
  });
19
- const startedAt = new Date();
20
- await this.recordAuditStart(job, startedAt);
21
13
  try {
22
14
  await this.processJob(job);
23
15
  this.logger.info('Job completed', {
@@ -25,7 +17,6 @@ export class BaseWorker extends WorkerHost {
25
17
  type: job.name,
26
18
  workerId: this.workerId,
27
19
  });
28
- await this.recordAuditSuccess(job);
29
20
  }
30
21
  catch (error) {
31
22
  this.logger.error('Job failed', {
@@ -34,78 +25,8 @@ export class BaseWorker extends WorkerHost {
34
25
  workerId: this.workerId,
35
26
  error,
36
27
  });
37
- await this.recordAuditFailure(job, error);
38
28
  throw error;
39
29
  }
40
30
  }
41
- async recordAuditStart(job, startedAt) {
42
- if (!this.auditRepo || !job.id)
43
- return;
44
- try {
45
- await this.auditRepo.upsert({
46
- jobId: job.id,
47
- jobType: job.name,
48
- status: JobAuditStatus.PROCESSING,
49
- workerId: this.workerId,
50
- currentAttempt: job.attemptsMade + 1,
51
- startedAt,
52
- }, ['jobId']);
53
- }
54
- catch (error) {
55
- this.logger.error('Failed to record audit start', {
56
- jobId: job.id,
57
- error,
58
- });
59
- }
60
- }
61
- async recordAuditSuccess(job) {
62
- if (!this.auditRepo || !job.id) {
63
- return;
64
- }
65
- try {
66
- await this.auditRepo
67
- .createQueryBuilder()
68
- .update()
69
- .set({
70
- status: JobAuditStatus.COMPLETED,
71
- finishedAt: new Date(),
72
- })
73
- .where('jobId = :jobId', { jobId: job.id })
74
- .execute();
75
- }
76
- catch (error) {
77
- this.logger.error('Failed to record audit success', {
78
- jobId: job.id,
79
- error,
80
- });
81
- }
82
- }
83
- async recordAuditFailure(job, error) {
84
- if (!this.auditRepo || !job.id) {
85
- return;
86
- }
87
- try {
88
- const errorMessage = error instanceof Error ? error.message : String(error);
89
- const errorStack = error instanceof Error ? error.stack : undefined;
90
- await this.auditRepo
91
- .createQueryBuilder()
92
- .update()
93
- .set({
94
- status: JobAuditStatus.FAILED,
95
- errorMessage,
96
- errorStack,
97
- finishedAt: new Date(),
98
- currentAttempt: job.attemptsMade + 1,
99
- })
100
- .where('jobId = :jobId', { jobId: job.id })
101
- .execute();
102
- }
103
- catch (auditError) {
104
- this.logger.error('Failed to record audit failure', {
105
- jobId: job.id,
106
- error: auditError,
107
- });
108
- }
109
- }
110
31
  }
111
32
  //# sourceMappingURL=base.worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.worker.js","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAgB,UAAuC,SAAQ,UAAU;IAI9C;IAHZ,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,QAAQ,GAAW,QAAQ,EAAE,CAAC;IAEjD,YAA+B,SAA8B;QAC3D,KAAK,EAAE,CAAC;QADqB,cAAS,GAAT,SAAS,CAAqB;IAE7D,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAiC,EAAE,MAAe;QAC9D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjC,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I,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE;gBAChC,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC9B,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/workers",
3
- "version": "0.1.0-snap-e0dc7be",
3
+ "version": "0.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -32,11 +32,7 @@
32
32
  "lint": "eslint src/",
33
33
  "test": "node --experimental-vm-modules $(yarn bin jest)",
34
34
  "test:coverage": "node --experimental-vm-modules $(yarn bin jest) --coverage --coverageReporters=\"text\" --coverageReporters=\"json-summary\" --coverageReporters=\"lcov\"",
35
- "test:watch": "node --experimental-vm-modules $(yarn bin jest) --watch",
36
- "test:int": "INTEGRATION=true node --experimental-vm-modules $(yarn bin jest)",
37
- "test:int:watch": "INTEGRATION=true node --experimental-vm-modules $(yarn bin jest) --watch",
38
- "db:up": "docker compose -f ../../ci-tools/testing/docker-compose.yml --profile test up -d test-db redis",
39
- "db:down": "docker compose -f ../../ci-tools/testing/docker-compose.yml --profile test stop test-db redis"
35
+ "test:watch": "node --experimental-vm-modules $(yarn bin jest) --watch"
40
36
  },
41
37
  "dependencies": {
42
38
  "@volontariapp/config": "3.0.1",
@@ -54,14 +50,10 @@
54
50
  "@nestjs/common": "^11.0.0",
55
51
  "@types/jest": "^30.0.0",
56
52
  "@types/node": "^24.0.0",
57
- "@volontariapp/database": "1.15.1",
58
53
  "@volontariapp/testing": "1.0.0",
59
54
  "bullmq": "^5.76.5",
60
- "ioredis": "^5.3.7",
61
55
  "jest": "^30.3.0",
62
- "pg": "^8.11.5",
63
56
  "ts-jest": "^29.4.6",
64
- "typeorm": "^0.3.21",
65
57
  "typescript": "5.7.3"
66
58
  }
67
59
  }
@@ -1,15 +0,0 @@
1
- import { BaseEntity } from '@volontariapp/database';
2
- import type { JobAuditStatus } from '../types/job-audit.status.js';
3
- export declare class JobAuditEntity extends BaseEntity {
4
- jobId: string;
5
- jobType: string;
6
- status: JobAuditStatus;
7
- workerId: string;
8
- currentAttempt: number;
9
- startedAt?: Date;
10
- finishedAt?: Date;
11
- resultPayload?: Record<string, unknown>;
12
- errorMessage?: string;
13
- errorStack?: string;
14
- }
15
- //# sourceMappingURL=job-audit.entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.entity.d.ts","sourceRoot":"","sources":["../../../src/data/entities/job-audit.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,qBAAa,cAAe,SAAQ,UAAU;IAC5C,KAAK,EAAG,MAAM,CAAC;IAEf,OAAO,EAAG,MAAM,CAAC;IAEjB,MAAM,EAAG,cAAc,CAAC;IAExB,QAAQ,EAAG,MAAM,CAAC;IAElB,cAAc,EAAG,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,14 +0,0 @@
1
- import { BaseEntity } from '@volontariapp/database';
2
- export class JobAuditEntity extends BaseEntity {
3
- jobId;
4
- jobType;
5
- status;
6
- workerId;
7
- currentAttempt;
8
- startedAt;
9
- finishedAt;
10
- resultPayload;
11
- errorMessage;
12
- errorStack;
13
- }
14
- //# sourceMappingURL=job-audit.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.entity.js","sourceRoot":"","sources":["../../../src/data/entities/job-audit.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,KAAK,CAAU;IAEf,OAAO,CAAU;IAEjB,MAAM,CAAkB;IAExB,QAAQ,CAAU;IAElB,cAAc,CAAU;IAExB,SAAS,CAAQ;IAEjB,UAAU,CAAQ;IAElB,aAAa,CAA2B;IAExC,YAAY,CAAU;IAEtB,UAAU,CAAU;CACrB"}
@@ -1,5 +0,0 @@
1
- export * from './entities/job-audit.entity.js';
2
- export * from './models/job-audit.model.js';
3
- export * from './repositories/job-audit.repository.js';
4
- export * from './types/job-audit.status.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from './entities/job-audit.entity.js';
2
- export * from './models/job-audit.model.js';
3
- export * from './repositories/job-audit.repository.js';
4
- export * from './types/job-audit.status.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC"}
@@ -1,15 +0,0 @@
1
- import { BaseModel } from '@volontariapp/database';
2
- import { JobAuditStatus } from '../types/job-audit.status.js';
3
- export declare class JobAuditModel extends BaseModel {
4
- jobId: string;
5
- jobType: string;
6
- status: JobAuditStatus;
7
- workerId: string;
8
- currentAttempt: number;
9
- startedAt?: Date;
10
- finishedAt?: Date;
11
- resultPayload?: Record<string, unknown>;
12
- errorMessage?: string;
13
- errorStack?: string;
14
- }
15
- //# sourceMappingURL=job-audit.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.model.d.ts","sourceRoot":"","sources":["../../../src/data/models/job-audit.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAKa,aAAc,SAAQ,SAAS;IAE1C,KAAK,EAAG,MAAM,CAAC;IAGf,OAAO,EAAG,MAAM,CAAC;IAGjB,MAAM,EAAE,cAAc,CAA0B;IAGhD,QAAQ,EAAG,MAAM,CAAC;IAGlB,cAAc,EAAE,MAAM,CAAK;IAG3B,SAAS,CAAC,EAAE,IAAI,CAAC;IAGjB,UAAU,CAAC,EAAE,IAAI,CAAC;IAGlB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGxC,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,73 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { Column, Entity, Index } from 'typeorm';
11
- import { BaseModel } from '@volontariapp/database';
12
- import { JobAuditStatus } from '../types/job-audit.status.js';
13
- let JobAuditModel = class JobAuditModel extends BaseModel {
14
- jobId;
15
- jobType;
16
- status = JobAuditStatus.PENDING;
17
- workerId;
18
- currentAttempt = 1;
19
- startedAt;
20
- finishedAt;
21
- resultPayload;
22
- errorMessage;
23
- errorStack;
24
- };
25
- __decorate([
26
- Column({ type: 'varchar', length: 100, name: 'job_id', unique: true }),
27
- __metadata("design:type", String)
28
- ], JobAuditModel.prototype, "jobId", void 0);
29
- __decorate([
30
- Column({ type: 'varchar', length: 255, name: 'job_type' }),
31
- __metadata("design:type", String)
32
- ], JobAuditModel.prototype, "jobType", void 0);
33
- __decorate([
34
- Column({ type: 'varchar', length: 20, default: JobAuditStatus.PENDING }),
35
- __metadata("design:type", String)
36
- ], JobAuditModel.prototype, "status", void 0);
37
- __decorate([
38
- Column({ type: 'varchar', length: 255, name: 'worker_id' }),
39
- __metadata("design:type", String)
40
- ], JobAuditModel.prototype, "workerId", void 0);
41
- __decorate([
42
- Column({ name: 'current_attempt', type: 'int', default: 1 }),
43
- __metadata("design:type", Number)
44
- ], JobAuditModel.prototype, "currentAttempt", void 0);
45
- __decorate([
46
- Column({ name: 'started_at', type: 'timestamp', nullable: true }),
47
- __metadata("design:type", Date)
48
- ], JobAuditModel.prototype, "startedAt", void 0);
49
- __decorate([
50
- Column({ name: 'finished_at', type: 'timestamp', nullable: true }),
51
- __metadata("design:type", Date)
52
- ], JobAuditModel.prototype, "finishedAt", void 0);
53
- __decorate([
54
- Column({ name: 'result_payload', type: 'jsonb', nullable: true }),
55
- __metadata("design:type", Object)
56
- ], JobAuditModel.prototype, "resultPayload", void 0);
57
- __decorate([
58
- Column({ name: 'error_message', type: 'text', nullable: true }),
59
- __metadata("design:type", String)
60
- ], JobAuditModel.prototype, "errorMessage", void 0);
61
- __decorate([
62
- Column({ name: 'error_stack', type: 'text', nullable: true }),
63
- __metadata("design:type", String)
64
- ], JobAuditModel.prototype, "errorStack", void 0);
65
- JobAuditModel = __decorate([
66
- Entity('job_audit'),
67
- Index(['jobId'], { unique: true }),
68
- Index(['jobType']),
69
- Index(['workerId']),
70
- Index(['status'])
71
- ], JobAuditModel);
72
- export { JobAuditModel };
73
- //# sourceMappingURL=job-audit.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.model.js","sourceRoot":"","sources":["../../../src/data/models/job-audit.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAOvD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,SAAS;IAE1C,KAAK,CAAU;IAGf,OAAO,CAAU;IAGjB,MAAM,GAAmB,cAAc,CAAC,OAAO,CAAC;IAGhD,QAAQ,CAAU;IAGlB,cAAc,GAAW,CAAC,CAAC;IAG3B,SAAS,CAAQ;IAGjB,UAAU,CAAQ;IAGlB,aAAa,CAA2B;IAGxC,YAAY,CAAU;IAGtB,UAAU,CAAU;CACrB,CAAA;AA5BC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;4CACxD;AAGf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AAC,CAAC,SAAS,CAAC,CAAC;IAClB,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;IACnB,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;GACL,aAAa,CA8BzB"}
@@ -1,9 +0,0 @@
1
- import { Repository } from 'typeorm';
2
- import { BaseRepository } from '@volontariapp/database';
3
- import { JobAuditEntity } from '../entities/job-audit.entity.js';
4
- import { JobAuditModel } from '../models/job-audit.model.js';
5
- export declare class JobAuditRepository extends BaseRepository<JobAuditModel, JobAuditEntity> {
6
- constructor(repository: Repository<JobAuditModel>);
7
- findByJobId(jobId: string): Promise<JobAuditEntity | null>;
8
- }
9
- //# sourceMappingURL=job-audit.repository.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.repository.d.ts","sourceRoot":"","sources":["../../../src/data/repositories/job-audit.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,qBACa,kBAAmB,SAAQ,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC;gBAGjF,UAAU,EAAE,UAAU,CAAC,aAAa,CAAC;IAKjC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAGjE"}
@@ -1,33 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { Injectable } from '@nestjs/common';
14
- import { InjectRepository } from '@nestjs/typeorm';
15
- import { Repository } from 'typeorm';
16
- import { BaseRepository } from '@volontariapp/database';
17
- import { JobAuditEntity } from '../entities/job-audit.entity.js';
18
- import { JobAuditModel } from '../models/job-audit.model.js';
19
- let JobAuditRepository = class JobAuditRepository extends BaseRepository {
20
- constructor(repository) {
21
- super(repository, JobAuditEntity, JobAuditModel);
22
- }
23
- async findByJobId(jobId) {
24
- return this.findOne({ jobId });
25
- }
26
- };
27
- JobAuditRepository = __decorate([
28
- Injectable(),
29
- __param(0, InjectRepository(JobAuditModel)),
30
- __metadata("design:paramtypes", [Repository])
31
- ], JobAuditRepository);
32
- export { JobAuditRepository };
33
- //# sourceMappingURL=job-audit.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.repository.js","sourceRoot":"","sources":["../../../src/data/repositories/job-audit.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGtD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,cAA6C;IACnF,YAEE,UAAqC;QAErC,KAAK,CAAC,UAAU,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAXY,kBAAkB;IAD9B,UAAU,EAAE;IAGR,WAAA,gBAAgB,CAAC,aAAa,CAAC,CAAA;qCACpB,UAAU;GAHb,kBAAkB,CAW9B"}
@@ -1,7 +0,0 @@
1
- export declare enum JobAuditStatus {
2
- PENDING = "PENDING",
3
- PROCESSING = "PROCESSING",
4
- COMPLETED = "COMPLETED",
5
- FAILED = "FAILED"
6
- }
7
- //# sourceMappingURL=job-audit.status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.status.d.ts","sourceRoot":"","sources":["../../../src/data/types/job-audit.status.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
@@ -1,8 +0,0 @@
1
- export var JobAuditStatus;
2
- (function (JobAuditStatus) {
3
- JobAuditStatus["PENDING"] = "PENDING";
4
- JobAuditStatus["PROCESSING"] = "PROCESSING";
5
- JobAuditStatus["COMPLETED"] = "COMPLETED";
6
- JobAuditStatus["FAILED"] = "FAILED";
7
- })(JobAuditStatus || (JobAuditStatus = {}));
8
- //# sourceMappingURL=job-audit.status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"job-audit.status.js","sourceRoot":"","sources":["../../../src/data/types/job-audit.status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}