diff --git a/apps/web/src/contexts/permissions.tsx b/apps/web/src/contexts/permissions.tsx index 8db5345db..db6f51599 100644 --- a/apps/web/src/contexts/permissions.tsx +++ b/apps/web/src/contexts/permissions.tsx @@ -29,7 +29,7 @@ export const usePermissions = () => { const { user, ownsObject } = useUser(); const role = useRole(); const { participants } = useParticipants(); - const isClosed = poll.closed === true || poll.event !== null; + const isClosed = poll.event !== null; return { isUser: (userId: string) => userId === user.id || userId === context.userId, canAddNewParticipant: !isClosed, diff --git a/apps/web/src/trpc/client/types.ts b/apps/web/src/trpc/client/types.ts index b104287f3..7d0349e0a 100644 --- a/apps/web/src/trpc/client/types.ts +++ b/apps/web/src/trpc/client/types.ts @@ -17,7 +17,6 @@ export type GetPollApiResponse = { adminUrlId: string; status: PollStatus; participantUrlId: string; - closed: boolean; createdAt: Date; deleted: boolean; }; diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.ts index c2093cb39..49d2a52ec 100644 --- a/apps/web/src/trpc/routers/polls.ts +++ b/apps/web/src/trpc/routers/polls.ts @@ -265,7 +265,6 @@ export const polls = router({ description: z.string().optional(), optionsToDelete: z.string().array().optional(), optionsToAdd: z.string().array().optional(), - closed: z.boolean().optional(), hideParticipants: z.boolean().optional(), disableComments: z.boolean().optional(), hideScores: z.boolean().optional(), @@ -344,7 +343,6 @@ export const polls = router({ location: input.location, description: input.description, timeZone: input.timeZone, - closed: input.closed, hideScores: input.hideScores, hideParticipants: input.hideParticipants, disableComments: input.disableComments, @@ -431,7 +429,6 @@ export const polls = router({ createdAt: true, adminUrlId: true, participantUrlId: true, - closed: true, status: true, hideParticipants: true, disableComments: true, @@ -770,7 +767,6 @@ export const polls = router({ delete: true, }, status: "live", - closed: false, // @deprecated }, }), ]); @@ -787,7 +783,6 @@ export const polls = router({ id: input.pollId, }, data: { - closed: true, // TODO (Luke Vella) [2023-12-05]: Remove this status: "paused", }, }); @@ -865,7 +860,6 @@ export const polls = router({ id: input.pollId, }, data: { - closed: false, status: "live", }, }); diff --git a/packages/database/prisma/migrations/20250402100733_remove_closed_column/migration.sql b/packages/database/prisma/migrations/20250402100733_remove_closed_column/migration.sql new file mode 100644 index 000000000..c3874a248 --- /dev/null +++ b/packages/database/prisma/migrations/20250402100733_remove_closed_column/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `closed` on the `polls` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "polls" DROP COLUMN "closed"; diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma index afb4ed3d4..800b43e1a 100644 --- a/packages/database/prisma/schema.prisma +++ b/packages/database/prisma/schema.prisma @@ -148,7 +148,6 @@ model Poll { userId String? @map("user_id") guestId String? @map("guest_id") timeZone String? @map("time_zone") - closed Boolean @default(false) // @deprecated status PollStatus @default(live) deleted Boolean @default(false) deletedAt DateTime? @map("deleted_at")