diff --git a/src/lib/db/index.server.ts b/src/lib/db/index.server.ts index b0862f7..d590f2b 100644 --- a/src/lib/db/index.server.ts +++ b/src/lib/db/index.server.ts @@ -848,7 +848,7 @@ export async function getApplications(postingId: number): Promise phone: application.phone, fullName: application.fullName, resume: fs.existsSync( - path.join(process.cwd(), 'static', 'uploads', 'resumes', `${application.userId}.pdf`) + path.join(process.cwd(), 'uploads', 'resumes', `${application.userId}.pdf`) ) }; delete application.userId; diff --git a/src/lib/index.server.ts b/src/lib/index.server.ts index 0307d60..e159bd5 100644 --- a/src/lib/index.server.ts +++ b/src/lib/index.server.ts @@ -10,7 +10,7 @@ export async function saveAvatar(user: User): Promise { const url = `https://ui-avatars.com/api/?background=random&format=svg&name=${user.fullName ? encodeURIComponent(user.fullName) : encodeURIComponent(user.username)}`; const response = await fetch(url, { headers: { accept: 'image/svg+xml' } }); const avatar = await response.text(); - const filePath = path.join('static', 'uploads', 'avatars', `${user.id}.svg`); + const filePath = path.join('uploads', 'avatars', `${user.id}.svg`); fs.writeFileSync(filePath, avatar); } @@ -18,12 +18,12 @@ export async function saveLogo(company: Company): Promise { // const url = `https://ui-avatars.com/api/?background=random&format=svg&name=${encodeURIComponent(company.name!)}`; // const response = await fetch(url, { headers: { accept: 'image/svg+xml' } }); // const avatar = await response.text(); - // const filePath = path.join('static', 'uploads', 'logos', `${company.id}.svg`); + // const filePath = path.join('uploads', 'logos', `${company.id}.svg`); const url = `https://img.logo.dev/${new URL(company.website!).hostname}`; console.log(url); const response = await fetch(url, { headers: { accept: 'image/jpeg' } }); const avatar = await response.buffer(); - const filePath = path.join('static', 'uploads', 'logos', `${company.id}.jpg`); + const filePath = path.join('uploads', 'logos', `${company.id}.jpg`); fs.writeFileSync(filePath, avatar); } @@ -31,7 +31,7 @@ export async function deleteLogo(company: Company): Promise { // const url = `https://ui-avatars.com/api/?background=random&format=svg&name=${encodeURIComponent(company.name!)}`; // const response = await fetch(url, { headers: { accept: 'image/svg+xml' } }); // const avatar = await response.text(); - const filePath = path.join('static', 'uploads', 'logos', `${company.id}.jpg`); + const filePath = path.join('uploads', 'logos', `${company.id}.jpg`); fs.rmSync(filePath); } diff --git a/src/routes/account/+page.server.ts b/src/routes/account/+page.server.ts index 0d1772a..42919bf 100644 --- a/src/routes/account/+page.server.ts +++ b/src/routes/account/+page.server.ts @@ -9,9 +9,7 @@ import { writeFileSync } from 'fs'; export const load: PageServerLoad = async ({ cookies }) => { const id = getUserId(cookies); const userData = await getUserWithCompanyAndApplications(id); - const resumeExists = fs.existsSync( - path.join(process.cwd(), 'static', 'uploads', 'resumes', `${id}.pdf`) - ); + const resumeExists = fs.existsSync(path.join(process.cwd(), 'uploads', 'resumes', `${id}.pdf`)); return { ...userData, @@ -36,7 +34,7 @@ export const actions: Actions = { fail(400, { message: 'invalid' }); } writeFileSync( - `static/uploads/resumes/${getUserId(cookies)}.pdf`, + `uploads/resumes/${getUserId(cookies)}.pdf`, Buffer.from(await file.arrayBuffer()) );