-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Advanced-computer-lab-2024/backend/sherle…
…mious/dev feat: minor fixes and updates to models/references
- Loading branch information
Showing
17 changed files
with
355 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,62 @@ | ||
import { Schema, model } from 'mongoose'; | ||
import { locationSchema } from './location.model'; | ||
|
||
const museumSchema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
tags: { | ||
type: [{ type: Schema.Types.ObjectId, ref: 'tag' }], | ||
}, | ||
description: { | ||
type: String, | ||
required: true, | ||
}, | ||
category: { | ||
type: String, | ||
required: true, | ||
}, | ||
pictures: { | ||
type: [String], | ||
}, | ||
location: { | ||
type: locationSchema, | ||
}, | ||
opening_hours: { | ||
type: String, | ||
required: true, | ||
}, | ||
ticket_prices: { | ||
foreigner: { | ||
type: Number, | ||
const museumSchema = new Schema( | ||
{ | ||
name: { | ||
type: String, | ||
required: true, | ||
min: 0, | ||
}, | ||
native: { | ||
type: Number, | ||
tags: { | ||
type: [{ type: Schema.Types.ObjectId, ref: 'tag' }], | ||
}, | ||
description: { | ||
type: String, | ||
required: true, | ||
min: 0, | ||
}, | ||
student: { | ||
type: Number, | ||
category: { | ||
type: String, | ||
required: true, | ||
min: 0, | ||
}, | ||
pictures: { | ||
type: [{ type: Schema.Types.ObjectId, ref: 'attachment' }], | ||
}, | ||
location: { | ||
type: locationSchema, | ||
}, | ||
opening_hours: { | ||
type: String, | ||
required: true, | ||
}, | ||
ticket_prices: { | ||
foreigner: { | ||
type: Number, | ||
required: true, | ||
min: 0, | ||
}, | ||
native: { | ||
type: Number, | ||
required: true, | ||
min: 0, | ||
}, | ||
student: { | ||
type: Number, | ||
required: true, | ||
min: 0, | ||
}, | ||
}, | ||
created_by: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'user', | ||
}, | ||
modified_by: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'user', | ||
}, | ||
}, | ||
}); | ||
{ | ||
timestamps: true, | ||
} | ||
); | ||
|
||
export const Museum = model('museum', museumSchema); |
Oops, something went wrong.