get resturent by slug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
|
||||
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
|
||||
import { RestaurantSpecificationDto } from '../dto/restaurant-specification.dto';
|
||||
import { Restaurant } from '../entities/restaurant.entity';
|
||||
import { EntityManager } from '@mikro-orm/postgresql';
|
||||
import { RestRepository } from '../repositories/rest.repository';
|
||||
@@ -37,6 +38,35 @@ export class RestaurantsService {
|
||||
return restaurant;
|
||||
}
|
||||
|
||||
async getRestaurantSpecification(slug: string): Promise<RestaurantSpecificationDto> {
|
||||
const restaurant = await this.findBySlug(slug);
|
||||
|
||||
const specification: RestaurantSpecificationDto = {
|
||||
id: restaurant.id,
|
||||
name: restaurant.name,
|
||||
slug: restaurant.slug,
|
||||
logo: restaurant.logo,
|
||||
address: restaurant.address,
|
||||
menuColor: restaurant.menuColor,
|
||||
latitude: restaurant.latitude,
|
||||
longitude: restaurant.longitude,
|
||||
serviceArea: restaurant.serviceArea,
|
||||
establishedYear: restaurant.establishedYear,
|
||||
phoneNumber: restaurant.phoneNumber,
|
||||
instagram: restaurant.instagram,
|
||||
telegram: restaurant.telegram,
|
||||
whatsapp: restaurant.whatsapp,
|
||||
description: restaurant.description,
|
||||
seoTitle: restaurant.seoTitle,
|
||||
seoDescription: restaurant.seoDescription,
|
||||
tagNames: restaurant.tagNames,
|
||||
images: restaurant.images,
|
||||
vat: restaurant.vat,
|
||||
};
|
||||
|
||||
return specification;
|
||||
}
|
||||
|
||||
async update(id: string, dto: UpdateRestaurantDto): Promise<Restaurant> {
|
||||
const restaurant = await this.restRepository.findOne({ id });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user