@felloh-org/lambda-wrapper 1.11.10 → 1.11.12

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.
@@ -7,7 +7,11 @@ exports.default = void 0;
7
7
 
8
8
  var _typeorm = require("typeorm");
9
9
 
10
- 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, _descriptor10, _descriptor11, _descriptor12;
10
+ var _organisation = _interopRequireDefault(require("../../user/organisation"));
11
+
12
+ 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, _descriptor13;
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
15
 
12
16
  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 }); }
13
17
 
@@ -57,6 +61,11 @@ let Customer = (_dec = (0, _typeorm.Entity)({
57
61
  }), _dec13 = (0, _typeorm.DeleteDateColumn)({
58
62
  type: 'timestamp with time zone',
59
63
  nullable: true
64
+ }), _dec14 = (0, _typeorm.ManyToOne)(() => _organisation.default, {
65
+ nullable: false
66
+ }), _dec15 = (0, _typeorm.JoinColumn)({
67
+ name: 'organisation_id',
68
+ referencedColumnName: 'id'
60
69
  }), _dec(_class = (_class2 = class Customer {
61
70
  constructor() {
62
71
  _initializerDefineProperty(this, "id", _descriptor, this);
@@ -82,6 +91,22 @@ let Customer = (_dec = (0, _typeorm.Entity)({
82
91
  _initializerDefineProperty(this, "updated_at", _descriptor11, this);
83
92
 
84
93
  _initializerDefineProperty(this, "deleted_at", _descriptor12, this);
94
+
95
+ _initializerDefineProperty(this, "organisation", _descriptor13, this);
96
+ }
97
+
98
+ getPublicData() {
99
+ return {
100
+ id: this.id,
101
+ customer_name: this.customer_name,
102
+ email: this.email,
103
+ address_1: this.address_1,
104
+ address_2: this.address_2,
105
+ city: this.city,
106
+ county: this.county,
107
+ country: this.country,
108
+ post_code: this.post_code
109
+ };
85
110
  }
86
111
 
87
112
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
@@ -162,5 +187,12 @@ let Customer = (_dec = (0, _typeorm.Entity)({
162
187
  enumerable: true,
163
188
  writable: true,
164
189
  initializer: null
190
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "organisation", [_dec14, _dec15], {
191
+ configurable: true,
192
+ enumerable: true,
193
+ writable: true,
194
+ initializer: function () {
195
+ return _organisation.default;
196
+ }
165
197
  })), _class2)) || _class);
166
198
  exports.default = Customer;
@@ -157,7 +157,7 @@ let Ecommerce = (_dec = (0, _typeorm.Entity)({
157
157
  };
158
158
 
159
159
  if (this.customer !== null && typeof this.customer.id !== 'undefined') {
160
- response.customer = this.customer;
160
+ response.customer = this.customer.getPublicData();
161
161
  }
162
162
 
163
163
  if (this.booking !== null && typeof this.booking.id !== 'undefined') {
@@ -198,7 +198,7 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
198
198
  };
199
199
 
200
200
  if (this.customer !== null && typeof this.customer.id !== 'undefined') {
201
- response.customer = this.customer;
201
+ response.customer = this.customer.getPublicData();
202
202
  }
203
203
 
204
204
  if (this.booking !== null && typeof this.booking.id !== 'undefined') {
@@ -0,0 +1,13 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class customerOrganisation1690368777929 {
4
+ name = 'customerOrganisation1690368777929'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "payment"."customer" ADD "organisation_id" character varying(150)`);
8
+ }
9
+
10
+ async down(queryRunner) {
11
+ await queryRunner.query(`ALTER TABLE "payment"."customer" DROP COLUMN "organisation_id"`);
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class customerOrganisationNotnull1690368949313 {
4
+ name = 'customerOrganisationNotnull1690368949313'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "payment"."customer" ALTER COLUMN "organisation_id" SET NOT NULL`);
8
+ await queryRunner.query(`ALTER TABLE "payment"."customer" ADD CONSTRAINT "FK_4826e339f8ec2dc55a693f896fc" 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 "payment"."customer" DROP CONSTRAINT "FK_4826e339f8ec2dc55a693f896fc"`);
13
+ await queryRunner.query(`ALTER TABLE "payment"."customer" ALTER COLUMN "organisation_id" DROP NOT NULL`);
14
+ }
15
+ }
@@ -50,7 +50,7 @@ class PaymentInitiationObject extends _dependencyAware.default {
50
50
  let result = null;
51
51
 
52
52
  if (initiationType === _paymentInitationTypes.default.PAYMENT_LINK) {
53
- result = await this.paymentLinkRepository.createQueryBuilder('payment_link').leftJoinAndSelect('payment_link.organisation', 'organisation').leftJoinAndSelect('payment_link.booking', 'booking').leftJoinAndMapOne('payment_link.currency', _currency.default, 'currency_join', 'currency_join.id = payment_link.currency').where('payment_link.id = :initiation_object_ID', {
53
+ result = await this.paymentLinkRepository.createQueryBuilder('payment_link').leftJoinAndSelect('payment_link.organisation', 'organisation').leftJoinAndSelect('payment_link.booking', 'booking').leftJoinAndSelect('payment_link.customer', 'customer').leftJoinAndMapOne('payment_link.currency', _currency.default, 'currency_join', 'currency_join.id = payment_link.currency').where('payment_link.id = :initiation_object_ID', {
54
54
  initiation_object_ID: initiationObjectID
55
55
  }).getOne(); // Throw an error response if the payment link does not exist
56
56
 
@@ -66,7 +66,7 @@ class PaymentInitiationObject extends _dependencyAware.default {
66
66
  throw notFoundResponse;
67
67
  }
68
68
  } else if (initiationType === _paymentInitationTypes.default.ECOMMERCE) {
69
- result = await this.ecommerceRepository.createQueryBuilder('ecommerce').leftJoinAndSelect('ecommerce.organisation', 'organisation').leftJoinAndSelect('ecommerce.booking', 'booking').leftJoinAndMapOne('ecommerce.currency', _currency.default, 'currency_join', 'currency_join.id = ecommerce.currency').where('ecommerce.id = :initiation_object_ID', {
69
+ result = await this.ecommerceRepository.createQueryBuilder('ecommerce').leftJoinAndSelect('ecommerce.organisation', 'organisation').leftJoinAndSelect('ecommerce.booking', 'booking').leftJoinAndSelect('ecommerce.customer', 'customer').leftJoinAndMapOne('ecommerce.currency', _currency.default, 'currency_join', 'currency_join.id = ecommerce.currency').where('ecommerce.id = :initiation_object_ID', {
70
70
  initiation_object_ID: initiationObjectID
71
71
  }).getOne(); // Throw an error response if the payment link does not exist
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.11.10",
3
+ "version": "1.11.12",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "engines": {