Merge branch 'dev' into fix/3981-login-email-case

This commit is contained in:
Alejandro Gispert authored and GitHub committed 2026-02-22 08:01:26 +01:00
commit 60c0915aa5
545 files changed
+33675 -142714

No files matched your search

+13 -17
View File
@@ -1,20 +1,12 @@
import { z } from "zod";
import { hashPassword } from "@/lib/password";
import { parseRequest } from "@/lib/request";
import { badRequest, json, ok, unauthorized } from "@/lib/response";
import { userRoleParam } from "@/lib/schema";
import { canDeleteUser, canUpdateUser, canViewUser } from "@/permissions";
import {
deleteUser,
getUser,
getUserByUsername,
updateUser,
} from "@/queries/prisma";
import { z } from 'zod';
import { hashPassword } from '@/lib/password';
import { parseRequest } from '@/lib/request';
import { badRequest, json, notFound, ok, unauthorized } from '@/lib/response';
import { userRoleParam } from '@/lib/schema';
import { canDeleteUser, canUpdateUser, canViewUser } from '@/permissions';
import { deleteUser, getUser, getUserByUsername, updateUser } from '@/queries/prisma';
export async function GET(
request: Request,
{ params }: { params: Promise<{ userId: string }> },
) {
export async function GET(request: Request, { params }: { params: Promise<{ userId: string }> }) {
const { auth, error } = await parseRequest(request);
if (error) {
@@ -38,7 +30,7 @@ export async function POST(
) {
const schema = z.object({
username: z.string().max(255).optional(),
password: z.string().max(255).optional(),
password: z.string().min(8).max(255).optional(),
role: userRoleParam.optional(),
});
@@ -58,6 +50,10 @@ export async function POST(
const user = await getUser(userId);
if (!user) {
return notFound();
}
const data: any = {};
if (password) {
+11 -10
View File
@@ -1,18 +1,19 @@
import { z } from "zod";
import { ROLES } from "@/lib/constants";
import { uuid } from "@/lib/crypto";
import { hashPassword } from "@/lib/password";
import { parseRequest } from "@/lib/request";
import { badRequest, json, unauthorized } from "@/lib/response";
import { canCreateUser } from "@/permissions";
import { createUser, getUserByUsername } from "@/queries/prisma";
import { z } from 'zod';
import { ROLES } from '@/lib/constants';
import { uuid } from '@/lib/crypto';
import { hashPassword } from '@/lib/password';
import { parseRequest } from '@/lib/request';
import { badRequest, json, unauthorized } from '@/lib/response';
import { userRoleParam } from '@/lib/schema';
import { canCreateUser } from '@/permissions';
import { createUser, getUserByUsername } from '@/queries/prisma';
export async function POST(request: Request) {
const schema = z.object({
id: z.uuid().optional(),
username: z.string().max(255),
password: z.string(),
role: z.string().regex(/admin|user|view-only/i),
password: z.string().min(8).max(255),
role: userRoleParam,
});
const { auth, body, error } = await parseRequest(request, schema);