Add file attachment functionality for equipment management

- Introduced DTO for file attachments with metadata (objectKey, originalFileName, contentType, sizeBytes, downloadUrl).
- Updated Equipment DTO to include an optional attachment field.
- Implemented endpoints for uploading and deleting equipment attachments.
- Enhanced Equipment service to handle file storage and retrieval using S3.
- Updated EquipmentEdit, EquipmentList, and EquipmentShow components to support file attachment input and display.
- Configured S3 settings in docker-compose and environment files.
This commit is contained in:
Первов Артем
2026-04-21 00:46:17 +03:00
parent 62446f2597
commit b60c4ee0ed
19 changed files with 2274 additions and 38 deletions

View File

@@ -4,6 +4,72 @@
],
"enums": [],
"dtos": [
{
"name": "DTO.FileAttachment",
"description": "Метаданные файла в объектном хранилище (MinIO/S3); бинарные данные в БД не хранятся",
"fields": [
{
"name": "objectKey",
"type": "string",
"required": false,
"nullable": false,
"unique": false,
"primary": false,
"description": "Ключ объекта в бакете",
"map": null,
"sync": false,
"label": null
},
{
"name": "originalFileName",
"type": "string",
"required": false,
"nullable": true,
"unique": false,
"primary": false,
"description": "Исходное имя файла",
"map": null,
"sync": false,
"label": null
},
{
"name": "contentType",
"type": "string",
"required": false,
"nullable": true,
"unique": false,
"primary": false,
"description": "MIME-тип",
"map": null,
"sync": false,
"label": null
},
{
"name": "sizeBytes",
"type": "integer",
"required": false,
"nullable": true,
"unique": false,
"primary": false,
"description": "Размер в байтах",
"map": null,
"sync": false,
"label": null
},
{
"name": "downloadUrl",
"type": "string",
"required": false,
"nullable": true,
"unique": false,
"primary": false,
"description": "Ссылка на скачивание (публичная или presigned)",
"map": null,
"sync": false,
"label": null
}
]
},
{
"name": "DTO.Equipment",
"description": "Полный response-объект для единицы оборудования",
@@ -79,6 +145,18 @@
"map": "Equipment.status",
"sync": false,
"label": null
},
{
"name": "attachment",
"type": "DTO.FileAttachment",
"required": false,
"nullable": true,
"unique": false,
"primary": false,
"description": "Вложение (файл в MinIO/S3)",
"map": "Equipment.attachment",
"sync": false,
"label": null
}
]
},
@@ -682,6 +760,34 @@
"description": null
}
]
},
{
"name": "uploadEquipmentAttachment",
"label": "POST /equipment/{id}/attachment",
"method": "POST",
"path": "/equipment/{id}/attachment",
"description": "Загрузить файл-вложение (multipart/form-data, поле file)",
"attributes": [
{
"name": "id",
"type": "uuid",
"description": null
}
]
},
{
"name": "deleteEquipmentAttachment",
"label": "DELETE /equipment/{id}/attachment",
"method": "DELETE",
"path": "/equipment/{id}/attachment",
"description": "Удалить файл-вложение из хранилища и из записи",
"attributes": [
{
"name": "id",
"type": "uuid",
"description": null
}
]
}
]
},