fix: request body

This commit is contained in:
Methapon2001 2024-03-22 16:32:15 +07:00
parent a0887d8b74
commit 808971b5b2
2 changed files with 4 additions and 8 deletions

View file

@ -56,10 +56,7 @@ export class ProfileGovernmentHistoryController extends Controller {
} }
@Post() @Post()
public async newFamilyHistory( public async newGov(@Request() req: RequestWithUser, @Body() body: CreateProfileGovernment) {
@Request() req: RequestWithUser,
@Body() body: CreateProfileGovernment,
) {
if (!body.profileId) { if (!body.profileId) {
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
} }
@ -87,7 +84,7 @@ export class ProfileGovernmentHistoryController extends Controller {
} }
@Patch("{profileId}") @Patch("{profileId}")
public async editFamilyHistory( public async editGov(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@Body() body: UpdateProfileGovernment, @Body() body: UpdateProfileGovernment,
@Path() profileId: string, @Path() profileId: string,
@ -114,7 +111,7 @@ export class ProfileGovernmentHistoryController extends Controller {
} }
@Delete("{profileId}") @Delete("{profileId}")
public async deleteGovHistory(@Path() profileId: string) { public async deleteGov(@Path() profileId: string) {
const result = await this.govRepo.delete({ profileId: profileId }); const result = await this.govRepo.delete({ profileId: profileId });
if (result.affected && result.affected <= 0) { if (result.affected && result.affected <= 0) {

View file

@ -165,10 +165,10 @@ export class ProfileGovernment extends EntityBase {
}) })
positionEmployeePositionSide: string; positionEmployeePositionSide: string;
} }
export type CreateProfileGovernment = { export type CreateProfileGovernment = {
positionId: string | null; positionId: string | null;
profileId: string | null; profileId: string | null;
profile: Profile | null;
posNoId: string | null; posNoId: string | null;
ocId: string | null; ocId: string | null;
dateAppoint: Date | null; dateAppoint: Date | null;
@ -193,7 +193,6 @@ export type CreateProfileGovernment = {
export type UpdateProfileGovernment = { export type UpdateProfileGovernment = {
positionId?: string | null; positionId?: string | null;
profile?: Profile | null;
posNoId?: string | null; posNoId?: string | null;
ocId?: string | null; ocId?: string | null;
dateAppoint?: Date | null; dateAppoint?: Date | null;