import students - KarolDawidG/MEGAK_HH_SPEC_G1_backend GitHub Wiki

Import users to database

Using this endpoint you will be able to import users to database.

Required role

Admin

Method and URL

POST /user/import

Request Body

[
  StudentImportFormatInterface {
    email: string,  // User email address
    courseCompletion: number | string,  // Course completion degree
    courseEngagement: number | string,  // Course engagement degree
    projectDegree: number | string,  // Project degree
    teamProjectDegree: number | string,  // Team project degree
    bonusProjectUrls: string,  // Bonus project degree
  },
  ...
]

Request Response

Returns object with two lists of approved and declined users.

{
  approved: StudentImportFormatInterface[],
  rejected: StudentsImportJsonInterface {
    email: string,
    courseCompletion: number | string,
    courseEngagement: number | string,
    projectDegree: number | string,
    teamProjectDegree: number | string,
    bonusProjectUrls: string,
    message?: string,
  }[];
}

Example data file

You can obtain example file data from here

Usage exmaple

  • URL: /user/import
  • Method: POST
  • Request Body:
[
 {
    "email": "[email protected]",
    "courseCompletion": 5,
    "courseEngagement": 5,
    "projectDegree": 5,
    "teamProjectDegree": 5,
    "bonusProjectUrls": [
       "https://github.com/project1_url",
       "https://github.com/project2_url",
    ],
  },
  {
    "email": "[email protected]",
    "courseCompletion": 5,
    "courseEngagement": 5,
    "projectDegree": 5,
    "teamProjectDegree": 5,
    "bonusProjectUrls": [
       "https://github.com/project1_url",
       "https://github.com/project2_url",
    ],
  },
]
  • Response:
{
  "approved": [
    {
      "email": "[email protected]",
      "courseCompletion": 5,
      "courseEngagement": 5,
      "projectDegree": 5,
      "teamProjectDegree": 5,
      "bonusProjectUrls": [
        "https://github.com/project1_url",
        "https://github.com/project2_url",
      ],
    },
  ],
  "rejected": [
    {
      "email": "[email protected]",
      "courseCompletion": 5,
      "courseEngagement": 5,
      "projectDegree": 5,
      "teamProjectDegree": 5,
      "bonusProjectUrls": [
         "https://github.com/project1_url",
         "https://github.com/project2_url",
      ],
      "message": "Ten email istnieje już w bazie danych."
    },
  ]
}