@vibe-flats/booking-engine-common-server 1.0.159 → 1.0.160

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.
@@ -4,6 +4,7 @@ import { BuildingDocument } from './building';
4
4
  import { CityDocument } from './cities';
5
5
  import { MarketDocument } from './markets';
6
6
  import { GuestDocument } from './guests';
7
+ import { ChannelDocument } from './channels';
7
8
  export type UnitReviewCategory = 'cleanliness' | 'communication' | 'checkin' | 'accuracy' | 'location' | 'value' | 'service';
8
9
  export type UnitReviewPlatform = 'direct' | 'airbnb' | 'vrbo' | 'booking' | 'expedia';
9
10
  export type UnitReviewChannel = 'all' | 'airbnb' | 'booking' | 'vrbo';
@@ -54,6 +55,39 @@ export declare const TAX_QUANTIFIERS: {
54
55
  readonly PER_NIGHT: "PER_NIGHT";
55
56
  };
56
57
  export type TaxQuantifier = (typeof TAX_QUANTIFIERS)[keyof typeof TAX_QUANTIFIERS];
58
+ export declare const DISTRIBUTION_BOOK_METHODS: {
59
+ readonly INSTANT: "instant";
60
+ readonly QUOTE: "quote";
61
+ };
62
+ export type DistributionBookMethod = (typeof DISTRIBUTION_BOOK_METHODS)[keyof typeof DISTRIBUTION_BOOK_METHODS];
63
+ export interface UnitMarkup {
64
+ channel?: ChannelDocument;
65
+ key: string;
66
+ amount: number;
67
+ }
68
+ export interface UnitDistributionHistory {
69
+ isListed: boolean;
70
+ at: Date;
71
+ status: string;
72
+ reason?: string;
73
+ }
74
+ export interface UnitDistribution {
75
+ channel?: ChannelDocument;
76
+ platformKey: string;
77
+ isListed: boolean;
78
+ status: string;
79
+ cancellationPolicy?: string;
80
+ cancellationPenalty?: number;
81
+ useRMCancellationPolicy?: boolean;
82
+ bookMethod?: DistributionBookMethod;
83
+ unlistedReason?: string;
84
+ listedAt?: Date;
85
+ unlistedAt?: Date;
86
+ history: UnitDistributionHistory[];
87
+ customNotes?: string;
88
+ externalUrl?: string;
89
+ lastSyncedAt: Date;
90
+ }
57
91
  export interface UnitDocument extends mongoose.Document {
58
92
  name: string;
59
93
  code: number;
@@ -135,6 +169,9 @@ export interface UnitDocument extends mongoose.Document {
135
169
  expedia: string;
136
170
  googleVacationRentals: string;
137
171
  };
172
+ useChannelMarkup: boolean;
173
+ markups: UnitMarkup[];
174
+ distribution: UnitDistribution[];
138
175
  website: {
139
176
  description: string;
140
177
  slug: string;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.UnitModel = exports.TAX_QUANTIFIERS = exports.TAX_UNITS = exports.UNIT_TYPES = void 0;
26
+ exports.UnitModel = exports.DISTRIBUTION_BOOK_METHODS = exports.TAX_QUANTIFIERS = exports.TAX_UNITS = exports.UNIT_TYPES = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
28
  exports.UNIT_TYPES = {
29
29
  SINGLE: 'single',
@@ -38,6 +38,10 @@ exports.TAX_QUANTIFIERS = {
38
38
  PER_STAY: 'PER_STAY',
39
39
  PER_NIGHT: 'PER_NIGHT'
40
40
  };
41
+ exports.DISTRIBUTION_BOOK_METHODS = {
42
+ INSTANT: 'instant',
43
+ QUOTE: 'quote'
44
+ };
41
45
  const ratingBucketSchema = new mongoose_1.default.Schema({
42
46
  rating: { type: Number, required: true, default: 0 },
43
47
  count: { type: Number, required: true, default: 0 }
@@ -46,6 +50,34 @@ const ratingsByWindowSchema = new mongoose_1.default.Schema({
46
50
  allTime: { type: ratingBucketSchema, required: true, default: () => ({}) },
47
51
  last3Reviews: { type: ratingBucketSchema, required: true, default: () => ({}) }
48
52
  }, { _id: false });
53
+ const markupSchema = new mongoose_1.default.Schema({
54
+ channel: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Channel', required: false },
55
+ key: { type: String, required: true },
56
+ amount: { type: Number, required: true }
57
+ }, { _id: false });
58
+ const distributionHistorySchema = new mongoose_1.default.Schema({
59
+ isListed: { type: Boolean, required: true },
60
+ at: { type: Date, required: true },
61
+ status: { type: String, required: false },
62
+ reason: { type: String, required: false }
63
+ }, { _id: false });
64
+ const distributionSchema = new mongoose_1.default.Schema({
65
+ channel: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Channel', required: false },
66
+ platformKey: { type: String, required: true },
67
+ isListed: { type: Boolean, required: true, default: false },
68
+ status: { type: String, required: false },
69
+ cancellationPolicy: { type: String, required: false },
70
+ cancellationPenalty: { type: Number, required: false },
71
+ useRMCancellationPolicy: { type: Boolean, required: false },
72
+ bookMethod: { type: String, enum: Object.values(exports.DISTRIBUTION_BOOK_METHODS), required: false },
73
+ unlistedReason: { type: String, required: false },
74
+ listedAt: { type: Date, required: false },
75
+ unlistedAt: { type: Date, required: false },
76
+ history: { type: [distributionHistorySchema], required: true, default: () => [] },
77
+ customNotes: { type: String, required: false },
78
+ externalUrl: { type: String, required: false },
79
+ lastSyncedAt: { type: Date, required: true }
80
+ }, { _id: false });
49
81
  const schema = new mongoose_1.default.Schema({
50
82
  name: { type: String, required: true },
51
83
  code: { type: Number, required: true },
@@ -143,6 +175,9 @@ const schema = new mongoose_1.default.Schema({
143
175
  required: false,
144
176
  _id: false
145
177
  },
178
+ useChannelMarkup: { type: Boolean, required: false, default: false },
179
+ markups: { type: [markupSchema], required: false, default: () => [] },
180
+ distribution: { type: [distributionSchema], required: false, default: () => [] },
146
181
  website: {
147
182
  type: new mongoose_1.default.Schema({
148
183
  description: { type: String, required: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-flats/booking-engine-common-server",
3
- "version": "1.0.159",
3
+ "version": "1.0.160",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",