Compare commits
2 Commits
ec407364d9
...
c8c645f7a6
| Author | SHA1 | Date | |
|---|---|---|---|
| c8c645f7a6 | |||
| db33948184 |
@ -63,12 +63,14 @@ export const createContract = async (ctx: any) => {
|
||||
|
||||
// 2. Insert the brand new active contract
|
||||
const [result] = await connection.execute(
|
||||
`INSERT INTO contracts (employee_id, department_id, job_id, date_joining, probation_days, status, salary_structure_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
||||
`INSERT INTO contracts (employee_id, department_id, job_id, work_email, reporting_to_id, date_joining, probation_days, status, salary_structure_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[
|
||||
data.employeeId,
|
||||
data.departmentId,
|
||||
data.jobId,
|
||||
data.workEmail, // <-- Added
|
||||
data.reportingToId, // <-- Added
|
||||
data.dateJoining,
|
||||
data.probationDays,
|
||||
'ACTIVE',
|
||||
|
||||
@ -279,20 +279,43 @@ 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(
|
||||
`UPDATE addresses
|
||||
SET door_number = ?, landmark = ?, address_line = ?, pincode = ?, district = ?, state = ?
|
||||
WHERE partner_id = ? AND address_type = ?`,
|
||||
`INSERT INTO addresses (partner_id, address_type, door_number, landmark, address_line, pincode, district, state)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
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.landmark,
|
||||
data.address.line,
|
||||
data.address.pincode,
|
||||
data.address.district,
|
||||
data.address.state,
|
||||
partnerId,
|
||||
data.address.type,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
await connection.commit();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user