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

@@ -1,3 +1,31 @@
dto DTO.FileAttachment {
description "Метаданные файла в объектном хранилище (MinIO/S3); бинарные данные в БД не хранятся";
attribute objectKey {
type string;
description "Ключ объекта в бакете";
}
attribute originalFileName {
type string;
is nullable;
description "Исходное имя файла";
}
attribute contentType {
type string;
is nullable;
description "MIME-тип";
}
attribute sizeBytes {
type integer;
is nullable;
description "Размер в байтах";
}
attribute downloadUrl {
type string;
is nullable;
description "Ссылка на скачивание (публичная или presigned)";
}
}
dto DTO.Equipment {
description "Полный response-объект для единицы оборудования";
attribute id {
@@ -31,6 +59,12 @@ dto DTO.Equipment {
description "Текущий статус";
map Equipment.status;
}
attribute attachment {
type DTO.FileAttachment;
is nullable;
description "Вложение (файл в MinIO/S3)";
map Equipment.attachment;
}
}
dto DTO.EquipmentCreate {
@@ -311,6 +345,22 @@ api API.Equipment {
type uuid;
}
}
endpoint uploadEquipmentAttachment {
label "POST /equipment/{id}/attachment";
description "Загрузить файл-вложение (multipart/form-data, поле file)";
attribute id {
type uuid;
}
}
endpoint deleteEquipmentAttachment {
label "DELETE /equipment/{id}/attachment";
description "Удалить файл-вложение из хранилища и из записи";
attribute id {
type uuid;
}
}
}
api API.EquipmentStatusChange {