Skip to content

Commit

Permalink
fix: skill, preffered job component showig if the have no values
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-abin committed Oct 28, 2024
1 parent a9c364b commit eecf999
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 27 deletions.
6 changes: 2 additions & 4 deletions client/src/axios/apiMethods/profile-service/candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ export const deleteResumeApi = async (candidateId: string): Promise<any> => {
return makeApiCall("patch", profileApiUrlConfig.deleteResumeUrl(candidateId));
};

export const updateCandidateSkillsProfileApi = async (userId: string,skills: Array<string>): Promise<any> => {
export const updateCandidateSkillsProfileApi = async (skills: Array<string>): Promise<any> => {
const data = {
id: userId,
skills
}
return makeApiCall("patch", profileApiUrlConfig.updateCandidateSkillsUrl, data, true);
};

export const updateCandidatePreferredJobsProfileApi = async (userId: string,preferredJobs: Array<string>): Promise<any> => {
export const updateCandidatePreferredJobsProfileApi = async (preferredJobs: Array<string>): Promise<any> => {
const data = {
id: userId,
preferredJobs
}
return makeApiCall("patch", profileApiUrlConfig.updateCandidatePreferredJobsUrl, data, true);
Expand Down
16 changes: 8 additions & 8 deletions client/src/pages/profile/candidate/CandidateProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import SpinnerLoading from "../../../components/loading/SpinnerLoading";
import { hotToastMessage } from "../../../utils/hotToastMessage";
import { setMyProfileData } from "../../../redux/slice/user";
import { swal } from "../../../utils/swal";
import { CONSTANTS } from "../../../utils/constants";

const CandidateProfilePage: React.FC = () => {
const navigate = useNavigate();
Expand Down Expand Up @@ -157,7 +158,6 @@ const CandidateProfilePage: React.FC = () => {

const handleSavePreferredJobs = async () => {
const response = await updateCandidatePreferredJobsProfileApi(
candidateData.id,
preferredJobs
);

Expand All @@ -172,7 +172,6 @@ const CandidateProfilePage: React.FC = () => {

const handleSaveSkills = async () => {
const response = await updateCandidateSkillsProfileApi(
candidateData.id,
skills
);

Expand Down Expand Up @@ -229,7 +228,7 @@ const CandidateProfilePage: React.FC = () => {
{imgLoading && <SpinnerLoading />}
{!imgLoading && (
<img
src={candidateProfileData?.profileImage}
src={candidateProfileData?.profileImage ?? CONSTANTS.CANDIDATE_DEFAULT_PROFILE_IMAGE}
className="md:w-3/6 rounded-full shadow-2xl"
/>
)}
Expand Down Expand Up @@ -346,7 +345,7 @@ const CandidateProfilePage: React.FC = () => {
</div>
</div>

<div className="bg-gray-100 p-6 my-6 rounded-lg shadow-md">
{isRecruiterUrl && !candidateProfileData?.resume?.filename ?"": <div className="bg-gray-100 p-6 my-6 rounded-lg shadow-md">
{candidateProfileData?.resume && (
<>
<label className="block mb-4 text-lg font-semibold">
Expand Down Expand Up @@ -424,7 +423,7 @@ const CandidateProfilePage: React.FC = () => {
Selected File: {selectedFile?.name}
</p>
)}
</div>
</div>}
</div>

{/* =============================================Skill start============================================= */}
Expand Down Expand Up @@ -522,7 +521,7 @@ const CandidateProfilePage: React.FC = () => {
{/* ====modal end ==== */}

{/* Skills */}
<div className="bg-gray-100 p-6 my-6 rounded-lg shadow-md">
{isRecruiterUrl && skills.length === 0 ?"": <div className="bg-gray-100 p-6 my-6 rounded-lg shadow-md">
<div className="">
<p className="flex items-center gap-4">
<span className="text-xl font-bold mb-2">
Expand Down Expand Up @@ -556,13 +555,13 @@ const CandidateProfilePage: React.FC = () => {
)}
</ul>
</div>
</div>
</div>}
{/* ===============================================Skill end================================================== */}

{/* =================================================Preferred jobs start================================================ */}
{/* ====modal start ==== */}
{/* Put this part before </body> tag */}

{isRecruiterUrl && preferredJobs.length === 0 ?"":<>
<input
type="checkbox"
id="my_modal_7"
Expand Down Expand Up @@ -689,6 +688,7 @@ const CandidateProfilePage: React.FC = () => {
</ul>
</div>
</div>
</>}
{/* =================================================Preferred jobs end================================================ */}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export = (dependencies: IDependency) => {
} = dependencies;

return async (req: Request, res: Response) => {
const { skills: skills } = req.body;
const { skills } = req.body;
const { userId } = req.currentUser;

const candidate = await updateSkillsUseCase(dependencies).execute(userId, skills);
Expand Down
15 changes: 2 additions & 13 deletions profile/src/useCases/candidate/deleteResume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,8 @@ export = (dependencies: IDependency) => {

const candidateProfileUpdatedEvent = new CandidateProfileUpdatedEventPublisher(kafkaClient);
await candidateProfileUpdatedEvent.publish({
name: updatedProfile?.name,
email: updatedProfile?.email,
phone: updatedProfile?.phone,
isActive: updatedProfile?.isActive,
gender: updatedProfile?.gender,
currentLocation: updatedProfile?.currentLocation,
address: updatedProfile?.address,
skills: updatedProfile?.skills,
profileImage: updatedProfile?.profileImage,
about: updatedProfile?.about,
resume: updatedProfile?.resume,
experience: updatedProfile?.experience,
userId: updatedProfile?.userId,
resume: undefined,
userId: updatedProfile?._id,
});

return updatedProfile;
Expand Down
2 changes: 1 addition & 1 deletion profile/src/useCases/candidate/uploadResume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export = (dependencies: IDependency) => {
const execute = async (profileId: string, file: IResume) => {
try {
if (!file) return; // Return or handle accordingly
const profile = await candidateProfileRepository.findById(profileId);
const profile = await candidateProfileRepository.getProfileByUserId(profileId);
if (!profile) throw new NotFoundError('profile not found');
const updatedProfile = await candidateProfileRepository.uploadResume(profileId, {
url: file?.url,
Expand Down

0 comments on commit eecf999

Please sign in to comment.