first commit
This commit is contained in:
19
src/tag/tag.mapper.ts
Normal file
19
src/tag/tag.mapper.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { TagResponseDto } from './dto/tag-response.dto';
|
||||
import { TagRow } from './tag.types';
|
||||
|
||||
/** Преобразует строки БД tag в стабильный DTO для API. */
|
||||
export function createTagResponse(rows: TagRow[]): TagResponseDto {
|
||||
return {
|
||||
items: rows.map((row) => ({
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
tagGroup: row.tag_group,
|
||||
min: row.min,
|
||||
max: row.max,
|
||||
comment: row.comment,
|
||||
unitOfMeasurement: row.unit_of_measurement,
|
||||
edgeIds: row.edge_ids ?? [],
|
||||
precision: row.precision,
|
||||
})),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user