chore: Add initial webhook wiring (TRPC handlers) to the new architecture (#27170)
* --init * clean up * unnecessary comment * remove comment * fix factory resolver * Add active filter to webhook query
This commit is contained in:
1 parent
646d18e286
commit
4115eaacbd
14 files changed
+142
-77
No files matched your search
@@ -2,4 +2,10 @@ import type { User } from "@calcom/prisma/client";
|
||||
|
||||
export interface IUsersRepository {
|
||||
updateLastActiveAt(userId: number): Promise<User>;
|
||||
|
||||
/**
|
||||
* @param userId - The user ID to query
|
||||
* @returns User with team memberships, or null if user not found
|
||||
*/
|
||||
findUserTeams(userId: number): Promise<{ teams: { teamId: number }[] } | null>;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import db, { prisma } from "@calcom/prisma";
|
||||
import { captureException } from "@sentry/nextjs";
|
||||
|
||||
import db from "@calcom/prisma";
|
||||
|
||||
import type { IUsersRepository } from "./users.repository.interface";
|
||||
|
||||
export class UsersRepository implements IUsersRepository {
|
||||
@@ -17,4 +15,23 @@ export class UsersRepository implements IUsersRepository {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async findUserTeams(userId: number): Promise<{ teams: { teamId: number }[] } | null> {
|
||||
try {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: userId },
|
||||
select: {
|
||||
teams: {
|
||||
select: {
|
||||
teamId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return user;
|
||||
} catch (err) {
|
||||
captureException(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user