mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-01 10:11:50 +02:00
✨ Self-Hosting Update (#842)
This commit is contained in:
parent
3e616d1e41
commit
7a5f9ae474
51 changed files with 945 additions and 781 deletions
|
@ -9,7 +9,6 @@ import utc from "dayjs/plugin/utc";
|
|||
import * as ics from "ics";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getSubscriptionStatus } from "../../utils/auth";
|
||||
import { getTimeZoneAbbreviation } from "../../utils/date";
|
||||
import { nanoid } from "../../utils/nanoid";
|
||||
import {
|
||||
|
@ -74,8 +73,6 @@ export const polls = router({
|
|||
const participantUrlId = nanoid();
|
||||
const pollId = nanoid();
|
||||
|
||||
const { active: isPro } = await getSubscriptionStatus(ctx.user.id);
|
||||
|
||||
const poll = await prisma.poll.create({
|
||||
select: {
|
||||
adminUrlId: true,
|
||||
|
@ -117,13 +114,9 @@ export const polls = router({
|
|||
})),
|
||||
},
|
||||
},
|
||||
...(isPro
|
||||
? {
|
||||
hideParticipants: input.hideParticipants,
|
||||
disableComments: input.disableComments,
|
||||
hideScores: input.hideScores,
|
||||
}
|
||||
: undefined),
|
||||
hideParticipants: input.hideParticipants,
|
||||
disableComments: input.disableComments,
|
||||
hideScores: input.hideScores,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -171,11 +164,9 @@ export const polls = router({
|
|||
hideScores: z.boolean().optional(),
|
||||
}),
|
||||
)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
.mutation(async ({ input }) => {
|
||||
const pollId = await getPollIdFromAdminUrlId(input.urlId);
|
||||
|
||||
const { active: isPro } = await getSubscriptionStatus(ctx.user.id);
|
||||
|
||||
if (input.optionsToDelete && input.optionsToDelete.length > 0) {
|
||||
await prisma.option.deleteMany({
|
||||
where: {
|
||||
|
@ -218,13 +209,9 @@ export const polls = router({
|
|||
description: input.description,
|
||||
timeZone: input.timeZone,
|
||||
closed: input.closed,
|
||||
...(isPro
|
||||
? {
|
||||
hideScores: input.hideScores,
|
||||
hideParticipants: input.hideParticipants,
|
||||
disableComments: input.disableComments,
|
||||
}
|
||||
: undefined),
|
||||
hideScores: input.hideScores,
|
||||
hideParticipants: input.hideParticipants,
|
||||
disableComments: input.disableComments,
|
||||
},
|
||||
});
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue