diff --git a/packages/be-gateway/src/routes/index.ts b/packages/be-gateway/src/routes/index.ts index 756e7670..a6530d9c 100644 --- a/packages/be-gateway/src/routes/index.ts +++ b/packages/be-gateway/src/routes/index.ts @@ -40,12 +40,16 @@ const router = Router() const logger = createModuleLog('Request') router.use((req, res, next) => { - logger.info(req.url, { - method: req.method, - url: req.url, - path: req.path - }) - console.log('\x1b[0m', `🥝 ${req.method}: ${req.url}`, '\x1b[90m') + try { + logger.info(req.url, { + method: req.method, + url: req.url, + path: req.path + }) + console.log('\x1b[0m', `🥝 ${req.method}: ${req.url}`, '\x1b[90m') + } catch (error) { + console.log() + } next() }) diff --git a/packages/be-gateway/src/routes/project/view.ts b/packages/be-gateway/src/routes/project/view.ts index 733fb863..9ff0e9c5 100644 --- a/packages/be-gateway/src/routes/project/view.ts +++ b/packages/be-gateway/src/routes/project/view.ts @@ -50,6 +50,7 @@ export default class ProjectViewController extends BaseController { point: string groupBy: string statusIds: string[] + assigneeIds: string[] } } @@ -68,7 +69,8 @@ export default class ProjectViewController extends BaseController { priority: data.priority, point: data.point, groupBy: data.groupBy, - statusIds: data.statusIds + statusIds: data.statusIds, + assigneeIds: data.assigneeIds } : {}, @@ -117,6 +119,7 @@ export default class ProjectViewController extends BaseController { point: string groupBy: string statusIds: string[] + assigneeIds: string[] } } @@ -130,7 +133,8 @@ export default class ProjectViewController extends BaseController { priority: data.priority, point: data.point, groupBy: data.groupBy, - statusIds: data.statusIds + statusIds: data.statusIds, + assigneeIds: data.assigneeIds } : {}, type, diff --git a/packages/ui-app/app/_features/Project/VisionTimeline/TimelineTaskFilter.tsx b/packages/ui-app/app/_features/Project/VisionTimeline/TimelineTaskFilter.tsx index 1c7cbc75..b28bb991 100644 --- a/packages/ui-app/app/_features/Project/VisionTimeline/TimelineTaskFilter.tsx +++ b/packages/ui-app/app/_features/Project/VisionTimeline/TimelineTaskFilter.tsx @@ -8,15 +8,13 @@ function TimelineTaskFilter() { const { filter, setFilterValue } = useTaskFilter() const { assigneeIds } = filter - const updatedAssigneeIds = assigneeIds.map(uid => { + const updatedAssigneeIds = assigneeIds ? assigneeIds.map(uid => { if (uid === 'ME' && user?.id) { return user.id } return uid - }) - - console.log('update assignee', updatedAssigneeIds) + }) : [] return
{ setTimeout(() => { - console.log('hide') setLoading(false) setVisible(false) setCustomView(false) @@ -47,15 +48,38 @@ export default function ProjectViewModalForm({ }, 500) } + const replaceUidToRelativeValue = (filter: IBoardFilter) => { + const cloneFilter = { ...filter } + + if (type === ProjectViewType.GOAL) { + cloneFilter.assigneeIds = ['ALL'] + } else { + cloneFilter.assigneeIds = cloneFilter.assigneeIds.map(uid => { + if (user?.id === uid) { + return "ME" + } + + return uid + }) + } + + + return cloneFilter + } + const addHandler = () => { + // setLoading(false) + const newFilter = replaceUidToRelativeValue(filter) + const isCustomView = customView || type === ProjectViewType.GOAL + addProjectView({ onlyMe: onlyMe || false, icon, name: viewName || name, type, projectId, - data: customView ? filter : undefined + data: isCustomView ? newFilter : undefined }) .catch(err => { hideModal() @@ -71,7 +95,7 @@ export default function ProjectViewModalForm({ const updateHandler = () => { const id = updateId - const dataFilter = filter + const newDataFilter = replaceUidToRelativeValue(filter) const dataView = filter as unknown as Pick updateView(id, { @@ -92,11 +116,12 @@ export default function ProjectViewModalForm({ setFilter(filter => ({ ...filter, ...{ - date: dataFilter.date, - groupBy: dataFilter.groupBy, - priority: dataFilter.priority, - statusIds: dataFilter.statusIds, - point: dataFilter.point + date: newDataFilter.date, + groupBy: newDataFilter.groupBy, + priority: newDataFilter.priority, + statusIds: newDataFilter.statusIds, + point: newDataFilter.point, + assigneeIds: newDataFilter.assigneeIds } })) diff --git a/packages/ui-app/app/_features/ProjectView/ProjectViewUpdate.tsx b/packages/ui-app/app/_features/ProjectView/ProjectViewUpdate.tsx index ff75ae5e..8266f8ff 100644 --- a/packages/ui-app/app/_features/ProjectView/ProjectViewUpdate.tsx +++ b/packages/ui-app/app/_features/ProjectView/ProjectViewUpdate.tsx @@ -1,10 +1,8 @@ -import { Dialog, messageError, setFixLoading } from '@shared/ui' +import { Dialog, messageError } from '@shared/ui' import { useEffect, useState } from 'react' import ProjectViewModal from './ProjectViewModal' import { IBoardFilter, ProjectViewModalProvider } from './context' import { ETaskFilterGroupByType } from '../TaskFilter/context' -import { projectView } from '@/services/projectView' -import { ProjectView } from '@prisma/client' import { useProjectViewUpdateContext } from './updateContext' import { useProjectViewStore } from '@/store/projectView' @@ -26,6 +24,7 @@ export default function ProjectViewUpdate({ priority: 'ALL', point: "-1", statusIds: ['ALL'], + assigneeIds: ['ME'], groupBy: ETaskFilterGroupByType.STATUS }) @@ -77,6 +76,7 @@ export default function ProjectViewUpdate({ priority: 'ALL', point: "-1", statusIds: ['ALL'], + assigneeIds: ['ME'], groupBy: ETaskFilterGroupByType.STATUS }) } diff --git a/packages/ui-app/app/_features/ProjectView/context.ts b/packages/ui-app/app/_features/ProjectView/context.ts index 594053f2..94d3ae5b 100644 --- a/packages/ui-app/app/_features/ProjectView/context.ts +++ b/packages/ui-app/app/_features/ProjectView/context.ts @@ -8,6 +8,7 @@ export interface IBoardFilter { point: string groupBy: ETaskFilterGroupByType statusIds: string[] + assigneeIds: string[] } interface IProjectViewContextProps { @@ -48,6 +49,7 @@ const ProjectViewContext = createContext({ priority: 'ALL', point: "-1", statusIds: ['ALL'], + assigneeIds: ['ME'], groupBy: ETaskFilterGroupByType.STATUS }, setFilter: () => { console.log(1) } diff --git a/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts b/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts index 68a5afce..ed96d565 100644 --- a/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts +++ b/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts @@ -27,6 +27,7 @@ export const useProjectViewAdd = () => { priority: data.priority, point: data.point, statusIds: data.statusIds, + assigneeIds: data.assigneeIds, groupBy: data.groupBy } : null diff --git a/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts b/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts index 6dc9b83c..bd11bddd 100644 --- a/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts +++ b/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts @@ -37,6 +37,7 @@ export default function useSetViewFilter() { groupBy: data.groupBy, priority: data.priority, statusIds: data.statusIds, + assigneeIds: data.assigneeIds, point: data.point } })) diff --git a/packages/ui-app/app/_features/ProjectViewFilter/FilterForm.tsx b/packages/ui-app/app/_features/ProjectViewFilter/FilterForm.tsx index 392d011b..2ae52975 100644 --- a/packages/ui-app/app/_features/ProjectViewFilter/FilterForm.tsx +++ b/packages/ui-app/app/_features/ProjectViewFilter/FilterForm.tsx @@ -6,12 +6,22 @@ import { ETaskFilterGroupByType } from '../TaskFilter/context' import { useProjectViewContext } from '../ProjectView/context' import StatusSelectMultiple from '@/components/StatusSelectMultiple' import { ProjectViewType } from '@prisma/client' +import MultiMemberPicker from '@/components/MultiMemberPicker' +import { useUser } from '@goalie/nextjs' export default function FilterForm({ type }: { type?: ProjectViewType }) { const { customView, setCustomView, filter, setFilterValue } = useProjectViewContext() const hidden = customView ? '' : 'hidden' - const { date, point, priority, groupBy, statusIds } = filter + const { user } = useUser() + const { date, point, priority, groupBy, statusIds, assigneeIds } = filter + + const updatedAssigneeIds = assigneeIds.map(uid => { + if (uid === 'ME' && user?.id) { + return user.id + } + return uid + }) return ( <> @@ -74,6 +84,15 @@ export default function FilterForm({ type }: { type?: ProjectViewType }) { }} /> ) : null} + + {type === ProjectViewType.LIST || + type === ProjectViewType.BOARD || + type === ProjectViewType.CALENDAR || + type === ProjectViewType.GOAL ? + { + setFilterValue('assigneeIds', val) + }} /> + : null}
diff --git a/packages/ui-app/app/_features/ProjectViewFilter/ListFilter.tsx b/packages/ui-app/app/_features/ProjectViewFilter/ListFilter.tsx index e791f010..c07a9d3c 100644 --- a/packages/ui-app/app/_features/ProjectViewFilter/ListFilter.tsx +++ b/packages/ui-app/app/_features/ProjectViewFilter/ListFilter.tsx @@ -18,7 +18,7 @@ export default function ProjectViewFilterByList({ type, desc, isUpdate, onAdd }:

List

{desc}

- +