23 lines
898 B
TypeScript
23 lines
898 B
TypeScript
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: hiboutikDto.category_position,
|
|
webEnabled: hiboutikDto.category_enabled_www === 1,
|
|
};
|
|
}
|
|
|
|
toHiboutik(): CategoryHiboutikDto {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
}
|