added Profile Page and Change password (also included breadcrumb

This commit is contained in:
2025-12-27 14:46:21 +07:00
parent bd71b27376
commit ba52869e8f
49 changed files with 11108 additions and 12778 deletions

25
src/utils/disk-storage.ts Normal file
View File

@@ -0,0 +1,25 @@
import fs, { writeFile } from 'fs/promises'
import path from 'path'
export async function saveFile(key: string, file: Buffer | File) {
const uploadDir = './files'
if (!uploadDir) {
throw new Error('Upload directory not found')
}
const fileBuffer =
file instanceof File ? Buffer.from(await file.arrayBuffer()) : file
const filePath = path.join(uploadDir, key)
try {
await fs.mkdir(uploadDir, { recursive: true })
await writeFile(filePath, fileBuffer)
return key
} catch (error) {
console.error(`Error saving file: ${key}`, error)
throw new Error(
`Failed to save file: ${error instanceof Error ? error.message : 'Unknown error'}`,
)
}
}