Skip to content

Advisers Endpoints

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

Get all advisers

GET: /api/advisers

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

Response Body:

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

Get a single adviser

GET: /api/advisers/:adviserId

  • Authorization Required: authorizeAdmin
  • Currently unused
Request Params Description
adviserID ID of Adviser in the Adviser table

Response Body:

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

Create a new account with Adviser role

POST: /api/advisers

  • Authorization Required: authorizeAdmin

Request Body:

{
    user: {
        email: string,
        name: string,
    },
    adviser: {
        nusnetId: string,
        matricNo: string,
        cohortYear: number,
        projectsIds?: number[],
    }
}

Creating multiple accounts with Adviser role

POST: /api/advisers/batch

  • Authorization Required: authorizeAdmin

Request Body:

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

Add an Adviser role to an existing account

POST: /api/users/:userId/adviser

  • Authorization Required: authorizeAdmin

Request Body:

{
    adviser: {
        nusnetId: string,
        matricNo: string,
        cohortYear: number,
        projectsIds?: number[],
    }
}

Edit an Adivser

PUT: /api/advisers/:adviserId

  • Authorization Required: authorizeAdmin
Request Params Description
adviserId ID of Adviser in the Adviser table

Request Body:

{
    adviser: {
        matricNo?: string
        nusnetId?: string,    
        projectsIds?: number[],
    }
}

Batch add advisers to existing users

POST: /api/users/attach-adviser/batch

  • Authorization Required: authorizeAdmin
  • Currently unused

Request Body:

{
    count: number,
    nusnetIds: string[],
}

NUS Skylab v2 - Backend

Introduction

Project Organization

Project Requirements

Endpoints

Clone this wiki locally