@@ -4,50 +4,50 @@ import { CreateProductDto } from './dto/create-product.dto';
44import { UpdateProductDto } from './dto/update-product.dto' ;
55import { Product } from './entities/product.entity' ;
66
7- @Controller ( )
7+ @Controller ( "products" )
88export class ProductController {
9- constructor ( private readonly productService : ProductService ) { }
9+ constructor ( private readonly productService : ProductService ) { }
1010
1111 // Admin endpoints
12- @Post ( 'admin/products ' )
12+ @Post ( 'admin' )
1313 create ( @Body ( ) createProductDto : CreateProductDto ) {
1414 return this . productService . create ( createProductDto ) ;
1515 }
1616
17- @Get ( 'admin/products ' )
17+ @Get ( 'admin' )
1818 findAll (
1919 @Query ( 'page' ) page ?: number ,
2020 @Query ( 'limit' ) limit ?: number ,
2121 ) {
2222 return this . productService . findAll ( page , limit ) ;
2323 }
2424
25- @Get ( 'admin/products/ :id' )
25+ @Get ( 'admin/:id' )
2626 findOne ( @Param ( 'id' ) id : string ) {
2727 return this . productService . findOne ( + id ) ;
2828 }
2929
30- @Patch ( 'admin/products/ :id' )
30+ @Patch ( 'admin/:id' )
3131 update ( @Param ( 'id' ) id : string , @Body ( ) updateProductDto : UpdateProductDto ) {
3232 return this . productService . update ( + id , updateProductDto ) ;
3333 }
3434
35- @Delete ( 'admin/products/ :id' )
35+ @Delete ( 'admin/:id' )
3636 @HttpCode ( HttpStatus . NO_CONTENT )
3737 async remove ( @Param ( 'id' ) id : string ) {
3838 await this . productService . remove ( + id ) ;
3939 }
4040
4141 // Public endpoints
42- @Get ( 'products ' )
42+ @Get ( '' )
4343 findAllActive (
4444 @Query ( 'page' ) page ?: number ,
4545 @Query ( 'limit' ) limit ?: number ,
4646 ) {
4747 return this . productService . findAllActive ( page , limit ) ;
4848 }
4949
50- @Get ( 'products/ :id' )
50+ @Get ( ':id' )
5151 findOnePublic ( @Param ( 'id' ) id : string ) {
5252 return this . productService . findOne ( + id ) ;
5353 }
0 commit comments