generated from agiledev-students-fall2023/generic-project-repository
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #183 from agiledev-students-fall2023/map_search
Map search
- Loading branch information
Showing
12 changed files
with
134 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Artwork from '../models/Artwork.mjs'; | ||
|
||
const searchArtsRouter = async (req, res) => { | ||
// artinfo, timeRange | ||
const { artInfo, timeRange } = req.query; | ||
console.log(artInfo, timeRange) | ||
|
||
const startYear = parseInt(timeRange[0]); | ||
const endYear = parseInt(timeRange[1]); | ||
|
||
console.log(req.query); | ||
console.log(startYear); | ||
console.log(endYear); | ||
|
||
try { | ||
console.log('Searching for artworks...'); | ||
const artworks = await Artwork.find({ | ||
Year: { $gte: startYear, $lte: endYear }, | ||
$or: [ | ||
{ title: { $regex: `${artInfo}`, $options: 'i' } }, | ||
{ artist: { $regex: `${artInfo}`, $options: 'i' } } | ||
] | ||
}).limit(15); | ||
console.log('Artworks found'); | ||
console.log(artworks); | ||
return res.json(artworks); | ||
} catch (err) { | ||
console.error(err); // Log the error for debugging | ||
return res.status(500).send('Internal Server Error'); | ||
} | ||
}; | ||
|
||
export default searchArtsRouter; |
This file was deleted.
Oops, something went wrong.
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
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