sort จังหวัด อำเภอ ตำบล
This commit is contained in:
parent
b4b49b7378
commit
0fa198a771
3 changed files with 30 additions and 5 deletions
|
|
@ -43,7 +43,10 @@ export class DistrictController extends Controller {
|
|||
async GetResult() {
|
||||
const _district = await this.districtRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||
order: { name: "ASC" },
|
||||
order: {
|
||||
name: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
});
|
||||
return new HttpSuccess(_district);
|
||||
}
|
||||
|
|
@ -59,8 +62,16 @@ export class DistrictController extends Controller {
|
|||
async GetById(@Path() id: string) {
|
||||
const _district = await this.districtRepository.findOne({
|
||||
where: { id },
|
||||
select: ["id", "name"],
|
||||
select: ["id", "name", "createdAt"],
|
||||
relations: { subDistricts: true },
|
||||
order: {
|
||||
name: "ASC",
|
||||
createdAt: "DESC",
|
||||
subDistricts: {
|
||||
name: "ASC",
|
||||
createdAt: "DESC"
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!_district) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเขตนี้");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue