@felloh-org/lambda-wrapper 1.1.28 → 1.1.31

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.
@@ -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
Binary file
@@ -11,7 +11,9 @@ var _organisation = _interopRequireDefault(require("../../user/organisation"));
11
11
 
12
12
  var _uuid = require("uuid");
13
13
 
14
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
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, "created_at", _descriptor4, 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, "created_at", [_dec6], {
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,18 @@ 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
147
  response.booking = this.booking.getPublicData();
148
148
  }
149
149
 
150
+ if (this.payment_link !== null && typeof this.payment_link !== 'undefined') {
151
+ response.payment_link = this.payment_link.getPublicData();
152
+ }
153
+
154
+ if (this.metadata !== null) {
155
+ response.metadata = this.metadata;
156
+ }
157
+
150
158
  if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
151
159
  response.organisation = this.organisation.getPublicCompactData();
152
160
  }
@@ -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.28",
3
+ "version": "1.1.31",
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",