Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
1155be4116
3 changed files with 30 additions and 5 deletions
|
|
@ -43,7 +43,10 @@ export class DistrictController extends Controller {
|
||||||
async GetResult() {
|
async GetResult() {
|
||||||
const _district = await this.districtRepository.find({
|
const _district = await this.districtRepository.find({
|
||||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||||
order: { name: "ASC" },
|
order: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(_district);
|
return new HttpSuccess(_district);
|
||||||
}
|
}
|
||||||
|
|
@ -59,8 +62,16 @@ export class DistrictController extends Controller {
|
||||||
async GetById(@Path() id: string) {
|
async GetById(@Path() id: string) {
|
||||||
const _district = await this.districtRepository.findOne({
|
const _district = await this.districtRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
select: ["id", "name"],
|
select: ["id", "name", "createdAt"],
|
||||||
relations: { subDistricts: true },
|
relations: { subDistricts: true },
|
||||||
|
order: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC",
|
||||||
|
subDistricts: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!_district) {
|
if (!_district) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเขตนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเขตนี้");
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ export class ProvinceController extends Controller {
|
||||||
async GetResult() {
|
async GetResult() {
|
||||||
const _province = await this.provinceRepository.find({
|
const _province = await this.provinceRepository.find({
|
||||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||||
order: { createdAt: "DESC" },
|
order: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(_province);
|
return new HttpSuccess(_province);
|
||||||
}
|
}
|
||||||
|
|
@ -57,8 +60,16 @@ export class ProvinceController extends Controller {
|
||||||
async GetById(@Path() id: string) {
|
async GetById(@Path() id: string) {
|
||||||
const _province = await this.provinceRepository.findOne({
|
const _province = await this.provinceRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
select: ["id", "name"],
|
select: ["id", "name", "createdAt"],
|
||||||
relations: { districts: true },
|
relations: { districts: true },
|
||||||
|
order: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC",
|
||||||
|
districts: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (!_province) {
|
if (!_province) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลจังหวัดนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลจังหวัดนี้");
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,10 @@ export class SubDistrictController extends Controller {
|
||||||
async GetResult() {
|
async GetResult() {
|
||||||
const _subDistrict = await this.subDistrictRepository.find({
|
const _subDistrict = await this.subDistrictRepository.find({
|
||||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
select: ["id", "name", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
||||||
order: { name: "ASC" },
|
order: {
|
||||||
|
name: "ASC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(_subDistrict);
|
return new HttpSuccess(_subDistrict);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue