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