Skip to content

Mentors Endpoints

N Vijay Narayanan edited this page Aug 16, 2022 · 11 revisions

Get all mentors

GET: /api/mentors

  • Authorization Required: authorizeAdmin
  • Currently unused
Query Params Description Optional
cohortYear Cohort year of the mentors true
page Page number to retrieve true
limit Number of records to retrieve true

Response Body:

{
    mentors: [
        {
            id: number;
            name: string;
            email: string;
            profilePicUrl?: string;
            githubUrl?: string;
            linkedinUrl?: string;
            personalSiteUrl?: string;
            selfIntro?: string;
            mentorId: number;
            cohortYear: number;
            projectIds: number[];
        }
    ]
}

Get a single mentor

GET: /api/mentors/:mentorId

  • Authorization Required: authorizeAdmin
  • Currently unused
Request Params Description
mentorId ID of Mentor in the Student table

Response Body:

{
    mentor: {
        id: number;
        name: string;
        email: string;
        profilePicUrl?: string;
        githubUrl?: string;
        linkedinUrl?: string;
        personalSiteUrl?: string;
        selfIntro?: string;
        mentorId: number;
        cohortYear: number;
        projectIds: number[];
    }
}

Creating a new account with Mentor role

POST: /api/mentors

  • Authorization Required: authorizeAdmin

Request Body:

{
    user: {
        email: string,
        name: string,
    },
    mentor: {
        cohortYear: number,
        projectsIds?: number[],
    }
}

Editing a Mentor role

POST: /api/mentors/:mentorId

  • Authorization Required: authorizeAdmin

Request Body:

{
    mentor: {
        projectsIds?: number[],
    }
}

Creating multiple accounts with Mentor role

POST: /api/mentors/batch

  • Authorization Required: authorizeAdmin

Request Body:

{
    count: number
    accounts: [
        {
            user: {
                name: string
                email: string
                password: string | undefined // password if dev
            },
            mentor: {
                cohortYear: number,
            }
        }
    ]
}

Add a Mentor role to an existing account

POST: /api/users/:userId/mentor

  • Authorization Required: authorizeAdmin

Request Body:

{
    mentor: {
        cohortYear: number,
        projectsIds?: number[],
    }
}

NUS Skylab v2 - Backend

Introduction

Project Organization

Project Requirements

Endpoints

Clone this wiki locally