feat: align RU validation, error contract, and generator runtime templates
Wire DSL-derived field labels, safe API error JSON (string|string[]), decimal/enum DTO fixes, and client dataProvider without comma-splitting. Add generation/templates/runtime as canonical source copied on generate; extend AID bundle, prompts, validation gate, and docs.
This commit is contained in:
@@ -8,34 +8,7 @@ import {
|
||||
import { AppModule } from './app.module';
|
||||
import { RuntimeEnvironment } from './config/env.validation';
|
||||
import { ApiExceptionFilter } from './common/filters/api-exception.filter';
|
||||
|
||||
const FIELD_LABELS: Record<string, string> = {
|
||||
code: 'Код',
|
||||
name: 'Название',
|
||||
manufacturer: 'Производитель',
|
||||
maintenanceIntervalHours: 'Интервал ТО (часы)',
|
||||
overhaulIntervalHours: 'Интервал капремонта (часы)',
|
||||
inventoryNumber: 'Инвентарный номер',
|
||||
serialNumber: 'Серийный номер',
|
||||
equipmentTypeCode: 'Тип оборудования',
|
||||
equipmentId: 'Оборудование',
|
||||
status: 'Статус',
|
||||
location: 'Местоположение',
|
||||
commissionedAt: 'Дата ввода в эксплуатацию',
|
||||
totalEngineHours: 'Наработка общая',
|
||||
engineHoursSinceLastRepair: 'Наработка после ремонта',
|
||||
lastRepairAt: 'Дата последнего ремонта',
|
||||
notes: 'Примечание',
|
||||
number: 'Номер',
|
||||
repairKind: 'Вид ремонта',
|
||||
plannedAt: 'Плановая дата',
|
||||
startedAt: 'Дата начала',
|
||||
completedAt: 'Дата завершения',
|
||||
contractor: 'Подрядчик',
|
||||
engineHoursAtRepair: 'Наработка на момент ремонта',
|
||||
description: 'Описание',
|
||||
id: 'Идентификатор',
|
||||
};
|
||||
import { FIELD_LABELS } from './common/field-labels.generated';
|
||||
|
||||
function prettifyFieldName(field: string): string {
|
||||
if (FIELD_LABELS[field]) return FIELD_LABELS[field];
|
||||
@@ -60,9 +33,12 @@ function constraintToRuMessage(field: string, constraint: string): string {
|
||||
return `Поле "${label}" должно быть UUID`;
|
||||
case 'isNumberString':
|
||||
return `Поле "${label}" должно быть числом`;
|
||||
case 'isNumber':
|
||||
return `Поле "${label}" должно быть числом`;
|
||||
case 'isIso8601':
|
||||
return `Поле "${label}" должно содержать корректную дату`;
|
||||
case 'isEnum':
|
||||
case 'isIn':
|
||||
return `Поле "${label}" содержит недопустимое значение`;
|
||||
default:
|
||||
return `Поле "${label}" заполнено некорректно`;
|
||||
|
||||
Reference in New Issue
Block a user