mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
fix: wip
This commit is contained in:
@ -9,6 +9,8 @@ import {
|
||||
} from '@documenso/prisma/generated/zod';
|
||||
import { TeamMemberSchema } from '@documenso/prisma/generated/zod';
|
||||
|
||||
import { AppError, AppErrorCode } from '../../errors/app-error';
|
||||
|
||||
export type GetTeamByIdOptions = {
|
||||
userId?: number;
|
||||
teamId: number;
|
||||
@ -74,6 +76,8 @@ export type GetTeamByUrlOptions = {
|
||||
teamUrl: string;
|
||||
};
|
||||
|
||||
export type TGetTeamByUrlResponse = Awaited<ReturnType<typeof getTeamByUrl>>;
|
||||
|
||||
/**
|
||||
* Get a team given a team URL.
|
||||
*/
|
||||
@ -90,7 +94,7 @@ export const getTeamByUrl = async ({ userId, teamUrl }: GetTeamByUrlOptions) =>
|
||||
};
|
||||
}
|
||||
|
||||
const result = await prisma.team.findUniqueOrThrow({
|
||||
const result = await prisma.team.findFirst({
|
||||
where: whereFilter,
|
||||
include: {
|
||||
teamEmail: true,
|
||||
@ -121,6 +125,10 @@ export const getTeamByUrl = async ({ userId, teamUrl }: GetTeamByUrlOptions) =>
|
||||
},
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new AppError(AppErrorCode.NOT_FOUND);
|
||||
}
|
||||
|
||||
const { members, ...team } = result;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user