oca-shared-model 1.0.147 → 1.0.149

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.
@@ -16,4 +16,5 @@ export declare class PublishedLearning extends DefaultColumn {
16
16
  repeat?: boolean;
17
17
  repeat_duration?: number;
18
18
  vessel_id?: number;
19
+ certificate_validity?: number;
19
20
  }
@@ -79,6 +79,10 @@ __decorate([
79
79
  (0, typeorm_1.Column)({ array: true }),
80
80
  __metadata("design:type", Number)
81
81
  ], PublishedLearning.prototype, "vessel_id", void 0);
82
+ __decorate([
83
+ (0, typeorm_1.Column)(),
84
+ __metadata("design:type", Number)
85
+ ], PublishedLearning.prototype, "certificate_validity", void 0);
82
86
  exports.PublishedLearning = PublishedLearning = __decorate([
83
87
  (0, typeorm_1.Entity)({
84
88
  schema: "company",
@@ -16,4 +16,7 @@ export declare class Enrollment extends DefaultColumn {
16
16
  repeat_duration?: number;
17
17
  feedback?: any;
18
18
  is_archived?: boolean;
19
+ expiry_date?: Date;
20
+ completed_date?: Date;
21
+ certificate_validity?: number;
19
22
  }
@@ -79,6 +79,18 @@ __decorate([
79
79
  (0, typeorm_1.Column)(),
80
80
  __metadata("design:type", Boolean)
81
81
  ], Enrollment.prototype, "is_archived", void 0);
82
+ __decorate([
83
+ (0, typeorm_1.Column)(),
84
+ __metadata("design:type", Date)
85
+ ], Enrollment.prototype, "expiry_date", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)(),
88
+ __metadata("design:type", Date)
89
+ ], Enrollment.prototype, "completed_date", void 0);
90
+ __decorate([
91
+ (0, typeorm_1.Column)(),
92
+ __metadata("design:type", Number)
93
+ ], Enrollment.prototype, "certificate_validity", void 0);
82
94
  exports.Enrollment = Enrollment = __decorate([
83
95
  (0, typeorm_1.Entity)({
84
96
  schema: "crew",
@@ -64,13 +64,16 @@ let BaseService = class BaseService {
64
64
  update(id, payload) {
65
65
  return __awaiter(this, void 0, void 0, function* () {
66
66
  try {
67
- const data = yield this.findOne(id);
68
- if (!data) {
69
- throw new common_1.NotFoundException(`Entity with ID ${id} not found`);
70
- }
71
- const update = Object.assign(data, payload);
72
- const result = yield this.repository.save(update);
73
- return result;
67
+ return yield this.repository.manager.transaction((manager) => __awaiter(this, void 0, void 0, function* () {
68
+ const data = yield manager.findOne(this.repository.target, {
69
+ where: { id },
70
+ });
71
+ if (!data) {
72
+ throw new common_1.NotFoundException(`Entity with ID ${id} not found`);
73
+ }
74
+ const update = Object.assign(data, payload);
75
+ return yield manager.save(update);
76
+ }));
74
77
  }
75
78
  catch (error) {
76
79
  if (error instanceof Error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oca-shared-model",
3
- "version": "1.0.147",
3
+ "version": "1.0.149",
4
4
  "description": "onboard shared model",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {