@felloh-org/lambda-wrapper 1.1.25 → 1.1.28

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