Skip to content

Commit

Permalink
Merge pull request #3072 from ever-co/fix/employee-object-and-employe…
Browse files Browse the repository at this point in the history
…eId-validation

Fix: validate employee object and employeeId string format in request…
  • Loading branch information
evereq authored Sep 26, 2024
2 parents e1e8819 + 88c84f3 commit 9dff678
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 32 deletions.
6 changes: 5 additions & 1 deletion apps/web/app/hooks/features/useDailyPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ export function useDailyPlan() {
async (data: ICreateDailyPlan) => {
if (user?.tenantId) {
const res = await createQueryCall(
{ ...data, organizationTeamId: activeTeam?.id },
{
...data,
organizationTeamId: activeTeam?.id,
employeeId: user?.employee?.id
},
user?.tenantId || ''
);
//Check if there is an existing plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function CreateDailyPlanFormModal({
) as 'Select' | 'Select & Close';

const existingPlanDates = useMemo(
() => profileDailyPlans.items.map((plan) => new Date(plan.date)),
() => profileDailyPlans?.items?.map((plan) => new Date(plan.date)),
[profileDailyPlans.items]
);

Expand Down Expand Up @@ -290,12 +290,12 @@ function MembersList({
{(member?.employee?.user?.image?.thumbUrl ||
member?.employee?.user?.image?.fullUrl ||
member?.employee?.user?.imageUrl) &&
isValidUrl(
member?.employee?.user?.image?.thumbUrl ||
isValidUrl(
member?.employee?.user?.image?.thumbUrl ||
member?.employee?.user?.image?.fullUrl ||
member?.employee?.user?.imageUrl ||
''
) ? (
) ? (
<Avatar
size={36}
className="relative cursor-pointer dark:border-[0.25rem] dark:border-[#26272C]"
Expand Down
54 changes: 27 additions & 27 deletions apps/web/lib/features/task/task-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -711,39 +711,39 @@ function TaskCardMenu({
{(viewType == 'default' ||
(viewType === 'dailyplan' &&
planMode === 'Outstanding')) && (
<>
<Divider type="HORIZONTAL" />
<div className="mt-3">
{!taskPlannedToday && (
<li className="mb-2">
<PlanTask
planMode="today"
taskId={task.id}
employeeId={profile?.member?.employeeId ?? ''}
taskPlannedToday={taskPlannedToday}
/>
</li>
)}
{!taskPlannedTomorrow && (
<>
<Divider type="HORIZONTAL" />
<div className="mt-3">
{!taskPlannedToday && (
<li className="mb-2">
<PlanTask
planMode="today"
taskId={task.id}
employeeId={profile?.member?.employeeId ?? ''}
taskPlannedToday={taskPlannedToday}
/>
</li>
)}
{!taskPlannedTomorrow && (
<li className="mb-2">
<PlanTask
planMode="tomorow"
taskId={task.id}
employeeId={profile?.member?.employeeId ?? ''}
taskPlannedForTomorrow={taskPlannedTomorrow}
/>
</li>
)}
<li className="mb-2">
<PlanTask
planMode="tomorow"
planMode="custom"
taskId={task.id}
employeeId={profile?.member?.employeeId ?? ''}
taskPlannedForTomorrow={taskPlannedTomorrow}
/>
</li>
)}
<li className="mb-2">
<PlanTask
planMode="custom"
taskId={task.id}
employeeId={profile?.member?.employeeId ?? ''}
/>
</li>
</div>
</>
)}
</div>
</>
)}

{viewType === 'dailyplan' &&
(planMode === 'Today Tasks' ||
Expand Down

0 comments on commit 9dff678

Please sign in to comment.