Compare commits
No commits in common. "c8c645f7a6b9819e95a038359df02b89ded6fec5" and "ec407364d9c424c8af01d6d6cdf11b2d78ebe9ef" have entirely different histories.
c8c645f7a6
...
ec407364d9
@ -62,15 +62,13 @@ export const createContract = async (ctx: any) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 2. Insert the brand new active contract
|
// 2. Insert the brand new active contract
|
||||||
const [result] = await connection.execute(
|
const [result] = await connection.execute(
|
||||||
`INSERT INTO contracts (employee_id, department_id, job_id, work_email, reporting_to_id, date_joining, probation_days, status, salary_structure_id)
|
`INSERT INTO contracts (employee_id, department_id, job_id, date_joining, probation_days, status, salary_structure_id)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
||||||
[
|
[
|
||||||
data.employeeId,
|
data.employeeId,
|
||||||
data.departmentId,
|
data.departmentId,
|
||||||
data.jobId,
|
data.jobId,
|
||||||
data.workEmail, // <-- Added
|
|
||||||
data.reportingToId, // <-- Added
|
|
||||||
data.dateJoining,
|
data.dateJoining,
|
||||||
data.probationDays,
|
data.probationDays,
|
||||||
'ACTIVE',
|
'ACTIVE',
|
||||||
|
|||||||
@ -279,43 +279,20 @@ export const updateEmployee = async (ctx: any) => {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
// await connection.execute(
|
|
||||||
// `UPDATE addresses
|
|
||||||
// SET door_number = ?, landmark = ?, address_line = ?, pincode = ?, district = ?, state = ?
|
|
||||||
// WHERE partner_id = ? AND address_type = ?`,
|
|
||||||
// [
|
|
||||||
// data.address.doorNumber,
|
|
||||||
// data.address.landmark,
|
|
||||||
// data.address.line,
|
|
||||||
// data.address.pincode,
|
|
||||||
// data.address.district,
|
|
||||||
// data.address.state,
|
|
||||||
// partnerId,
|
|
||||||
// data.address.type,
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
|
|
||||||
// Upsert Address (Fixes the missing address bug)
|
|
||||||
await connection.execute(
|
await connection.execute(
|
||||||
`INSERT INTO addresses (partner_id, address_type, door_number, landmark, address_line, pincode, district, state)
|
`UPDATE addresses
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
SET door_number = ?, landmark = ?, address_line = ?, pincode = ?, district = ?, state = ?
|
||||||
ON DUPLICATE KEY UPDATE
|
WHERE partner_id = ? AND address_type = ?`,
|
||||||
door_number = VALUES(door_number),
|
|
||||||
landmark = VALUES(landmark),
|
|
||||||
address_line = VALUES(address_line),
|
|
||||||
pincode = VALUES(pincode),
|
|
||||||
district = VALUES(district),
|
|
||||||
state = VALUES(state)`,
|
|
||||||
[
|
[
|
||||||
partnerId,
|
|
||||||
data.address.type,
|
|
||||||
data.address.doorNumber,
|
data.address.doorNumber,
|
||||||
data.address.landmark,
|
data.address.landmark,
|
||||||
data.address.line,
|
data.address.line,
|
||||||
data.address.pincode,
|
data.address.pincode,
|
||||||
data.address.district,
|
data.address.district,
|
||||||
data.address.state,
|
data.address.state,
|
||||||
]
|
partnerId,
|
||||||
|
data.address.type,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user