mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-08 05:31:51 +02:00
uncommit
This commit is contained in:
parent
dc9940b390
commit
331c7fd9ad
16 changed files with 150 additions and 40 deletions
|
@ -29,6 +29,7 @@ export const dashboard = router({
|
|||
title: true,
|
||||
createdAt: true,
|
||||
status: true,
|
||||
timeZone: true,
|
||||
options: {
|
||||
select: {
|
||||
startTime: true,
|
||||
|
@ -58,7 +59,48 @@ export const dashboard = router({
|
|||
status: poll.status,
|
||||
responseCount: poll._count.participants,
|
||||
inviteLink: shortUrl(`/invite/${poll.id}`),
|
||||
timeZone: poll.timeZone,
|
||||
};
|
||||
});
|
||||
}),
|
||||
getUpcoming: possiblyPublicProcedure.query(async ({ ctx }) => {
|
||||
const events = await prisma.event.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
start: true,
|
||||
duration: true,
|
||||
poll: {
|
||||
select: {
|
||||
timeZone: true,
|
||||
location: true,
|
||||
participants: {
|
||||
include: {
|
||||
_count: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
where: {
|
||||
userId: ctx.user.id,
|
||||
start: { gte: new Date() },
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
start: "desc",
|
||||
},
|
||||
{
|
||||
title: "asc",
|
||||
},
|
||||
],
|
||||
take: 3,
|
||||
});
|
||||
|
||||
return events.map(({ poll, ...event }) => ({
|
||||
...event,
|
||||
timeZone: poll?.timeZone || null,
|
||||
location: poll?.location || null,
|
||||
}));
|
||||
}),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue