Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- openapi: 3.0.0
- info:
- title: TusionAPI
- description: |
- Tusion rest server API
- \[SwaggerUI\] $$ref in examples is a bug and should be ignored!
- version: 1.0.0
- contact:
- email: "konstantin@tusion.xyz"
- servers:
- - url: http://api.tusion.xyz/v1
- description: Production rest server
- - url: 178.128.32.99:8080/v1
- description: Test rest server
- tags:
- - name: Profile
- description: Current user's profile related endpoints
- - name: Departments
- description: Departments related endpoints
- - name: Employees
- description: Employees related endpoints
- - name: Other
- description: Miscellaneous endpoints
- - name: Rate
- description: Rate endpoints
- components:
- securitySchemes:
- ApiKeyAuth:
- type: apiKey
- in: header
- name: Authorization
- schemas:
- Rate:
- type: object
- properties:
- rate: { type: integer }
- date: { type: string }
- goalID: { type: integer }
- example:
- rate: 1
- date: "2018-02-02"
- goalID: 1
- Organisation:
- type: object
- properties:
- name: { type: string }
- logoUrl: { type: string, format: url }
- example:
- name: Tusion
- logoUrl: https://tusion.xyz/assets/logo
- Department:
- type: object
- properties:
- id: { type: integer }
- title: { type: string }
- isMain: { type: boolean }
- statistics:
- type: object
- properties:
- tpi: { type: number }
- avgRating: { type: number }
- example: { $ref: '#/components/examples/Department_Tusion/value' }
- Employee:
- type: object
- properties:
- id: { type: integer, example: 1 }
- name: { type: string, example: John Doe }
- email: { type: string, format: email, example: jh@tusion.xyz }
- photoUrl: { type: string, format: uri, example: https://tusion.xyz/jhPhoto }
- position: { type: string, example: Golang developer }
- isAdmin: { type: boolean }
- timezone: { type: string, format: TZ, example: UTC }
- goal:
- type: object
- properties:
- name: { type: string }
- type:
- type: string
- enum: [concentration, relaxation]
- statistics: { $ref: '#/components/schemas/EmployeeStatistics' }
- EmployeeStatistics:
- type: object
- properties:
- tpi: { type: number }
- data:
- type: array
- items:
- type: object
- properties:
- date: { type: string, format: date }
- adminRating: { type: integer }
- selfRating: { type: integer }
- relaxation: { $ref: '#/components/schemas/IntTusesStatistics' }
- concentration: { $ref: '#/components/schemas/IntTusesStatistics' }
- duration: { $ref: '#/components/schemas/IntTusesStatistics' }
- example: { $ref: '#/components/examples/EmployeeStatistics/value' }
- IntTusesStatistics:
- type: object
- properties:
- spinner: { type: integer }
- way: { type: integer }
- reaperoid3000: { type: integer }
- jumper: { type: integer }
- pushazier: { type: integer }
- modernSnake: { type: integer }
- cleanTheDay: { type: integer }
- DashboardContent:
- type: object
- properties:
- department: { $ref: '#/components/schemas/Department' }
- otherSubordinates:
- type: array
- items: { $ref: '#/components/schemas/Employee' }
- example:
- department:
- id: 1
- title: Tusion
- isMain: false
- staff:
- - $ref: '#/components/examples/Employee_Andrey/value'
- - $ref: '#/components/examples/Employee_Konstantin/value'
- statistics:
- tpi: 45.2
- avgRating: 4.5
- otherSubordinates:
- - $ref: '#/components/examples/Employee_John1/value'
- - $ref: '#/components/examples/Employee_John2/value'
- DepartmentsHierarchyItem:
- type: object
- properties:
- id: { type: integer }
- name: { type: string }
- subdepartments:
- type: array
- items: { $ref: '#/components/schemas/DepartmentsHierarchyItem' }
- example:
- id: 1
- name: Tusion
- subdepartments:
- - id: 2
- name: Development Department
- subdepartments:
- - id: 5
- name: Mobile Development Department
- subdepartments: []
- - id: 6
- name: Backoffice Development Department
- subdepartments: []
- - id: 3
- name: HR Department
- subdepartments: []
- - id: 4
- name: PR Department
- subdepartments: []
- Error:
- type: object
- properties:
- code: { type: integer, minimum: 100, maximum: 999 }
- message: { type: string }
- examples:
- Department_Tusion:
- summary: Main department example
- value:
- id: 1
- title: Tusion
- isMain: true
- statistics:
- tpi: 45.2
- avgRating: 4.5
- Employee_Andrey:
- summary: Employee example — Andrey
- value:
- id: 1
- name: Andrey Khapsasov
- email: ak@tusion.xyz
- photoUrl: https://staff.tusion.xyz/ak/photo
- position: CEO, Alcoholic
- timezone: Europe/Moscow
- goal:
- name: Find a girlfriend
- type: concentration
- statistics: { $ref: '#/components/examples/EmployeeStatistics/value'}
- Employee_Konstantin:
- summary: Employee example — Konstantin
- value:
- id: 2
- name: Konstantin Mazunin
- email: km@tusion.xyz
- photoUrl: https://staff.tusion.xyz/km/photo
- position: CTO, Anime fan
- timezone: Europe/Moscow
- goal:
- name: Buy a Bentley
- type: concentration
- statistics: { $ref: '#/components/examples/EmployeeStatistics/value' }
- Employee_John1:
- summary: Employee example — John 1
- value:
- id: 10
- name: John Doe 1
- email: jh@tusion.xyz
- photoUrl: https://staff.tusion.xyz/jh1/photo
- position: Jumper 1
- timezone: Australia/Sydney
- goal:
- name: Be a good jumper 2
- type: relaxation
- statistics: { $ref: '#/components/examples/EmployeeStatistics/value' }
- Employee_John2:
- summary: Employee example — John 2
- value:
- id: 10
- name: John Doe 2
- email: jh@tusion.xyz
- photoUrl: https://staff.tusion.xyz/jh2/photo
- position: Jumper 2
- timezone: Australia/Sydney
- goal:
- name: Be a good jumper 2
- type: relaxation
- statistics: { $ref: '#/components/examples/EmployeeStatistics/value' }
- EmployeeStatistics:
- summary: Employee statistics example
- value:
- tpi: 45.2
- data:
- - date: '2018-07-01T21:00:00Z'
- adminRatig: 4
- selfRating: 6
- relaxation:
- spinner: 9
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 3
- concentration:
- spinner: 9
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 3
- duration:
- spinner: 5
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 3
- - date: '2018-07-02T21:00:00Z'
- adminRatig: 3
- selfRating: 5
- relaxation:
- spinner: 9
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 3
- concentration:
- spinner: 5
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 3
- duration:
- spinner: 5
- way: 1
- reaperoid3000: 0
- jumper: 3
- pushazier: 4
- modernSnake: 1
- cleanTheDay: 2
- parameters:
- employeeFields:
- name: fields
- description: |
- Array of expected employee atttribute names
- Style — form, no explode
- **Example**
- `[ id, name, position, goal ] -> ?fields=id,name,position,goal`
- in: query
- required: false
- style: form
- explode: false
- schema:
- type: array
- items: { type: string }
- default: [ id, name, email, photoUrl, position, isAdmin, timezone, goal, statistics ]
- example: [ id, name, position, goal ]
- departmentFields:
- name: fields
- description: |
- Array of expected department atttribute names
- Style — form, no explode
- **Example**
- `[ id, title, isMain ] -> ?fields=id,title,isMain`
- in: query
- required: false
- style: form
- explode: false
- schema:
- type: array
- items: { type: string }
- default: [ id, title, isMain, statistics ]
- example: [ id, title, statistics ]
- organisationFields:
- name: fields
- description: |
- Array of expected organisation atttribute names
- Style — form, no explode
- **Example**
- `[ title, logoUrl ] -> ?fields=title,logoUrl`
- in: query
- required: false
- style: form
- explode: false
- schema:
- type: array
- items: { type: string }
- default: [ title, logoUrl ]
- example: [ title, logoUrl ]
- departmentId:
- name: depId
- in: path
- description: Department's id
- required: true
- schema: { type: integer, example: 1 }
- employeeId:
- name: employeeId
- in: path
- description: Employee's id
- required: true
- schema: { type: integer, example: 1 }
- start:
- name: start
- description: |
- Start date for statistics calculation (such as average department rating for last week)
- Format — ISO date and time in UTC timezone
- **Examples**: `?start=2018-07-01T21:00:00Z` — start of July 2nd in Europe/Moscow
- in: query
- required: false
- schema:
- type: string
- format: date
- default: \<utc time of current month start in users's timezone\>
- example: '2018-07-01T21:00:00Z'
- end:
- name: end
- in: query
- description: |
- End date for statistics calculation (such as average department rating for last week)
- Format — ISO date in UTC timezone
- **Example**: `?end=2018-07-04T21:00:00Z` — start of July 5th in Europe/Moscow
- required: false
- schema:
- type: string
- format: date
- default: \<utc time of current day start in users's timezone\>
- example: '2018-07-04T21:00:00Z'
- responses:
- # 1xx
- UserIsUnauthenticated:
- description: |
- User is unauthenticated
- Possible cases:
- * Access token is not supplied
- * Access token is invalid
- * Access token has expired
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 101 ] }
- message: { type: string, enum: [ 'User is unauthenticated' ] }
- # 2xx
- NotAdminAccessForbidden:
- description: |
- Access forbidden
- Possible reasons:
- * Current user in not admin
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 201 ] }
- message: { type: string, enum: [ 'Access forbidden: you are not and admin' ] }
- NotAdminOrDepartmentAccessForbidden:
- description: |
- Access forbidden
- Possible reasons:
- * Current user is not admin
- * Neither current user is a member of specified department nor
- specified department is a direct or indirect subdepartment of
- the department current user is a member of
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 201, 202 ] }
- message: { type: string, enum: [
- 'Access forbidden: you are not an admin',
- 'Access forbidden: you don''t have control over specified department'
- ] }
- NotAdminOrEmployeeAccessForbidden:
- description: |
- Access forbidden
- Possible reasons:
- * Current user is not admin
- * Specified employee is not direct or indirect subordinate of
- current user
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 201, 203 ] }
- message: { type: string, enum: [
- 'Access forbidden: you are not an admin',
- 'Access forbidden: you don''t have control over specified employee'
- ] }
- NotAdminOrEmployeeOrDepartmentAccessForbidden:
- description: |
- Access forbidden
- Possible reasons:
- * Current user is not admin
- * Neither current user is a member of specified department nor
- specified department is a direct or indirect subdepartment of
- the department current user is a member of
- * Specified employee is not direct or indirect subordinate of
- current user
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 201, 202, 203 ] }
- message: { type: string, enum: [
- 'Access forbidden: you are not an admin',
- 'Access forbidden: you don''t have control over specified department',
- 'Access forbidden: you don''t have control over specified employee'
- ] }
- AlreadyAdmin:
- description: User already admin of department
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 211 ] }
- message: { type: string, enum: [
- "This user is already admin: user can not be admin of more then one department"
- ] }
- NoActiveGoalOrAlreadyRated:
- description: |
- Unposible to rate.
- Possible reasons:
- * User has no active goal, assigned by admin of department. Code = 212
- * User has already rated himself at this day. Code = 213
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [212, 213] }
- message: { type: string, enum: [
- "No active goal for user",
- "User has already rated at this date"
- ] }
- # 3xx
- DepartmentNotFound:
- description: Department with specified id wasn't found
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 301 ] }
- message: { type: string, enum: [ 'Department wasn''t found' ] }
- EmployeeNotFound:
- description: Employee with specified id wasn't found
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 302 ] }
- message: { type: string, enum: [ 'Employee wasn''t found' ] }
- RateNotFound:
- description: Rate for specified date not found
- content:
- application/json:
- schema:
- type: object
- properties:
- code: { type: integer, enum: [ 303 ] }
- message: { type: string, enum: [
- 'No rate for required date'
- ] }
- BadJsonResponse:
- description: Bad Request
- ForbiddenAccessError:
- description: Forbidden
- LoginResponse:
- description: OK
- content:
- application/json:
- schema:
- type: object
- properties:
- access_token:
- type: string
- refresh_token:
- type: string
- expires_in:
- type: integer
- paths:
- /my_profile:
- get:
- tags:
- - Profile
- summary: Get current user's profile info
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/employeeFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content: { application/json: { schema: { $ref: '#/components/schemas/Employee' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- patch:
- tags:
- - Profile
- summary: Update current user's profile
- security:
- - ApiKeyAuth: []
- requestBody:
- description: |
- Profile patch document in JSON merge patch format
- Properties available for update:
- * name
- * photoUrl
- content:
- application/json:
- schema:
- type: object
- properties:
- name: { type: string }
- photoUrl: { type: string, format: url }
- responses:
- 200:
- description: Profile updated, response contains object width updated profile properties
- content:
- application/json:
- schema:
- type: object
- properties:
- name: { type: string }
- photoUrl: { title: string, format: url }
- /my_profile/organistation:
- get:
- tags:
- - Profile
- summary: Get current user's organistation info
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/organisationFields'
- responses:
- 200:
- description: Information fetched successfully
- content: { application/json: { schema: { $ref: '#/components/schemas/Organisation' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- /my_profile/department:
- get:
- tags:
- - Profile
- - Departments
- summary: Get current user's department info
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: OK
- content: { application/json: { schema: { $ref: '#/components/schemas/Department' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- # ** Departments specific endpoints ** #
- /departments/{depId}:
- get:
- tags:
- - Departments
- summary: Get info about department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- - $ref: '#/components/parameters/departmentFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content: { application/json: { schema: { $ref: '#/components/schemas/Department' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- patch:
- tags:
- - Departments
- summary: Update info about department width specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- requestBody:
- description: |
- Department patch document in JSON merge patch format
- Properties available for update:
- * title
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- title: { type: string }
- responses:
- 200:
- description: Department info updated, response contains object width updated properties
- content:
- application/json:
- schema:
- type: object
- properties:
- title: { type: string }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- delete:
- tags:
- - Departments
- summary: Delete department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- responses:
- 204:
- description: Department width specific id successfully deleted
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- /departments/{depId}/subdepartments:
- get:
- tags:
- - Departments
- summary: Get subdepartments list of department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- - $ref: '#/components/parameters/departmentFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content:
- application/json:
- schema: { type: array, items: { $ref: '#/components/schemas/Department' } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- post:
- summary: Create new subdepartment of department with specified id
- tags:
- - Departments
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- requestBody:
- description: New subdepartment description
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- title: { type: string }
- adminId: { type: integer }
- required: [ title, adminId ]
- responses:
- 201:
- description: New subdepartment successfully created, response contains its description
- content: { application/json: { schema: { $ref: '#/components/schemas/Department' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- /departments/{depid}/admin:
- get:
- tags:
- - Departments
- - Employees
- summary: Get info about admin of department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- - $ref: '#/components/parameters/employeeFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content: { application/json: { schema: { $ref: '#/components/schemas/Employee' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- post:
- tags:
- - Departments
- - Employees
- summary: Assign admin to department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- requestBody:
- description: New admin id
- content:
- application/json:
- schema:
- type: object
- properties:
- newAdminId: { type: integer, minimum: 1 }
- responses:
- 201:
- description: Admin assigned
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrEmployeeOrDepartmentAccessForbidden' }
- 404:
- description: Specified department or employee wasn't found
- delete:
- tags:
- - Departments
- - Employees
- summary: Unassign admin of department with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- responses:
- 204:
- description: Admin unassigned
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- 422:
- description: No admin is assigned to specified department
- /departments/{depId}/staff:
- get:
- tags:
- - Departments
- - Employees
- summary: Get staff list of department width specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- - $ref: '#/components/parameters/employeeFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content:
- application/json:
- schema: { type: array, items: { $ref: '#/components/schemas/Employee' } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- post:
- tags:
- - Departments
- - Employees
- summary: Invite new employee to department width specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/departmentId'
- requestBody:
- description: New employee description
- content:
- application/json:
- schema:
- type: object
- properties:
- name: { type: string }
- email: { type: string, format: email }
- photoUrl: { type: string, format: url }
- position: { type: string }
- required: [ name, email, position ]
- responses:
- 201:
- description: |
- User successfully invited (new profile is created and e-main
- with invitation sent)
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrDepartmentAccessForbidden' }
- 404: { $ref: '#/components/responses/DepartmentNotFound' }
- /hierarchy:
- get:
- summary: Get visible to current user hierarchial organisation structure
- tags:
- - Departments
- security:
- - ApiKeyAuth: []
- responses:
- 200:
- description: Information successfully fetched
- content: { application/json: { schema: { $ref: '#/components/schemas/DepartmentsHierarchyItem' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminAccessForbidden' }
- # Employees specific endpoints #
- /employees:
- get:
- tags:
- - Employees
- summary: Get suborinate employees list
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/employeeFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- - name: groupByDepartment
- in: query
- description: Whether to group employees in list by their departments
- required: false
- schema:
- type: boolean
- default: false
- responses:
- 200:
- description: |
- Information fetched successfully, response body contains subordinate employees list
- Since viewer at swaggerhub doesn't display response body model if it's "oneOf", body
- description is provided further.
- Response structure varies depending on value of `groupByDepartment` parameters.
- **If `groupByDepartment` is false, then response is of the following structure:**
- [Employee] — array of employees
- **If `groupByDepartment`is true, the response is of the following structure:**
- ```
- [{
- department: { id: integer, title: string }
- staff: [Employee]
- }, {
- ...
- }]
- ```
- content:
- application/json:
- schema:
- oneOf:
- - type: array
- items: { $ref: '#/components/schemas/Employee' }
- - type: array
- items:
- type: object
- properties:
- department: { type: object, properties: { id: { type: integer }, name: { type: string } } }
- staff: { type: array, items: { $ref: '#/components/schemas/Employee' } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- /employees/{employeeId}:
- get:
- tags:
- - Employees
- summary: Get information about employee with specified id
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/employeeId'
- - $ref: '#/components/parameters/employeeFields'
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: Information fetched successfully
- content: { application/json: { schema: { $ref: '#/components/schemas/Employee' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrEmployeeAccessForbidden' }
- 404: { $ref: '#/components/responses/EmployeeNotFound' }
- patch:
- tags:
- - Employees
- summary: Update information about employee with specified id (currently goal)
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/employeeId'
- requestBody:
- description: |
- Employee patch document in JSON merge patch format
- Properties available for update:
- * goal
- content:
- application/json:
- schema:
- type: object
- properties:
- goal:
- type: object
- properties:
- name: { type: string }
- type: { type: string, enum: [ concentration, relaxation ] }
- responses:
- 200:
- description: Employee info updated, response contains object width updated properties
- content:
- application/json:
- schema:
- type: object
- properties:
- title: { type: string }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrEmployeeAccessForbidden' }
- 404: { $ref: '#/components/responses/EmployeeNotFound' }
- delete:
- tags:
- - Employees
- summary: Delete employee
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/employeeId'
- responses:
- 204:
- description: Employee deleted
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrEmployeeAccessForbidden' }
- 404: { $ref: '#/components/responses/EmployeeNotFound' }
- /employees/{employeeId}/department:
- get:
- tags:
- - Employees
- - Departments
- summary: Get information about department the user with specified id is a member of
- security:
- - ApiKeyAuth: []
- responses:
- 200:
- description: Information successfully fetched
- content: { application/json: { schema: { $ref: '#/components/schemas/Department' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminOrEmployeeAccessForbidden' }
- 404: { $ref: '#/components/responses/EmployeeNotFound' }
- # Rate endpoints #
- /rate:
- get:
- summary: Get ratings for period
- tags:
- - Rate
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: "Contains array of ratings for required period. If some of date was offday, then rating value will be -1"
- content:
- application/json:
- schema:
- type: array
- items: { $ref: '#/components/schemas/Rate' }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- post:
- summary: Rate yourself
- tags:
- - Rate
- security:
- - ApiKeyAuth: []
- requestBody:
- description: "Rate is value [1 - 7], if rate is negative then this specified day of rating will be marked as offday.
- date field is required date of rating"
- content:
- application/json:
- schema: { $ref: '#/components/schemas/Rate' }
- responses:
- 201: { description: "Successfully rated" }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 409: { $ref: '#/components/responses/NoActiveGoalOrAlreadyRated' }
- patch:
- summary: change rate
- tags:
- - Rate
- security:
- - ApiKeyAuth: []
- requestBody:
- description: "Rate is value [1 - 7], if rate is negative then this specified day of rating will be marked as offday.
- date field is required date of rating"
- content:
- application/json:
- schema: { $ref: '#/components/schemas/Rate' }
- responses:
- 200: { description: Successfully updated }
- 404: { $ref: '#/components/responses/RateNotFound' }
- # Other endpoints #
- /dashboard:
- get:
- summary: Fetch dashboard data
- tags:
- - Other
- security:
- - ApiKeyAuth: []
- parameters:
- - $ref: '#/components/parameters/start'
- - $ref: '#/components/parameters/end'
- responses:
- 200:
- description: OK
- content: { application/json: { schema: { $ref: '#/components/schemas/DashboardContent' } } }
- 401: { $ref: '#/components/responses/UserIsUnauthenticated' }
- 403: { $ref: '#/components/responses/NotAdminAccessForbidden' }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement