export const getTeamById: GetTeamById<{ id: string }, Team> = async ({ id }, context) => {
if (!context.user) {
throw new HttpError(401);
}
try {
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
return team;
} catch (error: any) {
throw new HttpError(404, error.message);
}
}
export const getTeamById: GetTeamById<{ id: string }, Team> = async ({ id }, context) => {
if (!context.user) {
throw new HttpError(401);
}
try {
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
return team;
} catch (error: any) {
throw new HttpError(404, error.message);
}
}