Skip to content

devclub-iitd/IITDConnectServer

Repository files navigation

IITD Connect Server


Running The Server Locally On Your System

  1. Clone The Repo
  2. Run a local MongoDB server or use atlas mogodb service.
  1. For development Mode create a .env file root directory of the project and place the following in it. MONGODB_URI='localhost:27017/dbname'
    PORT=5000
    >
    OR
    > MONGODB_URI='YOUR_ATLAS_CLUSTER_NAME'
    PORT=5000

    REFER THE .env.sample FILE

  1. run npm i inside the project DIR, to install the npm packages.

MONGODB_URI=mongodb://localhost:27017/dbname?retryWrites=true&w=majority

PORT=5000

OR

MONGODB_URI=YOUR_ATLAS_CLUSTER_STRING

PORT=5000

  1. run npm i inside the project DIR, to install the npm packages.
  2. Run The Server In Development Mode using npm run watch-debug
  3. View at localhost:5000

API DOCUMENTATION


-To view POSTMAN documentation head over to IITD-Connect

The API endpoints has been categorized into folders .

  • User Based
  • Event Based
  • Club/Hostel/Body based
  • IITD News Related
  • Calendar Related

Setting Up

Before Making Any request one should signup and then login . The login request gives back a token which must be used in header before making other request.

  • Extract the token
  • Add it to header of your request , in Authorization field and make it as Bearer Token.
  • This must be done for every request

Structure of Admins


  • Admins can be made with supersuperAdmin as the highest status , and admin as lowest status.
  • Below represent the relationship

Administrative Powers for Admins


Given Below is a structure presently

SupersuperAdmin


Super Admin


]

Admin


Indices


Body/Clubs based

General Schema for Body


Attributes Hostel club&boards Hangout Places Attribute Type
name String
about String
caption String
events Array of event document
admins Array
superAdmin mongoose ID
imageUrl String
links Object of Type Link Schema
typeOfBody 0 1 2 value in range 0,1,2
members Array of objects type memberSchema
hangoutInfo object of type hangoutSchema

Hangout Schema


  1. hangoutInfo is a attribute in body Schema , which is itself an object and has the following Schema
  2. hangoutInfo is only used for the Hangout places , i.e typeOfBody:2
Attributes Type
contactNumber Number
webUrl String
gmapsUrl String

Links Schema


  1. links is a attribute in body Schema , which is itself an object and has the following Schema
  2. links is used for typeOfBody: 0,1
Attributes Type
fbUrl String
webUrl String
instaUrl String
linkedinUrl String

Members Schema


  1. members is a attribute in body Schema , which is itself an object and has the following Schema
  2. members is used for typeOfBody: 0,1
Attributes Type
name String
por String
imgUrl String
link object of type linksSchema

1. Add A Body

Add a Body/Club/Hostel

Provide the following fields inside body in JSON format/url-encoded

  • name
  • about
  • typeOfBody
    RULES :
  1. typeOfBody of body takes value in 0,1,2 . 0:Hostel , 1:Club/Bodies ,2:HangoutPlaces

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/body

Headers:

Key Value Description
Content-Type application/json

Body:

{"name":"FACC",
  "about":"Art is everything",
  "typeOfBody":"1"
}

More example Requests/Responses:

I. Example Request: Adding FACC club

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzU4Mzg0MGU1ZjE0MDBiMjAwNSIsImlhdCI6MTU3NjMzNDI3OSwiZXhwIjoxNTc2OTM5MDc5fQ.nMVL_FeUqj9-iCrz6jVOZZ1NkCWk3o9PSlcXONjcp6Y
Content-Type application/x-www-form-urlencoded
I. Example Response: Adding FACC club
{
    "message": "Body Created Successfully",
    "data": {
        "events": [],
        "admins": [],
        "_id": "60e54c6da75895171b914a75",
        "name": "FACC",
        "about": "Art is everything",
        "typeOfBody": 1,
        "members": [],
        "createdAt": "2021-07-07T06:40:45.911Z",
        "updatedAt": "2021-07-07T06:40:45.911Z",
        "__v": 0
    }
}

Status Code: 200


2. Add body Members

Add Body Members


  • Make a POST request at /api/addMember with body as {"bodyId":"body_id", "member":"{object of member Schema}" }
  • const memberSchema = new Schema({ name: { type: String, required: true, }, por: { type: String, required: true, }, imgUrl: { type: String, trim: true, }, link: linksSchema, });
  • webUrl: { type: String, trim: true, }, instaUrl: { type: String, trim: true, }, fbUrl: { type: String, trim: true, }, linkedinUrl: { type: String, trim: true, },

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/body/addMember

Headers:

Key Value Description
Content-Type application/json

Body:

{
    "bodyId": "5ef8c8ed49c8257d2d47c200",
    "member": {
        "name": "Jaskeerat",
        "por": "House Secretary",
        "imgUrl": "https://www.google.com/images",
        "link": {
            "webUrl": "https://www.jaskeerat.com/lablab",
            "instaUrl": "https://instagram/"
        }
    }
}

More example Requests/Responses:

I. Example Request: Add body Members

Headers:

Key Value Description
Content-Type application/json

Body:

{
    "bodyId": "5ef8c8ed49c8257d2d47c200",
    "member": {
        "name": "Jaskeerat",
        "por": "House Secretary",
        "imgUrl": "https://www.google.com/images",
        "link": {
            "webUrl": "https://www.jaskeerat.com/lablab",
            "instaUrl": "https://instagram/"
        }
    }
}
I. Example Response: Add body Members
{
    "message": "Sucess",
    "data": {
        "_id": "5efb1472f9e86c023adc5c87",
        "name": "Jaskeerat",
        "por": "House Secretary",
        "imgUrl": "https://www.google.com/images",
        "link": {
            "_id": "5efb1472f9e86c023adc5c88",
            "webUrl": "https://www.jaskeerat.com/lablab",
            "instaUrl": "https://instagram/"
        }
    }
}

Status Code: 200


3. Get Details of a Body(club/Hostel/Dept)

Details of Body

  • Provide the id of body , as a parameter , to get result for a body desciption.
  • GET at /api/body/body_id
  • require JWT token authentication

Endpoint:

Method: GET
Type:
URL: http://localhost:5000/api/body/600dc91a86476f0cfa84f129

More example Requests/Responses:

I. Example Request: Get Details of a Body(club/Hostel/Dept)
I. Example Response: Get Details of a Body(club/Hostel/Dept)
{
    "message": "Success",
    "data": {
        "events": [],
        "admins": [],
        "_id": "600dc91a86476f0cfa84f129",
        "name": "DevClub",
        "about": "Technical Club IITD",
        "typeOfBody": 1,
        "members": [],
        "createdAt": "2021-01-24T19:23:06.074Z",
        "updatedAt": "2021-01-24T19:38:45.712Z",
        "__v": 2,
        "superAdmin": "600dc40386476f0cfa84f127"
    }
}

Status Code: 200


II. Example Request: Get Details of a Body(club/Hostel/Dept)
II. Example Response: Get Details of a Body(club/Hostel/Dept)
{
    "message": "Success",
    "data": {
        "events": [],
        "admins": [],
        "_id": "5ef8c8ed49c8257d2d47c200",
        "name": "Satpura Hostel",
        "about": "We are Samurai,we are famous for or mess food",
        "typeOfBody": 0,
        "caption": "Samurai",
        "createdAt": "2020-06-28T16:44:29.243Z",
        "updatedAt": "2020-06-30T10:31:14.242Z",
        "__v": 2,
        "members": [
            {
                "_id": "5efb1472f9e86c023adc5c87",
                "name": "Jaskeerat",
                "por": "House Secretary",
                "imgUrl": "https://www.google.com/images",
                "link": {
                    "_id": "5efb1472f9e86c023adc5c88",
                    "webUrl": "https://www.jaskeerat.com/lablab",
                    "instaUrl": "https://instagram/"
                }
            }
        ],
        "superAdmin": "5ec2e5aad3e63d114d93359e"
    }
}

Status Code: 200


4. Get List of All Bodies

Get List of all bodies

  1. get request at /api/body/
  2. params accepted is q , which can take value in [0,1,2]
  3. 0: Hostel , 1: Clubs & bodies , 2 :HangoutPlaces
  4. to get all hostels make get request at /api/body/?q=0
  5. If no paramas are provided you get list of all the existing bodies

Endpoint:

Method: GET
Type:
URL: {{url}}/api/body/

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzU4Mzg0MGU1ZjE0MDBiMjAwNSIsImlhdCI6MTU3NjMzNDI3OSwiZXhwIjoxNTc2OTM5MDc5fQ.nMVL_FeUqj9-iCrz6jVOZZ1NkCWk3o9PSlcXONjcp6Y

Query params:

Key Value Description
q 1

More example Requests/Responses:

I. Example Request: Get List of All Clubs

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzU4Mzg0MGU1ZjE0MDBiMjAwNSIsImlhdCI6MTU3NjMzNDI3OSwiZXhwIjoxNTc2OTM5MDc5fQ.nMVL_FeUqj9-iCrz6jVOZZ1NkCWk3o9PSlcXONjcp6Y

Query:

Key Value Description
q 0
I. Example Response: Get List of All Clubs
{
    "message": "Success",
    "data": [
        {
            "body": {
                "events": [],
                "admins": [],
                "_id": "5ef8c8ed49c8257d2d47c200",
                "name": "Satpura Hostel",
                "about": "We are Samurai,we are famous for or mess food",
                "typeOfBody": 0,
                "caption": "Samurai",
                "createdAt": "2020-06-28T16:44:29.243Z",
                "updatedAt": "2020-06-28T16:44:29.243Z",
                "__v": 0,
                "members": []
            },
            "isSub": false
        }
    ]
}

Status Code: 200


II. Example Request: Get List of All Clubs

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzU4Mzg0MGU1ZjE0MDBiMjAwNSIsImlhdCI6MTU3NjMzNDI3OSwiZXhwIjoxNTc2OTM5MDc5fQ.nMVL_FeUqj9-iCrz6jVOZZ1NkCWk3o9PSlcXONjcp6Y
II. Example Response: Get List of All Clubs
{
    "message": "Success",
    "data": [
        {
            "body": {
                "events": [
                    "600ad185f14e27417c0d1dc2",
                    "600daa94f84256933cb2c71b",
                    "600eb184c9fef2c643b9b90f",
                    "601150619a2e671e33511e6b",
                    "6016ef5f455c7a5089cf46e3",
                    "60183277890525d312b6e569",
                    "6019346a67cbfaf580d2e8e6"
                ],
                "admins": [
                    "600e7f521e8db81ba8323c47"
                ],
                "_id": "600acceff14e27417c0d1dbd",
                "name": "Literary Club",
                "about": "We are here to organise events",
                "typeOfBody": 0,
                "members": [],
                "createdAt": "2021-01-22T13:02:39.527Z",
                "updatedAt": "2021-03-26T11:41:38.424Z",
                "__v": 19,
                "superAdmin": "600dc40386476f0cfa84f127"
            },
            "isSub": false
        },
        {
            "body": {
                "events": [],
                "admins": [],
                "_id": "600acd3cf14e27417c0d1dbe",
                "name": "dancing Club",
                "about": "We are here to organise events",
                "typeOfBody": 1,
                "members": [],
                "createdAt": "2021-01-22T13:03:56.391Z",
                "updatedAt": "2021-01-22T13:03:56.391Z",
                "__v": 0
            },
            "isSub": false
        },
        {
            "body": {
                "events": [],
                "admins": [],
                "_id": "600dc91a86476f0cfa84f129",
                "name": "DevClub",
                "about": "Technical Club IITD",
                "typeOfBody": 1,
                "members": [],
                "createdAt": "2021-01-24T19:23:06.074Z",
                "updatedAt": "2021-01-24T19:38:45.712Z",
                "__v": 2,
                "superAdmin": "600dc40386476f0cfa84f127"
            },
            "isSub": false
        }
    ]
}

Status Code: 200


5. Toggle Subscribe Option

Subscribe (Toggle Feature)

  • POST at /api/body/body_id/subscribe
  • require Jwt token to be included in the header

Endpoint:

Method: POST
Type:
URL: http://localhost:5000/api/body/5df4f4d43840e5f1400b2007/subscribe

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzM5Mzg0MGU1ZjE0MDBiMjAwMCIsImlhdCI6MTU3OTQzMTc4NCwiZXhwIjoxNTgwMDM2NTg0fQ.xuuRYS4N_5d5g3nC-lnDRe46B_c3QVzULFgI4DGTmPE

More example Requests/Responses:

I. Example Request: Example-subscribe

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzM5Mzg0MGU1ZjE0MDBiMjAwMCIsImlhdCI6MTU3OTQzMTc4NCwiZXhwIjoxNTgwMDM2NTg0fQ.xuuRYS4N_5d5g3nC-lnDRe46B_c3QVzULFgI4DGTmPE
I. Example Response: Example-subscribe
{
    "message": "Successfully Toggled Subscribe"
}

Status Code: 200


6. Update Body

Update Body

  1. Only superadmin of bodies are aloowed to update body info.

  2. Make a patch request at /api/body/:id

Endpoint:

Method: PATCH
Type: RAW
URL: {{url}}/api/body/5ec2e638d3e63d114d93359f

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"typeOfBody":1,
	"name":"Devclub"
}

More example Requests/Responses:

I. Example Request: Update Body

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"typeOfBody":1,
	"name":"Devclub"
}
I. Example Response: Update Body
{
    "message": "Sucess",
    "data": {
        "typeOfBody": 1,
        "name": "Devclub"
    }
}

Status Code: 200


Calendar-Api

Calendar Schema


The following attributes are allowed in a calendar schema

Attributes Type
createdBy mongoose.Types.ObjectId
name string
description string
startTime Date Object
endTime Date Object
venue string
color string
repeat string
eventId string
reminder string
participants Array of String
url string

About

This API contains endpoint to add a custom reminder and also fetch the calendar events between 2 dates

1. Delete reminder

Endpoint:

Method: DELETE
Type:
URL: {{url}}/api/calendar/reminder/5ec3e4a1986d1b1f233aa6eb

More example Requests/Responses:

I. Example Request: Delete reminder
I. Example Response: Delete reminder
{
    "message": "Reminder deleted Successfully",
    "data": {}
}

Status Code: 200


2. Get Reminders

Endpoint:

Method: GET
Type:
URL: {{url}}/api/calendar/reminder

More example Requests/Responses:

I. Example Request: Get Reminders
I. Example Response: Get Reminders
{
    "message": "Successful",
    "data": [
        {
            "_id": "5ec3e4a1986d1b1f233aa6eb",
            "title": "MTL 100 Quiz",
            "startTime": "2020-08-07T08:00:20.000Z",
            "endTime": "2020-08-07T10:00:20.000Z",
            "createdBy": "5ec2e5aad3e63d114d93359e",
            "__v": 0,
            "venue": "LHC 321"
        },
        {
            "_id": "5ef7b28e7685e71996cf7c23",
            "title": "CMP100 Lab Quiz",
            "startTime": "2020-06-07T08:00:20.000Z",
            "endTime": "2020-06-07T10:00:20.000Z",
            "color": "#ffffff",
            "description": "Let rock the CMP quiz",
            "venue": "LHC 101",
            "repeat": "never",
            "createdBy": "5ec2e5aad3e63d114d93359e",
            "__v": 0
        }
    ]
}

Status Code: 200


3. Get all reminders and Events

Get all Events , reminders and stared events

  • POST request at /api/calendar/all
  • Authorization token needed
  • request body should contain 2 keys 'startTime' and 'endTime' , value of both are date object of javascript in UTC time notation.
  • eg of request is { "startTime": "2020-08-07T08:00:00.000Z", "endTime":"2020-08-07T08:00:30.000Z"

}

  • The response contains all event , stared event and reminder between the two times provided
  • eg of response is { "message": "SuccesFull", "data": { "reminders": [ { "_id": "5ec3e4a1986d1b1f233aa6eb", "title": "MTL 100 Quiz", "startTime": "2020-08-07T08:00:20.000Z", "endTime": "2020-08-07T10:00:20.000Z", "createdBy": "5ec2e5aad3e63d114d93359e", "venue": "LHC 321" } ], "staredEvents": [ { "_id": "5ec6a078a3c1605a567ae3f7", "name": "Code Night", "startDate": "2020-08-07T08:00:20.000Z", "endDate": "2020-08-07T10:00:20.000Z", "topicName": "Code-Night-jhtn52" } ], "event": [ { "_id": "5ec6a078a3c1605a567ae3f7", "name": "Code Night", "startDate": "2020-08-07T08:00:20.000Z", "endDate": "2020-08-07T10:00:20.000Z", "topicName": "Code-Night-jhtn52" } ] } }

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/calendar/all

Headers:

Key Value Description
Content-Type application/json

Body:

{
  "startTime": "2020-08-07T08:00:00.000Z",
  "endTime":"2020-08-07T08:00:30.000Z"

}

More example Requests/Responses:

I. Example Request: Get all reminders and Events

Headers:

Key Value Description
Content-Type application/json

Body:

{
  "startTime": "2020-08-07T08:00:00.000Z",
  "endTime":"2020-08-07T08:00:30.000Z"

}
I. Example Response: Get all reminders and Events
{
    "message": "SuccesFull",
    "data": {
        "reminders": [
            {
                "_id": "5ec3e4a1986d1b1f233aa6eb",
                "title": "MTL 100 Quiz",
                "startTime": "2020-08-07T08:00:20.000Z",
                "endTime": "2020-08-07T10:00:20.000Z",
                "createdBy": "5ec2e5aad3e63d114d93359e",
                "venue": "LHC 321"
            },
            {
                "_id": "5ef7b28e7685e71996cf7c23",
                "title": "CMP100 Lab Quiz",
                "startTime": "2020-06-07T08:00:20.000Z",
                "endTime": "2020-06-07T10:00:20.000Z",
                "color": "#ffffff",
                "description": "Let rock the CMP quiz",
                "venue": "LHC 102",
                "repeat": "never",
                "createdBy": "5ec2e5aad3e63d114d93359e"
            }
        ],
        "staredEvents": [],
        "event": [
            {
                "_id": "5ecea450e97f9511dfe412ff",
                "name": "Code Night",
                "startDate": "2020-08-07T08:00:20.000Z",
                "endDate": "2020-08-07T10:00:20.000Z",
                "topicName": "Code-Night-46li58"
            },
            {
                "_id": "5ecea4b5e97f9511dfe41300",
                "name": "Drama 2020",
                "startDate": "2020-08-07T08:00:20.000Z",
                "endDate": "2020-08-07T10:00:20.000Z",
                "topicName": "Drama-2020-hv4f6c"
            }
        ]
    }
}

Status Code: 200


4. Set Reminder

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/calendar/reminder

Headers:

Key Value Description
Content-Type application/json

Body:

 {
 	"title":"CMP100 Lab Quiz",
 	"startTime": "2020-06-07T08:00:20.000Z",
  "endTime": "2020-06-07T10:00:20.000Z",
  "color":"#ffffff",
  "description":"Let rock the CMP quiz",
  "venue":"LHC 101",
  "repeat":"never",
  "reminder":"Here comes the reminder string"
  }

More example Requests/Responses:

I. Example Request: Set Reminder

Headers:

Key Value Description
Content-Type application/json

Body:

 {
 	"title":"CMP100 Lab Quiz",
 	"startTime": "2020-06-07T08:00:20.000Z",
  "endTime": "2020-06-07T10:00:20.000Z",
  "color":"#ffffff",
  "description":"Let rock the CMP quiz",
  "venue":"LHC 101",
  "repeat":"never",
  "reminder":"Here comes the reminder string"
  }
I. Example Response: Set Reminder
{
    "message": "Reminder Added Succesfully",
    "data": {
        "_id": "5ef7b28e7685e71996cf7c23",
        "title": "CMP100 Lab Quiz",
        "startTime": "2020-06-07T08:00:20.000Z",
        "endTime": "2020-06-07T10:00:20.000Z",
        "color": "#ffffff",
        "description": "Let rock the CMP quiz",
        "venue": "LHC 101",
        "repeat": "never",
        "createdBy": "5ec2e5aad3e63d114d93359e",
        "__v": 0
    }
}

Status Code: 200


5. Update Reminder

Endpoint:

Method: PATCH
Type: RAW
URL: {{url}}/api/calendar/reminder/5ec3e4a1986d1b1f233aa6eb

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"title":"MTL 100 Quiz",
	"venue":"LHC 321"
}

More example Requests/Responses:

I. Example Request: Update Reminder

Headers:

Key Value Description
Content-Type application/json

Body:

{

	"venue":"LHC 102"
}
I. Example Response: Update Reminder
{
    "message": "Update Successfull",
    "data": {
        "_id": "5ef7b28e7685e71996cf7c23",
        "venue": "LHC 101"
    }
}

Status Code: 200


Event Based

Events Schema


The below are available fields for the events Schema

Attributes Type
name string
createdBy mongoose.Types.ObjectId
about string
body mongoose.Types.ObjectId
startDate Date
endDate Date
participants mongoose.Types.ObjectId[]
venue string
imageLink string
updates mongoose.Types.ObjectId[]
topicName string
official_inti_event boolean
color string
eventId string

1. Add An Event

Endpoint:

Method: POST
Type: URLENCODED
URL: http://localhost:5000/api/events/

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
name Drama 2020
about For all IIt delhi students
venue Bharti Building
body 5ec2e638d3e63d114d93359f
startDate 2020-08-07T08:00:20.000Z
endDate 2020-08-07T10:00:20.000Z

2. Add An Update

Endpoint:

Method: POST
Type: URLENCODED
URL: http://localhost:5000/api/events/5df489e3c34a83df8ee27011/addUpdate

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
body Event Finally Cancelled
title Cancel Hi Kardiya

3. Delete Event

Endpoint:

Method: DELETE
Type:
URL: http://localhost:5000/api/events/5ec6a078a3c1605a567ae3f7

More example Requests/Responses:

I. Example Request: Delete Event

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjE3ODkxMCwiZXhwIjoxNTc2NzgzNzEwfQ.e66flrNcVRKG055KdTnjDcoMqCKMnq_K1rpHHsakZcc
I. Example Response: Delete Event
Event Was Successfully Removed

Status Code: 200


4. Delete Update

Endpoint:

Method: DELETE
Type: URLENCODED
URL: http://localhost:5000/api/events/5df21b3415f7de7ad2129449/removeUpdate

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
updateId 5df3dfdc9b67df11d9238c7d

5. Get Details About An Event

Endpoint:

Method: GET
Type:
URL: http://localhost:5000/api/events/5df50dbf54fad33b476f6a84

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzRkMzg0MGU1ZjE0MDBiMjAwNCIsImlhdCI6MTU3NzE2NTU3NCwiZXhwIjoxNTc3NzcwMzc0fQ.vMGWv0zYupmh10uwTJ6dzNYKt_9rcJd-uvDO5p-v_8o

More example Requests/Responses:

I. Example Request: Details of event in Devclub

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzRkMzg0MGU1ZjE0MDBiMjAwNCIsImlhdCI6MTU3NzE2NTU3NCwiZXhwIjoxNTc3NzcwMzc0fQ.vMGWv0zYupmh10uwTJ6dzNYKt_9rcJd-uvDO5p-v_8o
I. Example Response: Details of event in Devclub
{
    "event": {
        "id": "5df50dbf54fad33b476f6a84",
        "name": "Orientation",
        "about": "get educated in dark arts",
        "body": {
            "name": "DevClub",
            "about": "Software Development Club",
            "id": "5df4f4753840e5f1400b2006",
            "department": "CSE",
            "isSub": false
        },
        "startDate": "2019-12-24T10:58:00.000Z",
        "endDate": "2019-12-26T16:28:00.000Z",
        "stared": false,
        "image": "",
        "venue": "LH-316",
        "updates": [
            {
                "_id": "5e1620b8cc86eb200dd19ec6",
                "body": "Notification check",
                "title": "check one",
                "createdAt": "2020-01-08T18:34:32.510Z",
                "updatedAt": "2020-01-08T18:34:32.510Z",
                "__v": 0
            },
            {
                "_id": "5e1620bccc86eb200dd19ec7",
                "body": "Notification check",
                "title": "check one",
                "createdAt": "2020-01-08T18:34:36.822Z",
                "updatedAt": "2020-01-08T18:34:36.822Z",
                "__v": 0
            },
            {
                "_id": "5e1620c2cc86eb200dd19ec8",
                "body": "Notification check",
                "title": "check one",
                "createdAt": "2020-01-08T18:34:42.332Z",
                "updatedAt": "2020-01-08T18:34:42.332Z",
                "__v": 0
            },
            {
                "_id": "5e1c593be69cc08bc58c4520",
                "body": "Notification check",
                "title": "check two",
                "createdAt": "2020-01-13T11:49:15.175Z",
                "updatedAt": "2020-01-13T11:49:15.175Z",
                "__v": 0
            },
            {
                "_id": "5e1c5978e69cc08bc58c4521",
                "body": "Notification check",
                "title": "check three",
                "createdAt": "2020-01-13T11:50:16.892Z",
                "updatedAt": "2020-01-13T11:50:16.892Z",
                "__v": 0
            },
            {
                "_id": "5e1c6e7c16c6bc9935e7121b",
                "body": "Notification check",
                "title": "Brand New",
                "createdAt": "2020-01-13T13:19:56.298Z",
                "updatedAt": "2020-01-13T13:19:56.298Z",
                "__v": 0
            },
            {
                "_id": "5e1c6eba4e467199729b9dc1",
                "body": "Notification check",
                "title": "Brand New",
                "createdAt": "2020-01-13T13:20:58.048Z",
                "updatedAt": "2020-01-13T13:20:58.048Z",
                "__v": 0
            },
            {
                "_id": "5e1c6f2a4e467199729b9dc2",
                "body": "Notification check",
                "title": "Brand New",
                "createdAt": "2020-01-13T13:22:50.123Z",
                "updatedAt": "2020-01-13T13:22:50.123Z",
                "__v": 0
            },
            {
                "_id": "5e987965780bd9580b289ea7",
                "body": "Event Finally Cancelled",
                "title": "Cancel Hi Kardiya",
                "createdAt": "2020-04-16T15:27:33.835Z",
                "updatedAt": "2020-04-16T15:27:33.835Z",
                "__v": 0
            }
        ]
    }
}

Status Code: 200


6. Get List of All Events

Endpoint:

Method: GET
Type:
URL: http://localhost:5000/api/events/

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzRkMzg0MGU1ZjE0MDBiMjAwNCIsImlhdCI6MTU3NzE2NTU3NCwiZXhwIjoxNTc3NzcwMzc0fQ.vMGWv0zYupmh10uwTJ6dzNYKt_9rcJd-uvDO5p-v_8o

7. Update An Event

Endpoint:

Method: PUT
Type: URLENCODED
URL: http://localhost:5000/api/events/5df3e9d1412da31ca986d94f

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
venue No Fucking Venue
about YES GO GET THEM

News -api

News Schema


The following Attributes are allowed in the news Schema

Attributes Type
sourceName string
sourceUrl string
createdBy mongoose.Types.ObjectId
author string
title string
description string
imgUrl string
publDate Date
content string
clicks number
reports Array of objects of type reportSchema
visible boolean

ReportSchema


  1. reports is an attribute in the news Schema , which itself is an array of objects of type reportSchema
  2. The reportSchema is defined as following
Attributes Type
description String
reporter mongoose Id
date Date object

News Visibility


  • All reported news are reviewed by the admins. So before deleting the news , he can temporarily hide the news , so to review it later . If news found to be abusive , he can delete , else he can unhide it again.
  • Also when an api call to fetch news is made , only the news with {visible:true} are send from api

[])

1. Add News

Add News

  • POST at /api/news/:id
  • Include the news in json format in the body
  • Only admins can add a news

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/news

Body:

{
	"description":"Pay your fucking fees",
	"title":"Fees Deadline Till 8 FEB",
	"content":"Student are requested to pay their fees by 8 feb",
	"sourceName":"IITD administration",
	"author":"lolarmy"
}

More example Requests/Responses:

I. Example Request: Adding News example(provide authorization Token in header)

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"description":"Corona has spread all over the world",
	"title":"Fighting corona cannot be done much longer",
	"content":"IIT delhi has its third case of corona",
	"sourceName":"Zee-News",
	"author":"Ayush"
}
I. Example Response: Adding News example(provide authorization Token in header)
{
    "message": "News added Successfully",
    "data": {
        "clicks": 0,
        "_id": "5ec2e828d3e63d114d9335a3",
        "description": "Corona has spread all over the world",
        "content": "IIT delhi has its third case of corona",
        "sourceName": "Zee-News",
        "author": "Ayush",
        "createdBy": "5ec2e5aad3e63d114d93359e",
        "publDate": "2020-05-18T19:55:20.878Z",
        "reports": [],
        "createdAt": "2020-05-18T19:55:20.879Z",
        "updatedAt": "2020-05-18T19:55:20.879Z",
        "__v": 0
    }
}

Status Code: 200


2. Delete News

Delete News

  • delete request at /api/news/:id
  • id : news id
  • require admin status to delete the news

Endpoint:

Method: DELETE
Type:
URL: {{url}}/api/news/5ebfcf0b440fd226fab48ba6

3. Get Specific News Details

Get News Details

  • Get at /api/news/:id

Endpoint:

Method: GET
Type:
URL: {{url}}/api/news/600ee5e64ca82023bf3790fa

More example Requests/Responses:

I. Example Request: Get Specific News Details
I. Example Response: Get Specific News Details
{
    "clicks": 3,
    "_id": "5ec2e809d3e63d114d9335a2",
    "description": "Corona has spread all over the world",
    "content": "IIT delhi has its second case of corona",
    "sourceName": "Aaj-tak",
    "author": "Aranya",
    "createdBy": "5ec2e5aad3e63d114d93359e",
    "publDate": "2020-05-18T19:54:49.619Z",
    "reports": [],
    "createdAt": "2020-05-18T19:54:49.620Z",
    "updatedAt": "2020-05-18T20:29:50.852Z",
    "__v": 0
}

Status Code: 200


4. Get Trend News

  • To get the trending news make a get request at /api/news/trend
  • It also support the limit quesry i.e /api/news/?trend=10 , will fetch top 10 trending news .

Endpoint:

Method: GET
Type:
URL: {{url}}/api/news/trend/

Query params:

Key Value Description
limit 10

5. Get all News

Get all News

  • Get request at /api/news/
  • Following query string are supported -- 1.limit=[arg] : will display [arg] number of documents -- 2.skip=[arg] : will skip the [arg] number of documents -- 3.sortBy=[fieldname]:[desc|asc] -- By default sorting take place in ascending order

Examples of Get request

  • 1.Get the trending news -- GET /api/news/?sortBy=clicks:desc
  • 2.Get last 15 Recent news -- GET /api/news/?limit=15&sortBy=createdAt:desc

  • 3.Pagination : Suppose you can show only 10 news in a page , to load news for second page do -- Get api/news/?limit=10&skip=10

Endpoint:

Method: GET
Type:
URL: {{url}}/api/news/

More example Requests/Responses:

I. Example Request: Get Trending News

Query:

Key Value Description
sortBy clicks:desc
I. Example Response: Get Trending News
[
  {
    clicks: 5,
    _id: '5ec2e7d9d3e63d114d9335a1',
    description: 'Corona has spread all over the world',
    sourceName: 'ABP',
    author: 'Jaskeerat',
    createdAt: '2020-05-18T19:54:01.633Z',
  },
  {
    clicks: 3,
    _id: '5ec2e809d3e63d114d9335a2',
    description: 'Corona has spread all over the world',
    sourceName: 'Aaj-tak',
    author: 'Aranya',
    createdAt: '2020-05-18T19:54:49.620Z',
  },
  {
    clicks: 0,
    _id: '5ec2e828d3e63d114d9335a3',
    description: 'Corona has spread all over the world',
    sourceName: 'Zee-News',
    author: 'Ayush',
    createdAt: '2020-05-18T19:55:20.879Z',
  },
];

Status Code: 200


II. Example Request: Get Recent News

Query:

Key Value Description
sortBy createdAt:desc
II. Example Response: Get Recent News
[
  {
    clicks: 0,
    _id: '5ec2e828d3e63d114d9335a3',
    description: 'Corona has spread all over the world',
    sourceName: 'Zee-News',
    author: 'Ayush',
    createdAt: '2020-05-18T19:55:20.879Z',
  },
  {
    clicks: 0,
    _id: '5ec2e809d3e63d114d9335a2',
    description: 'Corona has spread all over the world',
    sourceName: 'Aaj-tak',
    author: 'Aranya',
    createdAt: '2020-05-18T19:54:49.620Z',
  },
  {
    clicks: 0,
    _id: '5ec2e7d9d3e63d114d9335a1',
    description: 'Corona has spread all over the world',
    sourceName: 'ABP',
    author: 'Jaskeerat',
    createdAt: '2020-05-18T19:54:01.633Z',
  },
];

Status Code: 200


6. Get reported News

Get Reported

  • only admin can see all the reported news
  • this api endpoint gives all reported news
  • Make get request at /api/news/report/all

Endpoint:

Method: GET
Type:
URL: {{url}}/api/news/report/all

More example Requests/Responses:

I. Example Request: Get reported News
I. Example Response: Get reported News
{
    "message": "Reported News",
    "data": [
        {
            "clicks": 0,
            "visible": true,
            "_id": "5ec2e828d3e63d114d9335a3",
            "description": "Corona has spread all over the world",
            "content": "IIT delhi has its third case of corona",
            "sourceName": "Zee-News",
            "author": "Ayush",
            "createdBy": "5ec2e5aad3e63d114d93359e",
            "publDate": "2020-05-18T19:55:20.878Z",
            "reports": [
                {
                    "date": "2020-06-28T00:37:13.529Z",
                    "_id": "5ef7e6392a6e233cafc07b4c",
                    "description": "The above news is Fake",
                    "reporter": "5ec2e5aad3e63d114d93359e"
                }
            ],
            "createdAt": "2020-05-18T19:55:20.879Z",
            "updatedAt": "2020-06-28T00:37:13.543Z",
            "__v": 1
        }
    ]
}

Status Code: 200


7. Report News

Report News

  • Post request at /api/news/report/:id

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/api/news/report/5ec2e828d3e63d114d9335a3

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"description":"The above news is Fake"
}

More example Requests/Responses:

I. Example Request: Report News

Headers:

Key Value Description
Content-Type application/json

Body:

{
	"description":"The above news is Fake"
}
I. Example Response: Report News
{
    "message": "Report issued successfully",
    "data": {
        "description": "The above news is Fake",
        "reporter": "5ec2e5aad3e63d114d93359e"
    }
}

Status Code: 200


8. Update news

Update news

  • Patch at /api/news/:id
  • id:news id
  • only admin are allowed to update the news
  • allowed fields : ['sourceName','sourceUrl','title','author','description','imgUrl','content'];

Endpoint:

Method: PATCH
Type: RAW
URL: {{url}}/api/news/5ec2e828d3e63d114d9335a3

Headers:

Key Value Description
Content-Type application/json

Body:

{
"visible":"false"

}

9. report news : Toggle visibility

Toggle Visibility of news

  • A news can be made unvisible by admins , if they cause reports.
  • so admin can hide news without deleting it for a while
  • this can be done by this api endpoint
  • Only admins can do ,
  • Make get request at /api/news/report/toggle/:_id

Endpoint:

Method: GET
Type:
URL: {{url}}/api/news/report/toggle/5ec2e828d3e63d114d9335a3

More example Requests/Responses:

I. Example Request: report news : Toggle visibility
I. Example Response: report news : Toggle visibility
{
    "message": "succefull",
    "data": {
        "visibleStatus": false
    }
}

Status Code: 200


TestEndpoints

This contains List of Testing Enpoints for the development purpose

1. Make me SuperSuperAmin

Make me superSuperAdmin

  • superSuperAdmin is a status
  • Only supersuperadmin can make a user superAdmin for a Body
  • then the superadmin can make admins for his body
  • supersuperadmin: Director
  • superadmin: HOD
  • admin : Proff

Endpoint:

Method: GET
Type:
URL: {{url}}/api/testEndpoint/makeMeSuperSuperAdmin

More example Requests/Responses:

I. Example Request: Make me SuperSuperAmin
I. Example Response: Make me SuperSuperAmin
{
    "message": "SuperSuperadmin made Succesfully",
    "data": {
        "superAdminStatus": true
    }
}

Status Code: 200


User Based

User Schema


The following are the attributes available for User Schema

Attributes Type
name string
password string
privilege string
subscribedBodies mongoose.Types.ObjectId[]
canCreate boolean
createdEvents mongoose.Types.ObjectId[]
staredEvents mongoose.Types.ObjectId[]
iitdEmail string
emailValidated boolean
facebookID string
googleID string
entryNumber string
department string
fcmRegistrationToken string
adminOf mongoose.Types.ObjectId[]
email string
superSuperAdmin boolean
superAdminOf mongoose.Types.ObjectId[]

1. Add An Admin

Adding an Admin


  1. Admins can only be added by a superadmin of the club
  2. There can be many admins to a club
  3. To make a admin : a superadmin must make a POST request at /api/users/addAdmin and in body provide the {clubid, userEmail}, userEmail is mail of user you want to make admin

Endpoint:

Method: POST
Type: URLENCODED
URL: http://localhost:5000/api/users/addAdmin

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 600dc91a86476f0cfa84f129
userEmail [email protected]

More example Requests/Responses:

I. Example Request: Add An Admin

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6
userEmail [email protected]
I. Example Response: Add An Admin
{
    "message": "Admin Added Succesfully",
    "data": {
        "bodyId": "5ec6a039a3c1605a567ae3f6",
        "userId": "5ef867f538c52658f4d2d905"
    }
}

Status Code: 200


2. Add SuperAdmin

Add SuperAdmin

  1. A superAdmin can only be added by a user of status supersuperadmin
  2. A body can have only single Super admin , but multiple admins , which are added by super admin
  3. Make POST request at /api/users/addSuperAdmin and in body provide the {clubid , userEmail}. {userEmail} is the email of user you want to make admin

Endpoint:

Method: POST
Type: URLENCODED
URL: {{url}}/api/users/addSuperAdmin

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 600dc91a86476f0cfa84f129
userEmail [email protected]

More example Requests/Responses:

I. Example Request: Add SuperAdmin

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6
userEmail [email protected]
I. Example Response: Add SuperAdmin
{
    "message": "Success",
    "data": {
        "body": {
            "events": [],
            "admins": [],
            "_id": "5ec6a039a3c1605a567ae3f6",
            "name": "Literary Club",
            "about": "We are here to organise events",
            "dept": "ME",
            "createdAt": "2020-05-21T15:37:29.946Z",
            "updatedAt": "2020-06-28T09:32:52.301Z",
            "__v": 0,
            "superAdmin": "5ec2e5aad3e63d114d93359e"
        },
        "superAdmin": {
            "emailValidated": false,
            "superSuperAdmin": true,
            "subscribedBodies": [],
            "canCreate": false,
            "createdEvents": [],
            "staredEvents": [
                "5ec6a078a3c1605a567ae3f7"
            ],
            "adminOf": [
                "5ec2e638d3e63d114d93359f"
            ],
            "superAdminOf": [
                "5ec2e638d3e63d114d93359f",
                "5ec2e638d3e63d114d93359f",
                "5ec6a039a3c1605a567ae3f6",
                "5ec6a039a3c1605a567ae3f6"
            ],
            "_id": "5ec2e5aad3e63d114d93359e",
            "email": "[email protected]",
            "password": "$2a$10$NOh/CHqTr9CMQ.Ny0qnkzOXnpLBEwD9n6nXNOGt.z7bgzyAwHY1..",
            "createdAt": "2020-05-18T19:44:42.205Z",
            "updatedAt": "2020-06-28T09:40:26.018Z",
            "__v": 5
        }
    }
}

Status Code: 200


3. Get List User starred Events

List Of events

  • Just provide jwt token as bearer token in header
  • GET request at /api/events/

Endpoint:

Method: GET
Type:
URL: http://localhost:5000/api/events/

More example Requests/Responses:

I. Example Request: Get List of Events

Headers:

Key Value Description
authorization eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjRmMzM5Mzg0MGU1ZjE0MDBiMjAwMCIsImlhdCI6MTU4OTE5MTk3OSwiZXhwIjoxNTg5Nzk2Nzc5fQ.PYHSLOe6M9n4_PjppN-QsTbJRuOCsejcikknVSi-U
I. Example Response: Get List of Events
{
    "message": "Events Found",
    "data": {
        "events": [
            {
                "id": "600ad185f14e27417c0d1dc2",
                "name": "n",
                "about": "n",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-01-22T18:51:00.000Z",
                "endDate": "2021-01-22T21:52:00.000Z",
                "stared": false,
                "image": "",
                "venue": "n",
                "updates": []
            },
            {
                "id": "600daa94f84256933cb2c71b",
                "name": "rrrm",
                "about": "content",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-01-24T22:42:00.000Z",
                "endDate": "2021-01-27T17:12:00.000Z",
                "stared": false,
                "image": "",
                "venue": "ee",
                "updates": [
                    {
                        "_id": "600eaed2c9fef2c643b9b90e",
                        "title": "TITLE",
                        "body": "delay",
                        "createdAt": "2021-01-25T11:43:14.973Z",
                        "updatedAt": "2021-01-25T11:43:14.973Z",
                        "__v": 0
                    }
                ]
            },
            {
                "id": "600eb184c9fef2c643b9b90f",
                "name": "m",
                "about": "m",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-01-25T17:24:00.000Z",
                "endDate": "2021-01-26T17:24:00.000Z",
                "stared": false,
                "image": "",
                "venue": "m",
                "updates": []
            },
            {
                "id": "601150619a2e671e33511e6b",
                "name": "Test Event",
                "about": "qwerty",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-01-27T18:06:00.000Z",
                "endDate": "2021-01-27T19:06:00.000Z",
                "stared": false,
                "image": "",
                "venue": "LHC",
                "updates": [
                    {
                        "_id": "601153379a2e671e33511e6d",
                        "title": "TITLE",
                        "body": "Bring your own laptops",
                        "createdAt": "2021-01-27T11:49:11.961Z",
                        "updatedAt": "2021-01-27T11:49:11.961Z",
                        "__v": 0
                    }
                ]
            },
            {
                "id": "6016ef5f455c7a5089cf46e3",
                "name": "Code Night 6",
                "about": "Just For Members",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-01-31T17:56:47.285Z",
                "endDate": "2021-01-31T18:56:47.285Z",
                "stared": false,
                "image": "",
                "venue": "Bharti Building",
                "updates": []
            },
            {
                "id": "60183277890525d312b6e569",
                "name": "Code Night 2",
                "about": "Just For Members",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-02-01T16:55:19.520Z",
                "endDate": "2021-02-01T17:55:19.520Z",
                "stared": false,
                "image": "",
                "venue": "Bharti Building",
                "updates": []
            },
            {
                "id": "6019346a67cbfaf580d2e8e6",
                "name": "r",
                "about": "m",
                "body": {
                    "name": "Literary Club",
                    "about": "We are here to organise events",
                    "id": "600acceff14e27417c0d1dbd",
                    "isSub": false
                },
                "startDate": "2021-02-02T16:45:00.000Z",
                "endDate": "2021-02-02T16:45:00.000Z",
                "stared": false,
                "image": "",
                "venue": "u",
                "updates": []
            }
        ]
    }
}

Status Code: 200


4. Get List of Admins

  1. Make post request at /api/users/getAdmins with body of {clubid}
  2. The response contains only id of the admins

Endpoint:

Method: POST
Type: URLENCODED
URL: http://localhost:5000/api/users/getAdmins

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6

More example Requests/Responses:

I. Example Request: Get List of Admins

Headers:

Key Value Description
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6
I. Example Response: Get List of Admins
{
    "message": "Admins",
    "data": {
        "admins": [
            {
                "_id": "600e7f521e8db81ba8323c47",
                "name": "Prakhar Jagwani",
                "email": "[email protected]"
            }
        ]
    }
}

Status Code: 200


5. Logged In User Details

User Details

  • require only jwt token of user logged in

Endpoint:

Method: GET
Type:
URL: {{url}}/api/user/me

6. Remove Admin

Remove Admin

  1. A superadmin can only remove the admin
  2. make post request at /api/users/removeAdmin and provide {userEmail, clubid} in the body of the request

Endpoint:

Method: POST
Type: URLENCODED
URL: http://localhost:5000/api/users/removeAdmin

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 600dc91a86476f0cfa84f129
userEmail [email protected]

More example Requests/Responses:

I. Example Request: Remove Admin(when SuperAdmin status)

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6
userEmail [email protected]
I. Example Response: Remove Admin(when SuperAdmin status)
{
    "message": "Successfully Deleted The Admin",
    "data": {}
}

Status Code: 200


II. Example Request: Remove Admin(when not a super admin)

Headers:

Key Value Description
authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkZjIxMjJkYzFmMDcxNzg1NGUwMWJhZiIsImlhdCI6MTU3NjI1ODU2OSwiZXhwIjoxNTc2ODYzMzY5fQ.ZpKaksZxRF4g8C8-FgDk32cL_EHESRFa2QpaF-S7kYI
Content-Type application/x-www-form-urlencoded

Body:

Key Value Description
clubId 5ec6a039a3c1605a567ae3f6
userEmail [email protected]
II. Example Response: Remove Admin(when not a super admin)
{
    "errors": {
        "message": "Not Authorized To Perform this Action. Require SuperAdmin Status",
        "error": {
            "name": "Authorization",
            "message": "Not Authorized To Perform this Action. Require SuperAdmin Status"
        }
    }
}

Status Code: 500


7. Toggle Star An Event

Starred event

  • provide the event id to toogle the starred feature

Endpoint:

Method: POST
Type:
URL: http://localhost:5000/api/events/5ec6a078a3c1605a567ae3f7/star

Back to top

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages