update
This commit is contained in:
@ -183,8 +183,8 @@ export class RoomController {
|
||||
room.location = param.location;
|
||||
room.picture = param.picture;
|
||||
room.floor = param.floor;
|
||||
room.created_by = req.auth.data.name;
|
||||
room.updated_by = req.auth.data.name;
|
||||
room.created_by = req.auth?.data.name;
|
||||
room.updated_by = req.auth?.data.name;
|
||||
await queryRunner.manager.save(room);
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
@ -266,7 +266,7 @@ export class RoomController {
|
||||
room.floor = param.floor;
|
||||
room.location = param.location;
|
||||
room.picture = param.picture;
|
||||
room.updated_by = req.auth.data.name;
|
||||
room.updated_by = req.auth?.data.name;
|
||||
await queryRunner.manager.save(room);
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
@ -299,13 +299,13 @@ export class RoomController {
|
||||
if (!param.hard) {
|
||||
let room: Room = await RoomModel.list({ "Room.id": param.id }).then((q) => q.getOne());
|
||||
if (!room) throw { message: "Room " + Language.lang.failed_not_found };
|
||||
room.deleted_by = req.auth.data.name;
|
||||
room.deleted_by = req.auth?.data.name;
|
||||
room.deleted_at = moment().toDate();
|
||||
await OrmHelper.DB.manager.save(room);
|
||||
affected = 1;
|
||||
} else {
|
||||
const repo = OrmHelper.DB.getRepository(Room);
|
||||
affected = (await repo.delete({ id: param.id })).affected;
|
||||
affected = (await repo.delete({ id: param.id })).affected ?? 0;
|
||||
}
|
||||
|
||||
if (affected > 0) {
|
||||
@ -332,7 +332,7 @@ export class RoomController {
|
||||
});
|
||||
const param: any = await schema.validateAsync(req.params);
|
||||
const repo = OrmHelper.DB.getRepository(Room);
|
||||
const affected = (await repo.restore({ id: param.id })).affected;
|
||||
const affected = (await repo.restore({ id: param.id })).affected ?? 0;
|
||||
if (affected > 0) {
|
||||
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_restore, {});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user