fix(intern): menerapkan fallback posisi intern ke snapshot tabal user
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -184,6 +184,8 @@ class ProjectRepository {
|
||||
full_name: true,
|
||||
email: true,
|
||||
professional_bio: true,
|
||||
intern_position: true,
|
||||
intern_interest_group: true,
|
||||
is_active: true,
|
||||
lamaran_magang: {
|
||||
select: {
|
||||
|
||||
@@ -393,8 +393,8 @@ class ProjectService {
|
||||
full_name: user.full_name,
|
||||
email: user.email,
|
||||
professional_bio: user.professional_bio || null,
|
||||
position: lowongan?.posisi || null,
|
||||
kelompok_peminatan: lowongan?.kelompok_peminatan || null,
|
||||
position: lowongan?.posisi || user.intern_position || null,
|
||||
kelompok_peminatan: lowongan?.kelompok_peminatan || user.intern_interest_group || null,
|
||||
},
|
||||
created_at: member.created_at,
|
||||
updated_at: member.updated_at,
|
||||
@@ -540,7 +540,7 @@ class ProjectService {
|
||||
const mappedInterns = interns.map((intern) => {
|
||||
const activeMembership = intern.project_members?.[0] || null;
|
||||
const projectName = activeMembership?.project?.project_name || "Unassigned";
|
||||
const role = intern.lamaran_magang?.lowongan_magang?.posisi || "-";
|
||||
const role = intern.lamaran_magang?.lowongan_magang?.posisi || intern.intern_position || "-";
|
||||
|
||||
return {
|
||||
id: intern.id,
|
||||
|
||||
Reference in New Issue
Block a user