From 49160d001b493a4b9f3610323b123b1fb89f7131 Mon Sep 17 00:00:00 2001 From: DenisVorop Date: Thu, 12 Oct 2023 16:11:59 +0300 Subject: [PATCH] refactor: priority string replaced with priority model --- scripts/fillDevData.ts | 5 +---- src/components/GlobalSearch/GlobalSearch.tsx | 2 +- src/components/GoalHeader.tsx | 2 +- src/components/GoalsGroup.tsx | 2 +- src/components/GoalsPage/GoalsPage.tsx | 2 +- src/components/ProjectListItemConnected.tsx | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/fillDevData.ts b/scripts/fillDevData.ts index 8d1d4d3f3..916ccc5ea 100644 --- a/scripts/fillDevData.ts +++ b/scripts/fillDevData.ts @@ -167,8 +167,6 @@ const sample = (arr: any[]) => arr[Math.floor(Math.random() * arr.length)]; [faker.lorem.words(2), faker.lorem.sentence(5), sample(users).activityId], // eslint-disable-next-line no-loop-func ].map(([title, description, activityId]: string[], index) => { - const p = sample(priority); - return prisma.goal.create({ data: { scopeId: index + 1, @@ -177,8 +175,7 @@ const sample = (arr: any[]) => arr[Math.floor(Math.random() * arr.length)]; projectId: project.id, activityId, ownerId: activityId, - priority: p.title, - priorityId: p.value, + priorityId: sample(priority).id, participants: { connect: Math.random() > 0.5 diff --git a/src/components/GlobalSearch/GlobalSearch.tsx b/src/components/GlobalSearch/GlobalSearch.tsx index 21b0348ea..19dbe8fb5 100644 --- a/src/components/GlobalSearch/GlobalSearch.tsx +++ b/src/components/GlobalSearch/GlobalSearch.tsx @@ -162,7 +162,7 @@ export const GlobalSearch = () => { gap={10} item={{ title: item.title, - priority: item.priority, + priority: item.priority?.title, state: item.state, owner: item.owner, issuer: item.activity, diff --git a/src/components/GoalHeader.tsx b/src/components/GoalHeader.tsx index 94f3143ad..c5692fd43 100644 --- a/src/components/GoalHeader.tsx +++ b/src/components/GoalHeader.tsx @@ -76,7 +76,7 @@ export const GoalHeader: FC = ({ (function GoalsGroup({ issuer={g.activity} owner={g.owner} tags={g.tags} - priority={g.priority} + priority={g.priority?.title} comments={g._count?.comments} estimate={g.estimate} estimateType={g.estimateType} diff --git a/src/components/GoalsPage/GoalsPage.tsx b/src/components/GoalsPage/GoalsPage.tsx index 063848ef5..9617b0a99 100644 --- a/src/components/GoalsPage/GoalsPage.tsx +++ b/src/components/GoalsPage/GoalsPage.tsx @@ -200,7 +200,7 @@ export const GoalsPage = ({ user, ssrTime, defaultPresetFallback }: ExternalPage issuer={g.activity} owner={g.owner} tags={g.tags} - priority={g.priority} + priority={g.priority?.title} comments={g._count?.comments} estimate={g.estimate} estimateType={g.estimateType} diff --git a/src/components/ProjectListItemConnected.tsx b/src/components/ProjectListItemConnected.tsx index 037bd258b..549954dc7 100644 --- a/src/components/ProjectListItemConnected.tsx +++ b/src/components/ProjectListItemConnected.tsx @@ -73,7 +73,7 @@ export const ProjectListItemConnected: FC<{ issuer={g.activity} owner={g.owner} tags={g.tags} - priority={g.priority} + priority={g.priority?.title} comments={g._count?.comments} estimate={g.estimate} estimateType={g.estimateType}