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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user