whitelabel-db 1.0.23 → 1.0.25

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.
@@ -49,7 +49,8 @@ export declare class Hotel extends Model<Partial<Hotel>> {
49
49
  occupancy: number;
50
50
  photos: {
51
51
  url: string;
52
- caption: string;
52
+ caption?: string;
53
+ main_photo: boolean;
53
54
  }[];
54
55
  room_amenities: {
55
56
  id: number;
@@ -1,5 +1,6 @@
1
1
  import { Model } from 'sequelize-typescript';
2
2
  import { Agency } from './Agency';
3
+ import { LiteApiClient } from '../libs/liteapi';
3
4
  export declare class Project extends Model<Partial<Project>> {
4
5
  id: string;
5
6
  name: string;
@@ -9,4 +10,5 @@ export declare class Project extends Model<Partial<Project>> {
9
10
  agencyId?: string;
10
11
  agency?: Agency;
11
12
  generateSession(secret: string): string;
13
+ getLiteApiClient(): LiteApiClient;
12
14
  }
@@ -16,6 +16,8 @@ exports.Project = void 0;
16
16
  const sequelize_typescript_1 = require("sequelize-typescript");
17
17
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
18
18
  const Agency_1 = require("./Agency");
19
+ const liteapi_1 = require("../libs/liteapi");
20
+ const clients = {};
19
21
  let Project = class Project extends sequelize_typescript_1.Model {
20
22
  generateSession(secret) {
21
23
  return jsonwebtoken_1.default.sign({ id: this.id }, secret, {
@@ -23,6 +25,22 @@ let Project = class Project extends sequelize_typescript_1.Model {
23
25
  expiresIn: 86400, // 24 hours
24
26
  });
25
27
  }
28
+ getLiteApiClient() {
29
+ try {
30
+ let key = this.settings.liteApiKey;
31
+ if (!key || !key.length) {
32
+ key = process.env.LITEAPI_KEY;
33
+ }
34
+ if (!clients[key]) {
35
+ clients[key] = new liteapi_1.LiteApiClient(key);
36
+ }
37
+ return clients[key];
38
+ }
39
+ catch (err) {
40
+ console.log(err);
41
+ throw err;
42
+ }
43
+ }
26
44
  };
27
45
  exports.Project = Project;
28
46
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",