fix:editing doctor dept
This commit is contained in:
@@ -365,6 +365,30 @@ export const updateDoctor = async (req, res) => {
|
||||
globalSortOrder !== undefined ? Number(globalSortOrder) : undefined,
|
||||
},
|
||||
});
|
||||
for (const dep of departments) {
|
||||
const department = await prisma.department.findUnique({
|
||||
where: {departmentId: dep.departmentId},
|
||||
});
|
||||
|
||||
if (!department) continue;
|
||||
|
||||
const doctorDepartment = await prisma.doctorDepartment.create({
|
||||
data: {
|
||||
doctorId: doctor.id,
|
||||
departmentId: department.id,
|
||||
sortOrder: dep.sortOrder !== undefined ? Number(dep.sortOrder) : 0,
|
||||
},
|
||||
});
|
||||
|
||||
if (dep.timing) {
|
||||
await prisma.doctorTiming.create({
|
||||
data: {
|
||||
doctorDepartmentId: doctorDepartment.id,
|
||||
...dep.timing,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
if (doctor.seoId) {
|
||||
await prisma.seo.update({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user