A brief description of api endpoints of the admin panel
Auth middleware and image upload will be added after writing all the endpoints
To run this project, you will need to add the following environment variables to your .env file
MONGODB_URI
To test this project, run
npm run start:dev
GET /events
GET /events/${id}
Parameter | Type | Description | Validation |
---|---|---|---|
id |
string |
required | valid mongodb _id |
POST /events/new
Body Parameter | Type | Description | Validation |
---|---|---|---|
title |
string |
required | ascii only, minLength: 5, maxLength: 100 |
description |
string |
required | ascii only, minLength: 10, maxLength: 1000 |
eventDate |
date |
required | date must be in ISO 8601 format |
poster |
url |
Optional | image url |
images |
array |
Optional | array of urls |
winners |
[Schema:Student] |
Optional | array of objs contains winner details |
PUT /events/${eventId}
same body ref for creating a new event.
DELETE /events/${eventId}
Parameter | Type | Description | Validation |
---|---|---|---|
id |
string |
required | valid mongodb _id |
GET /students
Query Parameter | Type | Description | Validation |
---|---|---|---|
page |
number |
Optional | default value is 1 |
GET /students/${registrationNumber}
Parameter | Type | Description | Validation |
---|---|---|---|
registrationNumber |
alphanumeric |
required | valid registration number |
POST /students/add
Body Parameter | Type | Description | Validation |
---|---|---|---|
name |
string |
required | alphabetic, minLength: 3, maxLength: 30 |
registrationNumber |
string |
required | alphanumeric, minLength: 6, maxLength: 9 |
password |
string |
required | minLength: 6, maxLength: 30 |
PUT /students/${registrationNumber}
Body Parameter | Type | Description | Validation |
---|---|---|---|
name |
string |
required | same validation |
password |
string |
Optional | same validation |
DELETE /students/${registrationNumber}
Parameter | Type | Description | Validation |
---|---|---|---|
registrationNumber |
string |
required. | valid registration number |
To run tests, run the following command
Note: Test functions have not been added yet!
npm run test