feat: integrate authentication and password management features, including bcrypt for hashing and NextAuth for session handling

This commit is contained in:
Julien Froidefond
2025-11-30 08:04:06 +01:00
parent 7cb1d5f433
commit d663fbcbd0
30 changed files with 3287 additions and 4164 deletions

View File

@@ -1,8 +1,11 @@
import { NextResponse } from "next/server";
import { folderService, FolderNotFoundError } from "@/services/folder.service";
import { requireAuth } from "@/lib/auth-utils";
import type { Folder } from "@/lib/types";
export async function POST(request: Request) {
const authError = await requireAuth();
if (authError) return authError;
try {
const data: Omit<Folder, "id"> = await request.json();
const created = await folderService.create(data);
@@ -17,6 +20,9 @@ export async function POST(request: Request) {
}
export async function PUT(request: Request) {
const authError = await requireAuth();
if (authError) return authError;
try {
const folder: Folder = await request.json();
const updated = await folderService.update(folder.id, folder);
@@ -31,6 +37,9 @@ export async function PUT(request: Request) {
}
export async function DELETE(request: Request) {
const authError = await requireAuth();
if (authError) return authError;
try {
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");