Files
toir-light/domain/toir.api.dsl
Первов Артем 4584a0d581 Add download functionality for equipment attachments
- Introduced a new endpoint `GET /equipment/{id}/attachment/download` in the API for downloading equipment attachment files.
- Implemented the `downloadEquipmentAttachmentFile` function in the client to handle file downloads via the API, ensuring proper token management and blob handling.
- Updated the EquipmentAttachmentInput, EquipmentList, and EquipmentShow components to utilize the new download link, enhancing user experience by allowing direct downloads without exposing the MinIO URL.
- Added a new EquipmentAttachmentLink component to encapsulate the download link logic and improve code reusability.
2026-04-21 01:26:00 +03:00

425 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 {
type uuid;
map Equipment.id;
}
attribute name {
type string;
description "Название оборудования";
map Equipment.name;
}
attribute serialNumber {
type string;
description "Заводской (серийный) номер";
map Equipment.serialNumber;
}
attribute dateOfInspection {
type date;
is nullable;
description "Дата поверки";
map Equipment.dateOfInspection;
}
attribute commissionedAt {
type date;
is nullable;
description "Дата изготовления";
map Equipment.commissionedAt;
}
attribute status {
type EquipmentStatus;
description "Текущий статус";
map Equipment.status;
}
attribute attachment {
type DTO.FileAttachment;
is nullable;
description "Вложение (файл в MinIO/S3)";
map Equipment.attachment;
}
}
dto DTO.EquipmentCreate {
description "Тело запроса на создание единицы оборудования";
attribute name {
type string;
description "Название оборудования";
is required;
map Equipment.name;
}
attribute serialNumber {
type string;
description "Заводской (серийный) номер";
is required;
map Equipment.serialNumber;
}
attribute dateOfInspection {
type date;
is nullable;
description "Дата поверки";
map Equipment.dateOfInspection;
}
attribute commissionedAt {
type date;
is nullable;
description "Дата изготовления";
map Equipment.commissionedAt;
}
attribute status {
type EquipmentStatus;
description "Текущий статус";
is required;
map Equipment.status;
}
}
dto DTO.EquipmentUpdate {
description "Тело запроса на обновление единицы оборудования";
attribute name {
type string;
description "Название оборудования";
is nullable;
map Equipment.name;
}
attribute serialNumber {
type string;
description "Заводской (серийный) номер";
is nullable;
map Equipment.serialNumber;
}
attribute dateOfInspection {
type date;
is nullable;
description "Дата поверки";
map Equipment.dateOfInspection;
}
attribute commissionedAt {
type date;
is nullable;
description "Дата изготовления";
map Equipment.commissionedAt;
}
attribute status {
type EquipmentStatus;
description "Текущий статус";
is nullable;
map Equipment.status;
}
}
dto DTO.EquipmentListRequest {
description "Запрос для постраничного получения списка оборудования с фильтрацией";
attribute page {
type DTO.PageRequest;
}
attribute filterName {
type string;
is nullable;
}
attribute filterSerialNumber {
type string;
is nullable;
}
attribute filterStatus {
type EquipmentStatus;
is nullable;
}
}
dto DTO.EquipmentListResponse {
description "Ответ с постраничным списком оборудования и метаданными";
attribute content {
type DTO.Equipment[];
}
attribute pageInfo {
type DTO.PageInfo;
}
}
dto DTO.ChangeEquipmentStatus {
description "Полный response-объект для документа изменения статуса";
attribute equipmentId {
type Equipment;
is nullable;
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
description "Номер";
is nullable;
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
description "Дата изменения статуса";
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
description "Ответственный";
is nullable;
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusCreate {
description "Тело запроса на создание документа изменения статуса";
attribute equipmentId {
type Equipment;
is nullable;
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
is required;
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
description "Номер";
is nullable;
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
description "Дата изменения статуса";
is required;
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
description "Ответственный";
is nullable;
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusUpdate {
description "Тело запроса на обновление документа изменения статуса";
attribute equipmentId {
type Equipment;
is nullable;
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
is nullable;
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
description "Номер";
is nullable;
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
description "Дата изменения статуса";
is nullable;
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
description "Ответственный";
is nullable;
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusListRequest {
description "Запрос для постраничного получения списка документов изменения статуса с фильтрацией";
attribute page {
type DTO.PageRequest;
}
attribute filterEquipmentId {
type uuid;
is nullable;
}
attribute filterNumber {
type string;
is nullable;
}
attribute filterDate {
type date;
is nullable;
}
attribute filterResponsible {
type string;
is nullable;
}
}
dto DTO.ChangeEquipmentStatusListResponse {
description "Ответ с постраничным списком документов изменения статуса и метаданными";
attribute content {
type DTO.ChangeEquipmentStatus[];
}
attribute pageInfo {
type DTO.PageInfo;
}
}
api API.Equipment {
description "API управления справочником оборудования";
endpoint listEquipment {
label "POST /equipment/page";
description "Постраничный список оборудования с фильтрацией";
attribute request {
type DTO.EquipmentListRequest;
}
attribute response {
type DTO.EquipmentListResponse;
}
}
endpoint getEquipment {
label "GET /equipment/{id}";
description "Получить единицу оборудования по идентификатору";
attribute id {
type uuid;
}
attribute response {
type DTO.Equipment;
}
}
endpoint createEquipment {
label "POST /equipment";
description "Создать новую единицу оборудования";
attribute request {
type DTO.EquipmentCreate;
}
}
endpoint updateEquipment {
label "PUT /equipment/{id}";
description "Обновить данные единицы оборудования";
attribute id {
type uuid;
}
attribute request {
type DTO.EquipmentUpdate;
}
}
endpoint deleteEquipment {
label "DELETE /equipment/{id}";
description "Удалить единицу оборудования";
attribute id {
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;
}
}
endpoint downloadEquipmentAttachment {
label "GET /equipment/{id}/attachment/download";
description "Скачать файл-вложение (Content-Disposition: attachment, поток из MinIO)";
attribute id {
type uuid;
}
}
}
api API.EquipmentStatusChange {
description "API управления документами изменения статуса оборудования";
endpoint listStatusChanges {
label "POST /status-changes/page";
description "Постраничный список документов изменения статуса с фильтрацией";
attribute request {
type DTO.ChangeEquipmentStatusListRequest;
}
attribute response {
type DTO.ChangeEquipmentStatusListResponse;
}
}
endpoint getStatusChange {
label "GET /status-changes/{id}";
description "Получить документ изменения статуса по идентификатору";
attribute id {
type uuid;
}
attribute response {
type DTO.ChangeEquipmentStatus;
}
}
endpoint createStatusChange {
label "POST /status-changes";
description "Создать документ изменения статуса оборудования";
attribute request {
type DTO.ChangeEquipmentStatusCreate;
}
}
endpoint updateStatusChange {
label "PUT /status-changes/{id}";
description "Обновить документ изменения статуса";
attribute id {
type uuid;
}
attribute request {
type DTO.ChangeEquipmentStatusUpdate;
}
}
endpoint deleteStatusChange {
label "DELETE /status-changes/{id}";
description "Удалить документ изменения статуса";
attribute id {
type uuid;
}
}
}