Employee Management API (1.0.0)

Download OpenAPI specification:

API для управления информацией о сотрудниках

Auth

Authentication routes

Register a new user

Register a new employee or admin account. Only explicitly allowed fields are accepted. Admin-only fields (salary, position, mentorName, englishLevel, etc.) cannot be set during registration for security reasons. To create an admin, provide role='admin' and the correct secretWord from environment variable. Passwords are automatically hashed before storage.

Authorizations:
bearerAuth
Request Body schema: application/json
required
email
required
string <email>

Email address (must be unique)

password
required
string <password> [ 6 .. 20 ] characters

Password (6-20 characters, will be hashed)

firstName
required
string [ 2 .. 40 ] characters

First name (2-40 characters)

lastName
required
string [ 2 .. 40 ] characters

Last name (2-40 characters)

middleName
required
string [ 2 .. 40 ] characters

Middle name (2-40 characters)

birthDate
required
string <date>

Birth date (YYYY-MM-DD)

phone
required
string <= 50 characters

Phone number

programmingLanguage
required
string <= 100 characters

Primary programming language

role
string
Enum: "employee" "admin"

User role (defaults to employee if not provided)

secretWord
string

Required ONLY for admin registration - must match SECRET_WORD environment variable

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word",
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "programmingLanguage": "string",
  • "role": "employee",
  • "secretWord": "string"
}

Response samples

Content type
application/json
{
  • "message": "Пользователь успешно зарегистрирован",
  • "userId": 1
}

User login

Authorizations:
bearerAuth
Request Body schema: application/json
required
email
required
string <email>
password
required
string <password>

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word"
}

Notifications

Notification routes

Get the current user's list of notifications with pagination

Authorizations:
bearerAuth
query Parameters
type
string

Notification type for filtering

sortBy
string
Enum: "createdAt" "type"

Field to sort notifications by

order
string
Enum: "ASC" "DESC"

Sort order (ASC for ascending, DESC for descending)

page
integer
Default: 1

Page number for pagination

limit
integer
Default: 10

Number of notifications per page

Responses

Response samples

Content type
application/json
{
  • "notifications": [
    ],
  • "total": 0,
  • "page": 0,
  • "totalPages": 0
}

Mark a notification as read

Authorizations:
bearerAuth
path Parameters
id
required
integer

Notification ID

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "message": "string",
  • "userId": 0,
  • "relatedUserId": 0,
  • "type": "birthday_reminder",
  • "eventDate": "2019-08-24",
  • "isRead": false,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Projects

Project management routes

Get all projects

Returns a list of all projects. Non-admin users cannot see wage field. Can filter by active status and search by name.

Authorizations:
bearerAuth
query Parameters
active
boolean

Filter by active status

search
string

Search by project name

page
integer
Default: 1

Page number

limit
integer
Default: 100

Number of projects per page

Responses

Create a new project (admin only)

Admin-only endpoint to create new projects.

Authorizations:
bearerAuth
Request Body schema: application/json
required
name
required
string
description
required
string
wage
number
active
boolean
Default: true

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "wage": 0,
  • "active": true
}

Get a project by ID

Returns details of a specific project including assigned employees. Non-admin users cannot see wage field.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Responses

Update a project (admin only)

Admin-only endpoint to update project details.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Request Body schema: application/json
required
name
string
description
string
wage
number
active
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "wage": 0,
  • "active": true
}

Delete a project (admin only)

Admin-only endpoint to delete a project.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Responses

Assign employees to a project (admin only)

Admin-only endpoint to assign multiple employees to a project (replaces existing assignments).

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Request Body schema: application/json
required
employeeIds
required
Array of integers

Responses

Request samples

Content type
application/json
{
  • "employeeIds": [
    ]
}

Get all employees assigned to a project

Returns the list of employees assigned to a specific project. Non-admin users cannot see salary field.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Responses

Add a single employee to a project (admin only)

Admin-only endpoint to add one employee to a project.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

Request Body schema: application/json
required
employeeId
required
integer

Responses

Request samples

Content type
application/json
{
  • "employeeId": 0
}

Remove an employee from a project (admin only)

Admin-only endpoint to remove an employee from a project.

Authorizations:
bearerAuth
path Parameters
id
required
integer

Project ID

employeeId
required
integer

Employee ID

Responses

Users

User routes

Get current user's profile

Returns the profile data of the currently authenticated user

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "email": "user@example.com",
  • "programmingLanguage": "string",
  • "country": "string",
  • "bankCard": "string",
  • "registrationDate": "2019-08-24T14:15:22Z",
  • "lastLoginDate": "2019-08-24T14:15:22Z",
  • "salary": 0,
  • "lastSalaryIncreaseDate": "2019-08-24T14:15:22Z",
  • "position": "string",
  • "mentorName": "string",
  • "vacationDates": [
    ],
  • "githubLink": "http://example.com",
  • "linkedinLink": "http://example.com",
  • "adminNote": "string",
  • "englishLevel": "string",
  • "projects": [
    ],
  • "workingHoursPerWeek": 0,
  • "role": "employee",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Create a new employee (admin only)

Admin-only endpoint to create new employee accounts with all fields. Role defaults to 'employee' if not specified. Passwords are automatically hashed before storage. A notification is created for audit trail.

Authorizations:
bearerAuth
Request Body schema: application/json
required
email
required
string <email>

Email address (must be unique)

password
required
string <password> [ 6 .. 20 ] characters

Password (6-20 characters, will be hashed)

firstName
required
string [ 2 .. 40 ] characters

First name (2-40 characters)

lastName
required
string [ 2 .. 40 ] characters

Last name (2-40 characters)

middleName
string or null [ 2 .. 40 ] characters

Middle name (2-40 characters, optional)

birthDate
string or null <date>

Birth date (YYYY-MM-DD, optional)

phone
string or null <= 50 characters

Phone number (optional)

programmingLanguage
string or null <= 100 characters

Primary programming language (optional)

country
string or null

Country (optional)

bankCard
string or null

Bank card info (optional)

linkedinLink
string or null <uri>

LinkedIn profile URL (optional)

githubLink
string or null <uri>

GitHub profile URL (optional)

hireDate
string or null <date>

Hire date (optional)

adminNote
string or null

Admin notes (optional)

projectIds
Array of integers or null

Array of project IDs to assign to the user (optional)

englishLevel
string or null

English proficiency level (optional)

vacationDates
Array of strings or null <date> [ items <date > ]

Vacation dates (optional)

mentorName
string or null

Assigned mentor (optional)

position
string or null

Job position (optional)

salary
number or null

Salary amount (optional)

role
string
Enum: "employee" "admin"

User role (defaults to employee if not provided)

workingHoursPerWeek
integer or null [ 0 .. 100 ]

Working hours per week (0-100, optional)

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word",
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "programmingLanguage": "string",
  • "country": "string",
  • "bankCard": "string",
  • "linkedinLink": "http://example.com",
  • "githubLink": "http://example.com",
  • "hireDate": "2019-08-24",
  • "adminNote": "string",
  • "projectIds": [
    ],
  • "englishLevel": "string",
  • "vacationDates": [
    ],
  • "mentorName": "string",
  • "position": "string",
  • "salary": 0,
  • "role": "employee",
  • "workingHoursPerWeek": 100
}

Response samples

Content type
application/json
{
  • "message": "Сотрудник успешно создан",
  • "user": {
    }
}

Get a list of users with pagination, search, and sorting

Authorizations:
bearerAuth
query Parameters
page
integer
Default: 1

Page number

limit
integer
Default: 10

Number of users per page

firstName
string

Search by first name

lastName
string

Search by last name

sortBy
string
Default: "registrationDate"
Enum: "registrationDate" "programmingLanguage" "country" "mentorName" "englishLevel" "position"

Field to sort by

order
string
Default: "ASC"
Enum: "ASC" "DESC"

Sort order

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total": 0,
  • "page": 0,
  • "totalPages": 0
}

Delete an employee (admin only)

Authorizations:
bearerAuth
path Parameters
id
required
integer

Employee ID

Responses

Update a user's profile

Update user profile. Employees can update their own basic profile fields (firstName, lastName, middleName, birthDate, phone, email, programmingLanguage, country, bankCard, linkedinLink, githubLink). Admins can update all fields including admin-only fields (hireDate, adminNote, projectIds, englishLevel, vacationDates, mentorName, position, salary, role, password, workingHoursPerWeek). Passwords are automatically hashed when updated.

Authorizations:
bearerAuth
path Parameters
id
required
integer

User ID

Request Body schema: application/json
required
firstName
string [ 2 .. 40 ] characters

First name - employees can update their own

lastName
string [ 2 .. 40 ] characters

Last name - employees can update their own

middleName
string [ 2 .. 40 ] characters

Middle name - employees can update their own

birthDate
string <date>

Birth date - employees can update their own

phone
string <= 50 characters

Phone number - employees can update their own

email
string <email>

Email address (must be unique) - employees can update their own

programmingLanguage
string <= 100 characters

Programming language - employees can update their own

country
string or null

Country - employees can update their own

bankCard
string or null

Bank card info - employees can update their own

linkedinLink
string or null <uri>

LinkedIn profile URL - employees can update their own

githubLink
string or null <uri>

GitHub profile URL - employees can update their own

hireDate
string or null <date>

Hire date - ADMIN ONLY

adminNote
string or null

Admin notes - ADMIN ONLY

projectIds
Array of integers or null

Array of project IDs to assign to the user - ADMIN ONLY

englishLevel
string or null

English proficiency level - ADMIN ONLY

vacationDates
Array of strings or null <date> [ items <date > ]

Vacation dates - ADMIN ONLY

mentorName
string or null

Assigned mentor - ADMIN ONLY

position
string or null

Job position - ADMIN ONLY

salary
number or null

Salary amount - ADMIN ONLY

role
string
Enum: "employee" "admin"

User role - ADMIN ONLY

password
string <password> [ 6 .. 20 ] characters

New password (will be automatically hashed) - ADMIN ONLY

workingHoursPerWeek
integer or null [ 0 .. 100 ]

Working hours per week - ADMIN ONLY

Responses

Request samples

Content type
application/json
{
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "email": "user@example.com",
  • "programmingLanguage": "string",
  • "country": "string",
  • "bankCard": "string",
  • "linkedinLink": "http://example.com",
  • "githubLink": "http://example.com",
  • "hireDate": "2019-08-24",
  • "adminNote": "string",
  • "projectIds": [
    ],
  • "englishLevel": "string",
  • "vacationDates": [
    ],
  • "mentorName": "string",
  • "position": "string",
  • "salary": 0,
  • "role": "employee",
  • "password": "pa$$word",
  • "workingHoursPerWeek": 100
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "email": "user@example.com",
  • "programmingLanguage": "string",
  • "country": "string",
  • "bankCard": "string",
  • "registrationDate": "2019-08-24T14:15:22Z",
  • "lastLoginDate": "2019-08-24T14:15:22Z",
  • "salary": 0,
  • "lastSalaryIncreaseDate": "2019-08-24T14:15:22Z",
  • "position": "string",
  • "mentorName": "string",
  • "vacationDates": [
    ],
  • "githubLink": "http://example.com",
  • "linkedinLink": "http://example.com",
  • "adminNote": "string",
  • "englishLevel": "string",
  • "projects": [
    ],
  • "workingHoursPerWeek": 0,
  • "role": "employee",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Get an employee by ID

Authorizations:
bearerAuth
path Parameters
id
required
integer

Employee ID

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "firstName": "string",
  • "lastName": "string",
  • "middleName": "string",
  • "birthDate": "2019-08-24",
  • "phone": "string",
  • "email": "user@example.com",
  • "programmingLanguage": "string",
  • "country": "string",
  • "bankCard": "string",
  • "registrationDate": "2019-08-24T14:15:22Z",
  • "lastLoginDate": "2019-08-24T14:15:22Z",
  • "salary": 0,
  • "lastSalaryIncreaseDate": "2019-08-24T14:15:22Z",
  • "position": "string",
  • "mentorName": "string",
  • "vacationDates": [
    ],
  • "githubLink": "http://example.com",
  • "linkedinLink": "http://example.com",
  • "adminNote": "string",
  • "englishLevel": "string",
  • "projects": [
    ],
  • "workingHoursPerWeek": 0,
  • "role": "employee",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}