bugs
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
"db:drop": "npx mikro-orm schema:drop --run --config ./src/config/mikro-orm.config.dev.ts",
|
"db:drop": "npx mikro-orm schema:drop --run --config ./src/config/mikro-orm.config.dev.ts",
|
||||||
"db:seed": "npx mikro-orm seeder:run --config ./src/config/mikro-orm.config.dev.ts",
|
"db:seed": "npx mikro-orm seeder:run --config ./src/config/mikro-orm.config.dev.ts",
|
||||||
"db:reset": "npm run db:drop && npm run db:create && npm run db:seed",
|
"db:reset": "npm run db:drop && npm run db:create && npm run db:seed",
|
||||||
|
"db:refresh": "npm run db:drop && npm run db:create ",
|
||||||
"build": "nest build",
|
"build": "nest build",
|
||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "nest start dist/main",
|
"start": "nest start dist/main",
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|||||||
|
|
||||||
export function getSwaggerConfig(app: INestApplication) {
|
export function getSwaggerConfig(app: INestApplication) {
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('D-menu API')
|
.setTitle('Negareh API')
|
||||||
.setDescription('API documentation for D-menu backend')
|
.setDescription('API documentation for Negareh backend')
|
||||||
.setVersion('1.0')
|
.setVersion('1.0')
|
||||||
.addBearerAuth() // optional: for JWT endpoints
|
.addBearerAuth() // optional: for JWT endpoints
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ export class AuthService {
|
|||||||
|
|
||||||
await this.cacheService.set(key, code, this.OTP_EXPIRATION_TIME);
|
await this.cacheService.set(key, code, this.OTP_EXPIRATION_TIME);
|
||||||
|
|
||||||
await this.smsService.sendotp(normalizedPhone, code);
|
// await this.smsService.sendotp(normalizedPhone, code);
|
||||||
|
|
||||||
return { code: null };
|
return { code };
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyOtp(phone: string, code: string) {
|
async verifyOtp(phone: string, code: string) {
|
||||||
|
|||||||
@@ -36,20 +36,20 @@ export class productController {
|
|||||||
|
|
||||||
|
|
||||||
/* ---------------------------------- Admin ---------------------------------- */
|
/* ---------------------------------- Admin ---------------------------------- */
|
||||||
|
@Post('admin/product')
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@Permissions(Permission.MANAGE_productS)
|
@Permissions(Permission.MANAGE_productS)
|
||||||
@Post('admin/product')
|
|
||||||
@ApiOperation({ summary: 'Create a new product' })
|
@ApiOperation({ summary: 'Create a new product' })
|
||||||
@ApiBody({ type: CreateproductDto })
|
@ApiBody({ type: CreateproductDto })
|
||||||
create(@Body() createproductDto: CreateproductDto) {
|
create(@Body() createproductDto: CreateproductDto) {
|
||||||
return this.productsService.create(createproductDto);
|
return this.productsService.create(createproductDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('admin/products')
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@Permissions(Permission.MANAGE_productS)
|
@Permissions(Permission.MANAGE_productS)
|
||||||
@Get('admin/products')
|
|
||||||
@ApiOperation({ summary: 'Get a paginated list of products' })
|
@ApiOperation({ summary: 'Get a paginated list of products' })
|
||||||
@ApiQuery({ name: 'page', required: false, type: Number })
|
@ApiQuery({ name: 'page', required: false, type: Number })
|
||||||
@ApiQuery({ name: 'limit', required: false, type: Number })
|
@ApiQuery({ name: 'limit', required: false, type: Number })
|
||||||
@@ -73,20 +73,21 @@ export class productController {
|
|||||||
return this.productsService.findById(id);
|
return this.productsService.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Patch('admin/products/:id')
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@Permissions(Permission.MANAGE_productS)
|
@Permissions(Permission.MANAGE_productS)
|
||||||
@Patch('admin/products/:id')
|
|
||||||
@ApiOperation({ summary: 'Update a product' })
|
@ApiOperation({ summary: 'Update a product' })
|
||||||
@ApiParam({ name: 'id', required: true })
|
@ApiParam({ name: 'id', required: true })
|
||||||
@ApiBody({ type: UpdateproductDto })
|
@ApiBody({ type: UpdateproductDto })
|
||||||
update(@Param('id') id: string, @Body() updateproductDto: UpdateproductDto) {
|
update(@Param('id') id: string, @Body() updateproductDto: UpdateproductDto) {
|
||||||
return this.productsService.update(id, updateproductDto);
|
return this.productsService.update(id, updateproductDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Delete('admin/products/:id')
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@Permissions(Permission.MANAGE_productS)
|
@Permissions(Permission.MANAGE_productS)
|
||||||
@Delete('admin/products/:id')
|
|
||||||
@ApiOperation({ summary: 'Delete (soft) a product' })
|
@ApiOperation({ summary: 'Delete (soft) a product' })
|
||||||
@ApiParam({ name: 'id', required: true })
|
@ApiParam({ name: 'id', required: true })
|
||||||
remove(@Param('id') id: string,) {
|
remove(@Param('id') id: string,) {
|
||||||
|
|||||||
Reference in New Issue
Block a user