@vibe-flats/booking-engine-common-server 1.0.156 → 1.0.157
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/src/models/units.d.ts +35 -14
- package/build/src/models/units.js +22 -0
- package/package.json +1 -1
|
@@ -6,6 +6,39 @@ import { MarketDocument } from './markets';
|
|
|
6
6
|
import { GuestDocument } from './guests';
|
|
7
7
|
export type UnitReviewCategory = 'cleanliness' | 'communication' | 'checkin' | 'accuracy' | 'location' | 'value' | 'service';
|
|
8
8
|
export type UnitReviewPlatform = 'direct' | 'airbnb' | 'vrbo' | 'booking' | 'expedia';
|
|
9
|
+
export type UnitReviewChannel = 'all' | 'airbnb' | 'booking' | 'vrbo';
|
|
10
|
+
export interface UnitReview {
|
|
11
|
+
body: string;
|
|
12
|
+
isPublic: boolean;
|
|
13
|
+
isPublicOnChannel: boolean;
|
|
14
|
+
rating: number;
|
|
15
|
+
nativeRating?: number;
|
|
16
|
+
nativeScale?: 5 | 10;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
reservationId: string;
|
|
19
|
+
externalId: string;
|
|
20
|
+
platform: UnitReviewPlatform;
|
|
21
|
+
guest: GuestDocument;
|
|
22
|
+
categories: {
|
|
23
|
+
name: UnitReviewCategory;
|
|
24
|
+
rating: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export interface UnitRatingBucket {
|
|
28
|
+
rating: number;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
export interface UnitRatingsByWindow {
|
|
32
|
+
allTime: UnitRatingBucket;
|
|
33
|
+
last6Months: UnitRatingBucket;
|
|
34
|
+
last3Reviews: UnitRatingBucket;
|
|
35
|
+
}
|
|
36
|
+
export interface UnitRatings {
|
|
37
|
+
all: UnitRatingsByWindow;
|
|
38
|
+
airbnb: UnitRatingsByWindow;
|
|
39
|
+
booking: UnitRatingsByWindow;
|
|
40
|
+
vrbo: UnitRatingsByWindow;
|
|
41
|
+
}
|
|
9
42
|
export declare const UNIT_TYPES: {
|
|
10
43
|
readonly SINGLE: "single";
|
|
11
44
|
readonly MULTI_PARENT: "multi-listing-parent";
|
|
@@ -120,20 +153,8 @@ export interface UnitDocument extends mongoose.Document {
|
|
|
120
153
|
updatedAt: Date;
|
|
121
154
|
isTrue: boolean;
|
|
122
155
|
rating: number;
|
|
123
|
-
reviews:
|
|
124
|
-
|
|
125
|
-
isPublic: boolean;
|
|
126
|
-
rating: number;
|
|
127
|
-
createdAt: Date;
|
|
128
|
-
reservationId: string;
|
|
129
|
-
externalId: string;
|
|
130
|
-
platform: UnitReviewPlatform;
|
|
131
|
-
guest: GuestDocument;
|
|
132
|
-
categories: {
|
|
133
|
-
name: UnitReviewCategory;
|
|
134
|
-
rating: number;
|
|
135
|
-
}[];
|
|
136
|
-
}[];
|
|
156
|
+
reviews: UnitReview[];
|
|
157
|
+
ratings: UnitRatings;
|
|
137
158
|
salesBlockWarning: string;
|
|
138
159
|
hasOpenExtensionLink: boolean;
|
|
139
160
|
lengthOfStayType: 'monthly' | 'hybrid' | 'nightly';
|
|
@@ -38,6 +38,15 @@ exports.TAX_QUANTIFIERS = {
|
|
|
38
38
|
PER_STAY: 'PER_STAY',
|
|
39
39
|
PER_NIGHT: 'PER_NIGHT'
|
|
40
40
|
};
|
|
41
|
+
const ratingBucketSchema = new mongoose_1.default.Schema({
|
|
42
|
+
rating: { type: Number, required: true, default: 0 },
|
|
43
|
+
count: { type: Number, required: true, default: 0 }
|
|
44
|
+
}, { _id: false });
|
|
45
|
+
const ratingsByWindowSchema = new mongoose_1.default.Schema({
|
|
46
|
+
allTime: { type: ratingBucketSchema, required: true, default: () => ({}) },
|
|
47
|
+
last6Months: { type: ratingBucketSchema, required: true, default: () => ({}) },
|
|
48
|
+
last3Reviews: { type: ratingBucketSchema, required: true, default: () => ({}) }
|
|
49
|
+
}, { _id: false });
|
|
41
50
|
const schema = new mongoose_1.default.Schema({
|
|
42
51
|
name: { type: String, required: true },
|
|
43
52
|
code: { type: Number, required: true },
|
|
@@ -163,7 +172,10 @@ const schema = new mongoose_1.default.Schema({
|
|
|
163
172
|
{
|
|
164
173
|
body: { type: String, required: true },
|
|
165
174
|
isPublic: { type: Boolean, required: true },
|
|
175
|
+
isPublicOnChannel: { type: Boolean, required: false },
|
|
166
176
|
rating: { type: Number, required: true },
|
|
177
|
+
nativeRating: { type: Number, required: false },
|
|
178
|
+
nativeScale: { type: Number, enum: [5, 10], required: false },
|
|
167
179
|
createdAt: { type: Date, required: true },
|
|
168
180
|
reservationId: { type: String, required: true },
|
|
169
181
|
externalId: { type: String, required: true },
|
|
@@ -184,6 +196,16 @@ const schema = new mongoose_1.default.Schema({
|
|
|
184
196
|
required: false,
|
|
185
197
|
_id: false
|
|
186
198
|
},
|
|
199
|
+
ratings: {
|
|
200
|
+
type: new mongoose_1.default.Schema({
|
|
201
|
+
all: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
202
|
+
airbnb: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
203
|
+
booking: { type: ratingsByWindowSchema, required: true, default: () => ({}) },
|
|
204
|
+
vrbo: { type: ratingsByWindowSchema, required: true, default: () => ({}) }
|
|
205
|
+
}, { _id: false }),
|
|
206
|
+
required: false,
|
|
207
|
+
default: () => ({})
|
|
208
|
+
},
|
|
187
209
|
salesBlockWarning: { type: String, required: false },
|
|
188
210
|
hasOpenExtensionLink: { type: Boolean, required: false },
|
|
189
211
|
lengthOfStayType: { type: String, required: false },
|