Files
cloud-v3/src/current/current.mapper.ts
Первов Артем 05a9e0e535 first commit
2026-06-19 08:18:52 +03:00

25 lines
731 B
TypeScript

import { CurrentResponseDto } from './dto/current-response.dto';
import { CurrentRow } from './current.types';
/** Преобразует строки БД current в стабильный DTO для API. */
export function createCurrentResponse(edge: string, rows: CurrentRow[]): CurrentResponseDto {
return {
edge,
items: rows.map((row) => ({
edge: row.edge,
tag: row.tag,
value: row.value,
createdAt: row.createdAt,
updatedAt: row.updatedAt,
time: row.updatedAt,
name: row.name,
tagGroup: row.tag_group,
min: row.min,
max: row.max,
comment: row.comment,
unitOfMeasurement: row.unit_of_measurement,
precision: row.precision,
})),
};
}