Files
toir-automatization/domain/toir.api.dsl
2026-04-07 19:40:41 +03:00

438 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.
enum EquipmentStatus {
value Active {
label "В эксплуатации";
}
value Repair {
label "В ремонте";
}
value Reserve {
label "В резерве";
}
value WriteOff {
label "Списано";
}
}
// =====================
// DTO
// =====================
dto DTO.Equipment {
description "Полный объект оборудования";
attribute id {
type uuid;
description "Идентификатор оборудования";
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;
}
}
dto DTO.EquipmentCreate {
description "Тело запроса на создание оборудования";
attribute name {
type string;
is required;
description "Название оборудования";
map Equipment.name;
}
attribute serialNumber {
type string;
is required;
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;
is nullable;
description "Текущий статус";
map Equipment.status;
}
}
dto DTO.EquipmentUpdate {
description "Тело запроса на обновление оборудования (частичное)";
attribute name {
type string;
is nullable;
description "Название оборудования";
map Equipment.name;
}
attribute serialNumber {
type string;
is nullable;
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;
is nullable;
description "Текущий статус";
map Equipment.status;
}
}
dto DTO.EquipmentListRequest {
description "Запрос постраничного списка оборудования с фильтрацией";
attribute filter {
type DTO.Filter;
is nullable;
description "Фильтр";
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
}
}
dto DTO.EquipmentListResponse {
description "Ответ со списком оборудования";
attribute content {
type DTO.Equipment[];
description "Список оборудования";
}
attribute pageInfo {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
dto DTO.ChangeEquipmentStatus {
description "Полный объект документа изменения статуса оборудования";
attribute equipmentId {
type uuid;
description "Оборудование";
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
is nullable;
description "Номер";
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
description "Дата изменения статуса";
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
is nullable;
description "Ответственный";
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusCreate {
description "Тело запроса на создание документа изменения статуса";
attribute equipmentId {
type uuid;
is required;
description "Оборудование";
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
is required;
description "Новый статус";
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
is nullable;
description "Номер";
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
is required;
description "Дата изменения статуса";
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
is nullable;
description "Ответственный";
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusUpdate {
description "Тело запроса на обновление документа изменения статуса (частичное)";
attribute equipmentId {
type uuid;
is nullable;
description "Оборудование";
map ChangeEquipmentStatus.equipmentId;
}
attribute newStatus {
type EquipmentStatus;
is nullable;
description "Новый статус";
map ChangeEquipmentStatus.newStatus;
}
attribute number {
type string;
is nullable;
description "Номер";
map ChangeEquipmentStatus.number;
}
attribute date {
type date;
is nullable;
description "Дата изменения статуса";
map ChangeEquipmentStatus.date;
}
attribute responsible {
type string;
is nullable;
description "Ответственный";
map ChangeEquipmentStatus.responsible;
}
}
dto DTO.ChangeEquipmentStatusListRequest {
description "Запрос постраничного списка документов изменения статуса с фильтрацией";
attribute filter {
type DTO.Filter;
is nullable;
description "Фильтр";
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
}
}
dto DTO.ChangeEquipmentStatusListResponse {
description "Ответ со списком документов изменения статуса";
attribute content {
type DTO.ChangeEquipmentStatus[];
description "Список документов изменения статуса";
}
attribute pageInfo {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
// =====================
// API
// =====================
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;
description "Идентификатор оборудования";
}
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;
description "Идентификатор оборудования";
}
attribute request {
type DTO.EquipmentUpdate;
}
}
endpoint deleteEquipment {
label "DELETE /equipment/{id}";
description "Удалить оборудование";
attribute id {
type uuid;
description "Идентификатор оборудования";
}
}
}
api API.ChangeEquipmentStatus {
description "API управления документами изменения статуса оборудования";
endpoint listChangeEquipmentStatus {
label "POST /change-equipment-status/page";
description "Постраничный список документов изменения статуса с фильтрацией";
attribute request {
type DTO.ChangeEquipmentStatusListRequest;
}
attribute response {
type DTO.ChangeEquipmentStatusListResponse;
}
}
endpoint getChangeEquipmentStatus {
label "GET /change-equipment-status/{equipmentId}/{newStatus}";
description "Получить документ изменения статуса по ключу";
attribute equipmentId {
type uuid;
description "Оборудование";
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
}
attribute response {
type DTO.ChangeEquipmentStatus;
}
}
endpoint createChangeEquipmentStatus {
label "POST /change-equipment-status";
description "Создать документ изменения статуса";
attribute request {
type DTO.ChangeEquipmentStatusCreate;
}
}
endpoint updateChangeEquipmentStatus {
label "PUT /change-equipment-status/{equipmentId}/{newStatus}";
description "Обновить документ изменения статуса";
attribute equipmentId {
type uuid;
description "Оборудование";
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
}
attribute request {
type DTO.ChangeEquipmentStatusUpdate;
}
}
endpoint deleteChangeEquipmentStatus {
label "DELETE /change-equipment-status/{equipmentId}/{newStatus}";
description "Удалить документ изменения статуса";
attribute equipmentId {
type uuid;
description "Оборудование";
}
attribute newStatus {
type EquipmentStatus;
description "Новый статус";
}
}
}