@vibe-flats/booking-engine-common-server 1.0.59 → 1.0.60

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/build/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './src/units-models';
2
2
  export * from './src/config/app';
3
3
  export * from './src/utils/guesty-price';
4
- export * from './src/utils/monthly-diff';
package/build/index.js CHANGED
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./src/units-models"), exports);
18
18
  __exportStar(require("./src/config/app"), exports);
19
19
  __exportStar(require("./src/utils/guesty-price"), exports);
20
- __exportStar(require("./src/utils/monthly-diff"), exports);
@@ -3,9 +3,6 @@ export declare const COMMON_SERVER: {
3
3
  symbol: string;
4
4
  code: string;
5
5
  };
6
- priceFactor: {
7
- monthly: number;
8
- };
9
6
  guesty: {
10
7
  fees: {
11
8
  utilities: string;
@@ -18,6 +15,9 @@ export declare const COMMON_SERVER: {
18
15
  reservation: string;
19
16
  };
20
17
  reservations: {
18
+ associations: {
19
+ guest: number;
20
+ };
21
21
  channels: {
22
22
  direct: string;
23
23
  };
@@ -6,9 +6,6 @@ exports.COMMON_SERVER = {
6
6
  symbol: '$',
7
7
  code: 'USD'
8
8
  },
9
- priceFactor: {
10
- monthly: 30
11
- },
12
9
  guesty: {
13
10
  fees: {
14
11
  utilities: 'Utilities'
@@ -21,6 +18,9 @@ exports.COMMON_SERVER = {
21
18
  reservation: '2-30640026'
22
19
  },
23
20
  reservations: {
21
+ associations: {
22
+ guest: 41
23
+ },
24
24
  channels: {
25
25
  direct: 'Direct'
26
26
  },
@@ -5,10 +5,7 @@ export interface AreaDocument extends mongoose.Document {
5
5
  externalName: string;
6
6
  publicId: string;
7
7
  city: CityDocument;
8
- website: {
9
- summary: string;
10
- description: string;
11
- };
8
+ description: string;
12
9
  }
13
10
  export declare const AreaModel: (connection: mongoose.Connection) => mongoose.Model<AreaDocument, {}, {}, {}, mongoose.Document<unknown, {}, AreaDocument> & AreaDocument & Required<{
14
11
  _id: unknown;
@@ -42,13 +42,9 @@ const schema = new mongoose_1.default.Schema({
42
42
  type: mongoose_1.Schema.Types.ObjectId,
43
43
  ref: 'City'
44
44
  },
45
- website: {
46
- type: new mongoose_1.default.Schema({
47
- summary: { type: String, required: false },
48
- description: { type: String, required: false }
49
- }),
50
- required: false,
51
- _id: false
45
+ description: {
46
+ type: String,
47
+ required: false
52
48
  }
53
49
  });
54
50
  schema.index({ publicId: 1 });
@@ -6,11 +6,6 @@ export interface AvailabilityDocument extends mongoose.Document {
6
6
  isAvailable: boolean;
7
7
  price: number;
8
8
  minNights: number;
9
- checkin: boolean;
10
- checkout?: {
11
- min: Date;
12
- max: Date;
13
- };
14
9
  }
15
10
  export declare const AvailabilityModel: (connection: mongoose.Connection) => mongoose.Model<AvailabilityDocument, {}, {}, {}, mongoose.Document<unknown, {}, AvailabilityDocument> & AvailabilityDocument & Required<{
16
11
  _id: unknown;
@@ -46,18 +46,6 @@ const schema = new mongoose_1.default.Schema({
46
46
  minNights: {
47
47
  type: Number,
48
48
  required: true
49
- },
50
- checkin: {
51
- type: Boolean,
52
- required: true
53
- },
54
- checkout: {
55
- type: new mongoose_1.default.Schema({
56
- min: { type: Date, required: true },
57
- max: { type: Date, required: true }
58
- }),
59
- required: false,
60
- _id: false
61
49
  }
62
50
  }, {
63
51
  timestamps: true,
@@ -3,23 +3,8 @@ export interface CityDocument extends mongoose.Document {
3
3
  name: string;
4
4
  externalName: string;
5
5
  publicId: string;
6
- isActive: boolean;
7
- minNights: number;
8
- website: {
9
- summary: string;
10
- description: string;
11
- slug: string;
12
- meta: {
13
- title: string;
14
- description: string;
15
- };
16
- faq: {
17
- question: string;
18
- answer: string;
19
- }[];
20
- };
21
- createdAt: Date;
22
- updatedAt: Date;
6
+ slug: string;
7
+ description: string;
23
8
  }
24
9
  export declare const CityModel: (connection: mongoose.Connection) => mongoose.Model<CityDocument, {}, {}, {}, mongoose.Document<unknown, {}, CityDocument> & CityDocument & Required<{
25
10
  _id: unknown;
@@ -18,42 +18,14 @@ const schema = new mongoose_1.default.Schema({
18
18
  type: String,
19
19
  required: true
20
20
  },
21
- isActive: {
22
- type: Boolean,
23
- required: true,
24
- default: true
25
- },
26
- minNights: {
21
+ slug: {
27
22
  type: String,
28
- required: true,
29
- default: 2
23
+ required: false
30
24
  },
31
- website: {
32
- type: new mongoose_1.default.Schema({
33
- summary: { type: String },
34
- description: { type: String },
35
- slug: { type: String },
36
- meta: {
37
- type: new mongoose_1.default.Schema({
38
- title: { type: String },
39
- description: { type: String }
40
- }),
41
- _id: false
42
- },
43
- faq: [
44
- {
45
- type: new mongoose_1.default.Schema({
46
- question: { type: String },
47
- answer: { type: String }
48
- }),
49
- _id: false
50
- }
51
- ]
52
- }),
53
- _id: false
25
+ description: {
26
+ type: String,
27
+ required: false
54
28
  }
55
- }, {
56
- timestamps: true
57
29
  });
58
30
  schema.index({ publicId: 1 });
59
31
  schema.index({ slug: 1 }, { unique: true });
@@ -58,20 +58,7 @@ export interface UnitDocument extends mongoose.Document {
58
58
  vrbo: string;
59
59
  booking: string;
60
60
  };
61
- website: {
62
- description: string;
63
- slug: string;
64
- };
65
- deal: {
66
- total: number;
67
- monthly: number;
68
- nights: number;
69
- from: Date;
70
- to: Date;
71
- };
72
- availableFrom?: Date;
73
- createdAt: Date;
74
- updatedAt: Date;
61
+ slug: string;
75
62
  }
76
63
  export declare const UnitModel: (connection: mongoose.Connection) => mongoose.Model<UnitDocument, {}, {}, {}, mongoose.Document<unknown, {}, UnitDocument> & UnitDocument & Required<{
77
64
  _id: unknown;
@@ -93,26 +93,7 @@ const schema = new mongoose_1.default.Schema({
93
93
  required: false,
94
94
  _id: false
95
95
  },
96
- website: {
97
- type: new mongoose_1.default.Schema({
98
- description: { type: String, required: false },
99
- slug: { type: String, required: false }
100
- }),
101
- required: false,
102
- _id: false
103
- },
104
- deal: {
105
- type: new mongoose_1.default.Schema({
106
- total: { type: Number, required: true },
107
- monthly: { type: Number, required: true },
108
- nights: { type: Number, required: true },
109
- from: { type: Date, required: false },
110
- to: { type: Date, required: false }
111
- }),
112
- required: false,
113
- _id: false
114
- },
115
- availableFrom: { type: Date, required: false }
96
+ slug: { type: String, required: false }
116
97
  }, {
117
98
  timestamps: true,
118
99
  versionKey: false,
@@ -6,7 +6,7 @@ const guestyPrice = (unit, stay) => {
6
6
  var _a;
7
7
  //
8
8
  const nights = stay.length;
9
- const multiplier = nights >= app_1.COMMON_SERVER.priceFactor.monthly ? unit.prices.monthlyPriceFactor : 1;
9
+ const multiplier = nights >= 30 ? unit.prices.monthlyPriceFactor : 1;
10
10
  // Apply multiplier: Guesty's approach to monthly pricing
11
11
  const rent = +(stay.reduce((acc, stay) => acc + stay.price, 0) * multiplier).toFixed(0);
12
12
  const cleaning = unit.prices.cleaningFee;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-flats/booking-engine-common-server",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -21,7 +21,6 @@
21
21
  "typescript": "^5.1.6"
22
22
  },
23
23
  "dependencies": {
24
- "dayjs": "^1.11.13",
25
24
  "mongoose": "^8.5.2"
26
25
  }
27
26
  }
@@ -1 +0,0 @@
1
- export declare const calculatePreciseMonthDifference: (from: Date, to: Date) => number;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.calculatePreciseMonthDifference = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- const calculatePreciseMonthDifference = (from, to) => {
9
- //
10
- const monthsDiff = (0, dayjs_1.default)(to).diff(from, 'month', true);
11
- if (monthsDiff >= 1) {
12
- return monthsDiff;
13
- }
14
- const daysDiff = (0, dayjs_1.default)(to).diff(from, 'day');
15
- return Number((daysDiff / 30).toFixed(2));
16
- };
17
- exports.calculatePreciseMonthDifference = calculatePreciseMonthDifference;