Skip to content

Commit

Permalink
Merge pull request #12 from htoann/development
Browse files Browse the repository at this point in the history
feat: add timestamp hotel
  • Loading branch information
htoann authored Nov 7, 2022
2 parents be58911 + 45403ee commit 4acec05
Showing 1 changed file with 63 additions and 58 deletions.
121 changes: 63 additions & 58 deletions server/src/hotel/hotelModel.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,69 @@
import mongoose from "mongoose";

const HotelSchema = new mongoose.Schema({
title: {
type: String,
required: true,
const HotelSchema = new mongoose.Schema(
{
title: {
type: String,
required: true,
},
name: {
type: String,
required: true,
},
type: {
type: String,
enum: ["hotels", "apartments", "resorts", "villas", "cabins"],
required: true,
},
desc: {
type: String,
required: true,
},
descShort: {
type: String,
required: true,
},
city: {
type: String,
required: true,
},
address: {
type: { name: String, lat: Number, lng: Number },
required: true,
},
distance: {
type: String,
required: true,
},
photos: {
type: [String],
},
cheapestPrice: {
type: Number,
required: true,
},
featured: {
type: Boolean,
default: false,
},
rating: {
type: Number,
min: 0,
max: 5,
},
score: {
type: Number,
min: 0,
max: 10,
},
rooms: {
type: [String],
},
},
name: {
type: String,
required: true,
},
type: {
type: String,
enum: ["hotels", "apartments", "resorts", "villas", "cabins"],
required: true,
},
desc: {
type: String,
required: true,
},
descShort: {
type: String,
required: true,
},
city: {
type: String,
required: true,
},
address: {
type: { name: String, lat: Number, lng: Number },
required: true,
},
distance: {
type: String,
required: true,
},
photos: {
type: [String],
},
cheapestPrice: {
type: Number,
required: true,
},
featured: {
type: Boolean,
default: false,
},
rating: {
type: Number,
min: 0,
max: 5,
},
score: {
type: Number,
min: 0,
max: 10,
},
rooms: {
type: [String],
},
});
{
timestamps: true,
}
);

// autoIncrement.initialize(mongoose.connection);

Expand Down

0 comments on commit 4acec05

Please sign in to comment.