Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
import "server-only";
import { prisma } from "@rallly/database";
export const getCalendars = async (userId: string) => {
return await prisma.calendarConnection.findMany({
where: {
userId,
},
select: {
id: true,
displayName: true,
email: true,
provider: true,
integrationId: true,
providerCalendars: {
where: {
isDeleted: false,
},
select: {
id: true,
name: true,
isSelected: true,
},
orderBy: {
name: "asc",
},
},
},
});
};
export const getDefaultCalendar = async (userId: string) => {
return await prisma.user.findUnique({
where: { id: userId },
select: { defaultDestinationCalendarId: true },
});
};