Merge branch 'main' into refactor/handle-seats

This commit is contained in:
Joe Au-Yeung 2024-01-12 12:36:03 -05:00 committed by GitHub
commit 8c081fd6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -58,6 +58,7 @@ export async function patchHandler(req: NextApiRequest) {
const { prisma, body, userId } = req;
const data = schemaTeamUpdateBodyParams.parse(body);
const { teamId } = schemaQueryTeamId.parse(req.query);
/** Only OWNERS and ADMINS can edit teams */
const _team = await prisma.team.findFirst({
include: { members: true },
@ -65,6 +66,18 @@ export async function patchHandler(req: NextApiRequest) {
});
if (!_team) throw new HttpError({ statusCode: 401, message: "Unauthorized: OWNER or ADMIN required" });
const slugAlreadyExists = await prisma.team.findFirst({
where: {
slug: {
mode: "insensitive",
equals: data.slug,
},
},
});
if (slugAlreadyExists && data.slug !== _team.slug)
throw new HttpError({ statusCode: 409, message: "Team slug already exists" });
// Check if parentId is related to this user
if (data.parentId && data.parentId === teamId) {
throw new HttpError({

View File

@ -1,6 +1,6 @@
{
"name": "@calcom/web",
"version": "3.6.3",
"version": "3.6.4",
"private": true,
"scripts": {
"analyze": "ANALYZE=true next build",

View File

@ -74,7 +74,7 @@ export const Day = ({
<span
className={classNames(
"bg-brand-default absolute left-1/2 top-1/2 flex h-[5px] w-[5px] -translate-x-1/2 translate-y-[8px] items-center justify-center rounded-full align-middle sm:translate-y-[12px]",
active && "invert"
active && "bg-brand-accent"
)}>
<span className="sr-only">{t("today")}</span>
</span>