This commit is contained in:
2026-01-14 15:30:13 +03:30
parent aed4a1b333
commit 364f32e254
4 changed files with 10 additions and 8 deletions
+1
View File
@@ -11,6 +11,7 @@
"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: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",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start dist/main",
+2 -2
View File
@@ -3,8 +3,8 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
export function getSwaggerConfig(app: INestApplication) {
const config = new DocumentBuilder()
.setTitle('D-menu API')
.setDescription('API documentation for D-menu backend')
.setTitle('Negareh API')
.setDescription('API documentation for Negareh backend')
.setVersion('1.0')
.addBearerAuth() // optional: for JWT endpoints
.build();
+2 -2
View File
@@ -44,9 +44,9 @@ export class AuthService {
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) {
@@ -36,20 +36,20 @@ export class productController {
/* ---------------------------------- Admin ---------------------------------- */
@Post('admin/product')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Permissions(Permission.MANAGE_productS)
@Post('admin/product')
@ApiOperation({ summary: 'Create a new product' })
@ApiBody({ type: CreateproductDto })
create(@Body() createproductDto: CreateproductDto) {
return this.productsService.create(createproductDto);
}
@Get('admin/products')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Permissions(Permission.MANAGE_productS)
@Get('admin/products')
@ApiOperation({ summary: 'Get a paginated list of products' })
@ApiQuery({ name: 'page', required: false, type: Number })
@ApiQuery({ name: 'limit', required: false, type: Number })
@@ -73,20 +73,21 @@ export class productController {
return this.productsService.findById(id);
}
@Patch('admin/products/:id')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Permissions(Permission.MANAGE_productS)
@Patch('admin/products/:id')
@ApiOperation({ summary: 'Update a product' })
@ApiParam({ name: 'id', required: true })
@ApiBody({ type: UpdateproductDto })
update(@Param('id') id: string, @Body() updateproductDto: UpdateproductDto) {
return this.productsService.update(id, updateproductDto);
}
@Delete('admin/products/:id')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Permissions(Permission.MANAGE_productS)
@Delete('admin/products/:id')
@ApiOperation({ summary: 'Delete (soft) a product' })
@ApiParam({ name: 'id', required: true })
remove(@Param('id') id: string,) {