Spaces:
Sleeping
Sleeping
| import { | |
| Controller, | |
| Get, | |
| Post, | |
| Body, | |
| Patch, | |
| Param, | |
| Delete, | |
| } from '@nestjs/common'; | |
| import { BranchMenusService } from './branch-menus.service.js'; | |
| import { CreateBranchMenuDto } from './dto/create-branch-menu.dto.js'; | |
| import { UpdateBranchMenuDto } from './dto/update-branch-menu.dto.js'; | |
| import { Public } from '../authentication/authentication.decorator.js'; | |
| import { Paginate, PaginateQuery } from 'nestjs-paginate'; | |
| () | |
| ('branchs/:branchId/menus') | |
| export class BranchMenusController { | |
| constructor(private readonly branchMenusService: BranchMenusService) {} | |
| () // thêm menu vào branch | |
| create( | |
| ('branchId') branchId: string, | |
| () createBranchMenuDto: CreateBranchMenuDto, | |
| ) { | |
| return this.branchMenusService.create(branchId, createBranchMenuDto); | |
| } | |
| () // lấy danh sách menu trong branch | |
| findAll( | |
| ('branchId') branchId: string, | |
| () query: PaginateQuery, | |
| ) { | |
| // console.log('branchId', branchId); | |
| return this.branchMenusService.findAll(branchId, query); | |
| } | |
| (':id') // lấy một menu trong branch | |
| findOne(('branchId') branchId: string, ('id') id: string) { | |
| return this.branchMenusService.findOne(branchId, id); | |
| } | |
| (':id') | |
| update( | |
| ('id') id: string, | |
| () updateBranchMenuDto: UpdateBranchMenuDto, | |
| ) { | |
| return this.branchMenusService.update(+id, updateBranchMenuDto); | |
| } | |
| (':id') | |
| remove(('id') id: string) { | |
| return this.branchMenusService.remove(+id); | |
| } | |
| } | |