23 lines
625 B
TypeScript
23 lines
625 B
TypeScript
import { MenuItemDto } from "src/item/dto/menu-item.dto";
|
|
import { RestaurantDto } from "src/restaurant/dto/restaurant.dto";
|
|
|
|
export class CategoryDto {
|
|
id: string;
|
|
name: string;
|
|
image: string;
|
|
restaurantId: string;
|
|
items?: MenuItemDto[];
|
|
restaurant?: RestaurantDto;
|
|
|
|
static fromEntity(entity: any): CategoryDto {
|
|
return {
|
|
id: entity.id,
|
|
name: entity.name,
|
|
image: entity.image,
|
|
restaurantId: entity.restaurantId,
|
|
items: entity.items?.map(MenuItemDto.fromEntity) ?? [],
|
|
restaurant: entity.restaurant ? RestaurantDto.fromEntity(entity.restaurant) : undefined,
|
|
};
|
|
}
|
|
}
|