Commit 97681a93 authored by rlacko's avatar rlacko 💬
Browse files

Activity documentation

parent 6dd5fd35
Pipeline #4723 passed with stages
in 2 minutes and 5 seconds
openapi: '3.0.2'
info:
title: Activity Endpoint
title: 'Activity Endpoint'
version: '1.0'
components:
schemas:
Activity:
type: object
properties:
property:
type: integer
paths:
/activity:
get:
tags:
- 'Activity'
summary: 'Get a List of comments'
description: 'Have to be logged in for this.'
operationId: 'getAllActivity'
responses:
'200':
description: OK
content:
application/json:
schema:
type: 'array'
items:
$ref: '#/components/schemas/Activity'
post:
tags:
- 'Activity'
summary: 'Create a activity'
description: 'Only mentors can create activity.'
operationId: 'createActivity'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
/activity/{id}:
get:
tags:
- 'Activity'
summary: 'Get a activity by ID'
description: 'Have to be logged in for this.'
operationId: 'getActivity'
responses:
'400':
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
put:
tags:
- 'Activity'
summary: 'Update an activity by ID'
description: 'Only mentors can update an activity.'
operationId: 'updateOneActivity'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
delete:
tags:
- 'Activity'
summary: 'Delete an activity by ID'
description: 'Only mentors can delete an activity.'
operationId: 'deleteActivity'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Activity'
components:
schemas:
Activity:
type: object
properties:
title:
type: string
description:
type: string
date:
type: string
format: date-time
type:
type: string
enum:
- class
- optional
- camp
attendance:
type: array
items:
type: string
description: cuid of each attendance
comment:
type: array
items:
type: string
description: cuid of each comment
required:
- title
- description
- date
- type
......@@ -29,7 +29,6 @@ const ActivitySchema = new mongoose.Schema(
{
type: mongoose.Schema.Types.ObjectId,
ref: 'comment',
required: true,
},
],
},
......
......@@ -4,13 +4,13 @@ const { isLoggedIn, isMentor } = require('../../middlewares/auth')
const router = Router()
// /api/item
// /api/v1/activity
router
.route('/')
.get(isLoggedIn, controllers.getMany)
.post(isLoggedIn, isMentor, controllers.createOne)
// /api/item/:id
// /api/v1/activity/:id
router
.route('/:id')
.get(isLoggedIn, controllers.getOne)
......
Supports Markdown
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