@vibe-flats/booking-engine-common-server 1.0.1
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 +1 -0
- package/build/index.js +17 -0
- package/build/src/models/areas.d.ts +11 -0
- package/build/src/models/areas.js +52 -0
- package/build/src/models/availability.d.ts +12 -0
- package/build/src/models/availability.js +59 -0
- package/build/src/models/building.d.ts +21 -0
- package/build/src/models/building.js +87 -0
- package/build/src/models/cities.d.ts +8 -0
- package/build/src/models/cities.js +28 -0
- package/build/src/models/units.d.ts +55 -0
- package/build/src/models/units.js +96 -0
- package/build/src/units-models.d.ts +18 -0
- package/build/src/units-models.js +16 -0
- package/package.json +26 -0
- package/readme.md +1 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/units-models';
|
package/build/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/units-models"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { CityDocument } from './cities';
|
|
3
|
+
export interface AreaDocument extends mongoose.Document {
|
|
4
|
+
name: string;
|
|
5
|
+
externalName: string;
|
|
6
|
+
publicId: string;
|
|
7
|
+
city: CityDocument;
|
|
8
|
+
}
|
|
9
|
+
export declare const AreaModel: (connection: mongoose.Connection) => mongoose.Model<AreaDocument, {}, {}, {}, mongoose.Document<unknown, {}, AreaDocument> & AreaDocument & Required<{
|
|
10
|
+
_id: unknown;
|
|
11
|
+
}>, any>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AreaModel = void 0;
|
|
27
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
+
const schema = new mongoose_1.default.Schema({
|
|
29
|
+
name: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
externalName: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
publicId: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true
|
|
40
|
+
},
|
|
41
|
+
city: {
|
|
42
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
43
|
+
ref: 'City'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
schema.index({ publicId: 1 });
|
|
47
|
+
schema.index({ externalName: 1 });
|
|
48
|
+
const AreaModel = (connection) => {
|
|
49
|
+
return connection.model('Area', schema);
|
|
50
|
+
};
|
|
51
|
+
exports.AreaModel = AreaModel;
|
|
52
|
+
// export const AreaModel = connection.model<AreaDocument>('Area', schema);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { UnitDocument } from './units';
|
|
3
|
+
export interface AvailabilityDocument extends mongoose.Document {
|
|
4
|
+
unit: UnitDocument;
|
|
5
|
+
date: Date;
|
|
6
|
+
isAvailable: boolean;
|
|
7
|
+
price: number;
|
|
8
|
+
minNights: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const AvailabilityModel: (connection: mongoose.Connection) => mongoose.Model<AvailabilityDocument, {}, {}, {}, mongoose.Document<unknown, {}, AvailabilityDocument> & AvailabilityDocument & Required<{
|
|
11
|
+
_id: unknown;
|
|
12
|
+
}>, any>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AvailabilityModel = void 0;
|
|
27
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
+
const schema = new mongoose_1.default.Schema({
|
|
29
|
+
unit: {
|
|
30
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
31
|
+
ref: 'Unit',
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
date: {
|
|
35
|
+
type: Date,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
isAvailable: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
price: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
minNights: {
|
|
47
|
+
type: Number,
|
|
48
|
+
required: true
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
timestamps: true,
|
|
52
|
+
versionKey: false
|
|
53
|
+
});
|
|
54
|
+
schema.index({ unit: 1, date: 1 });
|
|
55
|
+
const AvailabilityModel = (connection) => {
|
|
56
|
+
return connection.model('Availability', schema);
|
|
57
|
+
};
|
|
58
|
+
exports.AvailabilityModel = AvailabilityModel;
|
|
59
|
+
// export const AvailabilityModel = unitsDbConnection.model<AvailabilityDocument>('Availability', schema);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { AreaDocument } from './areas';
|
|
3
|
+
import { CityDocument } from './cities';
|
|
4
|
+
export interface BuildingDocument extends mongoose.Document {
|
|
5
|
+
name: string;
|
|
6
|
+
externalName: string;
|
|
7
|
+
publicId: string;
|
|
8
|
+
hubspotId: string;
|
|
9
|
+
area: AreaDocument;
|
|
10
|
+
city: CityDocument;
|
|
11
|
+
address: string;
|
|
12
|
+
state: string;
|
|
13
|
+
zip: string;
|
|
14
|
+
position: {
|
|
15
|
+
lat: number;
|
|
16
|
+
lng: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const BuildingModel: (connection: mongoose.Connection) => mongoose.Model<BuildingDocument, {}, {}, {}, mongoose.Document<unknown, {}, BuildingDocument> & BuildingDocument & Required<{
|
|
20
|
+
_id: unknown;
|
|
21
|
+
}>, any>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.BuildingModel = void 0;
|
|
27
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
+
const schema = new mongoose_1.default.Schema({
|
|
29
|
+
name: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
externalName: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
publicId: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false
|
|
40
|
+
},
|
|
41
|
+
hubspotId: {
|
|
42
|
+
type: String,
|
|
43
|
+
required: false
|
|
44
|
+
},
|
|
45
|
+
area: {
|
|
46
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
47
|
+
ref: 'Area',
|
|
48
|
+
required: false
|
|
49
|
+
},
|
|
50
|
+
city: {
|
|
51
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
52
|
+
ref: 'City',
|
|
53
|
+
required: false
|
|
54
|
+
},
|
|
55
|
+
address: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: false
|
|
58
|
+
},
|
|
59
|
+
state: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: false
|
|
62
|
+
},
|
|
63
|
+
zip: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
67
|
+
position: {
|
|
68
|
+
// coming from guesty
|
|
69
|
+
type: new mongoose_1.default.Schema({
|
|
70
|
+
lat: { type: Number, required: true },
|
|
71
|
+
lng: { type: Number, required: true }
|
|
72
|
+
}),
|
|
73
|
+
required: true,
|
|
74
|
+
_id: false
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
timestamps: true,
|
|
78
|
+
versionKey: false
|
|
79
|
+
});
|
|
80
|
+
// Unique index
|
|
81
|
+
schema.index({ publicId: 1 });
|
|
82
|
+
schema.index({ hubspotId: 1 });
|
|
83
|
+
const BuildingModel = (connection) => {
|
|
84
|
+
return connection.model('Building', schema);
|
|
85
|
+
};
|
|
86
|
+
exports.BuildingModel = BuildingModel;
|
|
87
|
+
// export const BuildingModel = unitsDbConnection.model<BuildingDocument>('Building', schema);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export interface CityDocument extends mongoose.Document {
|
|
3
|
+
name: string;
|
|
4
|
+
publicId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const CityModel: (connection: mongoose.Connection) => mongoose.Model<CityDocument, {}, {}, {}, mongoose.Document<unknown, {}, CityDocument> & CityDocument & Required<{
|
|
7
|
+
_id: unknown;
|
|
8
|
+
}>, any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.CityModel = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const schema = new mongoose_1.default.Schema({
|
|
9
|
+
name: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
externalName: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
publicId: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
schema.index({ publicId: 1 });
|
|
23
|
+
schema.index({ externalName: 1 });
|
|
24
|
+
const CityModel = (connection) => {
|
|
25
|
+
return connection.model('City', schema);
|
|
26
|
+
};
|
|
27
|
+
exports.CityModel = CityModel;
|
|
28
|
+
// export const CityModel = unitsDbConnection.model<CityDocument>('City', schema);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { AreaDocument } from './areas';
|
|
3
|
+
import { BuildingDocument } from './building';
|
|
4
|
+
import { CityDocument } from './cities';
|
|
5
|
+
export interface UnitDocument extends mongoose.Document {
|
|
6
|
+
name: string;
|
|
7
|
+
code: number;
|
|
8
|
+
building?: BuildingDocument;
|
|
9
|
+
city?: CityDocument;
|
|
10
|
+
area?: AreaDocument;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
publicId: string;
|
|
13
|
+
guestyId: string;
|
|
14
|
+
hubspotId?: string;
|
|
15
|
+
image: string;
|
|
16
|
+
images: string[];
|
|
17
|
+
guestyAddress: {
|
|
18
|
+
street: string;
|
|
19
|
+
city: string;
|
|
20
|
+
state: string;
|
|
21
|
+
zipcode: string;
|
|
22
|
+
country: string;
|
|
23
|
+
lat: number;
|
|
24
|
+
lng: number;
|
|
25
|
+
full: string;
|
|
26
|
+
};
|
|
27
|
+
bedrooms: number;
|
|
28
|
+
bathrooms: number;
|
|
29
|
+
elevator: boolean;
|
|
30
|
+
laundry: boolean;
|
|
31
|
+
floor: number;
|
|
32
|
+
gym: boolean;
|
|
33
|
+
parking: boolean;
|
|
34
|
+
pool: boolean;
|
|
35
|
+
beds: {
|
|
36
|
+
type: string;
|
|
37
|
+
qty: number;
|
|
38
|
+
}[];
|
|
39
|
+
prices: {
|
|
40
|
+
monthlyPriceFactor: number;
|
|
41
|
+
weeklyPriceFactor: number;
|
|
42
|
+
cleaningFee: number;
|
|
43
|
+
};
|
|
44
|
+
fees: {
|
|
45
|
+
name: string;
|
|
46
|
+
value: number;
|
|
47
|
+
multiplier: 'PER_NIGHT' | 'PER_STAY' | 'PER_GUEST' | 'PER_GUEST_PER_NIGHT';
|
|
48
|
+
isOptional: boolean;
|
|
49
|
+
isPercentage: boolean;
|
|
50
|
+
}[];
|
|
51
|
+
lastSyncedAt?: Date;
|
|
52
|
+
}
|
|
53
|
+
export declare const UnitModel: (connection: mongoose.Connection) => mongoose.Model<UnitDocument, {}, {}, {}, mongoose.Document<unknown, {}, UnitDocument> & UnitDocument & Required<{
|
|
54
|
+
_id: unknown;
|
|
55
|
+
}>, any>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.UnitModel = void 0;
|
|
27
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
+
const schema = new mongoose_1.default.Schema({
|
|
29
|
+
name: { type: String, required: true },
|
|
30
|
+
code: { type: Number, required: true },
|
|
31
|
+
building: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Building', required: false },
|
|
32
|
+
city: { type: mongoose_1.Schema.Types.ObjectId, ref: 'City', required: false },
|
|
33
|
+
area: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Area', required: false },
|
|
34
|
+
isActive: { type: Boolean, required: true, default: true },
|
|
35
|
+
publicId: { type: String, required: false },
|
|
36
|
+
guestyId: { type: String, required: true },
|
|
37
|
+
hubspotId: { type: String, required: true },
|
|
38
|
+
image: { type: String, required: true },
|
|
39
|
+
images: [{ type: String, required: true }],
|
|
40
|
+
guestyAddress: {
|
|
41
|
+
type: new mongoose_1.default.Schema({
|
|
42
|
+
street: { type: String, required: true },
|
|
43
|
+
city: { type: String, required: true },
|
|
44
|
+
state: { type: String, required: true },
|
|
45
|
+
zipcode: { type: String, required: true },
|
|
46
|
+
country: { type: String, required: true },
|
|
47
|
+
lat: { type: Number, required: true },
|
|
48
|
+
lng: { type: Number, required: true },
|
|
49
|
+
full: { type: String, required: true }
|
|
50
|
+
}),
|
|
51
|
+
required: true,
|
|
52
|
+
_id: false
|
|
53
|
+
},
|
|
54
|
+
bedrooms: { type: Number, required: true },
|
|
55
|
+
bathrooms: { type: Number, required: true },
|
|
56
|
+
elevator: { type: Boolean, required: true },
|
|
57
|
+
laundry: { type: Boolean, required: true },
|
|
58
|
+
floor: { type: Number, required: true },
|
|
59
|
+
gym: { type: Boolean, required: true },
|
|
60
|
+
parking: { type: Boolean, required: true },
|
|
61
|
+
pool: { type: Boolean, required: true },
|
|
62
|
+
beds: [{ type: { type: String, required: true }, qty: { type: Number, required: true }, _id: false }],
|
|
63
|
+
prices: {
|
|
64
|
+
type: new mongoose_1.default.Schema({
|
|
65
|
+
monthlyPriceFactor: { type: Number, required: true },
|
|
66
|
+
weeklyPriceFactor: { type: Number, required: true },
|
|
67
|
+
cleaningFee: { type: Number, required: true }
|
|
68
|
+
}),
|
|
69
|
+
required: true,
|
|
70
|
+
_id: false
|
|
71
|
+
},
|
|
72
|
+
fees: [
|
|
73
|
+
{
|
|
74
|
+
name: { type: String, required: true },
|
|
75
|
+
value: { type: Number, required: true },
|
|
76
|
+
multiplier: { type: String, required: true },
|
|
77
|
+
isOptional: { type: Boolean, required: true },
|
|
78
|
+
isPercentage: { type: Boolean, required: true },
|
|
79
|
+
_id: false
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
lastSyncedAt: { type: Boolean, required: false }
|
|
83
|
+
}, {
|
|
84
|
+
timestamps: true,
|
|
85
|
+
versionKey: false,
|
|
86
|
+
strict: false
|
|
87
|
+
});
|
|
88
|
+
// Unique index
|
|
89
|
+
schema.index({ publicId: 1 });
|
|
90
|
+
schema.index({ code: 1 });
|
|
91
|
+
schema.index({ hubspotId: 1 });
|
|
92
|
+
const UnitModel = (connection) => {
|
|
93
|
+
return connection.model('Unit', schema);
|
|
94
|
+
};
|
|
95
|
+
exports.UnitModel = UnitModel;
|
|
96
|
+
// export const UnitModel = unitsDbConnection.model<UnitDocument>('Unit', schema);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export declare const unitsModels: (connection: mongoose.Connection) => {
|
|
3
|
+
CityModel: mongoose.Model<import("./models/cities").CityDocument, {}, {}, {}, mongoose.Document<unknown, {}, import("./models/cities").CityDocument> & import("./models/cities").CityDocument & Required<{
|
|
4
|
+
_id: unknown;
|
|
5
|
+
}>, any>;
|
|
6
|
+
UnitModel: mongoose.Model<import("./models/units").UnitDocument, {}, {}, {}, mongoose.Document<unknown, {}, import("./models/units").UnitDocument> & import("./models/units").UnitDocument & Required<{
|
|
7
|
+
_id: unknown;
|
|
8
|
+
}>, any>;
|
|
9
|
+
AvailabilityModel: mongoose.Model<import("./models/availability").AvailabilityDocument, {}, {}, {}, mongoose.Document<unknown, {}, import("./models/availability").AvailabilityDocument> & import("./models/availability").AvailabilityDocument & Required<{
|
|
10
|
+
_id: unknown;
|
|
11
|
+
}>, any>;
|
|
12
|
+
BuildingModel: mongoose.Model<import("./models/building").BuildingDocument, {}, {}, {}, mongoose.Document<unknown, {}, import("./models/building").BuildingDocument> & import("./models/building").BuildingDocument & Required<{
|
|
13
|
+
_id: unknown;
|
|
14
|
+
}>, any>;
|
|
15
|
+
AreaModel: mongoose.Model<import("./models/areas").AreaDocument, {}, {}, {}, mongoose.Document<unknown, {}, import("./models/areas").AreaDocument> & import("./models/areas").AreaDocument & Required<{
|
|
16
|
+
_id: unknown;
|
|
17
|
+
}>, any>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unitsModels = void 0;
|
|
4
|
+
const cities_1 = require("./models/cities");
|
|
5
|
+
const units_1 = require("./models/units");
|
|
6
|
+
const availability_1 = require("./models/availability");
|
|
7
|
+
const building_1 = require("./models/building");
|
|
8
|
+
const areas_1 = require("./models/areas");
|
|
9
|
+
const unitsModels = (connection) => ({
|
|
10
|
+
CityModel: (0, cities_1.CityModel)(connection),
|
|
11
|
+
UnitModel: (0, units_1.UnitModel)(connection),
|
|
12
|
+
AvailabilityModel: (0, availability_1.AvailabilityModel)(connection),
|
|
13
|
+
BuildingModel: (0, building_1.BuildingModel)(connection),
|
|
14
|
+
AreaModel: (0, areas_1.AreaModel)(connection)
|
|
15
|
+
});
|
|
16
|
+
exports.unitsModels = unitsModels;
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibe-flats/booking-engine-common-server",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"types": "./build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"clean": "del ./build/*",
|
|
12
|
+
"build": "npm run clean && tsc",
|
|
13
|
+
"pub": "npm version patch && npm run build && npm publish"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "Omri Regev",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^22.1.0",
|
|
20
|
+
"del-cli": "^5.1.0",
|
|
21
|
+
"typescript": "^5.1.6"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"mongoose": "^8.5.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Common Tools
|