@felloh-org/lambda-wrapper 1.1.26 → 1.1.27

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.
@@ -15,7 +15,9 @@ var _transaction = _interopRequireDefault(require("../../payment/transaction"));
15
15
 
16
16
  var _uuid = require("uuid");
17
17
 
18
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12;
18
+ var _bookingComponent = _interopRequireDefault(require("../booking-component"));
19
+
20
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13;
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
@@ -40,24 +42,24 @@ let Booking = (_dec = (0, _typeorm.Entity)({
40
42
  }), _dec6 = (0, _typeorm.JoinColumn)({
41
43
  name: 'user_id',
42
44
  referencedColumnName: 'id'
43
- }), _dec7 = (0, _typeorm.OneToMany)(() => _transaction.default, transaction => transaction.booking), _dec8 = (0, _typeorm.ManyToOne)(() => _organisation.default), _dec9 = (0, _typeorm.JoinColumn)({
45
+ }), _dec7 = (0, _typeorm.OneToMany)(() => _transaction.default, transaction => transaction.booking), _dec8 = (0, _typeorm.OneToMany)(() => _bookingComponent.default, bookingComponent => bookingComponent.booking), _dec9 = (0, _typeorm.ManyToOne)(() => _organisation.default), _dec10 = (0, _typeorm.JoinColumn)({
44
46
  name: 'organisation_id',
45
47
  referencedColumnName: 'id'
46
- }), _dec10 = (0, _typeorm.Column)({
47
- type: "varchar",
48
- length: "150"
49
48
  }), _dec11 = (0, _typeorm.Column)({
50
49
  type: "varchar",
51
50
  length: "150"
52
51
  }), _dec12 = (0, _typeorm.Column)({
52
+ type: "varchar",
53
+ length: "150"
54
+ }), _dec13 = (0, _typeorm.Column)({
53
55
  type: "date",
54
56
  nullable: true
55
- }), _dec13 = (0, _typeorm.Column)({
57
+ }), _dec14 = (0, _typeorm.Column)({
56
58
  type: "date",
57
59
  nullable: true
58
- }), _dec14 = (0, _typeorm.CreateDateColumn)({
60
+ }), _dec15 = (0, _typeorm.CreateDateColumn)({
59
61
  type: 'timestamp with time zone'
60
- }), _dec15 = (0, _typeorm.UpdateDateColumn)({
62
+ }), _dec16 = (0, _typeorm.UpdateDateColumn)({
61
63
  type: 'timestamp with time zone'
62
64
  }), _dec(_class = (_class2 = class Booking {
63
65
  constructor() {
@@ -71,19 +73,21 @@ let Booking = (_dec = (0, _typeorm.Entity)({
71
73
 
72
74
  _initializerDefineProperty(this, "transactions", _descriptor5, this);
73
75
 
74
- _initializerDefineProperty(this, "organisation", _descriptor6, this);
76
+ _initializerDefineProperty(this, "components", _descriptor6, this);
75
77
 
76
- _initializerDefineProperty(this, "customer_name", _descriptor7, this);
78
+ _initializerDefineProperty(this, "organisation", _descriptor7, this);
77
79
 
78
- _initializerDefineProperty(this, "booking_reference", _descriptor8, this);
80
+ _initializerDefineProperty(this, "customer_name", _descriptor8, this);
79
81
 
80
- _initializerDefineProperty(this, "departure_date", _descriptor9, this);
82
+ _initializerDefineProperty(this, "booking_reference", _descriptor9, this);
81
83
 
82
- _initializerDefineProperty(this, "return_date", _descriptor10, this);
84
+ _initializerDefineProperty(this, "departure_date", _descriptor10, this);
83
85
 
84
- _initializerDefineProperty(this, "created_at", _descriptor11, this);
86
+ _initializerDefineProperty(this, "return_date", _descriptor11, this);
85
87
 
86
- _initializerDefineProperty(this, "updated_at", _descriptor12, this);
88
+ _initializerDefineProperty(this, "created_at", _descriptor12, this);
89
+
90
+ _initializerDefineProperty(this, "updated_at", _descriptor13, this);
87
91
  }
88
92
 
89
93
  /**
@@ -106,6 +110,10 @@ let Booking = (_dec = (0, _typeorm.Entity)({
106
110
  response.transactions = this.transactions.map(transaction => transaction.getPublicCompactData());
107
111
  }
108
112
 
113
+ if (typeof this.components !== 'undefined') {
114
+ response.components = this.components.map(component => component.getPublicCompactData());
115
+ }
116
+
109
117
  if (this.user !== null && typeof this.user.id !== 'undefined') {
110
118
  response.user = this.user.getPublicCompactData();
111
119
  }
@@ -148,43 +156,48 @@ let Booking = (_dec = (0, _typeorm.Entity)({
148
156
  enumerable: true,
149
157
  writable: true,
150
158
  initializer: null
151
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "organisation", [_dec8, _dec9], {
159
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "components", [_dec8], {
160
+ configurable: true,
161
+ enumerable: true,
162
+ writable: true,
163
+ initializer: null
164
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "organisation", [_dec9, _dec10], {
152
165
  configurable: true,
153
166
  enumerable: true,
154
167
  writable: true,
155
168
  initializer: function () {
156
169
  return _organisation.default;
157
170
  }
158
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "customer_name", [_dec10], {
171
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "customer_name", [_dec11], {
159
172
  configurable: true,
160
173
  enumerable: true,
161
174
  writable: true,
162
175
  initializer: function () {
163
176
  return "";
164
177
  }
165
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "booking_reference", [_dec11], {
178
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "booking_reference", [_dec12], {
166
179
  configurable: true,
167
180
  enumerable: true,
168
181
  writable: true,
169
182
  initializer: function () {
170
183
  return "";
171
184
  }
172
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "departure_date", [_dec12], {
185
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "departure_date", [_dec13], {
173
186
  configurable: true,
174
187
  enumerable: true,
175
188
  writable: true,
176
189
  initializer: null
177
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "return_date", [_dec13], {
190
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "return_date", [_dec14], {
178
191
  configurable: true,
179
192
  enumerable: true,
180
193
  writable: true,
181
194
  initializer: null
182
- }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec14], {
195
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec15], {
183
196
  configurable: true,
184
197
  enumerable: true,
185
198
  writable: true,
186
199
  initializer: null
187
- }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec15], {
200
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec16], {
188
201
  configurable: true,
189
202
  enumerable: true,
190
203
  writable: true,
@@ -9,7 +9,13 @@ var _typeorm = require("typeorm");
9
9
 
10
10
  var _uuid = require("uuid");
11
11
 
12
- var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
12
+ var _supplier = _interopRequireDefault(require("../supplier"));
13
+
14
+ var _booking = _interopRequireDefault(require("../booking"));
15
+
16
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
19
 
14
20
  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
15
21
 
@@ -20,11 +26,55 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
20
26
  let BookingComponent = (_dec = (0, _typeorm.Entity)({
21
27
  name: 'booking_component',
22
28
  schema: 'agent_data'
23
- }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class BookingComponent {
29
+ }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.ManyToOne)(() => _booking.default), _dec4 = (0, _typeorm.JoinColumn)({
30
+ name: 'booking_id',
31
+ referencedColumnName: 'id'
32
+ }), _dec5 = (0, _typeorm.ManyToOne)(() => _supplier.default, {
33
+ nullable: true
34
+ }), _dec6 = (0, _typeorm.JoinColumn)({
35
+ name: 'supplier_id',
36
+ referencedColumnName: 'id'
37
+ }), _dec7 = (0, _typeorm.Column)({
38
+ type: "int",
39
+ nullable: true
40
+ }), _dec8 = (0, _typeorm.Column)({
41
+ type: "varchar",
42
+ length: "150",
43
+ nullable: true
44
+ }), _dec9 = (0, _typeorm.Column)({
45
+ type: "varchar",
46
+ length: "10",
47
+ nullable: true
48
+ }), _dec10 = (0, _typeorm.Column)({
49
+ type: "varchar",
50
+ length: "40"
51
+ }), _dec11 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class BookingComponent {
24
52
  constructor() {
25
53
  _initializerDefineProperty(this, "id", _descriptor, this);
26
54
 
27
- _initializerDefineProperty(this, "created_at", _descriptor2, this);
55
+ _initializerDefineProperty(this, "booking", _descriptor2, this);
56
+
57
+ _initializerDefineProperty(this, "supplier", _descriptor3, this);
58
+
59
+ _initializerDefineProperty(this, "amount", _descriptor4, this);
60
+
61
+ _initializerDefineProperty(this, "booking_reference", _descriptor5, this);
62
+
63
+ _initializerDefineProperty(this, "destination_air", _descriptor6, this);
64
+
65
+ _initializerDefineProperty(this, "type", _descriptor7, this);
66
+
67
+ _initializerDefineProperty(this, "created_at", _descriptor8, this);
68
+ }
69
+
70
+ getPublicCompactData() {
71
+ return {
72
+ id: this.id,
73
+ supplier: this.supplier,
74
+ amount: this.amount,
75
+ booking_reference: this.booking_reference,
76
+ destination_air: this.destination_air
77
+ };
28
78
  }
29
79
 
30
80
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
@@ -34,7 +84,47 @@ let BookingComponent = (_dec = (0, _typeorm.Entity)({
34
84
  initializer: function () {
35
85
  return (0, _uuid.v4)();
36
86
  }
37
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec3], {
87
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "booking", [_dec3, _dec4], {
88
+ configurable: true,
89
+ enumerable: true,
90
+ writable: true,
91
+ initializer: function () {
92
+ return _booking.default;
93
+ }
94
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "supplier", [_dec5, _dec6], {
95
+ configurable: true,
96
+ enumerable: true,
97
+ writable: true,
98
+ initializer: function () {
99
+ return _supplier.default;
100
+ }
101
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "amount", [_dec7], {
102
+ configurable: true,
103
+ enumerable: true,
104
+ writable: true,
105
+ initializer: null
106
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "booking_reference", [_dec8], {
107
+ configurable: true,
108
+ enumerable: true,
109
+ writable: true,
110
+ initializer: function () {
111
+ return null;
112
+ }
113
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "destination_air", [_dec9], {
114
+ configurable: true,
115
+ enumerable: true,
116
+ writable: true,
117
+ initializer: function () {
118
+ return null;
119
+ }
120
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "type", [_dec10], {
121
+ configurable: true,
122
+ enumerable: true,
123
+ writable: true,
124
+ initializer: function () {
125
+ return null;
126
+ }
127
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec11], {
38
128
  configurable: true,
39
129
  enumerable: true,
40
130
  writable: true,
@@ -0,0 +1,27 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class bookingComponents1656421768668 {
4
+ name = 'bookingComponents1656421768668'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "amount" integer`);
8
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "booking_reference" character varying(150)`);
9
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "destination_air" character varying(10)`);
10
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "type" character varying(40) NOT NULL`);
11
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "booking_id" character varying`);
12
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD "supplier_id" character varying`);
13
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD CONSTRAINT "FK_d243dfda8e27a088dc2661981d7" FOREIGN KEY ("booking_id") REFERENCES "agent_data"."booking"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
14
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" ADD CONSTRAINT "FK_f9577f42fa4c57747cefb8927b1" FOREIGN KEY ("supplier_id") REFERENCES "agent_data"."supplier"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
15
+ }
16
+
17
+ async down(queryRunner) {
18
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP CONSTRAINT "FK_f9577f42fa4c57747cefb8927b1"`);
19
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP CONSTRAINT "FK_d243dfda8e27a088dc2661981d7"`);
20
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "supplier_id"`);
21
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "booking_id"`);
22
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "type"`);
23
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "destination_air"`);
24
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "booking_reference"`);
25
+ await queryRunner.query(`ALTER TABLE "agent_data"."booking_component" DROP COLUMN "amount"`);
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {