feat(doctor): implement Doctors / Vets CRUD backend and DB model (TASK-2.18)
This commit is contained in:
parent
d784f3fcc7
commit
47bff2c6ed
@ -166,6 +166,18 @@ model Product {
|
|||||||
@@map("products")
|
@@map("products")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model Doctor {
|
||||||
|
id String @id @default(uuid()) @db.Uuid
|
||||||
|
name String @db.VarChar(150)
|
||||||
|
title String @db.VarChar(150)
|
||||||
|
avatarUrl String? @map("avatar_url") @db.Text
|
||||||
|
bio String? @db.Text
|
||||||
|
clinic String? @db.VarChar(200)
|
||||||
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||||
|
|
||||||
|
@@map("doctors")
|
||||||
|
}
|
||||||
|
|
||||||
model ProductIngredient {
|
model ProductIngredient {
|
||||||
productId String @map("product_id") @db.Uuid
|
productId String @map("product_id") @db.Uuid
|
||||||
ingredient String @db.VarChar(150)
|
ingredient String @db.VarChar(150)
|
||||||
|
|||||||
@ -236,4 +236,36 @@ export class AdminController {
|
|||||||
const settings = await this.adminService.updateSettings(data);
|
const settings = await this.adminService.updateSettings(data);
|
||||||
return { success: true, data: settings };
|
return { success: true, data: settings };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Doctors / Vets ---
|
||||||
|
@Get('doctors')
|
||||||
|
@ApiOperation({ summary: 'لیست پزشکان و متخصصان' })
|
||||||
|
async getDoctors() {
|
||||||
|
const doctors = await this.adminService.getDoctors();
|
||||||
|
return { success: true, data: doctors };
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Post('doctors')
|
||||||
|
@ApiOperation({ summary: 'افزودن پزشک جدید' })
|
||||||
|
async createDoctor(@Body() body: any) {
|
||||||
|
const doctor = await this.adminService.createDoctor(body);
|
||||||
|
return { success: true, data: doctor };
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Put('doctors/:id')
|
||||||
|
@ApiOperation({ summary: 'ویرایش اطلاعات پزشک' })
|
||||||
|
async updateDoctor(@Param('id') id: string, @Body() body: any) {
|
||||||
|
const doctor = await this.adminService.updateDoctor(id, body);
|
||||||
|
return { success: true, data: doctor };
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Delete('doctors/:id')
|
||||||
|
@ApiOperation({ summary: 'حذف پزشک' })
|
||||||
|
async deleteDoctor(@Param('id') id: string) {
|
||||||
|
await this.adminService.deleteDoctor(id);
|
||||||
|
return { success: true };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -429,4 +429,22 @@ export class AdminService {
|
|||||||
await this.prisma.$transaction(operations);
|
await this.prisma.$transaction(operations);
|
||||||
return this.getSettings();
|
return this.getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDoctors() {
|
||||||
|
return this.prisma.doctor.findMany({
|
||||||
|
orderBy: { createdAt: 'desc' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async createDoctor(data: { name: string; title: string; avatarUrl?: string; bio?: string; clinic?: string }) {
|
||||||
|
return this.prisma.doctor.create({ data });
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateDoctor(id: string, data: { name?: string; title?: string; avatarUrl?: string; bio?: string; clinic?: string }) {
|
||||||
|
return this.prisma.doctor.update({ where: { id }, data });
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteDoctor(id: string) {
|
||||||
|
return this.prisma.doctor.delete({ where: { id } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
### 🎥 ویدیوها، پزشکان و پروفایل ادمین (Videos, Doctors & Admin Profile)
|
### 🎥 ویدیوها، پزشکان و پروفایل ادمین (Videos, Doctors & Admin Profile)
|
||||||
- [x] **TASK-2.17 [Backend & Admin]:** ارتقاء مدیریت ویدیوها با قابلیت آپلود مستقیم فایل ویدیو روی سرور/S3 علاوه بر لینکهای Iframe.
|
- [x] **TASK-2.17 [Backend & Admin]:** ارتقاء مدیریت ویدیوها با قابلیت آپلود مستقیم فایل ویدیو روی سرور/S3 علاوه بر لینکهای Iframe.
|
||||||
- [ ] **TASK-2.18 [DB, Backend & Admin]:** پیادهسازی کامل CRUD مدیریت پزشکان/متخصصان (شامل بیوگرافی، تصویر، تخصص) و اتصال پزشک به ویدیوها، مقالات وبلاگ و نظرات کارشناسی محصولات.
|
- [x] **TASK-2.18 [DB, Backend & Admin]:** پیادهسازی کامل CRUD مدیریت پزشکان/متخصصان (شامل بیوگرافی، تصویر، تخصص) و اتصال پزشک به ویدیوها، مقالات وبلاگ و نظرات کارشناسی محصولات.
|
||||||
- [x] **TASK-2.19 [Admin Header UI]:** حذف دکمه خروج از Sidebar و اضافه کردن Dropdown کاربر در بالای صفحه سمت چپ (Header) شامل پروفایل، تنظیمات و خروج.
|
- [x] **TASK-2.19 [Admin Header UI]:** حذف دکمه خروج از Sidebar و اضافه کردن Dropdown کاربر در بالای صفحه سمت چپ (Header) شامل پروفایل، تنظیمات و خروج.
|
||||||
- [x] **TASK-2.20 [Admin Realtime Notifications]:** پیادهسازی سیستم اعلانهای واقعی/Realtime ادمین در هدر (ثبت سفارش جدید، نظر جدید، درخواست B2B، درخواست برداشت کیف پول و هشدارهای موجودی).
|
- [x] **TASK-2.20 [Admin Realtime Notifications]:** پیادهسازی سیستم اعلانهای واقعی/Realtime ادمین در هدر (ثبت سفارش جدید، نظر جدید، درخواست B2B، درخواست برداشت کیف پول و هشدارهای موجودی).
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user