update docker image
This commit is contained in:
parent
cf69a1a65b
commit
5cdd826b5d
BIN
packages/reservation-platform/docker/images/myp-rp_latest.tar.xz
(Stored with Git LFS)
BIN
packages/reservation-platform/docker/images/myp-rp_latest.tar.xz
(Stored with Git LFS)
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "myp-rp",
|
"name": "myp-rp",
|
||||||
"version": "0.1.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@9.12.1",
|
"packageManager": "pnpm@9.12.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { lucia, validateRequest } from "@/server/auth";
|
import { lucia, validateRequest } from "@/server/auth";
|
||||||
import { AuthenticationError } from "@/utils/errors";
|
import strings from "@/utils/strings";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
|
|
||||||
@ -9,13 +9,17 @@ export async function logout(path?: string) {
|
|||||||
const { session } = await validateRequest();
|
const { session } = await validateRequest();
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
throw new AuthenticationError();
|
return {
|
||||||
|
error: strings.ERROR.NO_SESSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await lucia.invalidateSession(session.id);
|
await lucia.invalidateSession(session.id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new AuthenticationError();
|
return {
|
||||||
|
error: strings.ERROR.NO_SESSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionCookie = lucia.createBlankSessionCookie();
|
const sessionCookie = lucia.createBlankSessionCookie();
|
||||||
|
@ -4,8 +4,8 @@ import { validateRequest } from "@/server/auth";
|
|||||||
import { UserRole } from "@/server/auth/permissions";
|
import { UserRole } from "@/server/auth/permissions";
|
||||||
import { db } from "@/server/db";
|
import { db } from "@/server/db";
|
||||||
import { users } from "@/server/db/schema";
|
import { users } from "@/server/db/schema";
|
||||||
import { PermissionError } from "@/utils/errors";
|
|
||||||
import { IS, IS_NOT, guard } from "@/utils/guard";
|
import { IS, IS_NOT, guard } from "@/utils/guard";
|
||||||
|
import strings from "@/utils/strings";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
@ -18,7 +18,9 @@ export async function deleteUser(userId: string, path?: string) {
|
|||||||
const { user } = await validateRequest();
|
const { user } = await validateRequest();
|
||||||
|
|
||||||
if (guard(user, IS_NOT, UserRole.ADMIN)) {
|
if (guard(user, IS_NOT, UserRole.ADMIN)) {
|
||||||
throw new PermissionError();
|
return {
|
||||||
|
error: strings.ERROR.PERMISSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const dbUser = await db.query.users.findFirst({
|
const dbUser = await db.query.users.findFirst({
|
||||||
@ -27,7 +29,9 @@ export async function deleteUser(userId: string, path?: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (guard(dbUser, IS_NOT, UserRole.ADMIN)) {
|
if (guard(dbUser, IS_NOT, UserRole.ADMIN)) {
|
||||||
throw new PermissionError();
|
return {
|
||||||
|
error: strings.ERROR.PERMISSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetUser = await db.query.users.findFirst({
|
const targetUser = await db.query.users.findFirst({
|
||||||
@ -35,11 +39,15 @@ export async function deleteUser(userId: string, path?: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!targetUser) {
|
if (!targetUser) {
|
||||||
throw new Error("Benutzer nicht gefunden");
|
return {
|
||||||
|
error: "Benutzer nicht gefunden",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guard(targetUser, IS, UserRole.ADMIN)) {
|
if (guard(targetUser, IS, UserRole.ADMIN)) {
|
||||||
throw new Error("Kann keinen Admin löschen");
|
return {
|
||||||
|
error: "Admins können nicht gelöscht werden.",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await db.delete(users).where(eq(users.id, userId));
|
await db.delete(users).where(eq(users.id, userId));
|
||||||
|
@ -3,8 +3,8 @@ import { validateRequest } from "@/server/auth";
|
|||||||
import { UserRole } from "@/server/auth/permissions";
|
import { UserRole } from "@/server/auth/permissions";
|
||||||
import { db } from "@/server/db";
|
import { db } from "@/server/db";
|
||||||
import { users } from "@/server/db/schema";
|
import { users } from "@/server/db/schema";
|
||||||
import { PermissionError } from "@/utils/errors";
|
|
||||||
import { IS_NOT, guard } from "@/utils/guard";
|
import { IS_NOT, guard } from "@/utils/guard";
|
||||||
|
import strings from "@/utils/strings";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
@ -19,7 +19,9 @@ export async function updateUser(userId: string, data: z.infer<typeof formSchema
|
|||||||
const { user } = await validateRequest();
|
const { user } = await validateRequest();
|
||||||
|
|
||||||
if (guard(user, IS_NOT, UserRole.ADMIN)) {
|
if (guard(user, IS_NOT, UserRole.ADMIN)) {
|
||||||
throw new PermissionError();
|
return {
|
||||||
|
error: strings.ERROR.PERMISSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const dbUser = await db.query.users.findFirst({
|
const dbUser = await db.query.users.findFirst({
|
||||||
@ -28,7 +30,9 @@ export async function updateUser(userId: string, data: z.infer<typeof formSchema
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (guard(dbUser, IS_NOT, UserRole.ADMIN)) {
|
if (guard(dbUser, IS_NOT, UserRole.ADMIN)) {
|
||||||
throw new PermissionError();
|
return {
|
||||||
|
error: strings.ERROR.PERMISSION,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await db.update(users).set(data).where(eq(users.id, userId));
|
await db.update(users).set(data).where(eq(users.id, userId));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user