fix
This commit is contained in:
parent
e6539edaec
commit
52e0141de4
3 changed files with 52 additions and 14 deletions
|
|
@ -1934,6 +1934,8 @@ export class ProfileController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Post("search-personal")
|
@Post("search-personal")
|
||||||
async getProfileBySearchKeyword(
|
async getProfileBySearchKeyword(
|
||||||
|
@Query("page") page: number = 1,
|
||||||
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
|
|
@ -1941,9 +1943,12 @@ export class ProfileController extends Controller {
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let findProfile: any;
|
let findProfile: any;
|
||||||
|
let total: any;
|
||||||
|
const skip = (page - 1) * pageSize;
|
||||||
|
const take = pageSize;
|
||||||
switch (body.fieldName) {
|
switch (body.fieldName) {
|
||||||
case "idcard":
|
case "citizenId":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { citizenId: Like(`%${body.keyword}%`) },
|
where: { citizenId: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1956,11 +1961,13 @@ export class ProfileController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "firstname":
|
case "firstname":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { firstName: Like(`%${body.keyword}%`) },
|
where: { firstName: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1973,11 +1980,13 @@ export class ProfileController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "lastname":
|
case "lastname":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { lastName: Like(`%${body.keyword}%`) },
|
where: { lastName: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1990,11 +1999,13 @@ export class ProfileController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
|
|
@ -2006,6 +2017,8 @@ export class ProfileController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2095,7 +2108,7 @@ export class ProfileController extends Controller {
|
||||||
firstName: item.firstName,
|
firstName: item.firstName,
|
||||||
lastName: item.lastName,
|
lastName: item.lastName,
|
||||||
position: item.position,
|
position: item.position,
|
||||||
idcard: item.citizenId,
|
citizenId: item.citizenId,
|
||||||
email: item.email,
|
email: item.email,
|
||||||
phone: item.phone,
|
phone: item.phone,
|
||||||
name: fullName,
|
name: fullName,
|
||||||
|
|
@ -2157,7 +2170,7 @@ export class ProfileController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return new HttpSuccess(mapDataProfile);
|
return new HttpSuccess({ data: mapDataProfile, total });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1356,6 +1356,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Post("search-personal")
|
@Post("search-personal")
|
||||||
async getProfileBySearchKeyword(
|
async getProfileBySearchKeyword(
|
||||||
|
@Query("page") page: number = 1,
|
||||||
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
|
|
@ -1363,9 +1365,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let findProfile: any;
|
let findProfile: any;
|
||||||
|
let total: any;
|
||||||
|
const skip = (page - 1) * pageSize;
|
||||||
|
const take = pageSize;
|
||||||
switch (body.fieldName) {
|
switch (body.fieldName) {
|
||||||
case "idcard":
|
case "citizenId":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { citizenId: Like(`%${body.keyword}%`) },
|
where: { citizenId: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1378,11 +1383,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "firstname":
|
case "firstname":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { firstName: Like(`%${body.keyword}%`) },
|
where: { firstName: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1395,11 +1402,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "lastname":
|
case "lastname":
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
where: { lastName: Like(`%${body.keyword}%`) },
|
where: { lastName: Like(`%${body.keyword}%`) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
|
|
@ -1412,11 +1421,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
findProfile = await this.profileRepo.find({
|
[findProfile, total] = await this.profileRepo.find({
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
|
|
@ -1428,6 +1439,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1517,7 +1530,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
firstName: item.firstName,
|
firstName: item.firstName,
|
||||||
lastName: item.lastName,
|
lastName: item.lastName,
|
||||||
position: item.position,
|
position: item.position,
|
||||||
idcard: item.citizenId,
|
citizenId: item.citizenId,
|
||||||
email: item.email,
|
email: item.email,
|
||||||
phone: item.phone,
|
phone: item.phone,
|
||||||
name: fullName,
|
name: fullName,
|
||||||
|
|
@ -1579,7 +1592,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return new HttpSuccess(mapDataProfile);
|
return new HttpSuccess({ data: mapDataProfile, total });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import {
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
|
import { IsNull } from "typeorm";
|
||||||
// import * as io from "../lib/websocket";
|
// import * as io from "../lib/websocket";
|
||||||
// import elasticsearch from "../elasticsearch";
|
// import elasticsearch from "../elasticsearch";
|
||||||
// import { StorageFolder } from "../interfaces/storage-fs";
|
// import { StorageFolder } from "../interfaces/storage-fs";
|
||||||
|
|
@ -184,6 +185,17 @@ export class KeycloakController extends Controller {
|
||||||
async deleteUser(@Path() userId: string) {
|
async deleteUser(@Path() userId: string) {
|
||||||
const result = await deleteUser(userId);
|
const result = await deleteUser(userId);
|
||||||
if (!result) throw new Error("Failed. Cannot delete userId.");
|
if (!result) throw new Error("Failed. Cannot delete userId.");
|
||||||
|
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
where: {
|
||||||
|
id: userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (profile) {
|
||||||
|
profile.keycloak = "";
|
||||||
|
await this.profileRepo.save(profile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// @Security("bearerAuth", ["system", "admin"])
|
// @Security("bearerAuth", ["system", "admin"])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue