upd
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { DoctorSchedule, Room, Paging } from "entity";
|
||||
import { DoctorSchedule, Room, User, Paging } from "entity";
|
||||
import { NextFunction, Response } from "express";
|
||||
import { Request } from "express-jwt";
|
||||
import Joi from "joi";
|
||||
@ -94,11 +94,14 @@ export class DoctorScheduleController {
|
||||
let room = await OrmHelper.DB.getRepository(Room).findOne({ where: { id: param.room_id } });
|
||||
if (!room) throw { message: "Room " + Language.lang.failed_not_found };
|
||||
|
||||
let doctor = await OrmHelper.DB.getRepository(User).findOne({ where: { id: param.doctor_id } });
|
||||
if (!doctor) throw { message: "Doctor (User) " + Language.lang.failed_not_found };
|
||||
|
||||
let doctorSchedule = new DoctorSchedule();
|
||||
doctorSchedule.day = param.day;
|
||||
doctorSchedule.start_time = param.start_time;
|
||||
doctorSchedule.end_time = param.end_time;
|
||||
doctorSchedule.doctor_id = param.doctor_id;
|
||||
doctorSchedule.doctor = doctor;
|
||||
doctorSchedule.room = room;
|
||||
doctorSchedule.quota = param.quota || null;
|
||||
doctorSchedule.status = param.status;
|
||||
@ -173,6 +176,9 @@ export class DoctorScheduleController {
|
||||
let room = await OrmHelper.DB.getRepository(Room).findOne({ where: { id: param.room_id } });
|
||||
if (!room) throw { message: "Room " + Language.lang.failed_not_found };
|
||||
|
||||
let doctor = await OrmHelper.DB.getRepository(User).findOne({ where: { id: param.doctor_id } });
|
||||
if (!doctor) throw { message: "Doctor (User) " + Language.lang.failed_not_found };
|
||||
|
||||
let doctorSchedule = await DoctorScheduleModel.list({ id: param.id }).then((q) => q.getOne());
|
||||
|
||||
if (!doctorSchedule) throw { message: "Doctor Schedule " + Language.lang.failed_not_found };
|
||||
@ -180,7 +186,7 @@ export class DoctorScheduleController {
|
||||
doctorSchedule.day = param.day;
|
||||
doctorSchedule.start_time = param.start_time;
|
||||
doctorSchedule.end_time = param.end_time;
|
||||
doctorSchedule.doctor_id = param.doctor_id;
|
||||
doctorSchedule.doctor = doctor;
|
||||
doctorSchedule.room = room;
|
||||
doctorSchedule.quota = param.quota || null;
|
||||
doctorSchedule.status = param.status;
|
||||
|
||||
Reference in New Issue
Block a user