Commit f5339224 authored by baesangjune's avatar baesangjune
Browse files

.

parent be0cdaed
[{"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js":"3","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js":"5","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js":"6"},{"size":1133,"mtime":1610956158273,"results":"7","hashOfConfig":"8"},{"size":375,"mtime":1610931750280,"results":"9","hashOfConfig":"8"},{"size":1553,"mtime":1610931750241,"results":"10","hashOfConfig":"8"},{"size":8468,"mtime":1611085803712,"results":"11","hashOfConfig":"8"},{"size":1608,"mtime":1611080275421,"results":"12","hashOfConfig":"8"},{"size":2199,"mtime":1610931750239,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"1hwnshv",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"21","usedDeprecatedRules":"16"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"26","usedDeprecatedRules":"16"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js",[],["29","30"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js",["31","32","33"],"import React, { useEffect, useState } from 'react';\r\nimport { Link, Redirect } from 'react-router-dom';\r\nimport ohuh from '../ohuh.PNG';\r\nimport { Container, Row, Form, Image, InputGroup, Button, Col, FormControl } from 'react-bootstrap';\r\n\r\nfunction App() {\r\n const [state, setState] = useState(false);\r\n const [search, setSearch] = useState(\"\");\r\n\r\n if (state !== false) {\r\n return <Redirect to={{\r\n pathname: `/search/${search}`,\r\n state: { id: search },\r\n }} />;\r\n }\r\n\r\n const handleChange = (e) => {\r\n setSearch(e.target.value);\r\n }\r\n\r\n const handleSubmit = () => {\r\n setState(true);\r\n }\r\n\r\n return (\r\n <Container className=\"vh-100 d-flex justify-content-md-center align-items-center\">\r\n <Col md={6} lassName=\" d-flex justify-content-center\">\r\n <Row style={{marginBottom:20}}>\r\n <Image src={ohuh} />\r\n </Row>\r\n <Row style={{marginBottom:500}}>\r\n <Form className=\"vw-100\" onSubmit={handleSubmit}>\r\n <InputGroup>\r\n <Form.Control\r\n size=\"lg\"\r\n placeholder=\"검색어를 입력하세요.\"\r\n aria-label=\"Large\"\r\n aria-describedby=\"inputGroup-sizing-sm\"\r\n onChange={handleChange}\r\n />\r\n <InputGroup.Append>\r\n <Button type='submit' variant=\"outline-secondary\">검색</Button>\r\n </InputGroup.Append>\r\n </InputGroup>\r\n </Form>\r\n </Row>\r\n </Col>\r\n </Container>\r\n );\r\n}\r\n\r\nexport default App;","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js",["34","35","36","37"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js",["38","39","40","41","42","43"],"import axios from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Modal, Container, Row, Col, Button, Badge, Card, Accordion, Carousel } from 'react-bootstrap';\r\n\r\nfunction Place(props) {\r\n const [reviews, setReviews] = useState([])\r\n const getReview = () => {\r\n axios.get(`/api/review/${props.search.name}`)\r\n .then(res => {\r\n console.log(\"place res.data\", res.data)\r\n setReviews(res.data)\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n getReview();\r\n }, [])\r\n\r\n\r\n return (\r\n <Modal {...props}\r\n size=\"xl\"\r\n keyboard=\"true\"\r\n variant=\"backdrop.in\"\r\n // show={lgShow}\r\n // onHide={() => setLgShow(false)}\r\n aria-labelledby=\"example-modal-sizes-title-lg\">\r\n <Modal.Header closeButton>\r\n <Modal.Title id=\"contained-modal-title-vcenter\" style={{ fontSize: '40px' }}>\r\n {props.index + 1}. {props.search.name}\r\n </Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body className=\"show-grid\">\r\n <Container style={{ fontSize: '40px' }}>\r\n {reviews.map((review, index) => {\r\n return (\r\n <Row className=\"mt-4\">\r\n <a href={review.link}>{review.title}</a>\r\n <div>{review.summary}</div>\r\n <div>{review.content}</div>\r\n </Row>\r\n )\r\n })}\r\n </Container>\r\n\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button block onClick={props.onHide}>Close</Button>\r\n </Modal.Footer>\r\n </Modal>\r\n );\r\n}\r\n\r\nexport default Place;\r\n","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js",[],{"ruleId":"44","replacedBy":"45"},{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","severity":1,"message":"49","line":1,"column":17,"nodeType":"50","messageId":"51","endLine":1,"endColumn":26},{"ruleId":"48","severity":1,"message":"52","line":2,"column":10,"nodeType":"50","messageId":"51","endLine":2,"endColumn":14},{"ruleId":"48","severity":1,"message":"53","line":4,"column":64,"nodeType":"50","messageId":"51","endLine":4,"endColumn":75},{"ruleId":"48","severity":1,"message":"54","line":5,"column":83,"nodeType":"50","messageId":"51","endLine":5,"endColumn":93},{"ruleId":"48","severity":1,"message":"55","line":15,"column":12,"nodeType":"50","messageId":"51","endLine":15,"endColumn":18},{"ruleId":"56","severity":1,"message":"57","line":51,"column":8,"nodeType":"58","endLine":51,"endColumn":10,"suggestions":"59"},{"ruleId":"60","severity":1,"message":"61","line":124,"column":35,"nodeType":"62","endLine":124,"endColumn":76},{"ruleId":"48","severity":1,"message":"63","line":3,"column":33,"nodeType":"50","messageId":"51","endLine":3,"endColumn":36},{"ruleId":"48","severity":1,"message":"64","line":3,"column":46,"nodeType":"50","messageId":"51","endLine":3,"endColumn":51},{"ruleId":"48","severity":1,"message":"65","line":3,"column":53,"nodeType":"50","messageId":"51","endLine":3,"endColumn":57},{"ruleId":"48","severity":1,"message":"66","line":3,"column":59,"nodeType":"50","messageId":"51","endLine":3,"endColumn":68},{"ruleId":"48","severity":1,"message":"67","line":3,"column":70,"nodeType":"50","messageId":"51","endLine":3,"endColumn":78},{"ruleId":"56","severity":1,"message":"68","line":20,"column":6,"nodeType":"58","endLine":20,"endColumn":8,"suggestions":"69"},"no-native-reassign",["70"],"no-negated-in-lhs",["71"],"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'Link' is defined but never used.","'FormControl' is defined but never used.","'Pagination' is defined but never used.","'mobile' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'getImg' and 'getPlace'. Either include them or remove the dependency array.","ArrayExpression",["72"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'Col' is defined but never used.","'Badge' is defined but never used.","'Card' is defined but never used.","'Accordion' is defined but never used.","'Carousel' is defined but never used.","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["73"],"no-global-assign","no-unsafe-negation",{"desc":"74","fix":"75"},{"desc":"76","fix":"77"},"Update the dependencies array to be: [getImg, getPlace]",{"range":"78","text":"79"},"Update the dependencies array to be: [getReview]",{"range":"80","text":"81"},[1683,1685],"[getImg, getPlace]",[560,562],"[getReview]"] [{"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js":"3","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js":"5","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js":"6"},{"size":1133,"mtime":1610956158273,"results":"7","hashOfConfig":"8"},{"size":375,"mtime":1610931750280,"results":"9","hashOfConfig":"8"},{"size":1553,"mtime":1610931750241,"results":"10","hashOfConfig":"8"},{"size":8936,"mtime":1611123129414,"results":"11","hashOfConfig":"8"},{"size":1608,"mtime":1611080275421,"results":"12","hashOfConfig":"8"},{"size":2199,"mtime":1610931750239,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"1hwnshv",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"21","usedDeprecatedRules":"16"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"26","usedDeprecatedRules":"16"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js",[],["29","30"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js",["31","32","33"],"import React, { useEffect, useState } from 'react';\r\nimport { Link, Redirect } from 'react-router-dom';\r\nimport ohuh from '../ohuh.PNG';\r\nimport { Container, Row, Form, Image, InputGroup, Button, Col, FormControl } from 'react-bootstrap';\r\n\r\nfunction App() {\r\n const [state, setState] = useState(false);\r\n const [search, setSearch] = useState(\"\");\r\n\r\n if (state !== false) {\r\n return <Redirect to={{\r\n pathname: `/search/${search}`,\r\n state: { id: search },\r\n }} />;\r\n }\r\n\r\n const handleChange = (e) => {\r\n setSearch(e.target.value);\r\n }\r\n\r\n const handleSubmit = () => {\r\n setState(true);\r\n }\r\n\r\n return (\r\n <Container className=\"vh-100 d-flex justify-content-md-center align-items-center\">\r\n <Col md={6} lassName=\" d-flex justify-content-center\">\r\n <Row style={{marginBottom:20}}>\r\n <Image src={ohuh} />\r\n </Row>\r\n <Row style={{marginBottom:500}}>\r\n <Form className=\"vw-100\" onSubmit={handleSubmit}>\r\n <InputGroup>\r\n <Form.Control\r\n size=\"lg\"\r\n placeholder=\"검색어를 입력하세요.\"\r\n aria-label=\"Large\"\r\n aria-describedby=\"inputGroup-sizing-sm\"\r\n onChange={handleChange}\r\n />\r\n <InputGroup.Append>\r\n <Button type='submit' variant=\"outline-secondary\">검색</Button>\r\n </InputGroup.Append>\r\n </InputGroup>\r\n </Form>\r\n </Row>\r\n </Col>\r\n </Container>\r\n );\r\n}\r\n\r\nexport default App;","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js",["34","35","36","37","38"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js",["39","40","41","42","43","44"],"import axios from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Modal, Container, Row, Col, Button, Badge, Card, Accordion, Carousel } from 'react-bootstrap';\r\n\r\nfunction Place(props) {\r\n const [reviews, setReviews] = useState([])\r\n const getReview = () => {\r\n axios.get(`/api/review/${props.search.name}`)\r\n .then(res => {\r\n console.log(\"place res.data\", res.data)\r\n setReviews(res.data)\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n getReview();\r\n }, [])\r\n\r\n\r\n return (\r\n <Modal {...props}\r\n size=\"xl\"\r\n keyboard=\"true\"\r\n variant=\"backdrop.in\"\r\n // show={lgShow}\r\n // onHide={() => setLgShow(false)}\r\n aria-labelledby=\"example-modal-sizes-title-lg\">\r\n <Modal.Header closeButton>\r\n <Modal.Title id=\"contained-modal-title-vcenter\" style={{ fontSize: '40px' }}>\r\n {props.index + 1}. {props.search.name}\r\n </Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body className=\"show-grid\">\r\n <Container style={{ fontSize: '40px' }}>\r\n {reviews.map((review, index) => {\r\n return (\r\n <Row className=\"mt-4\">\r\n <a href={review.link}>{review.title}</a>\r\n <div>{review.summary}</div>\r\n <div>{review.content}</div>\r\n </Row>\r\n )\r\n })}\r\n </Container>\r\n\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button block onClick={props.onHide}>Close</Button>\r\n </Modal.Footer>\r\n </Modal>\r\n );\r\n}\r\n\r\nexport default Place;\r\n","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js",[],{"ruleId":"45","replacedBy":"46"},{"ruleId":"47","replacedBy":"48"},{"ruleId":"49","severity":1,"message":"50","line":1,"column":17,"nodeType":"51","messageId":"52","endLine":1,"endColumn":26},{"ruleId":"49","severity":1,"message":"53","line":2,"column":10,"nodeType":"51","messageId":"52","endLine":2,"endColumn":14},{"ruleId":"49","severity":1,"message":"54","line":4,"column":64,"nodeType":"51","messageId":"52","endLine":4,"endColumn":75},{"ruleId":"49","severity":1,"message":"55","line":5,"column":83,"nodeType":"51","messageId":"52","endLine":5,"endColumn":93},{"ruleId":"49","severity":1,"message":"56","line":15,"column":12,"nodeType":"51","messageId":"52","endLine":15,"endColumn":18},{"ruleId":"57","severity":1,"message":"58","line":64,"column":8,"nodeType":"59","endLine":64,"endColumn":10,"suggestions":"60"},{"ruleId":"49","severity":1,"message":"61","line":71,"column":11,"nodeType":"51","messageId":"52","endLine":71,"endColumn":17},{"ruleId":"62","severity":1,"message":"63","line":137,"column":35,"nodeType":"64","endLine":137,"endColumn":76},{"ruleId":"49","severity":1,"message":"65","line":3,"column":33,"nodeType":"51","messageId":"52","endLine":3,"endColumn":36},{"ruleId":"49","severity":1,"message":"66","line":3,"column":46,"nodeType":"51","messageId":"52","endLine":3,"endColumn":51},{"ruleId":"49","severity":1,"message":"67","line":3,"column":53,"nodeType":"51","messageId":"52","endLine":3,"endColumn":57},{"ruleId":"49","severity":1,"message":"68","line":3,"column":59,"nodeType":"51","messageId":"52","endLine":3,"endColumn":68},{"ruleId":"49","severity":1,"message":"69","line":3,"column":70,"nodeType":"51","messageId":"52","endLine":3,"endColumn":78},{"ruleId":"57","severity":1,"message":"70","line":20,"column":6,"nodeType":"59","endLine":20,"endColumn":8,"suggestions":"71"},"no-native-reassign",["72"],"no-negated-in-lhs",["73"],"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'Link' is defined but never used.","'FormControl' is defined but never used.","'Pagination' is defined but never used.","'mobile' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'getAssociation', 'getImg', and 'getPlace'. Either include them or remove the dependency array.","ArrayExpression",["74"],"'places' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'Col' is defined but never used.","'Badge' is defined but never used.","'Card' is defined but never used.","'Accordion' is defined but never used.","'Carousel' is defined but never used.","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["75"],"no-global-assign","no-unsafe-negation",{"desc":"76","fix":"77"},{"desc":"78","fix":"79"},"Update the dependencies array to be: [getAssociation, getImg, getPlace]",{"range":"80","text":"81"},"Update the dependencies array to be: [getReview]",{"range":"82","text":"83"},[2097,2099],"[getAssociation, getImg, getPlace]",[560,562],"[getReview]"]
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,7 @@ function Search(props) { ...@@ -15,6 +15,7 @@ function Search(props) {
const [mobile, setMobile] = useState(); const [mobile, setMobile] = useState();
const [place, setPlace] = useState([{ name: "", category: "", address: "" }]) const [place, setPlace] = useState([{ name: "", category: "", address: "" }])
const [imgUrl, setImgUrl] = useState([]) const [imgUrl, setImgUrl] = useState([])
const [association, setAssociation] = useState([])
const getImg = () => { const getImg = () => {
axios.get(`/api/search/imges/${search}`) axios.get(`/api/search/imges/${search}`)
...@@ -23,7 +24,7 @@ function Search(props) { ...@@ -23,7 +24,7 @@ function Search(props) {
setImgUrl(res.data) setImgUrl(res.data)
}) })
.catch(err => { .catch(err => {
console.log('search.images발생', err) console.log('search.images 에러 발생', err)
}) })
} }
...@@ -34,7 +35,18 @@ function Search(props) { ...@@ -34,7 +35,18 @@ function Search(props) {
setPlace(res.data) setPlace(res.data)
}) })
.catch(err => { .catch(err => {
console.log('search.places발생', err) console.log('search.places 에러 발생', err)
})
}
const getAssociation =() => {
axios.get(`/api/search/association/${search}`)
.then(res => {
console.log("Associations = ", res.data)
setAssociation(res.data)
})
.catch(err => {
console.log("search.associations 에러 발생", err)
}) })
} }
...@@ -43,6 +55,7 @@ function Search(props) { ...@@ -43,6 +55,7 @@ function Search(props) {
useEffect(() => { useEffect(() => {
getPlace() getPlace()
getImg() getImg()
getAssociation()
if (window.innerWidth < 960) { if (window.innerWidth < 960) {
setMobile(true) setMobile(true)
} else { } else {
...@@ -106,7 +119,7 @@ function Search(props) { ...@@ -106,7 +119,7 @@ function Search(props) {
return page return page
} }
const pagePlace = paginate(places, index, 2) const pagePlace = paginate(association, index, association.length)
// function times (){ // function times (){
...@@ -137,10 +150,10 @@ function Search(props) { ...@@ -137,10 +150,10 @@ function Search(props) {
</InputGroup> </InputGroup>
</Form> </Form>
</Row> </Row>
{time.toString()}**** {/* {time.toString()}**** */}
{time.toLocaleString()}**** {time.toLocaleString()}****
{time.toLocaleDateString()}**** {/* {time.toLocaleDateString()}****
{time.toLocaleTimeString()}**** {time.toLocaleTimeString()}**** */}
<Col md={6} > <Col md={6} >
<Card align="center" border="info" style={{ margin: "3%" }}> <Card align="center" border="info" style={{ margin: "3%" }}>
<Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place[0].name}</Card.Title> <Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place[0].name}</Card.Title>
......
This diff is collapsed.
This diff is collapsed.
...@@ -17,6 +17,8 @@ const searchPlace = async (req, res) => { ...@@ -17,6 +17,8 @@ const searchPlace = async (req, res) => {
let places = {} let places = {}
$1('.ct_box_area').each(function (i) { $1('.ct_box_area').each(function (i) {
// console.log($1('.biz_name').text()) // console.log($1('.biz_name').text())
// console.log($1('.category').text()) // console.log($1('.category').text())
// console.log($1('.addr').text()) // console.log($1('.addr').text())
...@@ -49,24 +51,38 @@ const searchImg = async (req, res) => { ...@@ -49,24 +51,38 @@ const searchImg = async (req, res) => {
// images[i] = { imgUrl: $(this).find('img').atrr('src') } // images[i] = { imgUrl: $(this).find('img').atrr('src') }
// }) // })
// console.log('%%%%%%%%%%%%%%%%%%%%%%%%%%%', images) // console.log('%%%%%%%%%%%%%%%%%%%%%%%%%%%', images)
res.send(images)
// 여기서 있는건 찾아와서 추가를 시켜야한다. // 여기서 있는건 찾아와서 추가를 시켜야한다.
//사진만 업데이트 //사진만 업데이트
let Place = await Places.findOne({ name: req.params.search }) let Place = await Places.findOne({ name: req.params.search })
Place.times.push(new Date().toLocaleString()) Place.times.push(new Date().toLocaleString())
await Places.updateOne({ name: req.params.search }, { img: images, times : Place.times }) await Places.updateOne({ name: req.params.search }, { img: images, times: Place.times })
await Places.createIndex({address : "text", name : "text"})
console.log("************************************************", await Places.find({$text:{$search:"\"경남\""}}))
// console.log(await Places.find())
const newPlaces = await new Places( const newPlaces = await new Places(
).save() ).save()
res.send(images)
}) })
} }
const searchAssociation = async (req, res) => {
let Place = await Places.findOne({ name: req.params.search })
let address = Place.address.split(' ')[0]
// let AssociationsId = []
let addressPlaces = new RegExp(`${address}`)
let responsePlaces = await Places.find({ address: addressPlaces })
res.send(responsePlaces)
// responsePlaces.map(Association => {
// AssociationsId.push(Association._id)
// })
// console.log("Associations = ", Associations)
// res.send(AssociationsId)
}
export default { searchImg, searchPlace } export default { searchImg, searchPlace, searchAssociation }
...@@ -9,5 +9,7 @@ router.route('/api/search/imges/:search') ...@@ -9,5 +9,7 @@ router.route('/api/search/imges/:search')
router.route('/api/search/places/:search') router.route('/api/search/places/:search')
.get(place.searchPlace) .get(place.searchPlace)
router.route('/api/search/association/:search')
.get(place.searchAssociation)
export default router export default router
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment