targo-backend/docs/swagger/swagger-spec.json
2025-10-22 10:13:42 -04:00

1031 lines
25 KiB
JSON

{
"openapi": "3.0.0",
"paths": {
"/": {
"get": {
"operationId": "AppController_getHello",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"App"
]
}
},
"/health": {
"get": {
"operationId": "HealthController_check",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Health"
]
}
},
"/auth/v1/login": {
"get": {
"operationId": "AuthController_login",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Auth"
]
}
},
"/auth/callback": {
"get": {
"operationId": "AuthController_loginCallback",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Auth"
]
}
},
"/auth/me": {
"get": {
"operationId": "AuthController_getProfile",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Auth"
]
}
},
"/employees/employee-list": {
"get": {
"operationId": "EmployeesController_findListEmployees",
"parameters": [],
"responses": {
"200": {
"description": "List of employees with scoped info found",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EmployeeListItemDto"
}
}
}
}
},
"400": {
"description": "List of employees with scoped info not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find all employees with scoped info",
"tags": [
"Employees"
]
}
},
"/employees/{email}": {
"patch": {
"operationId": "EmployeesController_updateOrArchiveOrRestore",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"description": "Email of the employee",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateEmployeeDto"
}
}
}
},
"responses": {
"200": {
"description": "Employee updated or restored",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEmployeeDto"
}
}
}
},
"202": {
"description": "Employee archived successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEmployeeDto"
}
}
}
},
"404": {
"description": "Employee not found in active or archive"
}
},
"security": [
{
"access-token": []
},
{
"access-token": []
}
],
"summary": "Update, archive or restore an employee",
"tags": [
"Employees"
]
}
},
"/employees/profile/{email}": {
"get": {
"operationId": "EmployeesController_findOneProfile",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"description": "Identifier of the employee",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Employee profile found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmployeeProfileItemDto"
}
}
}
},
"400": {
"description": "Employee profile not found"
}
},
"security": [
{
"access-token": []
}
],
"summary": "Find employee profile",
"tags": [
"Employees"
]
}
},
"/notifications/summary": {
"get": {
"operationId": "NotificationsController_summary",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Notifications"
]
}
},
"/notifications/stream": {
"get": {
"operationId": "NotificationsController_stream",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Notifications"
]
}
},
"/oauth-sessions": {
"post": {
"operationId": "OauthSessionsController_create",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
},
"responses": {
"201": {
"description": "OAuth session created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
},
"400": {
"description": "Incomplete task or invalid data"
}
},
"security": [
{
"sessions": []
}
],
"summary": "Create OAuth session",
"tags": [
"OAuth Sessions"
]
},
"get": {
"operationId": "OauthSessionsController_findAll",
"parameters": [],
"responses": {
"201": {
"description": "List of OAuth session found",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
}
},
"400": {
"description": "List of OAuth session not found"
}
},
"security": [
{
"sessions": []
}
],
"summary": "Find all OAuth session",
"tags": [
"OAuth Sessions"
]
}
},
"/oauth-sessions/{id}": {
"get": {
"operationId": "OauthSessionsController_findOne",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"201": {
"description": "OAuth session found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
},
"400": {
"description": "OAuth session not found"
}
},
"security": [
{
"sessions": []
}
],
"summary": "Find OAuth session",
"tags": [
"OAuth Sessions"
]
},
"patch": {
"operationId": "OauthSessionsController_update",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateOauthSessionDto"
}
}
}
},
"responses": {
"201": {
"description": "OAuth session updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
},
"400": {
"description": "OAuth session not found"
}
},
"security": [
{
"sessions": []
}
],
"summary": "Update OAuth session",
"tags": [
"OAuth Sessions"
]
},
"delete": {
"operationId": "OauthSessionsController_remove",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"201": {
"description": "OAuth session deleted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateOauthSessionDto"
}
}
}
},
"400": {
"description": "OAuth session not found"
}
},
"security": [
{
"sessions": []
}
],
"summary": "Delete OAuth session",
"tags": [
"OAuth Sessions"
]
}
},
"/preferences/{email}": {
"patch": {
"operationId": "PreferencesController_updatePreferences",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreferencesDto"
}
}
}
},
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Preferences"
]
}
},
"/schedule-presets/{email}": {
"put": {
"operationId": "SchedulePresetsController_upsert",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "action",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SchedulePresetsDto"
}
}
}
},
"responses": {
"200": {
"description": ""
}
},
"tags": [
"SchedulePresets"
]
},
"get": {
"operationId": "SchedulePresetsController_findListByEmail",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"SchedulePresets"
]
}
},
"/schedule-presets/apply-presets/{email}": {
"post": {
"operationId": "SchedulePresetsController_applyPresets",
"parameters": [
{
"name": "email",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "preset",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "start",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"201": {
"description": ""
}
},
"tags": [
"SchedulePresets"
]
}
},
"/shift": {
"get": {
"operationId": "ShiftController_getShiftsByIds",
"parameters": [
{
"name": "shift_ids",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Shift"
]
},
"patch": {
"operationId": "ShiftController_updateBatch",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Shift"
]
}
},
"/shift/{timesheet_id}": {
"post": {
"operationId": "ShiftController_createBatch",
"parameters": [
{
"name": "timesheet_id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"responses": {
"201": {
"description": ""
}
},
"tags": [
"Shift"
]
}
},
"/shift/{shift_id}": {
"delete": {
"operationId": "ShiftController_remove",
"parameters": [
{
"name": "shift_id",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Shift"
]
}
},
"/timesheets": {
"get": {
"operationId": "TimesheetController_getTimesheetByIds",
"parameters": [
{
"name": "employee_email",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "year",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "period_number",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"Timesheet"
]
}
}
},
"info": {
"title": "Targo_Backend",
"description": "Documentation de l`API REST pour Targo (NestJS + Prisma)",
"version": "1.0",
"contact": {}
},
"tags": [
{
"name": "Users",
"description": ""
},
{
"name": "Employees",
"description": ""
},
{
"name": "Customers",
"description": ""
},
{
"name": "Timesheets",
"description": ""
},
{
"name": "Shifts",
"description": ""
},
{
"name": "Leave Requests",
"description": ""
},
{
"name": "Shift Codes",
"description": ""
},
{
"name": "OAuth Access Tokens",
"description": ""
},
{
"name": "Authorization",
"description": ""
}
],
"servers": [],
"components": {
"securitySchemes": {
"access-token": {
"scheme": "bearer",
"bearerFormat": "JWT",
"type": "http",
"name": "Authorization",
"description": "Invalid JWT token",
"in": "header"
}
},
"schemas": {
"EmployeeListItemDto": {
"type": "object",
"properties": {}
},
"UpdateEmployeeDto": {
"type": "object",
"properties": {
"id": {
"type": "number",
"example": 1,
"description": "Unique ID of an employee(primary-key, auto-incremented)"
},
"user_id": {
"type": "string",
"example": "0e6e2e1f-b157-4c7c-ae3f-999b3e4f914d",
"description": "UUID of the user linked to that employee"
},
"first_name": {
"type": "string",
"example": "Frodo",
"description": "Employee`s first name"
},
"last_name": {
"type": "string",
"example": "Baggins",
"description": "Employee`s last name"
},
"email": {
"type": "string",
"example": "i_cant_do_this_sam@targointernet.com",
"description": "Employee`s email"
},
"phone_number": {
"type": "string",
"example": "82538437464",
"description": "Employee`s phone number"
},
"residence": {
"type": "string",
"example": "1 Bagshot Row, Hobbiton, The Shire, Middle-earth",
"description": "Employee`s residence"
},
"external_payroll_id": {
"type": "number",
"example": 7464,
"description": "external ID for the pay system"
},
"company_code": {
"type": "number",
"example": 335567447,
"description": "Employee`s company code"
},
"job_title": {
"type": "string",
"example": "technicient",
"description": "employee`s job title"
},
"first_work_day": {
"format": "date-time",
"type": "string",
"example": "23/09/3018",
"description": "New hire date or undefined"
},
"last_work_day": {
"format": "date-time",
"type": "string",
"example": "25/03/3019",
"description": "Termination date (null to restore)"
},
"supervisor_id": {
"type": "number",
"description": "Supervisor ID"
}
}
},
"CreateEmployeeDto": {
"type": "object",
"properties": {
"id": {
"type": "number",
"example": 1,
"description": "Unique ID of an employee(primary-key, auto-incremented)"
},
"user_id": {
"type": "string",
"example": "0e6e2e1f-b157-4c7c-ae3f-999b3e4f914d",
"description": "UUID of the user linked to that employee"
},
"first_name": {
"type": "string",
"example": "Frodo",
"description": "Employee`s first name"
},
"last_name": {
"type": "string",
"example": "Baggins",
"description": "Employee`s last name"
},
"email": {
"type": "string",
"example": "i_cant_do_this_sam@targointernet.com",
"description": "Employee`s email"
},
"phone_number": {
"type": "string",
"example": "82538437464",
"description": "Employee`s phone number"
},
"residence": {
"type": "string",
"example": "1 Bagshot Row, Hobbiton, The Shire, Middle-earth",
"description": "Employee`s residence"
},
"external_payroll_id": {
"type": "number",
"example": 7464,
"description": "external ID for the pay system"
},
"company_code": {
"type": "number",
"example": 335567447,
"description": "Employee`s company code"
},
"job_title": {
"type": "string",
"example": "technicient",
"description": "employee`s job title"
},
"first_work_day": {
"type": "string",
"example": "23/09/3018",
"description": "Employee`s first working day"
},
"last_work_day": {
"type": "string",
"example": "25/03/3019",
"description": "Employee`s last working day"
}
},
"required": [
"id",
"user_id",
"first_name",
"last_name",
"email",
"phone_number",
"external_payroll_id",
"company_code",
"job_title",
"first_work_day"
]
},
"EmployeeProfileItemDto": {
"type": "object",
"properties": {}
},
"CreateOauthSessionDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "cklwi0vb70000z2z20q6f19qk",
"description": "Unique ID of an OAuth token (auto-generated)"
},
"user_id": {
"type": "string",
"example": "S7A2U8R7O6N6",
"description": "User`s unique identification number"
},
"application": {
"type": "string",
"example": "app.targo.ca",
"description": "URL in which the access token is used for"
},
"access_token": {
"type": "string",
"example": "L5O6R4D3/O6F3#T8H4E3&R6I4N6G4S7 ...",
"description": "Access token"
},
"refresh_token": {
"type": "string",
"example": "Th3731102h1p07Th3R1n92",
"description": "Refresh token"
},
"access_token_expiry": {
"format": "date-time",
"type": "string",
"example": "25/12/3018",
"description": "Access token`s expiry date"
},
"refresh_token_expiry": {
"format": "date-time",
"type": "string",
"example": "26/02/3019",
"description": "Refresh token`s expiry date"
},
"scopes": {
"example": "access tolkiens, email, etc... ",
"description": "scopes of infos linked to the access token",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"id",
"user_id",
"application",
"access_token",
"refresh_token",
"access_token_expiry"
]
},
"UpdateOauthSessionDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "cklwi0vb70000z2z20q6f19qk",
"description": "Unique ID of an OAuth token (auto-generated)"
},
"user_id": {
"type": "string",
"example": "S7A2U8R7O6N6",
"description": "User`s unique identification number"
},
"application": {
"type": "string",
"example": "app.targo.ca",
"description": "URL in which the access token is used for"
},
"access_token": {
"type": "string",
"example": "L5O6R4D3/O6F3#T8H4E3&R6I4N6G4S7 ...",
"description": "Access token"
},
"refresh_token": {
"type": "string",
"example": "Th3731102h1p07Th3R1n92",
"description": "Refresh token"
},
"access_token_expiry": {
"format": "date-time",
"type": "string",
"example": "25/12/3018",
"description": "Access token`s expiry date"
},
"refresh_token_expiry": {
"format": "date-time",
"type": "string",
"example": "26/02/3019",
"description": "Refresh token`s expiry date"
},
"scopes": {
"example": "access tolkiens, email, etc... ",
"description": "scopes of infos linked to the access token",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PreferencesDto": {
"type": "object",
"properties": {}
},
"SchedulePresetsDto": {
"type": "object",
"properties": {}
}
}
}
}