chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
4659a7b1de
commit
9f11d8fb2d
98 files changed
+1272
-1009
No files matched your search
@@ -14,6 +14,14 @@ import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
|
||||
export interface UserReqPayload {
|
||||
user: {
|
||||
id?: string;
|
||||
userId?: string;
|
||||
role?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@ApiTags('Prescriptions - نسخه و تاییدیه دارویی')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@@ -24,25 +32,25 @@ export class PrescriptionsController {
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'بارگذاری نسخه جدید توسط کاربر' })
|
||||
create(
|
||||
@Req() req: any,
|
||||
@Req() req: UserReqPayload,
|
||||
@Body() body: { petId?: string; fileUrl: string; notes?: string },
|
||||
) {
|
||||
const userId = req.user.id || req.user.userId;
|
||||
const userId = req.user.id || req.user.userId || '';
|
||||
return this.prescriptionsService.create(userId, body);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'دریافت لیست نسخهها (کاربر یا ادمین)' })
|
||||
findAll(@Req() req: any) {
|
||||
const userId = req.user.id || req.user.userId;
|
||||
findAll(@Req() req: UserReqPayload) {
|
||||
const userId = req.user.id || req.user.userId || '';
|
||||
const isAdmin = req.user.role === 'Admin';
|
||||
return this.prescriptionsService.findAll(userId, isAdmin);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'دریافت جزئیات یک نسخه' })
|
||||
findOne(@Req() req: any, @Param('id') id: string) {
|
||||
const userId = req.user.id || req.user.userId;
|
||||
findOne(@Req() req: UserReqPayload, @Param('id') id: string) {
|
||||
const userId = req.user.id || req.user.userId || '';
|
||||
const isAdmin = req.user.role === 'Admin';
|
||||
return this.prescriptionsService.findOne(id, userId, isAdmin);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user