no message
This commit is contained in:
parent
5ae266659a
commit
7d3839a195
1 changed files with 6 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { Command } from "../entities/Command";
|
import { Command } from "../entities/Command";
|
||||||
import { Brackets, LessThan, MoreThan, Double } from "typeorm";
|
import { Brackets, LessThan, MoreThan, Double, In } from "typeorm";
|
||||||
import { CommandType } from "../entities/CommandType";
|
import { CommandType } from "../entities/CommandType";
|
||||||
import { CommandSend } from "../entities/CommandSend";
|
import { CommandSend } from "../entities/CommandSend";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
|
|
@ -111,7 +111,7 @@ export class CommandController extends Controller {
|
||||||
: `${commandTypeId}`,
|
: `${commandTypeId}`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orderBy("command.createdAt", "ASC")
|
.orderBy("command.createdAt", "DESC")
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
@ -699,7 +699,10 @@ export class CommandController extends Controller {
|
||||||
if (!command) {
|
if (!command) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||||
}
|
}
|
||||||
await this.commandSendCCRepository.delete({ commandSend: { commandId: command.id } });
|
const commandSend = await this.commandSendRepository.find({
|
||||||
|
where: { commandId: id },
|
||||||
|
});
|
||||||
|
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
|
||||||
await this.commandReciveRepository.delete({ commandId: command.id });
|
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||||
await this.commandSendRepository.delete({ commandId: command.id });
|
await this.commandSendRepository.delete({ commandId: command.id });
|
||||||
await this.commandRepository.delete(command.id);
|
await this.commandRepository.delete(command.id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue