ออกคำสั่ง 10

This commit is contained in:
JoolsoftAdmin 2024-10-17 10:37:16 +07:00
parent 5e117d1703
commit 8fd229fa8a

View file

@ -16,6 +16,7 @@ import { EvaluateCommander } from "../entities/EvaluateCommander"
import CallAPI from "../interfaces/call-api"
import { Double, In } from "typeorm"
import Extension from "../interfaces/extension"
import { Appoint } from "../entities/Appoint"
@Route("api/v1/probation/report")
@Tags("Report")
@ -30,6 +31,7 @@ export class ReportController extends Controller {
private assignDirectorRepository = AppDataSource.getRepository(AssignDirector)
private evaluateAchievementRepository = AppDataSource.getRepository(EvaluateAchievement)
private evaluateCommanderRepository = AppDataSource.getRepository(EvaluateCommander)
private appointRepository = AppDataSource.getRepository(Appoint)
/**
* API
@ -1199,4 +1201,71 @@ export class ReportController extends Controller {
)
return new HttpSuccess()
}
@Post("command10/officer/report/excecute")
public async command10Excecute(
@Request() request: RequestWithUser,
@Body()
body: {
refIds: {
refId: string
commandAffectDate: Date | null
commandNo: string | null
commandYear: number
templateDoc: string | null
amount: Double | null
positionSalaryAmount: Double | null
mouthSalaryAmount: Double | null
}[]
}
) {
const lists = await this.appointRepository.find({
where: { id: In(body.refIds.map(x => x.refId)) },
})
await Promise.all(
lists.map(async list => {
list.status = "DONE"
await this.appointRepository.save(list)
})
)
return new HttpSuccess()
}
@Post("command10/officer/report")
public async command10(
@Request() req: RequestWithUser,
@Body()
body: {
refIds: string[]
}
) {
const lists = await this.appointRepository.find({
where: { id: In(body.refIds) },
})
await Promise.all(
lists.map(async list => {
list.status = "PENDING"
await this.appointRepository.save(list)
})
)
return new HttpSuccess()
}
@Post("command10/officer/report/delete")
public async command10Delete(
@Request() req: RequestWithUser,
@Body()
body: {
refIds: string[]
}
) {
const lists = await this.appointRepository.find({
where: { id: In(body.refIds) },
})
await Promise.all(
lists.map(async list => {
list.status = "REPORT"
await this.appointRepository.save(list)
})
)
return new HttpSuccess()
}
}