@felloh-org/lambda-wrapper 1.1.27 → 1.1.30
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.
- package/.concourse/pipeline.yml +40 -0
- package/.concourse/private.yml +0 -0
- package/dist/entity/agent-data/booking-component/index.js +39 -18
- package/dist/entity/agent-data/supplier/index.js +13 -4
- package/dist/entity/payment/payment-link/index.js +2 -2
- package/dist/entity/payment/transaction/index.js +10 -1
- package/dist/migration/agent-data/1656422133900-booking_components_organisation.js +15 -0
- package/dist/service/request.js +7 -0
- package/package.json +2 -1
package/.concourse/pipeline.yml
CHANGED
|
@@ -127,3 +127,43 @@ jobs:
|
|
|
127
127
|
params:
|
|
128
128
|
alert_type: 'failed'
|
|
129
129
|
message: Migrations deployment failed
|
|
130
|
+
|
|
131
|
+
- name: 'migrations.sandbox'
|
|
132
|
+
serial: true
|
|
133
|
+
plan:
|
|
134
|
+
- in_parallel:
|
|
135
|
+
- get: lambda-wrapper
|
|
136
|
+
passed: ['migrations.staging']
|
|
137
|
+
trigger: true
|
|
138
|
+
- get: concourse-scripts
|
|
139
|
+
- task: 'schema.create'
|
|
140
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
141
|
+
input_mapping:
|
|
142
|
+
repository: lambda-wrapper
|
|
143
|
+
params:
|
|
144
|
+
NPM_COMMAND: 'orm:schema:create'
|
|
145
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
146
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
147
|
+
AWS_REGION: ((aws.region.primary))
|
|
148
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.sandbox))
|
|
149
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.sandbox))
|
|
150
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
151
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
152
|
+
- task: 'migrations.run'
|
|
153
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
154
|
+
input_mapping:
|
|
155
|
+
repository: lambda-wrapper
|
|
156
|
+
params:
|
|
157
|
+
NPM_COMMAND: 'orm:migration:run'
|
|
158
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
159
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
160
|
+
AWS_REGION: ((aws.region.primary))
|
|
161
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.sandbox))
|
|
162
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.sandbox))
|
|
163
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
164
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
165
|
+
on_failure:
|
|
166
|
+
put: slack-alert-deploy
|
|
167
|
+
params:
|
|
168
|
+
alert_type: 'failed'
|
|
169
|
+
message: Migrations deployment failed
|
package/.concourse/private.yml
CHANGED
|
Binary file
|
|
@@ -13,7 +13,9 @@ var _supplier = _interopRequireDefault(require("../supplier"));
|
|
|
13
13
|
|
|
14
14
|
var _booking = _interopRequireDefault(require("../booking"));
|
|
15
15
|
|
|
16
|
-
var
|
|
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;
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
@@ -34,21 +36,24 @@ let BookingComponent = (_dec = (0, _typeorm.Entity)({
|
|
|
34
36
|
}), _dec6 = (0, _typeorm.JoinColumn)({
|
|
35
37
|
name: 'supplier_id',
|
|
36
38
|
referencedColumnName: 'id'
|
|
37
|
-
}), _dec7 = (0, _typeorm.
|
|
39
|
+
}), _dec7 = (0, _typeorm.ManyToOne)(() => _organisation.default), _dec8 = (0, _typeorm.JoinColumn)({
|
|
40
|
+
name: 'organisation_id',
|
|
41
|
+
referencedColumnName: 'id'
|
|
42
|
+
}), _dec9 = (0, _typeorm.Column)({
|
|
38
43
|
type: "int",
|
|
39
44
|
nullable: true
|
|
40
|
-
}),
|
|
45
|
+
}), _dec10 = (0, _typeorm.Column)({
|
|
41
46
|
type: "varchar",
|
|
42
47
|
length: "150",
|
|
43
48
|
nullable: true
|
|
44
|
-
}),
|
|
49
|
+
}), _dec11 = (0, _typeorm.Column)({
|
|
45
50
|
type: "varchar",
|
|
46
51
|
length: "10",
|
|
47
52
|
nullable: true
|
|
48
|
-
}),
|
|
53
|
+
}), _dec12 = (0, _typeorm.Column)({
|
|
49
54
|
type: "varchar",
|
|
50
55
|
length: "40"
|
|
51
|
-
}),
|
|
56
|
+
}), _dec13 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class BookingComponent {
|
|
52
57
|
constructor() {
|
|
53
58
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
54
59
|
|
|
@@ -56,25 +61,34 @@ let BookingComponent = (_dec = (0, _typeorm.Entity)({
|
|
|
56
61
|
|
|
57
62
|
_initializerDefineProperty(this, "supplier", _descriptor3, this);
|
|
58
63
|
|
|
59
|
-
_initializerDefineProperty(this, "
|
|
64
|
+
_initializerDefineProperty(this, "organisation", _descriptor4, this);
|
|
65
|
+
|
|
66
|
+
_initializerDefineProperty(this, "amount", _descriptor5, this);
|
|
60
67
|
|
|
61
|
-
_initializerDefineProperty(this, "booking_reference",
|
|
68
|
+
_initializerDefineProperty(this, "booking_reference", _descriptor6, this);
|
|
62
69
|
|
|
63
|
-
_initializerDefineProperty(this, "destination_air",
|
|
70
|
+
_initializerDefineProperty(this, "destination_air", _descriptor7, this);
|
|
64
71
|
|
|
65
|
-
_initializerDefineProperty(this, "type",
|
|
72
|
+
_initializerDefineProperty(this, "type", _descriptor8, this);
|
|
66
73
|
|
|
67
|
-
_initializerDefineProperty(this, "created_at",
|
|
74
|
+
_initializerDefineProperty(this, "created_at", _descriptor9, this);
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
getPublicCompactData() {
|
|
71
|
-
|
|
78
|
+
const response = {
|
|
72
79
|
id: this.id,
|
|
73
80
|
supplier: this.supplier,
|
|
74
81
|
amount: this.amount,
|
|
75
82
|
booking_reference: this.booking_reference,
|
|
76
|
-
destination_air: this.destination_air
|
|
83
|
+
destination_air: this.destination_air,
|
|
84
|
+
type: this.type
|
|
77
85
|
};
|
|
86
|
+
|
|
87
|
+
if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
|
|
88
|
+
response.organisation = this.organisation.getPublicCompactData();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return response;
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
|
|
@@ -98,33 +112,40 @@ let BookingComponent = (_dec = (0, _typeorm.Entity)({
|
|
|
98
112
|
initializer: function () {
|
|
99
113
|
return _supplier.default;
|
|
100
114
|
}
|
|
101
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
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], {
|
|
102
123
|
configurable: true,
|
|
103
124
|
enumerable: true,
|
|
104
125
|
writable: true,
|
|
105
126
|
initializer: null
|
|
106
|
-
}),
|
|
127
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "booking_reference", [_dec10], {
|
|
107
128
|
configurable: true,
|
|
108
129
|
enumerable: true,
|
|
109
130
|
writable: true,
|
|
110
131
|
initializer: function () {
|
|
111
132
|
return null;
|
|
112
133
|
}
|
|
113
|
-
}),
|
|
134
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "destination_air", [_dec11], {
|
|
114
135
|
configurable: true,
|
|
115
136
|
enumerable: true,
|
|
116
137
|
writable: true,
|
|
117
138
|
initializer: function () {
|
|
118
139
|
return null;
|
|
119
140
|
}
|
|
120
|
-
}),
|
|
141
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "type", [_dec12], {
|
|
121
142
|
configurable: true,
|
|
122
143
|
enumerable: true,
|
|
123
144
|
writable: true,
|
|
124
145
|
initializer: function () {
|
|
125
146
|
return null;
|
|
126
147
|
}
|
|
127
|
-
}),
|
|
148
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec13], {
|
|
128
149
|
configurable: true,
|
|
129
150
|
enumerable: true,
|
|
130
151
|
writable: true,
|
|
@@ -11,7 +11,9 @@ var _organisation = _interopRequireDefault(require("../../user/organisation"));
|
|
|
11
11
|
|
|
12
12
|
var _uuid = require("uuid");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _bookingComponent = _interopRequireDefault(require("../booking-component"));
|
|
15
|
+
|
|
16
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
@@ -30,7 +32,7 @@ let Supplier = (_dec = (0, _typeorm.Entity)({
|
|
|
30
32
|
}), _dec5 = (0, _typeorm.Column)({
|
|
31
33
|
type: "varchar",
|
|
32
34
|
length: "150"
|
|
33
|
-
}), _dec6 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class Supplier {
|
|
35
|
+
}), _dec6 = (0, _typeorm.OneToMany)(() => _bookingComponent.default, bookingComponent => bookingComponent.supplier), _dec7 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class Supplier {
|
|
34
36
|
constructor() {
|
|
35
37
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
36
38
|
|
|
@@ -38,7 +40,9 @@ let Supplier = (_dec = (0, _typeorm.Entity)({
|
|
|
38
40
|
|
|
39
41
|
_initializerDefineProperty(this, "name", _descriptor3, this);
|
|
40
42
|
|
|
41
|
-
_initializerDefineProperty(this, "
|
|
43
|
+
_initializerDefineProperty(this, "components", _descriptor4, this);
|
|
44
|
+
|
|
45
|
+
_initializerDefineProperty(this, "created_at", _descriptor5, this);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
getPublicData() {
|
|
@@ -70,7 +74,12 @@ let Supplier = (_dec = (0, _typeorm.Entity)({
|
|
|
70
74
|
initializer: function () {
|
|
71
75
|
return "";
|
|
72
76
|
}
|
|
73
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
77
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "components", [_dec6], {
|
|
78
|
+
configurable: true,
|
|
79
|
+
enumerable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
initializer: null
|
|
82
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec7], {
|
|
74
83
|
configurable: true,
|
|
75
84
|
enumerable: true,
|
|
76
85
|
writable: true,
|
|
@@ -146,7 +146,7 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
-
if (this.booking !== null) {
|
|
149
|
+
if (this.booking !== null && typeof this.booking.id !== 'undefined') {
|
|
150
150
|
response.booking = this.booking.getPublicData();
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -154,7 +154,7 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
|
|
|
154
154
|
response.transactions = this.transactions.map(transaction => transaction.getPublicCompactData());
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
if (this.user !== null) {
|
|
157
|
+
if (this.user !== null && typeof this.user.id !== 'undefined') {
|
|
158
158
|
response.user = this.user.getPublicCompactData();
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -143,10 +143,19 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
|
|
|
143
143
|
completed_at: this.completed_at
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
if (this.booking !== null) {
|
|
146
|
+
if (this.booking !== null && typeof this.booking.id !== 'undefined') {
|
|
147
|
+
console.log(this.booking);
|
|
147
148
|
response.booking = this.booking.getPublicData();
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
if (this.payment_link !== null && typeof this.payment_link !== 'undefined') {
|
|
152
|
+
response.payment_link = this.payment_link.getPublicData();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this.metadata !== null) {
|
|
156
|
+
response.metadata = this.metadata;
|
|
157
|
+
}
|
|
158
|
+
|
|
150
159
|
if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
|
|
151
160
|
response.organisation = this.organisation.getPublicCompactData();
|
|
152
161
|
}
|
|
@@ -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/dist/service/request.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.default = exports.REQUEST_TYPES = exports.HTTP_METHODS_WITH_PAYLOADS = e
|
|
|
7
7
|
|
|
8
8
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
9
9
|
|
|
10
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
|
|
10
12
|
var _useragent = _interopRequireDefault(require("useragent"));
|
|
11
13
|
|
|
12
14
|
var _validate = _interopRequireDefault(require("validate.js/validate"));
|
|
@@ -24,6 +26,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
24
26
|
/* eslint-disable class-methods-use-this */
|
|
25
27
|
|
|
26
28
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
29
|
+
_validate.default.extend(_validate.default.validators.datetime, {
|
|
30
|
+
parse: value => +_moment.default.utc(value),
|
|
31
|
+
format: (value, options) => _moment.default.utc(value).format(options.dateOnly ? 'YYYY-MM-DD' : 'YYYY-MM-DD hh:mm:ss')
|
|
32
|
+
});
|
|
33
|
+
|
|
27
34
|
const REQUEST_TYPES = {
|
|
28
35
|
DELETE: 'DELETE',
|
|
29
36
|
GET: 'GET',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felloh-org/lambda-wrapper",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
4
4
|
"description": "Lambda wrapper for all Felloh Serverless Projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"axios": "^0.26.1",
|
|
57
57
|
"dotenv": "^16.0.0",
|
|
58
58
|
"epsagon": "^1.121.3",
|
|
59
|
+
"moment": "^2.29.3",
|
|
59
60
|
"typeorm": "^0.2.41",
|
|
60
61
|
"typeorm-aurora-data-api-driver": "^2.4.2",
|
|
61
62
|
"useragent": "^2.3.0",
|