Compare commits

..

No commits in common. "c8c645f7a6b9819e95a038359df02b89ded6fec5" and "ec407364d9c424c8af01d6d6cdf11b2d78ebe9ef" have entirely different histories.

2 changed files with 9 additions and 34 deletions

View File

@ -63,14 +63,12 @@ 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, work_email, reporting_to_id, date_joining, probation_days, status, salary_structure_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
`INSERT INTO contracts (employee_id, department_id, job_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',

View File

@ -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(
`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)`,
`UPDATE addresses
SET door_number = ?, landmark = ?, address_line = ?, pincode = ?, district = ?, state = ?
WHERE partner_id = ? AND address_type = ?`,
[
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();