Files
KIS-TOiR/domain/toir.api.dsl

1291 lines
31 KiB
Plaintext
Raw Permalink 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.
// =============================================================================
// Enums (справочно — не дублируются, только ссылки)
// =============================================================================
enum EquipmentStatus {
value Active {
label "В эксплуатации";
}
value Repair {
label "В ремонте";
}
value Reserve {
label "В резерве";
}
value WriteOff {
label "Списано";
}
}
enum laborOperation {
description "Трудовые операции";
value Manual {
label "Ручные";
}
value MachineManual {
label "Машинно-ручные";
}
value Machine {
label "Машинные";
}
}
enum EnumPeriodicityTO {
value Ежедневное {
label "Ежедневное";
}
value Еженедельное {
label "Еженедельное";
}
value Ежемесячное {
label "Ежемесячное";
}
value Полугодовое {
label "Полугодовое";
}
value Годовое {
label "Годовое";
}
}
enum Role {
value Исполнитель {
label "Исполнитель";
}
value Подписант {
label "Подписант";
}
value Пользователь {
label "Пользователь";
}
}
enum CategoryPart {
value Расходник {
label "Расходник";
}
value Запчасть {
label "Запчасть";
}
value Инструмент {
label "Инструмент";
}
value Спецодежда {
label "Спецодежда";
}
}
enum EquipmentType {
description "Типы оборудования";
value Производственное {
label "производственное";
}
value Энергетическое {
label "энергетическое";
}
value Насосное {
label "насосное";
}
value Компрессорное {
label "компрессорное";
}
}
// =============================================================================
// DTO — Equipment
// =============================================================================
dto DTO.Equipment {
description "Оборудование — полный response-объект";
attribute id {
type uuid;
map Equipment.id;
description "Идентификатор оборудования";
}
attribute name {
type string;
map Equipment.name;
description "Название оборудования";
}
attribute serialNumber {
type string;
map Equipment.serialNumber;
description "Заводской (серийный) номер";
}
attribute inventoryNumber {
type string;
map Equipment.inventoryNumber;
description "Инвентарный номер";
is unique;
}
attribute equipmentType {
type EquipmentType;
map Equipment.equipmentType;
description "Тип оборудования";
is required;
}
attribute dateOfInspection {
type date;
map Equipment.dateOfInspection;
description "Дата проверки";
}
attribute periodicityTO {
type EnumPeriodicityTO;
map Equipment.periodicityTO;
description "Периодичность ТО";
is required;
}
attribute location {
type string;
map Equipment.location;
description "Место эксплуатации / скважина / куст";
}
attribute status {
type EquipmentStatus;
map Equipment.status;
description "Текущий статус";
is required;
}
attribute commissionedAt {
type date;
map Equipment.commissionedAt;
description "Год изготовления";
}
attribute totalEngineHours {
type decimal;
map Equipment.totalEngineHours;
description "Общая наработка, моточасов";
}
attribute engineHoursSinceLastRepair {
type decimal;
map Equipment.engineHoursSinceLastRepair;
description "Наработка с последнего ремонта, моточасов";
}
attribute lastRepairAt {
type date;
map Equipment.lastRepairAt;
description "Дата последнего ремонта";
}
attribute notes {
type text;
map Equipment.notes;
description "Примечания";
}
attribute workAsPartOf {
type laborOperation;
map Equipment.workAsPartOf;
description "Работы в составе";
}
attribute fuelConsumed {
type number;
map Equipment.fuelConsumed;
description "Расход топлива";
}
}
dto DTO.EquipmentCreate {
description "Тело запроса на создание оборудования";
attribute name {
type string;
map Equipment.name;
description "Название оборудования";
is required;
}
attribute serialNumber {
type string;
map Equipment.serialNumber;
description "Заводской (серийный) номер";
is required;
}
attribute inventoryNumber {
type string;
map Equipment.inventoryNumber;
description "Инвентарный номер";
is required;
is unique;
}
attribute equipmentType {
type EquipmentType;
map Equipment.equipmentType;
description "Тип оборудования";
is required;
}
attribute dateOfInspection {
type date;
map Equipment.dateOfInspection;
description "Дата проверки";
is nullable;
}
attribute periodicityTO {
type EnumPeriodicityTO;
map Equipment.periodicityTO;
description "Периодичность ТО";
is required;
}
attribute location {
type string;
map Equipment.location;
description "Место эксплуатации / скважина / куст";
is nullable;
}
attribute status {
type EquipmentStatus;
map Equipment.status;
description "Текущий статус";
is required;
}
attribute commissionedAt {
type date;
map Equipment.commissionedAt;
description "Год изготовления";
is nullable;
}
attribute totalEngineHours {
type decimal;
map Equipment.totalEngineHours;
description "Общая наработка, моточасов";
is nullable;
}
attribute engineHoursSinceLastRepair {
type decimal;
map Equipment.engineHoursSinceLastRepair;
description "Наработка с последнего ремонта, моточасов";
is nullable;
}
attribute lastRepairAt {
type date;
map Equipment.lastRepairAt;
description "Дата последнего ремонта";
is nullable;
}
attribute notes {
type text;
map Equipment.notes;
description "Примечания";
is nullable;
}
attribute workAsPartOf {
type laborOperation;
map Equipment.workAsPartOf;
description "Работы в составе";
is nullable;
}
attribute fuelConsumed {
type number;
map Equipment.fuelConsumed;
description "Расход топлива";
is nullable;
}
}
dto DTO.EquipmentUpdate {
description "Тело запроса на обновление оборудования (частичное обновление)";
attribute name {
type string;
map Equipment.name;
description "Название оборудования";
is nullable;
}
attribute serialNumber {
type string;
map Equipment.serialNumber;
description "Заводской (серийный) номер";
is nullable;
}
attribute inventoryNumber {
type string;
map Equipment.inventoryNumber;
description "Инвентарный номер";
is nullable;
is unique;
}
attribute equipmentType {
type EquipmentType;
map Equipment.equipmentType;
description "Тип оборудования";
is nullable;
}
attribute dateOfInspection {
type date;
map Equipment.dateOfInspection;
description "Дата проверки";
is nullable;
}
attribute periodicityTO {
type EnumPeriodicityTO;
map Equipment.periodicityTO;
description "Периодичность ТО";
is nullable;
}
attribute location {
type string;
map Equipment.location;
description "Место эксплуатации / скважина / куст";
is nullable;
}
attribute status {
type EquipmentStatus;
map Equipment.status;
description "Текущий статус";
is nullable;
}
attribute commissionedAt {
type date;
map Equipment.commissionedAt;
description "Год изготовления";
is nullable;
}
attribute totalEngineHours {
type decimal;
map Equipment.totalEngineHours;
description "Общая наработка, моточасов";
is nullable;
}
attribute engineHoursSinceLastRepair {
type decimal;
map Equipment.engineHoursSinceLastRepair;
description "Наработка с последнего ремонта, моточасов";
is nullable;
}
attribute lastRepairAt {
type date;
map Equipment.lastRepairAt;
description "Дата последнего ремонта";
is nullable;
}
attribute notes {
type text;
map Equipment.notes;
description "Примечания";
is nullable;
}
attribute workAsPartOf {
type laborOperation;
map Equipment.workAsPartOf;
description "Работы в составе";
is nullable;
}
attribute fuelConsumed {
type number;
map Equipment.fuelConsumed;
description "Расход топлива";
is nullable;
}
}
dto DTO.EquipmentFilter {
description "Фильтры для списка оборудования";
attribute inventoryNumber {
type string;
description "Частичное совпадение по инвентарному номеру";
is nullable;
}
attribute serialNumber {
type string;
description "Частичное совпадение по заводскому номеру";
is nullable;
}
attribute name {
type string;
description "Частичное совпадение по наименованию";
is nullable;
}
attribute equipmentTypeCode {
type string;
description "Точное совпадение по коду вида оборудования";
is nullable;
}
attribute equipmentPeriodicityTO {
type string;
description "Точное совпадение по периодичности ТО оборудования";
is nullable;
}
attribute dateOfInspection {
type date;
description "Дата проверки";
is nullable;
}
attribute status {
type EquipmentStatus;
description "Фильтр по статусу";
is nullable;
}
attribute location {
type string;
description "Частичное совпадение по месту эксплуатации";
is nullable;
}
attribute workAsPartOf {
type laborOperation;
description "Фильтр по трудовой операции";
is nullable;
}
}
dto DTO.EquipmentListRequest {
description "Запрос постраничного списка оборудования с фильтрацией";
attribute filter {
type DTO.EquipmentFilter;
description "Фильтры";
is nullable;
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
is nullable;
}
}
dto DTO.EquipmentListResponse {
description "Ответ постраничного списка оборудования";
attribute content {
type DTO.Equipment[];
description "Список оборудования";
}
attribute page {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
// =============================================================================
// DTO — Employee
// =============================================================================
dto DTO.Employee {
description "Сотрудник — полный response-объект";
attribute code {
type string;
map Employee.code;
description "Номер сотрудника (Табельный номер)";
key primary;
}
attribute fullName {
type string;
map Employee.fullName;
description "ФИО сотрудника";
label "Полное имя";
}
attribute role {
type Role;
map Employee.role;
description "Роль сотрудника";
label "Роль";
is required;
}
attribute position {
type string;
map Employee.position;
description "Должность сотрудника";
}
attribute boss {
type DTO.Employee;
map Employee.boss;
description "Руководитель";
is nullable;
}
attribute subordinates {
type DTO.Employee[];
map Employee.subordinates;
description "Подчинённые";
}
attribute price {
type number;
map Employee.price;
description "Стоимость часа работы сотрудника";
}
attribute phoneNumber {
type number;
map Employee.phoneNumber;
description "Номер телефона";
}
}
dto DTO.EmployeeCreate {
description "Тело запроса на создание сотрудника";
attribute code {
type string;
map Employee.code;
description "Номер сотрудника (Табельный номер)";
is required;
}
attribute fullName {
type string;
map Employee.fullName;
description "ФИО сотрудника";
label "Полное имя";
is required;
}
attribute role {
type Role;
map Employee.role;
description "Роль сотрудника";
label "Роль";
is required;
}
attribute position {
type string;
map Employee.position;
description "Должность сотрудника";
is required;
}
attribute boss {
type string;
map Employee.boss;
description "Код руководителя";
is nullable;
}
attribute price {
type number;
map Employee.price;
description "Стоимость часа работы сотрудника";
is nullable;
}
attribute phoneNumber {
type number;
map Employee.phoneNumber;
description "Номер телефона";
is nullable;
}
}
dto DTO.EmployeeUpdate {
description "Тело запроса на обновление сотрудника (частичное обновление)";
attribute fullName {
type string;
map Employee.fullName;
description "ФИО сотрудника";
label "Полное имя";
is nullable;
}
attribute role {
type Role;
map Employee.role;
description "Роль сотрудника";
label "Роль";
is nullable;
}
attribute position {
type string;
map Employee.position;
description "Должность сотрудника";
is nullable;
}
attribute boss {
type string;
map Employee.boss;
description "Код руководителя";
is nullable;
}
attribute price {
type number;
map Employee.price;
description "Стоимость часа работы сотрудника";
is nullable;
}
attribute phoneNumber {
type number;
map Employee.phoneNumber;
description "Номер телефона";
is nullable;
}
}
dto DTO.EmployeeFilter {
description "Фильтры для списка сотрудников";
attribute code {
type string;
description "Частичное совпадение по табельному номеру";
is nullable;
}
attribute fullName {
type string;
description "Частичное совпадение по ФИО";
is nullable;
}
attribute role {
type Role;
description "Точное совпадение по роли";
is nullable;
}
attribute position {
type string;
description "Частичное совпадение по должности";
is nullable;
}
}
dto DTO.EmployeeListRequest {
description "Запрос постраничного списка сотрудников с фильтрацией";
attribute filter {
type DTO.EmployeeFilter;
description "Фильтры";
is nullable;
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
is nullable;
}
}
dto DTO.EmployeeListResponse {
description "Ответ постраничного списка сотрудников";
attribute content {
type DTO.Employee[];
description "Список сотрудников";
}
attribute page {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
// =============================================================================
// DTO — Part (ЗИП/ТМЦ)
// =============================================================================
dto DTO.Part {
description "ЗИП/ТМЦ — полный response-объект";
attribute id {
type uuid;
map Part.id;
description "Идентификатор ЗИП/ТМЦ";
}
attribute name {
type string;
map Part.name;
description "Название";
}
attribute categories {
type CategoryPart;
map Part.categories;
description "Категории";
is nullable;
}
attribute price {
type number;
map Part.price;
description "Стоимость ЗИП/ТМЦ";
}
attribute description {
type string;
map Part.description;
description "Описание ЗИП/ТМЦ";
}
attribute serialNumber {
type string;
map Part.serialNumber;
description "Серийный номер запасных частей / инструментов / расходников";
}
}
dto DTO.PartCreate {
description "Тело запроса на создание ЗИП/ТМЦ";
attribute name {
type string;
map Part.name;
description "Название";
is required;
}
attribute categories {
type CategoryPart;
map Part.categories;
description "Категории";
is nullable;
}
attribute price {
type number;
map Part.price;
description "Стоимость ЗИП/ТМЦ";
is nullable;
}
attribute description {
type string;
map Part.description;
description "Описание ЗИП/ТМЦ";
is nullable;
}
attribute serialNumber {
type string;
map Part.serialNumber;
description "Серийный номер запасных частей / инструментов / расходников";
is nullable;
}
}
dto DTO.PartUpdate {
description "Тело запроса на обновление ЗИП/ТМЦ (частичное обновление)";
attribute name {
type string;
map Part.name;
description "Название";
is nullable;
}
attribute categories {
type CategoryPart;
map Part.categories;
description "Категории";
is nullable;
}
attribute price {
type number;
map Part.price;
description "Стоимость ЗИП/ТМЦ";
is nullable;
}
attribute description {
type string;
map Part.description;
description "Описание ЗИП/ТМЦ";
is nullable;
}
attribute serialNumber {
type string;
map Part.serialNumber;
description "Серийный номер запасных частей / инструментов / расходников";
is nullable;
}
}
dto DTO.PartFilter {
description "Фильтры для списка ЗИП/ТМЦ";
attribute name {
type string;
description "Частичное совпадение по названию";
is nullable;
}
attribute categories {
type CategoryPart;
description "Точное совпадение по категории";
is nullable;
}
attribute serialNumber {
type string;
description "Частичное совпадение по серийному номеру";
is nullable;
}
}
dto DTO.PartListRequest {
description "Запрос постраничного списка ЗИП/ТМЦ с фильтрацией";
attribute filter {
type DTO.PartFilter;
description "Фильтры";
is nullable;
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
is nullable;
}
}
dto DTO.PartListResponse {
description "Ответ постраничного списка ЗИП/ТМЦ";
attribute content {
type DTO.Part[];
description "Список ЗИП/ТМЦ";
}
attribute page {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
// =============================================================================
// DTO — CategoryResource
// =============================================================================
dto DTO.CategoryResource {
description "Категория ресурсов — полный response-объект";
attribute id {
type uuid;
map CategoryResource.id;
description "Идентификатор категории ресурсов";
}
attribute part {
type DTO.Part;
map CategoryResource.part;
description "ЗИП/ТМЦ";
is nullable;
}
attribute employee {
type DTO.Employee;
map CategoryResource.employee;
description "Сотрудник";
is nullable;
}
}
dto DTO.CategoryResourceCreate {
description "Тело запроса на создание категории ресурсов";
attribute partId {
type uuid;
map CategoryResource.part;
description "Идентификатор ЗИП/ТМЦ";
is nullable;
}
attribute employeeCode {
type string;
map CategoryResource.employee;
description "Код сотрудника";
is nullable;
}
}
dto DTO.CategoryResourceUpdate {
description "Тело запроса на обновление категории ресурсов (частичное обновление)";
attribute partId {
type uuid;
map CategoryResource.part;
description "Идентификатор ЗИП/ТМЦ";
is nullable;
}
attribute employeeCode {
type string;
map CategoryResource.employee;
description "Код сотрудника";
is nullable;
}
}
dto DTO.CategoryResourceFilter {
description "Фильтры для списка категорий ресурсов";
attribute partName {
type string;
description "Частичное совпадение по названию ЗИП/ТМЦ";
is nullable;
}
attribute employeeName {
type string;
description "Частичное совпадение по ФИО сотрудника";
is nullable;
}
}
dto DTO.CategoryResourceListRequest {
description "Запрос постраничного списка категорий ресурсов с фильтрацией";
attribute filter {
type DTO.CategoryResourceFilter;
description "Фильтры";
is nullable;
}
attribute page {
type DTO.PageRequest;
description "Параметры пагинации";
is nullable;
}
}
dto DTO.CategoryResourceListResponse {
description "Ответ постраничного списка категорий ресурсов";
attribute content {
type DTO.CategoryResource[];
description "Список категорий ресурсов";
}
attribute page {
type DTO.PageInfo;
description "Метаданные пагинации";
}
}
// =============================================================================
// DTO — PriceList
// =============================================================================
dto DTO.PriceList {
description "Регистр цен — response-объект";
attribute costOfWorkingHours {
type number;
description "Стоимость часов работы";
sync Employee.price;
}
attribute partPrice {
type number;
description "Стоимость ЗИП/ТМЦ";
sync Part.price;
}
}
// =============================================================================
// API — Equipment
// =============================================================================
api API.Equipment {
description "API управления справочником оборудования";
endpoint getEquipmentById {
label "GET /equipments/{id}";
description "Получить оборудование по идентификатору";
attribute id {
type uuid;
description "Идентификатор оборудования";
}
attribute response {
type DTO.Equipment;
}
}
endpoint listEquipments {
label "POST /equipments/page";
description "Постраничный список оборудования с фильтрацией";
attribute request {
type DTO.EquipmentListRequest;
}
attribute response {
type DTO.EquipmentListResponse;
}
}
endpoint createEquipment {
label "POST /equipments";
description "Создать единицу оборудования";
attribute request {
type DTO.EquipmentCreate;
}
}
endpoint updateEquipment {
label "PUT /equipments/{id}";
description "Обновить оборудование";
attribute id {
type uuid;
description "Идентификатор оборудования";
}
attribute request {
type DTO.EquipmentUpdate;
}
}
endpoint deleteEquipment {
label "DELETE /equipments/{id}";
description "Удалить единицу оборудования";
attribute id {
type uuid;
description "Идентификатор оборудования";
}
}
}
// =============================================================================
// API — Employee
// =============================================================================
api API.Employee {
description "API управления справочником сотрудников";
endpoint getEmployeeByCode {
label "GET /employees/{code}";
description "Получить сотрудника по табельному номеру";
attribute code {
type string;
description "Табельный номер сотрудника";
}
attribute response {
type DTO.Employee;
}
}
endpoint listEmployees {
label "POST /employees/page";
description "Постраничный список сотрудников с фильтрацией";
attribute request {
type DTO.EmployeeListRequest;
}
attribute response {
type DTO.EmployeeListResponse;
}
}
endpoint createEmployee {
label "POST /employees";
description "Создать сотрудника";
attribute request {
type DTO.EmployeeCreate;
}
}
endpoint updateEmployee {
label "PUT /employees/{code}";
description "Обновить сотрудника";
attribute code {
type string;
description "Табельный номер сотрудника";
}
attribute request {
type DTO.EmployeeUpdate;
}
}
endpoint deleteEmployee {
label "DELETE /employees/{code}";
description "Удалить сотрудника";
attribute code {
type string;
description "Табельный номер сотрудника";
}
}
}
// =============================================================================
// API — Part (ЗИП/ТМЦ)
// =============================================================================
api API.Part {
description "API управления справочником ЗИП/ТМЦ";
endpoint getPartById {
label "GET /parts/{id}";
description "Получить ЗИП/ТМЦ по идентификатору";
attribute id {
type uuid;
description "Идентификатор ЗИП/ТМЦ";
}
attribute response {
type DTO.Part;
}
}
endpoint listParts {
label "POST /parts/page";
description "Постраничный список ЗИП/ТМЦ с фильтрацией";
attribute request {
type DTO.PartListRequest;
}
attribute response {
type DTO.PartListResponse;
}
}
endpoint createPart {
label "POST /parts";
description "Создать ЗИП/ТМЦ";
attribute request {
type DTO.PartCreate;
}
}
endpoint updatePart {
label "PUT /parts/{id}";
description "Обновить ЗИП/ТМЦ";
attribute id {
type uuid;
description "Идентификатор ЗИП/ТМЦ";
}
attribute request {
type DTO.PartUpdate;
}
}
endpoint deletePart {
label "DELETE /parts/{id}";
description "Удалить ЗИП/ТМЦ";
attribute id {
type uuid;
description "Идентификатор ЗИП/ТМЦ";
}
}
}
// =============================================================================
// API — CategoryResource
// =============================================================================
api API.CategoryResource {
description "API управления категориями ресурсов";
endpoint getCategoryResourceById {
label "GET /category-resources/{id}";
description "Получить категорию ресурсов по идентификатору";
attribute id {
type uuid;
description "Идентификатор категории ресурсов";
}
attribute response {
type DTO.CategoryResource;
}
}
endpoint listCategoryResources {
label "POST /category-resources/page";
description "Постраничный список категорий ресурсов с фильтрацией";
attribute request {
type DTO.CategoryResourceListRequest;
}
attribute response {
type DTO.CategoryResourceListResponse;
}
}
endpoint createCategoryResource {
label "POST /category-resources";
description "Создать категорию ресурсов";
attribute request {
type DTO.CategoryResourceCreate;
}
}
endpoint updateCategoryResource {
label "PUT /category-resources/{id}";
description "Обновить категорию ресурсов";
attribute id {
type uuid;
description "Идентификатор категории ресурсов";
}
attribute request {
type DTO.CategoryResourceUpdate;
}
}
endpoint deleteCategoryResource {
label "DELETE /category-resources/{id}";
description "Удалить категорию ресурсов";
attribute id {
type uuid;
description "Идентификатор категории ресурсов";
}
}
}
// =============================================================================
// API — PriceList
// =============================================================================
api API.PriceList {
description "API получения регистра цен";
endpoint getPriceList {
label "GET /price-list";
description "Получить регистр цен";
attribute response {
type DTO.PriceList;
}
}
}