This commit is contained in:
parent
6f7069fdcb
commit
9aebd12d16
|
@ -99,18 +99,21 @@ climbingGymRouter.get('/', async (req: Request, res: Response) => {
|
||||||
* description: The name of the gym
|
* description: The name of the gym
|
||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
|
* example: DAV Kletterhalle
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: city
|
* name: city
|
||||||
* required: true
|
* required: true
|
||||||
* description: The city where the gym is in
|
* description: The city where the gym is in
|
||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
|
* example: Karlsruhe
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: h-captcha-response
|
* name: h-captcha-response
|
||||||
* required: true
|
* required: true
|
||||||
* description: The hCaptcha response key
|
* description: The hCaptcha response key
|
||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
|
* example: P0_ey[...]bVu
|
||||||
*/
|
*/
|
||||||
climbingGymRouter.post('/', async (req: Request, res: Response) => {
|
climbingGymRouter.post('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -13,6 +13,47 @@ import {verifyCaptcha} from '../common/VerifyCaptcha';
|
||||||
*/
|
*/
|
||||||
export const climbingRoutesRouter = express.Router();
|
export const climbingRoutesRouter = express.Router();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/routes:
|
||||||
|
* get:
|
||||||
|
* summary: Retrieve all known climbing routes
|
||||||
|
* description: Returns all climbing routes in a JSON list
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* route_id:
|
||||||
|
* type: string
|
||||||
|
* description: The route id
|
||||||
|
* example: duck-score-guide
|
||||||
|
* gym_id:
|
||||||
|
* type: integer
|
||||||
|
* description: The id of the gym that the route belongs to
|
||||||
|
* example: 1
|
||||||
|
* name:
|
||||||
|
* type: string
|
||||||
|
* description: The route name
|
||||||
|
* example: Mary Poppins
|
||||||
|
* difficulty:
|
||||||
|
* type: string
|
||||||
|
* description: The difficulty of the route
|
||||||
|
* example: 'DE: 5, FR: 5c'
|
||||||
|
* route_setting_date:
|
||||||
|
* type: datetime
|
||||||
|
* description: The route setting date
|
||||||
|
* example: 2022-01-07T23:00:00.000Z
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
*/
|
||||||
climbingRoutesRouter.get('/', async (req: Request, res: Response) => {
|
climbingRoutesRouter.get('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const routes: ClimbingRoute[] = await RouteService.findAll();
|
const routes: ClimbingRoute[] = await RouteService.findAll();
|
||||||
|
@ -29,6 +70,55 @@ climbingRoutesRouter.get('/', async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/routes/{id}:
|
||||||
|
* get:
|
||||||
|
* summary: Retrieve the route with the given id
|
||||||
|
* description: Returns the climbing route with the given id if it exists
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* route_id:
|
||||||
|
* type: string
|
||||||
|
* description: The route id
|
||||||
|
* example: duck-score-guide
|
||||||
|
* gym_id:
|
||||||
|
* type: integer
|
||||||
|
* description: The id of the gym that the route belongs to
|
||||||
|
* example: 1
|
||||||
|
* name:
|
||||||
|
* type: string
|
||||||
|
* description: The route name
|
||||||
|
* example: Mary Poppins
|
||||||
|
* difficulty:
|
||||||
|
* type: string
|
||||||
|
* description: The difficulty of the route
|
||||||
|
* example: 'DE: 5, FR: 5c'
|
||||||
|
* route_setting_date:
|
||||||
|
* type: datetime
|
||||||
|
* description: The route setting date
|
||||||
|
* example: 2022-01-07T23:00:00.000Z
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* required: true
|
||||||
|
* description: The id of the route
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: duck-score-guide
|
||||||
|
*/
|
||||||
climbingRoutesRouter.get('/:id', async (req: Request, res: Response) => {
|
climbingRoutesRouter.get('/:id', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let route_id = req.params.id;
|
let route_id = req.params.id;
|
||||||
|
@ -47,6 +137,62 @@ climbingRoutesRouter.get('/:id', async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/routes:
|
||||||
|
* post:
|
||||||
|
* summary: Create a new climbing route
|
||||||
|
* description: Creates a new climbing route and returns the id of the created route
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 201:
|
||||||
|
* description: Created
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* route_id:
|
||||||
|
* type: string
|
||||||
|
* description: The route id
|
||||||
|
* example: duck-score-guide
|
||||||
|
* 400:
|
||||||
|
* description: Wrong parameters, see response body for detailed information
|
||||||
|
* 403:
|
||||||
|
* description: Invalid captcha, please try again.
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: gym_id
|
||||||
|
* required: true
|
||||||
|
* description: The gym id of the gym that the route belongs to
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* example: 1
|
||||||
|
* - in: query
|
||||||
|
* name: name
|
||||||
|
* required: true
|
||||||
|
* description: The name of the route
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: Mary Poppins
|
||||||
|
* - in: query
|
||||||
|
* name: difficulty
|
||||||
|
* required: true
|
||||||
|
* description: The difficulty of the route
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: 'DE: 5, FR: 5c'
|
||||||
|
* - in: query
|
||||||
|
* name: h-captcha-response
|
||||||
|
* required: true
|
||||||
|
* description: The hCaptcha response key
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: P0_ey[...]bVu
|
||||||
|
*/
|
||||||
climbingRoutesRouter.post('/', async (req: Request, res: Response) => {
|
climbingRoutesRouter.post('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let gym_id = Number(req.query.gym_id);
|
let gym_id = Number(req.query.gym_id);
|
||||||
|
|
|
@ -7,6 +7,51 @@ import {verifyCaptcha} from '../common/VerifyCaptcha';
|
||||||
|
|
||||||
export const routeCommentsRouter = express.Router();
|
export const routeCommentsRouter = express.Router();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/comments/by/route/{id}:
|
||||||
|
* get:
|
||||||
|
* summary: Retrieve the comments for the given route
|
||||||
|
* description: Returns all comments for the route with the specified id
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* comment_id:
|
||||||
|
* type: integer
|
||||||
|
* description: The comment id
|
||||||
|
* example: 2
|
||||||
|
* route_id:
|
||||||
|
* type: string
|
||||||
|
* description: The id of the route that the comment belongs to
|
||||||
|
* example: duck-score-guide
|
||||||
|
* comment:
|
||||||
|
* type: string
|
||||||
|
* description: The comment text
|
||||||
|
* example: Nice route! Was a lot of fun!
|
||||||
|
* timestamp:
|
||||||
|
* type: datetime
|
||||||
|
* description: The time when the comment was sent
|
||||||
|
* example: 2022-01-08T21:43:31.000Z
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* required: true
|
||||||
|
* description: The id of the route
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: duck-score-guide
|
||||||
|
*/
|
||||||
routeCommentsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
routeCommentsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let route_id = req.params.id;
|
let route_id = req.params.id;
|
||||||
|
@ -25,6 +70,55 @@ routeCommentsRouter.get('/by/route/:id', async (req: Request, res: Response) =>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/comments:
|
||||||
|
* post:
|
||||||
|
* summary: Create a new comment
|
||||||
|
* description: Creates a new comment and returns the id of the created comment
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 201:
|
||||||
|
* description: Created
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* comment_id:
|
||||||
|
* type: integer
|
||||||
|
* description: The comment id
|
||||||
|
* example: 1
|
||||||
|
* 400:
|
||||||
|
* description: Wrong parameters, see response body for detailed information
|
||||||
|
* 403:
|
||||||
|
* description: Invalid captcha, please try again.
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: route_id
|
||||||
|
* required: true
|
||||||
|
* description: The id of the route to create the comment for
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: duck-score-guide
|
||||||
|
* - in: query
|
||||||
|
* name: comment
|
||||||
|
* required: true
|
||||||
|
* description: The comment text
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: Nice route! Was a lot of fun!
|
||||||
|
* - in: query
|
||||||
|
* name: h-captcha-response
|
||||||
|
* required: true
|
||||||
|
* description: The hCaptcha response key
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: P0_ey[...]bVu
|
||||||
|
*/
|
||||||
routeCommentsRouter.post('/', async (req: Request, res: Response) => {
|
routeCommentsRouter.post('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let route_id = req.query.route_id as string;
|
let route_id = req.query.route_id as string;
|
||||||
|
|
|
@ -6,6 +6,37 @@ import {verifyCaptcha} from '../common/VerifyCaptcha';
|
||||||
|
|
||||||
export const routeRatingsRouter = express.Router();
|
export const routeRatingsRouter = express.Router();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/ratings/by/route/{id}:
|
||||||
|
* get:
|
||||||
|
* summary: Retrieve the rating for the given route
|
||||||
|
* description: Returns the medium amount of stars that the route got
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Success
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* rating:
|
||||||
|
* type: float
|
||||||
|
* description: The median amount of stars
|
||||||
|
* example: 4.5
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: id
|
||||||
|
* required: true
|
||||||
|
* description: The id of the route
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: duck-score-guide
|
||||||
|
*/
|
||||||
routeRatingsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
routeRatingsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let route_id = req.params.id;
|
let route_id = req.params.id;
|
||||||
|
@ -24,6 +55,55 @@ routeRatingsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /crr/ratings:
|
||||||
|
* post:
|
||||||
|
* summary: Create a new rating
|
||||||
|
* description: Creates a new rating and returns the id of the created rating
|
||||||
|
* tags:
|
||||||
|
* - climbing-route-rating
|
||||||
|
* responses:
|
||||||
|
* 201:
|
||||||
|
* description: Created
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* rating_id:
|
||||||
|
* type: integer
|
||||||
|
* description: The rating id
|
||||||
|
* example: 1
|
||||||
|
* 400:
|
||||||
|
* description: Wrong parameters, see response body for detailed information
|
||||||
|
* 403:
|
||||||
|
* description: Invalid captcha, please try again.
|
||||||
|
* 500:
|
||||||
|
* description: A server error occurred. Please try again. If this issue persists, contact the admin.
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: route_id
|
||||||
|
* required: true
|
||||||
|
* description: The id of the route to create the rating for
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: duck-score-guide
|
||||||
|
* - in: query
|
||||||
|
* name: stars
|
||||||
|
* required: true
|
||||||
|
* description: The amount of stars to give
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* example: 4
|
||||||
|
* - in: query
|
||||||
|
* name: h-captcha-response
|
||||||
|
* required: true
|
||||||
|
* description: The hCaptcha response key
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: P0_ey[...]bVu
|
||||||
|
*/
|
||||||
routeRatingsRouter.post('/', async (req: Request, res: Response) => {
|
routeRatingsRouter.post('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
let route_id = req.query.route_id as string;
|
let route_id = req.query.route_id as string;
|
||||||
|
|
|
@ -34,30 +34,35 @@ export const raPlaMiddlewareRouter = express.Router();
|
||||||
* description: The user from RaPla, can be taken directly from the RaPla link
|
* description: The user from RaPla, can be taken directly from the RaPla link
|
||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
|
* example: mueller
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: file
|
* name: file
|
||||||
* required: true
|
* required: true
|
||||||
* description: The file from RaPla, can be taken directly from the RaPla link
|
* description: The file from RaPla, can be taken directly from the RaPla link
|
||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
|
* example: TINF19B4
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: blockers
|
* name: blockers
|
||||||
* required: false
|
* required: false
|
||||||
* description: Whether to remove blockers from the .ics file
|
* description: Whether to remove blockers from the .ics file
|
||||||
* schema:
|
* schema:
|
||||||
* type: boolean [0,1]
|
* type: boolean
|
||||||
|
* example: 1
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: wahl
|
* name: wahl
|
||||||
* required: false
|
* required: false
|
||||||
* description: The chosen elective module which is not to be filtered out
|
* description: The chosen elective module which is not to be filtered out
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
|
* example: 0
|
||||||
* - in: query
|
* - in: query
|
||||||
* name: pflicht
|
* name: pflicht
|
||||||
* required: false
|
* required: false
|
||||||
* description: The chosen profile module which is not to be filtered out
|
* description: The chosen profile module which is not to be filtered out
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
|
* example: 2
|
||||||
*/
|
*/
|
||||||
raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => {
|
raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user