From 59325b3000427ff4a31f9f368b03ecab0e94e515 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Fri, 14 Feb 2025 11:32:32 -0800 Subject: [PATCH 1/3] Fix deleteTeamUser route --- .../teams/[teamId]/users/[userId]/route.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/app/api/teams/[teamId]/users/[userId]/route.ts b/src/app/api/teams/[teamId]/users/[userId]/route.ts index cadcd8b0..bf5f4d36 100644 --- a/src/app/api/teams/[teamId]/users/[userId]/route.ts +++ b/src/app/api/teams/[teamId]/users/[userId]/route.ts @@ -1,8 +1,8 @@ -import { z } from 'zod'; -import { unauthorized, json, badRequest, ok } from '@/lib/response'; -import { canDeleteTeam, canUpdateTeam } from '@/lib/auth'; +import { canDeleteTeamUser, canUpdateTeam } from '@/lib/auth'; import { parseRequest } from '@/lib/request'; -import { deleteTeam, getTeamUser, updateTeamUser } from '@/queries'; +import { badRequest, json, ok, unauthorized } from '@/lib/response'; +import { deleteTeamUser, getTeamUser, updateTeamUser } from '@/queries'; +import { z } from 'zod'; export async function GET( request: Request, @@ -58,7 +58,7 @@ export async function POST( export async function DELETE( request: Request, - { params }: { params: Promise<{ teamId: string }> }, + { params }: { params: Promise<{ teamId: string; userId: string }> }, ) { const { auth, error } = await parseRequest(request); @@ -66,13 +66,19 @@ export async function DELETE( return error(); } - const { teamId } = await params; + const { teamId, userId } = await params; - if (!(await canDeleteTeam(auth, teamId))) { + if (!(await canDeleteTeamUser(auth, teamId, userId))) { return unauthorized('You must be the owner of this team.'); } - await deleteTeam(teamId); + const teamUser = await getTeamUser(teamId, userId); + + if (!teamUser) { + return badRequest('The User does not exists on this team.'); + } + + await deleteTeamUser(teamId, userId); return ok(); } From 195f8d945b8a3464933984d53abf328c80aa2af0 Mon Sep 17 00:00:00 2001 From: Joseph <61133303+zcraber@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:04:48 +0530 Subject: [PATCH 2/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(docker):=20re?= =?UTF-8?q?move=20versioning=20in=20docker=20compose=20file=20as=20it's=20?= =?UTF-8?q?deprecated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will remove the warning message `the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion`. Reference: https://docs.docker.com/reference/compose-file/version-and-name/#version-top-level-element-obsolete --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 185f1d0e..7b51db66 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ --- -version: '3' services: umami: image: ghcr.io/umami-software/umami:postgresql-latest From 0a92f987ee9f114c65a677ce7f2347e8b99e179c Mon Sep 17 00:00:00 2001 From: RikThePixel Date: Sat, 22 Feb 2025 00:59:43 +0100 Subject: [PATCH 3/3] docs(docker): Add -d flag to update commands to reflect docker install instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1378428..84f3a20c 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ To update the Docker image, simply pull the new images and rebuild: ```bash docker compose pull -docker compose up --force-recreate +docker compose up --force-recreate -d ``` ---