refactor: add delete
This commit is contained in:
parent
9618085ac4
commit
ae5f66eaa4
2 changed files with 115 additions and 2 deletions
|
|
@ -107,7 +107,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
transactionId?: string;
|
||||
},
|
||||
) {
|
||||
const { ...payload } = data;
|
||||
const { id, ...payload } = data;
|
||||
const res = await api.post<EmployeeCheckupCreate>(
|
||||
`/employee/${employeeId}/checkup`,
|
||||
{ ...payload },
|
||||
|
|
@ -134,7 +134,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
transactionId?: string;
|
||||
},
|
||||
) {
|
||||
const { ...payload } = data;
|
||||
const { id, ...payload } = data;
|
||||
const res = await api.post<EmployeeWorkCreate>(
|
||||
`/employee/${employeeId}/work`,
|
||||
{ ...payload },
|
||||
|
|
@ -293,6 +293,62 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
return res.data;
|
||||
}
|
||||
|
||||
async function deleteByIdCheckUp(
|
||||
opt: {
|
||||
employeeId: string;
|
||||
checkUpId?: string;
|
||||
},
|
||||
flow?: {
|
||||
sessionId?: string;
|
||||
refTransactionId?: string;
|
||||
transactionId?: string;
|
||||
},
|
||||
) {
|
||||
const res = await api.delete<Employee>(
|
||||
`/employee/${opt.employeeId}/checkup/${opt.checkUpId}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!res) return false;
|
||||
if (res.status === 200) return res.data;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async function deleteByIdWork(
|
||||
opt: {
|
||||
employeeId: string;
|
||||
workId?: string;
|
||||
},
|
||||
flow?: {
|
||||
sessionId?: string;
|
||||
refTransactionId?: string;
|
||||
transactionId?: string;
|
||||
},
|
||||
) {
|
||||
const res = await api.delete<Employee>(
|
||||
`/employee/${opt.employeeId}/work/${opt.workId}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!res) return false;
|
||||
if (res.status === 200) return res.data;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async function deleteById(
|
||||
id: string,
|
||||
flow?: {
|
||||
|
|
@ -472,9 +528,11 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
|
||||
createEmployeeCheckup,
|
||||
editByIdEmployeeCheckup,
|
||||
deleteByIdCheckUp,
|
||||
|
||||
createEmployeeWork,
|
||||
editByIdEmployeeWork,
|
||||
deleteByIdWork,
|
||||
|
||||
createEmployeeOtherInfo,
|
||||
editByIdEmployeeOtherInfo,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue