Changed place and country docs so query parameters work
This commit is contained in:
parent
3cccdab368
commit
4fa241ad60
@ -17,18 +17,13 @@ const sqlSanitzer = require("../util/sqlstring_sanitizer.js")
|
||||
module.exports = dbConn => {
|
||||
/**
|
||||
* @swagger
|
||||
* path:
|
||||
* /countries:
|
||||
* get:
|
||||
* summary: Get all countries
|
||||
* tags: [Countries]
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns all countries and aviable data
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: ''
|
||||
* /countries:
|
||||
* get:
|
||||
* summary: Get all countries
|
||||
* tags: [Countries]
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns aviable data for all countries
|
||||
*/
|
||||
router.get("/api/v1/countries", async (req, res) => {
|
||||
res.json(await getCountries(dbConn));
|
||||
@ -36,18 +31,18 @@ module.exports = dbConn => {
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* path:
|
||||
* /countries/:id:
|
||||
* get:
|
||||
* summary: Get a specific country by ID
|
||||
* tags: [Countries]
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns the selected country and aviable data
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: ''
|
||||
* /countries/{id}:
|
||||
* get:
|
||||
* summary: Get a specific country by id
|
||||
* tags: [Countries]
|
||||
* parameters:
|
||||
* - name: "id"
|
||||
* in: "path"
|
||||
* required: true
|
||||
* type: int
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns aviable data for the country
|
||||
*/
|
||||
router.get("/api/v1/countries/:id", async (req, res) => {
|
||||
const id = sqlSanitzer(req.params.id);
|
||||
|
||||
@ -18,18 +18,19 @@ const sqlSanitzer = require("../util/sqlstring_sanitizer.js")
|
||||
module.exports = dbConn => {
|
||||
/**
|
||||
* @swagger
|
||||
* path:
|
||||
* /place:
|
||||
* get:
|
||||
* summary: Get a specific place
|
||||
* tags: [Places]
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns a place from the google places API.
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: ''
|
||||
* /place:
|
||||
* get:
|
||||
* summary: Get a specific place
|
||||
* tags: [Places]
|
||||
* parameters:
|
||||
* - name: "q"
|
||||
* in: "query"
|
||||
* required: true
|
||||
* type: int
|
||||
* description: "Querystring, by which the place is searched"
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns a place from the google places API.
|
||||
*/
|
||||
router.get("/api/v1/place", async (req, res) => {
|
||||
const place = await getPlace(req.query.q)
|
||||
@ -38,18 +39,24 @@ module.exports = dbConn => {
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* path:
|
||||
* /place/nearby:
|
||||
* get:
|
||||
* summary: Get nearby places
|
||||
* tags: [Places]
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns nearby places from the google places API.
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: ''
|
||||
* /place/nearby:
|
||||
* get:
|
||||
* summary: Get nearby touristic places
|
||||
* tags: [Places]
|
||||
* parameters:
|
||||
* - name: "lat"
|
||||
* in: "query"
|
||||
* required: true
|
||||
* type: float
|
||||
* description: "Latitiude"
|
||||
* - name: "lng"
|
||||
* in: "query"
|
||||
* required: true
|
||||
* type: float
|
||||
* description: "Longitude"
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns nearby places from the google places API.
|
||||
*/
|
||||
router.get("/api/v1/place/nearby", async (req, res) => {
|
||||
const lat = req.query.lat
|
||||
@ -73,6 +80,22 @@ module.exports = dbConn => {
|
||||
* schema:
|
||||
* $ref: ''
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /place/photo:
|
||||
* get:
|
||||
* summary: Get a photo for a place
|
||||
* tags: [Places]
|
||||
* parameters:
|
||||
* - name: "photoref"
|
||||
* in: "query"
|
||||
* required: true
|
||||
* type: int
|
||||
* description: "Photo_Reference which is returned for a place by Google Places API"
|
||||
* responses:
|
||||
* "200":
|
||||
* description: Returns the matching photo for a photo_reference.
|
||||
*/
|
||||
router.get("/api/v1/place/photo", async (req, res) => {
|
||||
const photoref = req.query.photoref
|
||||
const photo = await getPlacePhoto(photoref)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user