Skip to content

Commit

Permalink
feat(cart): added boilerplate for cart service/controller
Browse files Browse the repository at this point in the history
  • Loading branch information
KostaD02 committed Aug 20, 2023
1 parent 90c7251 commit a1c2eb2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ prefix - /`shop`/`...`

### Cart

- `GET` cart | (currnet user cart) | jwt
- `GET` cart | (current user cart) | jwt
- `POST` cart/product | { id, quantity } | jwt
- `POST` cart/checkout | jwt
- `PATCH` cart/product | { id, quantity } | jwt
Expand Down
4 changes: 4 additions & 0 deletions src/modules/shop/cart/carts.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Controller } from '@nestjs/common';

@Controller('shop/cart')
export class CartsController {}
4 changes: 4 additions & 0 deletions src/modules/shop/cart/carts.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class CartsService {}
2 changes: 2 additions & 0 deletions src/modules/shop/cart/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './carts.controller';
export * from './carts.service';
1 change: 1 addition & 0 deletions src/modules/shop/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './shop.module';
export * from './product';
export * from './cart';
5 changes: 3 additions & 2 deletions src/modules/shop/shop.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Product, ProductSchema } from 'src/schemas';
import { ProductsController, ProductsService } from './product';
import { ExceptionService } from 'src/shared';
import { JwtModule } from '@nestjs/jwt';
import { CartsController, CartsService } from './cart';

@Module({
imports: [
Expand All @@ -14,7 +15,7 @@ import { JwtModule } from '@nestjs/jwt';
signOptions: { expiresIn: `${process.env.JWT_EXPIRES_IN || '1'}h` },
}),
],
providers: [ProductsService, ExceptionService],
controllers: [ProductsController],
providers: [ExceptionService, ProductsService, CartsService],
controllers: [ProductsController, CartsController],
})
export class ShopModule {}

0 comments on commit a1c2eb2

Please sign in to comment.