-
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.
- Loading branch information
1 parent
8197618
commit 32f210d
Showing
10 changed files
with
256 additions
and
272 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { ObjectId } from "mongodb"; | ||
import { Tag } from "../models/tag.model"; | ||
import { TagType } from "../../types/Tag.types"; | ||
import Validator from "../../utils/Validator.utils"; | ||
import { ObjectId } from 'mongodb'; | ||
import { Tag } from '../models/tag.model'; | ||
import { TagType } from '../../types/Tag.types'; | ||
import Validator from '../../utils/Validator.utils'; | ||
|
||
class TagRepo{ | ||
async findTagById(id: string){ | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.find({ _id: new ObjectId(id) }); | ||
} | ||
class TagRepo { | ||
async findTagById(id: string) { | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.find({ _id: new ObjectId(id) }); | ||
} | ||
|
||
async createTag(tag: TagType){ | ||
const tagRes = await Tag.create(tag); | ||
return tagRes; | ||
} | ||
async createTag(tag: TagType) { | ||
const tagRes = await Tag.create(tag); | ||
return tagRes; | ||
} | ||
|
||
async updateTag(id: string, tag: TagType){ | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.updateOne({ _id: new ObjectId(id) }, tag); | ||
} | ||
async updateTag(id: string, tag: TagType) { | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.updateOne({ _id: new ObjectId(id) }, tag); | ||
} | ||
|
||
async deleteTag(id: string){ | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.deleteOne({ _id: new ObjectId(id) }); | ||
} | ||
async deleteTag(id: string) { | ||
Validator.validateId(id, 'Invalid tag ID'); | ||
return await Tag.deleteOne({ _id: new ObjectId(id) }); | ||
} | ||
} | ||
export default new TagRepo(); | ||
export default new TagRepo(); |
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,11 +1,10 @@ | ||
import { Router } from "express"; | ||
import { createAdmin, updateAdmin, getAdmins } from "../controllers/users/admin.controller"; | ||
import { Router } from 'express'; | ||
import { createAdmin, updateAdmin, getAdmins } from '../controllers/users/admin.controller'; | ||
|
||
const router = Router(); | ||
|
||
router.get('', getAdmins); | ||
router.post('', createAdmin); | ||
router.put('/:id', updateAdmin); | ||
|
||
|
||
export default router; | ||
export default router; |
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,5 +1,5 @@ | ||
export interface LocationType { | ||
name: string; | ||
latitude: number; | ||
longitude: number; | ||
} | ||
name: string; | ||
latitude: number; | ||
longitude: number; | ||
} |
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,18 +1,17 @@ | ||
import { LocationType } from "./Location.types"; | ||
import { TagType } from "./Tag.types"; | ||
import { LocationType } from './Location.types'; | ||
import { TagType } from './Tag.types'; | ||
export interface MuseumType { | ||
id: number; | ||
name: string; | ||
tags: TagType[]; | ||
description: string; | ||
category: string; | ||
pictures: string[]; | ||
location: LocationType; | ||
opening_hours: string; | ||
ticket_prices: { | ||
foreigner: number; | ||
native: number; | ||
student: number; | ||
id: number; | ||
name: string; | ||
tags: TagType[]; | ||
description: string; | ||
category: string; | ||
pictures: string[]; | ||
location: LocationType; | ||
opening_hours: string; | ||
ticket_prices: { | ||
foreigner: number; | ||
native: number; | ||
student: number; | ||
}; | ||
} | ||
|
||
} |
Oops, something went wrong.