fix(intern): menerapkan fallback posisi intern ke snapshot tabal user

This commit is contained in:
Muhammad Zhafran Ilham
2026-07-01 18:30:04 +07:00
parent c31c91fb8a
commit b21f5ad5d9
3 changed files with 18 additions and 5 deletions
+13 -2
View File
@@ -124,8 +124,13 @@ class AuthService {
}
const { password, ...userWithoutPassword } = user;
const lowongan = user.lamaran_magang?.lowongan_magang;
return data(userWithoutPassword);
return data({
...userWithoutPassword,
position: lowongan?.posisi || user.intern_position || null,
kelompok_peminatan: lowongan?.kelompok_peminatan || user.intern_interest_group || null,
});
} else {
return error(new NotFoundError('Role tidak valid'));
}
@@ -262,7 +267,13 @@ class AuthService {
});
const { password: _, ...userWithoutPassword } = updatedUser;
return data(userWithoutPassword);
const lowongan = updatedUser.lamaran_magang?.lowongan_magang;
return data({
...userWithoutPassword,
position: lowongan?.posisi || updatedUser.intern_position || null,
kelompok_peminatan: lowongan?.kelompok_peminatan || updatedUser.intern_interest_group || null,
});
} else {
if (imageFile?.filename) {
const { deleteFileIfExists } = require('../../../helpers/utils/fileHelper');