Files
documenso/packages/lib/server-only/team/update-team-public-profile.ts
2025-06-10 11:49:52 +10:00

34 lines
616 B
TypeScript

import { prisma } from '@documenso/prisma';
import { buildTeamWhereQuery } from '../../utils/teams';
export type UpdatePublicProfileOptions = {
userId: number;
teamId: number;
data: {
bio?: string;
enabled?: boolean;
};
};
export const updateTeamPublicProfile = async ({
userId,
teamId,
data,
}: UpdatePublicProfileOptions) => {
return await prisma.team.update({
where: buildTeamWhereQuery({ teamId, userId }),
data: {
profile: {
upsert: {
create: data,
update: data,
},
},
},
include: {
profile: true,
},
});
};