feat(sync): add converters from Hiboutik DTOs to Prisma inputs

This commit is contained in:
MastersGame
2026-11-05 23:00:48 +01:00
parent 9cfcd12351
commit aa4262c45a
12 changed files with 294 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { Injectable } from '@nestjs/common';
import { CategoryHiboutikDto } from '../hiboutikDTO/category.hiboutik.dto';
import { Converter } from './converter';
import { CategoryCreateInput } from '../../../prisma/generated/models/Category';
@Injectable()
export class CategoryConverter extends Converter<CategoryCreateInput, CategoryHiboutikDto> {
/** The parent is not set here: it is linked afterwards, once every category exists (see CategoryHiboutikService). */
fromHiboutik(hiboutikDto: CategoryHiboutikDto): CategoryCreateInput {
return {
hiboutikId: hiboutikDto.category_id,
name: hiboutikDto.category_name,
enabled: hiboutikDto.category_enabled == 1,
position: Number(hiboutikDto.category_position) || 0,
webEnabled: hiboutikDto.category_enabled_www == 1,
};
}
toHiboutik(): CategoryHiboutikDto {
throw new Error('Method not implemented.');
}
}