perf: make metadata generation light for event type single page (#19143)

* add findTitleById method to Repository

* refactor route
This commit is contained in:
Benny Joo authored and GitHub committed 2025-02-07 00:26:29 +02:00
1 parent 19921ab7c9
commit c9bfd977b1
2 files changed
+67 -5

No files matched your search

@@ -441,6 +441,44 @@ export class EventTypeRepository {
});
}
static async findTitleById({ id, userId }: { id: number; userId: number }) {
return await prisma.eventType.findFirst({
where: {
AND: [
{
OR: [
{
users: {
some: {
id: userId,
},
},
},
{
team: {
members: {
some: {
userId: userId,
},
},
},
},
{
userId: userId,
},
],
},
{
id,
},
],
},
select: {
title: true,
},
});
}
static async findById({ id, userId }: { id: number; userId: number }) {
const userSelect = Prisma.validator<Prisma.UserSelect>()({
name: true,