style: apply standard ESLint & Prettier formatting across backend
Deploy Canina / deploy (push) Successful in 4m58s
Deploy Canina / deploy (push) Successful in 4m58s
This commit is contained in:
1 parent
ae636c8b03
commit
62bd8811fa
66 files changed
+1398
-607
No files matched your search
@@ -1,7 +1,27 @@
|
||||
import { Controller, Get, Patch, Post, Delete, Body, Param, UseGuards, Req, HttpStatus, BadRequestException } from '@nestjs/common';
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Patch,
|
||||
Post,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
UseGuards,
|
||||
Req,
|
||||
HttpStatus,
|
||||
BadRequestException,
|
||||
} from '@nestjs/common';
|
||||
import { UsersService } from './users.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { ApiTags, ApiBearerAuth, ApiOperation, ApiResponse, ApiOkResponse, ApiCreatedResponse, ApiBadRequestResponse } from '@nestjs/swagger';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiBearerAuth,
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiOkResponse,
|
||||
ApiCreatedResponse,
|
||||
ApiBadRequestResponse,
|
||||
} from '@nestjs/swagger';
|
||||
import { UpdateProfileDto } from './dto/update-profile.dto';
|
||||
import { AddressDto } from './dto/address.dto';
|
||||
|
||||
@@ -16,9 +36,9 @@ import { AddressDto } from './dto/address.dto';
|
||||
success: false,
|
||||
message: 'Unauthorized',
|
||||
code: 'UNAUTHORIZED',
|
||||
details: {}
|
||||
}
|
||||
}
|
||||
details: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
export class UsersController {
|
||||
constructor(private readonly usersService: UsersService) {}
|
||||
@@ -41,9 +61,9 @@ export class UsersController {
|
||||
addresses: [],
|
||||
pets: [],
|
||||
createdAt: '2026-05-26T15:20:00.000Z',
|
||||
updatedAt: '2026-05-26T15:20:00.000Z'
|
||||
}
|
||||
}
|
||||
updatedAt: '2026-05-26T15:20:00.000Z',
|
||||
},
|
||||
},
|
||||
})
|
||||
getProfile(@Req() req: any) {
|
||||
return this.usersService.findById(req.user.id);
|
||||
@@ -63,9 +83,9 @@ export class UsersController {
|
||||
mobile: '09123456789',
|
||||
role: 'User_PetOwner',
|
||||
walletBalance: '1500000.00',
|
||||
charityDonationTotal: '25000.00'
|
||||
}
|
||||
}
|
||||
charityDonationTotal: '25000.00',
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiBadRequestResponse({
|
||||
description: 'خطا در صحتسنجی فیلدهای ورودی',
|
||||
@@ -75,10 +95,10 @@ export class UsersController {
|
||||
message: 'ایمیل نامعتبر است',
|
||||
code: 'BAD_REQUEST',
|
||||
details: {
|
||||
message: ['ایمیل نامعتبر است']
|
||||
}
|
||||
}
|
||||
}
|
||||
message: ['ایمیل نامعتبر است'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
updateProfile(@Req() req: any, @Body() updateProfileDto: UpdateProfileDto) {
|
||||
return this.usersService.update(req.user.id, updateProfileDto);
|
||||
@@ -101,9 +121,9 @@ export class UsersController {
|
||||
detail: 'خیابان آزادی، کوچه مریم، پلاک ۱۰',
|
||||
zipCode: '1456789012',
|
||||
isDefault: false,
|
||||
createdAt: '2026-05-26T18:00:00.000Z'
|
||||
}
|
||||
}
|
||||
createdAt: '2026-05-26T18:00:00.000Z',
|
||||
},
|
||||
},
|
||||
})
|
||||
addAddress(@Req() req: any, @Body() addressDto: AddressDto) {
|
||||
return this.usersService.addAddress(req.user.id, addressDto);
|
||||
@@ -126,9 +146,9 @@ export class UsersController {
|
||||
detail: 'خیابان ولیعصر، برج سپهر، طبقه ۴',
|
||||
zipCode: '1456789012',
|
||||
isDefault: false,
|
||||
createdAt: '2026-05-26T18:00:00.000Z'
|
||||
}
|
||||
}
|
||||
createdAt: '2026-05-26T18:00:00.000Z',
|
||||
},
|
||||
},
|
||||
})
|
||||
updateAddress(
|
||||
@Req() req: any,
|
||||
@@ -146,9 +166,9 @@ export class UsersController {
|
||||
schema: {
|
||||
example: {
|
||||
success: true,
|
||||
message: 'آدرس با موفقیت حذف شد'
|
||||
}
|
||||
}
|
||||
message: 'آدرس با موفقیت حذف شد',
|
||||
},
|
||||
},
|
||||
})
|
||||
deleteAddress(@Req() req: any, @Param('addressId') addressId: string) {
|
||||
return this.usersService.deleteAddress(req.user.id, addressId);
|
||||
@@ -162,9 +182,9 @@ export class UsersController {
|
||||
schema: {
|
||||
example: {
|
||||
success: true,
|
||||
message: 'آدرس پیشفرض با موفقیت تغییر کرد'
|
||||
}
|
||||
}
|
||||
message: 'آدرس پیشفرض با موفقیت تغییر کرد',
|
||||
},
|
||||
},
|
||||
})
|
||||
setDefaultAddress(@Req() req: any, @Param('addressId') addressId: string) {
|
||||
return this.usersService.setDefaultAddress(req.user.id, addressId);
|
||||
@@ -183,9 +203,9 @@ export class UsersController {
|
||||
type: 'deposit',
|
||||
status: 'completed',
|
||||
description: 'شارژ کیف پول',
|
||||
createdAt: '2026-07-11T08:00:00.000Z'
|
||||
}
|
||||
}
|
||||
createdAt: '2026-07-11T08:00:00.000Z',
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiBadRequestResponse({ description: 'مبلغ نامعتبر است' })
|
||||
async topUpWallet(@Req() req: any, @Body() body: { amount: number }) {
|
||||
|
||||
Reference in new issue
Block a user