diff --git a/.env b/.env index b68c7ff..d0e7485 100644 --- a/.env +++ b/.env @@ -1,8 +1,9 @@ -DB_HOST=localhost -DB_USER=root -DB_PASS=Alpha -DB_NAME=LearnSync -DB_PORT=3306 +PGHOST=localhost +PGUSER=postgres +PGPASSWORD=amna@2327 +PGDATABASE=learnsync_database +PGPORT=5432 PORT=3000 JWT_SECRET=7c6278999cfae23d94f6aa7091b654bff3ad9e1a832c3127 JWT_EXPIRES_IN=1d + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb4fa82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules/ +.env +.env.local +.env.production +.env.development +uploads/ +logs/ diff --git a/controllers/adminController.js b/controllers/adminController.js new file mode 100644 index 0000000..08bd8bc --- /dev/null +++ b/controllers/adminController.js @@ -0,0 +1,57 @@ +// src/controllers/adminController.js +import { + getPendingInstructorsService, + approveInstructorService, + rejectInstructorService +} from "../services/adminService.js"; +import { getInstructorDetails } from "../databases/userDatabase.js"; + +// Existing functions (getPendingInstructors, approveInstructor, rejectInstructor) remain + +export async function approveInstructor(req, res) { + try { + const { id } = req.params; + const instructor = await approveInstructorService(id); + return res.json({ message: "Instructor approved", instructor }); + } catch (err) { + console.error(err); + return res.status(500).json({ error: err.message }); + } +} + +export async function rejectInstructor(req, res) { + try { + const { id } = req.params; + const instructor = await rejectInstructorService(id); + return res.json({ message: "Instructor rejected", instructor }); + } catch (err) { + console.error(err); + return res.status(500).json({ error: err.message }); + } +} + + +// New: fetch full instructor details including uploaded files +export async function getInstructorFullDetails(req, res) { + try { + const { id } = req.params; + const details = await getInstructorDetails(id); + if (!details) return res.status(404).json({ error: "Instructor not found" }); + + res.json(details); + } catch (err) { + console.error("Error fetching instructor details:", err); + res.status(500).json({ error: "Failed to fetch instructor details" }); + } +} + +export async function getPendingInstructors(req, res) { + try { + const instructors = await getPendingInstructorsService(); + return res.json(instructors); + } catch (err) { + console.error(err); + return res.status(500).json({ error: err.message }); + } +} + diff --git a/controllers/authController.js b/controllers/authController.js index 90bc0f8..3bf9198 100644 --- a/controllers/authController.js +++ b/controllers/authController.js @@ -1,4 +1,4 @@ -import {loginService, signupService} from "../services/authService.js"; +import { loginService, signupService } from "../services/authService.js"; export async function login(req, res) { try { @@ -14,12 +14,14 @@ export async function login(req, res) { export async function signup(req, res) { try { - const { name, email, password } = req.body; - const result = await signupService(name, email, password); + const { name, email, password, role, timeZone } = req.body; + + const result = await signupService(name, email, password, role, timeZone); console.log("noice signup"); return res.status(200).json(result); } catch (err) { console.log("error in signup"); return res.status(400).json({ error: err.message }); } -} \ No newline at end of file +} + diff --git a/controllers/instructorController.js b/controllers/instructorController.js new file mode 100644 index 0000000..d071331 --- /dev/null +++ b/controllers/instructorController.js @@ -0,0 +1,59 @@ +import { saveInstructorFiles } from "../services/instructorService.js"; +import { getInstructorDetails } from "../databases/userDatabase.js"; + +export async function getInstructorProfile(req, res) { + try { + const instructorId = req.user.id; // From JWT + + const details = await getInstructorDetails(instructorId); + + res.status(200).json({ + id: instructorId, + status: req.user.status, + certifications: details?.certifications || [], + demo_material: details?.demo_material || [], + subject_tags: details?.subject_tags || [], + education_level_tags: details?.education_level_tags || [] + }); + + } catch (err) { + console.error("Error fetching instructor profile:", err); + res.status(500).json({ error: "Failed to load instructor profile" }); + } +} + +export async function uploadInstructorFiles(req, res) { + try { + const instructorId = req.user.id; + if (!instructorId) throw new Error("Instructor not found"); + + // Files + const certificationsFiles = req.files["certifications"] || []; + const demoMaterialFiles = req.files["demo_material"] || []; + + const certificationsUrls = certificationsFiles.map(f => `/uploads/${f.filename}`); + const demoMaterialUrls = demoMaterialFiles.map(f => `/uploads/${f.filename}`); + + // Extra fields from form + const { subject_tags, education_level_tags } = req.body; + + // Convert comma-separated strings to arrays + const subjectsArray = subject_tags ? subject_tags.split(",").map(s => s.trim()) : []; + const educationLevelsArray = education_level_tags ? education_level_tags.split(",").map(s => s.trim()) : []; + + // Call service to update DB + await saveInstructorFiles( + instructorId, + certificationsUrls, + demoMaterialUrls, + subjectsArray, + educationLevelsArray + ); + + res.status(200).json({ message: "Instructor profile updated successfully" }); + } catch (err) { + console.error("Error uploading instructor files:", err); + res.status(500).json({ error: "Failed to upload instructor profile" }); + } +} + diff --git a/controllers/studentController.js b/controllers/studentController.js new file mode 100644 index 0000000..d75d657 --- /dev/null +++ b/controllers/studentController.js @@ -0,0 +1,58 @@ +// controllers/studentController.js +import { + getStudentDetailsService, + createStudentProfileService, + updateStudentProfileService +} from "../services/studentService.js"; + +/** + * GET /student/details + * Returns { exists: boolean, profile: {...} } + * Pure fetch, does NOT update anything. + */ +export async function getStudentDetailsForDashboard(req, res) { + try { + const details = await getStudentDetailsService(req.user.id); + if (!details) { + return res.json({ exists: false, profile: null }); + } + return res.json({ exists: true, profile: details }); + } catch (err) { + console.error("Error in getStudentDetailsForDashboard:", err); + return res.status(500).json({ error: "Server error fetching profile" }); + } +} + +/** + * POST /student/profile + * Called only when student submits the form (create or explicit update). + * This will create profile if none exists, otherwise it will update. + */ +export async function saveStudentProfile(req, res) { + try { + let { education_level, subject_tags } = req.body; + + // basic validation + if (!education_level || !subject_tags) { + return res.status(400).json({ error: "Missing required fields" }); + } + + // convert comma string to array if needed + if (typeof subject_tags === "string") { + subject_tags = subject_tags.split(",").map(s => s.trim()).filter(Boolean); + } + + const existing = await getStudentDetailsService(req.user.id); + + if (!existing) { + await createStudentProfileService(req.user.id, education_level, subject_tags); + return res.json({ message: "Profile created" }); + } else { + await updateStudentProfileService(req.user.id, education_level, subject_tags); + return res.json({ message: "Profile updated" }); + } + } catch (err) { + console.error("Error in saveStudentProfile:", err); + return res.status(500).json({ error: "Server error while saving profile" }); + } +} diff --git a/database_learnsync.sql b/database_learnsync.sql new file mode 100644 index 0000000..5d0ea11 --- /dev/null +++ b/database_learnsync.sql @@ -0,0 +1,118 @@ +-- Database: learnsync_database + +-- DROP DATABASE IF EXISTS learnsync_database; + +CREATE DATABASE learnsync_database + WITH + OWNER = postgres + ENCODING = 'UTF8' + LC_COLLATE = 'English_United States.1252' + LC_CTYPE = 'English_United States.1252' + LOCALE_PROVIDER = 'libc' + TABLESPACE = pg_default + CONNECTION LIMIT = -1 + IS_TEMPLATE = False; + +----------------------------------------------------------------- + +---the tables below are for zoom meeting, they have not been implememted completely(lack users) +----will be completed when working upon meeting inetgration +CREATE TABLE zoom_accounts ( + id SERIAL PRIMARY KEY, + name VARCHAR(100), + client_id TEXT, + client_secret TEXT, + account_id TEXT, + access_token TEXT, + token_expires_at BIGINT +); +CREATE TABLE sessions ( + session_id SERIAL PRIMARY KEY, + description TEXT NOT NULL, + start_time TIMESTAMP NOT NULL, + duration_minutes INT NOT NULL, + status VARCHAR(20) NOT NULL DEFAULT 'pending' -- pending, accepted, rejected, completed +); + +CREATE TABLE meetings ( + meeting_id SERIAL PRIMARY KEY, + link TEXT NOT NULL, + zoom_account_id INT NOT NULL REFERENCES zoom_accounts(id) ON DELETE CASCADE, + session_id INT REFERENCES sessions(session_id) ON DELETE CASCADE, + start_time TIMESTAMP NOT NULL, + duration_minutes INT NOT NULL +); + +------------------------------------------------------------------------------------------------ + +---This is complete zoom accounts, system zoom accounts which are used for scheduling meetings +INSERT INTO zoom_accounts (name, client_id, client_secret, account_id, access_token, token_expires_at) +VALUES ( + 'me', + 'fL85BzWMSRqLbSyFJFN3fQ', + 'v5yUyx6aHvP3avSxnN9P590xOXFVoiAv', + 'gV_PX5AdRWmUF3GMQItB3g', + NULL, + 0 +), +( + 'me', + 'Zk2T5hrsQGuCWtWWtsKCQg', + 'M0FjcxZ16VbeSvclmIsFJhcLOKoAqBKv', + '4CJlZ93eQVmPAjaiNhO5Pw', + NULL, + 0 +) + +---------------------------------------------------------------- +------User table used by all users including admins, instructors, students +-----this table is mainly used for signup and login +CREATE TABLE IF NOT EXISTS users ( + id BIGSERIAL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL UNIQUE, + password_hash VARCHAR(255) NOT NULL, + role VARCHAR(50) NOT NULL DEFAULT 'student', + time_zone VARCHAR(50) DEFAULT 'UTC', + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + status VARCHAR(50) NOT NULL DEFAULT 'active' +); + +-- Index for fast email lookup (login/lookup) +CREATE INDEX IF NOT EXISTS idx_users_email ON users(email); + +-- Insert an initial admin user +INSERT INTO users (name, email, password_hash, role, time_zone, status) +VALUES ( + 'Admin User', + 'admin@learnsync.com', + '$2b$10$k8C4kNzW23L4gbCakjSlxesE1RET1HaAP0QTv.uoXzz8qWHyRxYJK', + 'admin', + 'UTC', + 'active' +); + +--Extra info of instructor +CREATE TABLE IF NOT EXISTS instructor_details ( + id BIGSERIAL PRIMARY KEY, + instructor_id BIGINT REFERENCES users(id) ON DELETE CASCADE, + certifications TEXT[], -- array of URLs for PDF/image files(at the moment all these + -- files are going in local memory in root directory, named upload) + demo_material TEXT[], -- array of URLs for PDF/image/video files + subject_tags TEXT[], -- array of strings + education_level_tags TEXT[], -- array of strings + created_at TIMESTAMPTZ DEFAULT now(), + updated_at TIMESTAMPTZ DEFAULT now() +); + + +--Extra info of student +CREATE TABLE IF NOT EXISTS student_details ( + student_id INT PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE, + education_level VARCHAR, + subject_tags TEXT[], -- array of subjects interested in + created_at TIMESTAMP DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW() +); + diff --git a/databases/userDatabase.js b/databases/userDatabase.js index 4c632d3..a21ff6c 100644 --- a/databases/userDatabase.js +++ b/databases/userDatabase.js @@ -59,46 +59,47 @@ import pool from "../db.js"; // FOR LOCALHOST TESTING -export async function createUser(name, email, hashedPassword, role = 'student', timeZone = 'UTC') { +async function createUser(name, email, hashedPassword, role = 'student', timeZone = 'UTC') { try { - const [result] = await pool.execute( - "INSERT INTO `user` (name, email, password, role, timeZone) VALUES (?, ?, ?, ?, ?)", - [name, email, hashedPassword, role, timeZone] - ); //auto increment id done in DBMS - return result.affectedRows === 1; // TRUE if insert succeeded + const status = role === "instructor" ? "pending" : "active"; + + const result = await pool.query( + "INSERT INTO users (name, email, password_hash, role, time_zone, status) VALUES ($1, $2, $3, $4, $5, $6)", + [name, email, hashedPassword, role, timeZone, status] + ); + + return result.rowCount === 1; // TRUE if insert succeeded + } catch (err) { - console.log("Error creating user"); console.error("Error in createUser:", err); - return false; // insert failed + return false; } } -// First step of login -// check if a user exists by email -// return TRUE if exists, FALSE otherwise -export async function findUserByEmail(email) { + + +// Check if a user exists by email +async function findUserByEmail(email) { try { - const [rows] = await pool.execute( - "SELECT 1 FROM `user` WHERE email = ? LIMIT 1", + const { rows } = await pool.query( + "SELECT 1 FROM users WHERE email = $1 LIMIT 1", [email] ); return rows.length > 0; } catch (err) { - console.log(""); console.error("Error in findUserByEmail:", err); return false; } } -// Second step of login -// return user's hashed password OR null if not found -export async function getUserPasswordFromEmail(email) { +// Get user's hashed password by email +async function getUserPasswordFromEmail(email) { try { - const [rows] = await pool.execute( - "SELECT password FROM `user` WHERE email = ?", + const { rows } = await pool.query( + "SELECT password_hash FROM users WHERE email = $1", [email] ); if (rows.length === 0) return null; - return rows[0].password; + return rows[0].password_hash; } catch (err) { console.error("Error in getUserPasswordFromEmail:", err); return null; @@ -106,11 +107,10 @@ export async function getUserPasswordFromEmail(email) { } // Fetch full user info by email -// return full user object (id, user, email, role, timeZone) -export async function getUserInfoFromEmail(email) { +async function getUserInfoFromEmail(email) { try { - const [rows] = await pool.execute( - "SELECT id, name, email, role, timeZone FROM `user` WHERE email = ?", + const { rows } = await pool.query( + "SELECT id, name, email, role, time_zone, status FROM users WHERE email = $1", [email] ); if (rows.length === 0) return null; @@ -122,11 +122,10 @@ export async function getUserInfoFromEmail(email) { } // Fetch full user info by ID -// return full user object -export async function getUserInfoFromId(id) { +async function getUserInfoFromId(id) { try { - const [rows] = await pool.execute( - "SELECT id, name, email, role, timeZone FROM `user` WHERE id = ?", + const { rows } = await pool.query( + "SELECT id, name, email, role, time_zone, status FROM users WHERE id = $1", [id] ); if (rows.length === 0) return null; @@ -136,3 +135,131 @@ export async function getUserInfoFromId(id) { return null; } } + +///the funsctions below are for approving/rejecting instructors +//used by adminController and adminService + +// Get all pending instructors +async function getPendingInstructors() { + const result = await pool.query( + "SELECT id, name, email, time_zone, status FROM users WHERE role = 'instructor' AND status = 'pending'" + ); + return result.rows; +} + +// Update instructor status to 'active' +async function approveInstructorById(id) { + const result = await pool.query( + "UPDATE users SET status = 'active' WHERE id = $1 RETURNING *", + [id] + ); + return result.rows[0]; +} + +// Update instructor status to 'rejected' +async function rejectInstructorById(id) { + const result = await pool.query( + "UPDATE users SET status = 'rejected' WHERE id = $1 RETURNING *", + [id] + ); + return result.rows[0]; +} + +// Instructor Details Management + +async function getInstructorDetails(instructorId) { + const { rows } = await pool.query( + "SELECT * FROM instructor_details WHERE instructor_id = $1", + [instructorId] + ); + return rows[0] || null; +} + +async function insertInstructorDetails( + instructorId, + certifications, + demoMaterials, + subjectTags = [], + educationLevels = [] +) { + return pool.query( + `INSERT INTO instructor_details + (instructor_id, certifications, demo_material, subject_tags, education_level_tags) + VALUES ($1, $2, $3, $4, $5)`, + [instructorId, certifications, demoMaterials, subjectTags, educationLevels] + ); +} + +async function updateInstructorDetails( + instructorId, + certifications, + demoMaterials, + subjectTags = [], + educationLevels = [] +) { + return pool.query( + `UPDATE instructor_details + SET certifications = $1, + demo_material = $2, + subject_tags = $3, + education_level_tags = $4, + updated_at = now() + WHERE instructor_id = $5`, + [certifications, demoMaterials, subjectTags, educationLevels, instructorId] + ); +} + + +// Fetch student details +async function getStudentDetails(studentId) { + const { rows } = await pool.query( + "SELECT * FROM student_details WHERE student_id = $1", + [studentId] + ); + + const data = rows[0] || null; + + if (data && typeof data.subject_tags === "string") { + data.subject_tags = JSON.parse(data.subject_tags); + } + + return data; +} + + +// Insert new student details (after signup) +async function insertStudentDetails(studentId, educationLevel = null, subjectTags = []) { + return pool.query( + "INSERT INTO student_details (student_id, education_level, subject_tags) VALUES ($1, $2, $3)", + [studentId, educationLevel, subjectTags] + ); +} + +// Update student details +async function updateStudentDetails(studentId, educationLevel, subjectTags) { + return pool.query( + `UPDATE student_details + SET education_level = $1, + subject_tags = $2, + updated_at = now() + WHERE student_id = $3`, + [educationLevel, subjectTags, studentId] + ); +} + +export { + createUser, + findUserByEmail, + getUserPasswordFromEmail, + getUserInfoFromEmail, + getUserInfoFromId, + getPendingInstructors, + approveInstructorById, + rejectInstructorById, + getInstructorDetails, + insertInstructorDetails, + updateInstructorDetails, + getStudentDetails, + insertStudentDetails, + updateStudentDetails +}; diff --git a/db.js b/db.js index c455109..c57e662 100644 --- a/db.js +++ b/db.js @@ -1,17 +1,14 @@ -import mysql from 'mysql2'; +import { Pool } from 'pg'; import dotenv from 'dotenv'; -dotenv.config(); // load env +dotenv.config(); // loads .env -const pool = mysql.createPool({ - host: process.env.DB_HOST, - user: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_NAME, - port: process.env.DB_PORT, - waitForConnections: true, - connectionLimit: 10, - queueLimit: 0 -}).promise() +const pool = new Pool({ + host: process.env.PGHOST, + user: process.env.PGUSER, + password: process.env.PGPASSWORD, + database: process.env.PGDATABASE, + port: process.env.PGPORT +}); -export default pool; //exports the connection for reuse later \ No newline at end of file +export default pool; diff --git a/index.js b/index.js index 74a994e..bbbf323 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,10 @@ import { fileURLToPath } from "url"; import authRoutes from "./routes/authRoute.js"; import { verifyToken } from "./middlewares/jwtMiddleware.js"; +import { getUserInfoFromId, getStudentDetails } from "./databases/userDatabase.js"; +import adminRoutes from "./routes/adminRoute.js";//for admins +import instructorRoutes from "./routes/instructorRoute.js";//for instructors +import studentRoutes from "./routes/studentRoute.js"; const app = express(); const PORT = process.env.PORT || 3000; @@ -17,18 +21,52 @@ app.use(express.json()); const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); app.use(express.static(path.join(__dirname, "public"))); +app.use('/uploads', express.static(path.join(__dirname, 'uploads'))); // Auth routes app.use("/auth", authRoutes); - +app.use("/admin", adminRoutes);//for admins +app.use("/instructor", instructorRoutes);//instructors +app.use("/student", studentRoutes); // JWT token verified before controller is called. -app.get("/dashboard", verifyToken, (req, res) => { - res.json({ - message: "Welcome to dashboard", - user: req.user - }); +app.get("/dashboard", verifyToken, async (req, res) => { + try { + const user = await getUserInfoFromId(req.user.id); // fetch full info, including status + if (!user) return res.status(404).json({ error: "User not found" }); + + // Base response common to all roles + const response = { + message: "Welcome to dashboard", + user: { + id: user.id, + name: user.name, + email: user.email, + role: user.role, + status: user.status, + time_zone: user.time_zone + } + }; + + // If student, include profile info + if (user.role === "student") { + const studentProfile = await getStudentDetails(user.id); // null if first-time + response.studentProfile = studentProfile; + + // Optional: include upcoming sessions if you already track them + //response.user.upcomingSessions = await getStudentSessions(user.id); // implement separately + } + + // If instructor or admin, you can add extra fields similarly later + // e.g., pending approvals for admin, instructor sessions for instructor + + res.json(response); + } catch (err) { + console.error('Error in /dashboard:', err); + res.status(500).json({ error: "Failed to fetch user info" }); + } }); + app.get("/", (req, res) => { res.send("LearnSync API is running."); console.log(`Landing page showing vision and intended use`); @@ -36,4 +74,6 @@ app.get("/", (req, res) => { app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); -}); \ No newline at end of file +}); + + diff --git a/middlewares/uploadMiddleware.js b/middlewares/uploadMiddleware.js new file mode 100644 index 0000000..74ffe42 --- /dev/null +++ b/middlewares/uploadMiddleware.js @@ -0,0 +1,27 @@ +import multer from "multer"; +import path from "path"; +import fs from "fs"; +// For local storage (you can swap with cloud storage later) +const storage = multer.diskStorage({ + destination: function (req, file, cb) { + // Dynamically detect project root + const rootDir = path.resolve(process.cwd()); + + // uploads folder path in root + const uploadPath = path.join(rootDir, "uploads"); + + // Create folder if it doesn't exist + if (!fs.existsSync(uploadPath)) { + fs.mkdirSync(uploadPath, { recursive: true }); + } + + cb(null, uploadPath); + }, + + filename: function (req, file, cb) { + const uniqueSuffix = Date.now() + "-" + Math.round(Math.random() * 1e9); + cb(null, uniqueSuffix + "-" + file.originalname); + } +}); + +export const upload = multer({ storage }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..62fd292 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1500 @@ +{ + "name": "learnsync", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "learnsync", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "axios": "^1.13.2", + "bcryptjs": "^3.0.3", + "body-parser": "^2.2.0", + "dotenv": "^17.2.3", + "express": "^5.1.0", + "joi": "^18.0.1", + "jsonwebtoken": "^9.0.3", + "multer": "^2.0.2", + "pg": "^8.16.3" + } + }, + "node_modules/@hapi/address": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@hapi/address/-/address-5.1.1.tgz", + "integrity": "sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^11.0.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@hapi/formula": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-3.0.2.tgz", + "integrity": "sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw==", + "license": "BSD-3-Clause" + }, + "node_modules/@hapi/hoek": { + "version": "11.0.7", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-11.0.7.tgz", + "integrity": "sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@hapi/pinpoint": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.1.tgz", + "integrity": "sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@hapi/tlds": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@hapi/tlds/-/tlds-1.1.4.tgz", + "integrity": "sha512-Fq+20dxsxLaUn5jSSWrdtSRcIUba2JquuorF9UW1wIJS5cSUwxIsO2GIhaWynPRflvxSzFN+gxKte2HEW1OuoA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@hapi/topo": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-6.0.2.tgz", + "integrity": "sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^11.0.2" + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "license": "MIT" + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", + "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/bcryptjs": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.3.tgz", + "integrity": "sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g==", + "license": "BSD-3-Clause", + "bin": { + "bcrypt": "bin/bcrypt" + } + }, + "node_modules/body-parser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz", + "integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/form-data/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/joi": { + "version": "18.0.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-18.0.1.tgz", + "integrity": "sha512-IiQpRyypSnLisQf3PwuN2eIHAsAIGZIrLZkd4zdvIar2bDyhM91ubRjy8a3eYablXsh9BeI/c7dmPYHca5qtoA==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/address": "^5.1.1", + "@hapi/formula": "^3.0.2", + "@hapi/hoek": "^11.0.7", + "@hapi/pinpoint": "^2.0.1", + "@hapi/tlds": "^1.1.1", + "@hapi/topo": "^6.0.2", + "@standard-schema/spec": "^1.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", + "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "mkdirp": "^0.5.6", + "object-assign": "^4.1.1", + "type-is": "^1.6.18", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/multer/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pg": { + "version": "8.16.3", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz", + "integrity": "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==", + "license": "MIT", + "dependencies": { + "pg-connection-string": "^2.9.1", + "pg-pool": "^3.10.1", + "pg-protocol": "^1.10.3", + "pg-types": "2.2.0", + "pgpass": "1.0.5" + }, + "engines": { + "node": ">= 16.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.2.7" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.2.7.tgz", + "integrity": "sha512-YgCtzMH0ptvZJslLM1ffsY4EuGaU0cx4XSdXLRFae8bPP4dS5xL1tNB3k2o/N64cHJpwU7dxKli/nZ2lUa5fLg==", + "license": "MIT", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.9.1.tgz", + "integrity": "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.10.1.tgz", + "integrity": "sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.10.3.tgz", + "integrity": "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..203c622 --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "learnsync", + "version": "1.0.0", + "description": "Added MiddleWare for JWT handling", + "type": "module", + "main": "index.js", + "dependencies": { + "axios": "^1.13.2", + "bcryptjs": "^3.0.3", + "body-parser": "^2.2.0", + "dotenv": "^17.2.3", + "express": "^5.1.0", + "joi": "^18.0.1", + "jsonwebtoken": "^9.0.3", + "multer": "^2.0.2", + "pg": "^8.16.3" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ZainabMobin/LearnSync.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/ZainabMobin/LearnSync/issues" + }, + "homepage": "https://github.com/ZainabMobin/LearnSync#readme" +} diff --git a/public/admin/dashboard_admin.html b/public/admin/dashboard_admin.html new file mode 100644 index 0000000..e7ab943 --- /dev/null +++ b/public/admin/dashboard_admin.html @@ -0,0 +1,21 @@ + + + + + + Admin Dashboard + + + +

Admin Dashboard

+

+ +
+

Pending Instructor Approvals

+ +
+ + + + + \ No newline at end of file diff --git a/public/admin/dashboard_admin.js b/public/admin/dashboard_admin.js new file mode 100644 index 0000000..0af5893 --- /dev/null +++ b/public/admin/dashboard_admin.js @@ -0,0 +1,104 @@ +// dashboard_admin.js +async function loadDashboard() { + const token = localStorage.getItem('jwt'); + if (!token) { + window.location.href = '/login.html'; + return; + } + + try { + const res = await fetch('/dashboard', { + headers: { 'Authorization': 'Bearer ' + token } + }); + const data = await res.json(); + + if (!res.ok) { + alert(data.error || "Access denied"); + window.location.href = '/login.html'; + return; + } + + const user = data.user; + document.getElementById('userInfo').textContent = + `Welcome, ${user.name} | Role: ${user.role}`; + + // Fetch pending instructors + const pendingRes = await fetch('/admin/pending-instructors', { + headers: { 'Authorization': 'Bearer ' + token } + }); + const pending = await pendingRes.json(); + + const pendingUl = document.getElementById('pendingInstructors'); + pendingUl.innerHTML = ''; + + pending.forEach(inst => { + const li = document.createElement('li'); + li.innerHTML = ` + ${inst.name} - ${inst.email} | ${inst.time_zone} + + + + `; + pendingUl.appendChild(li); + }); + + // Attach event listeners + pendingUl.querySelectorAll('.approveBtn').forEach(btn => { + btn.addEventListener('click', async () => { + const id = btn.dataset.id; + const res = await fetch(`/admin/approve-instructor/${id}`, { + method: 'PUT', + headers: { 'Authorization': 'Bearer ' + token } + }); + const result = await res.json(); + alert(result.message); + loadDashboard(); // refresh list + }); + }); + + pendingUl.querySelectorAll('.rejectBtn').forEach(btn => { + btn.addEventListener('click', async () => { + const id = btn.dataset.id; + const res = await fetch(`/admin/reject-instructor/${id}`, { + method: 'PUT', + headers: { 'Authorization': 'Bearer ' + token } + }); + const result = await res.json(); + alert(result.message); + loadDashboard(); // refresh list + }); + }); + + pendingUl.querySelectorAll('.viewDocsBtn').forEach(btn => { + btn.addEventListener('click', async () => { + const id = btn.dataset.id; + const res = await fetch(`/admin/instructor-details/${id}`, { + headers: { 'Authorization': 'Bearer ' + token } + }); + const details = await res.json(); + if (!res.ok) { + alert(details.error || "Failed to fetch details"); + return; + } + + let html = "

Certifications:

Demo Materials:

"; + + const win = window.open("", "_blank", "width=600,height=400,scrollbars=yes"); + win.document.write(html); + }); + }); + + } catch (err) { + console.error("Error loading admin dashboard:", err); + } +} + +loadDashboard(); diff --git a/public/dashboard.html b/public/dashboard.html deleted file mode 100644 index f9d5a32..0000000 --- a/public/dashboard.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - LearnSync Dashboard - - -

Dashboard

-

- - - - diff --git a/public/dashboard.js b/public/dashboard.js deleted file mode 100644 index 6d2f49f..0000000 --- a/public/dashboard.js +++ /dev/null @@ -1,36 +0,0 @@ -// dashboard.js -async function loadDashboard() { - const token = localStorage.getItem('jwt'); - if (!token) { - alert("Please login first"); - window.location.href = '/login.html'; - return; - } - - try { - const res = await fetch('/dashboard', { - headers: { - 'Authorization': 'Bearer ' + token - } - }); - - const data = await res.json(); - - if (!res.ok) { - alert(data.error || "Access denied"); - window.location.href = '/login.html'; - return; - } - - document.getElementById('userInfo').textContent = - `Welcome, ${data.user.email} | Role: ${data.user.role}`; - - // Frontend debug: show role - console.log("[Frontend DEBUG] User role:", data.user.role); - - } catch (err) { - console.error(err); - } -} - -loadDashboard(); diff --git a/public/index.html b/public/index.html index ca8f1f7..d36016f 100644 --- a/public/index.html +++ b/public/index.html @@ -1,14 +1,17 @@ - - - - LearnSync - - -

LearnSync CMS

- - - - - + + + + + LearnSync + + + +

LearnSync CMS

+ + + + + + \ No newline at end of file diff --git a/public/instructor/dashboard_instructor.html b/public/instructor/dashboard_instructor.html new file mode 100644 index 0000000..ecc2de4 --- /dev/null +++ b/public/instructor/dashboard_instructor.html @@ -0,0 +1,61 @@ + + + + + + Instructor Dashboard + + + + +

Instructor Dashboard

+

+ + + + + + + + + + + + \ No newline at end of file diff --git a/public/instructor/dashboard_instructor.js b/public/instructor/dashboard_instructor.js new file mode 100644 index 0000000..50e631a --- /dev/null +++ b/public/instructor/dashboard_instructor.js @@ -0,0 +1,62 @@ +// dashboard_instructor.js + +async function loadInstructorDashboard() { + const token = localStorage.getItem('jwt'); + if (!token) { + window.location.href = '/shared/login.html'; + return; + } + + const res = await fetch('/dashboard', { + headers: { 'Authorization': 'Bearer ' + token } + }); + const data = await res.json(); + const user = data.user; + console.log("DEBUG user:", user); + + document.getElementById('userInfo').textContent = + `Welcome, ${user.name} | Role: ${user.role}`; + + if (user.status === "pending") { + document.getElementById("pendingInstructorUpload").style.display = "block"; + setupUploadForm(token); // <-- this calls the function I gave you + } else if (user.status === "active") { + document.getElementById("instructorContent").style.display = "block"; + // fetch approved sessions, etc. + } +} + +// The setupUploadForm function goes here in the same file +function setupUploadForm(token) { + const form = document.getElementById('uploadForm'); + form.addEventListener('submit', async (e) => { + e.preventDefault(); + + const formData = new FormData(form); + + try { + const res = await fetch('/instructor/upload-profile', { + method: 'POST', + headers: { + 'Authorization': 'Bearer ' + token + }, + body: formData + }); + + const data = await res.json(); + + if (!res.ok) { + document.getElementById('uploadMessage').textContent = data.error || "Upload failed"; + return; + } + + document.getElementById('uploadMessage').textContent = data.message; + } catch (err) { + document.getElementById('uploadMessage').textContent = "Error connecting to server"; + console.error(err); + } + }); +} + +// Call the dashboard loader +loadInstructorDashboard(); diff --git a/public/script.js b/public/script.js index 304107c..5106cbe 100644 --- a/public/script.js +++ b/public/script.js @@ -2,10 +2,10 @@ // Redirect to Login page document.getElementById("login-btn").addEventListener("click", () => { - window.location.href = "/login.html"; + window.location.href = "shared/login.html"; }); // Redirect to Signup page document.getElementById("signup-btn").addEventListener("click", () => { - window.location.href = "/signup.html"; + window.location.href = "shared/signup.html"; }); \ No newline at end of file diff --git a/public/login.html b/public/shared/login.html similarity index 100% rename from public/login.html rename to public/shared/login.html diff --git a/public/login.js b/public/shared/login.js similarity index 65% rename from public/login.js rename to public/shared/login.js index 269decf..5aee80c 100644 --- a/public/login.js +++ b/public/shared/login.js @@ -4,7 +4,7 @@ const message = document.getElementById('message'); form.addEventListener('submit', async (e) => { e.preventDefault(); - + const email = document.getElementById('email').value; const password = document.getElementById('password').value; @@ -22,14 +22,21 @@ form.addEventListener('submit', async (e) => { return; } - // Save JWT in localStorage + // Save JWT + role + status localStorage.setItem('jwt', data.token); - - // Frontend debug: show user role + localStorage.setItem('role', data.role); + localStorage.setItem('status', data.status); + console.log("[Frontend DEBUG] Logged-in user role:", data.role); - // Redirect to dashboard - window.location.href = '/dashboard.html'; + // Redirect based on role + if (data.role === "admin") { + window.location.href = "/admin/dashboard_admin.html"; + } else if (data.role === "instructor") { + window.location.href = "/instructor/dashboard_instructor.html"; + } else { + window.location.href = "/student/dashboard_student.html"; + } } catch (err) { message.textContent = "Error connecting to server"; diff --git a/public/signup.html b/public/shared/signup.html similarity index 100% rename from public/signup.html rename to public/shared/signup.html diff --git a/public/signup.js b/public/shared/signup.js similarity index 100% rename from public/signup.js rename to public/shared/signup.js diff --git a/public/style.css b/public/shared/style.css similarity index 100% rename from public/style.css rename to public/shared/style.css diff --git a/public/student/dashboard_student.html b/public/student/dashboard_student.html new file mode 100644 index 0000000..661f686 --- /dev/null +++ b/public/student/dashboard_student.html @@ -0,0 +1,37 @@ + + + + + + Student Dashboard + + + +

Student Dashboard

+

+ + + + + + + + + + + \ No newline at end of file diff --git a/public/student/dashboard_student.js b/public/student/dashboard_student.js new file mode 100644 index 0000000..17e09fa --- /dev/null +++ b/public/student/dashboard_student.js @@ -0,0 +1,159 @@ +// public/student/dashboard_student.js + +async function loadDashboard() { + const token = localStorage.getItem("jwt"); + if (!token) { + window.location.href = "/login.html"; + return; + } + + try { + // Fetch basic user info + const dashRes = await fetch("/dashboard", { + headers: { "Authorization": "Bearer " + token } + }); + + if (!dashRes.ok) { + const err = await dashRes.json().catch(() => ({})); + alert(err.error || "Access denied"); + window.location.href = "/login.html"; + return; + } + + const dashData = await dashRes.json(); + const user = dashData.user; + + document.getElementById("userInfo").textContent = + `Welcome, ${user.name} | Role: ${user.role}`; + + // Hide both initially + document.getElementById("studentContent").style.display = "none"; + document.getElementById("studentProfileForm").style.display = "none"; + + // Load student profile + const res = await fetch("/student/details", { + headers: { "Authorization": "Bearer " + token } + }); + + if (!res.ok) { + console.error("Failed to fetch student details"); + document.getElementById("studentContent").style.display = "block"; + return; + } + + const details = await res.json(); // { exists, profile } + + // FIRST TIME LOGIN → SHOW FORM + if (!details.exists) { + document.getElementById("studentProfileForm").style.display = "block"; + setupProfileForm(token); + return; + } + + // PROFILE EXISTS + const profile = details.profile; + + document.getElementById("studentContent").style.display = "block"; + renderUpcomingSessions(profile.upcomingSessions || []); + + // Enable update button + enableProfileEditing(profile, token); + + } catch (err) { + console.error("Error loading dashboard:", err); + } +} + +// Render upcoming sessions +function renderUpcomingSessions(sessions) { + const ul = document.getElementById("upcomingSessions"); + ul.innerHTML = ""; + + if (!sessions || sessions.length === 0) { + ul.innerHTML = "
  • No sessions yet.
  • "; + return; + } + + sessions.forEach(s => { + const li = document.createElement("li"); + li.textContent = `${s.title} - ${s.date}`; + ul.appendChild(li); + }); +} + +// Enable Edit Profile button +function enableProfileEditing(details, token) { + const btn = document.getElementById("editProfileBtn"); + + btn.addEventListener("click", () => { + document.getElementById("studentContent").style.display = "none"; + document.getElementById("studentProfileForm").style.display = "block"; + + // Pre-fill values + document.querySelector("select[name='education_level']").value = + details.education_level || ""; + + document.querySelector("input[name='subject_tags']").value = + (details.subject_tags || []).join(", "); + + setupProfileForm(token); + }, { once: true }); +} + +// Form handling (create/update) +function setupProfileForm(token) { + const form = document.getElementById("profileForm"); + + // Reset listeners to avoid duplicates + const cleanForm = form.cloneNode(true); + form.replaceWith(cleanForm); + + const newForm = document.getElementById("profileForm"); + + newForm.addEventListener("submit", async (e) => { + e.preventDefault(); + + const formData = new FormData(newForm); + const body = Object.fromEntries(formData.entries()); + + // Convert tags to array + if (typeof body.subject_tags === "string") { + body.subject_tags = body.subject_tags + .split(",") + .map(s => s.trim()) + .filter(Boolean); + } + + try { + const res = await fetch("/student/profile", { + method: "POST", + headers: { + "Content-Type": "application/json", + "Authorization": "Bearer " + token + }, + body: JSON.stringify(body) + }); + + const data = await res.json().catch(() => ({})); + + if (!res.ok) { + document.getElementById("profileMessage").textContent = + data.error || "Failed to save profile"; + return; + } + + document.getElementById("profileMessage").textContent = + data.message || "Profile saved"; + + // Go back to dashboard + document.getElementById("studentProfileForm").style.display = "none"; + document.getElementById("studentContent").style.display = "block"; + + } catch (err) { + console.error("Error saving profile:", err); + document.getElementById("profileMessage").textContent = "Server error"; + } + }, { once: true }); +} + +loadDashboard(); diff --git a/routes/adminRoute.js b/routes/adminRoute.js new file mode 100644 index 0000000..43b9403 --- /dev/null +++ b/routes/adminRoute.js @@ -0,0 +1,24 @@ +import express from "express"; +import { + getPendingInstructors, + approveInstructor, + rejectInstructor, + getInstructorFullDetails +} from "../controllers/adminController.js"; + +const router = express.Router(); + +// Get all pending instructors +router.get("/pending-instructors", getPendingInstructors); + +// Approve an instructor +router.put("/approve-instructor/:id", approveInstructor); + +// Reject an instructor +router.put("/reject-instructor/:id", rejectInstructor); + +// Fetch full instructor details (docs, tags, etc.) +router.get("/instructor-details/:id", getInstructorFullDetails); + +export default router; + diff --git a/routes/instructorRoute.js b/routes/instructorRoute.js new file mode 100644 index 0000000..7cedde3 --- /dev/null +++ b/routes/instructorRoute.js @@ -0,0 +1,19 @@ +import express from "express"; +import { verifyToken } from "../middlewares/jwtMiddleware.js"; +import { upload } from "../middlewares/uploadMiddleware.js"; +import { uploadInstructorFiles } from "../controllers/instructorController.js"; + +const router = express.Router(); + +// Upload instructor files +router.post( + '/upload-profile', + verifyToken, + upload.fields([ + { name: 'certifications', maxCount: 10 }, + { name: 'demo_material', maxCount: 10 } + ]), + uploadInstructorFiles +); + +export default router; diff --git a/routes/studentRoute.js b/routes/studentRoute.js new file mode 100644 index 0000000..08c5922 --- /dev/null +++ b/routes/studentRoute.js @@ -0,0 +1,11 @@ +// routes/studentRoute.js +import express from "express"; +import { getStudentDetailsForDashboard, saveStudentProfile } from "../controllers/studentController.js"; +import { verifyToken } from "../middlewares/jwtMiddleware.js"; + +const router = express.Router(); + +router.get("/details", verifyToken, getStudentDetailsForDashboard); +router.post("/profile", verifyToken, saveStudentProfile); + +export default router; diff --git a/services/adminService.js b/services/adminService.js new file mode 100644 index 0000000..546efbc --- /dev/null +++ b/services/adminService.js @@ -0,0 +1,28 @@ +// src/services/adminService.js +import { getPendingInstructors, getInstructorDetails, approveInstructorById, rejectInstructorById } from "../databases/userDatabase.js"; + +export async function getPendingInstructorsService() { + const pending = await getPendingInstructors(); + + // For each instructor, fetch their uploaded files/details + const detailedPending = await Promise.all( + pending.map(async (instr) => { + const details = await getInstructorDetails(instr.id); + return { ...instr, files: details || {} }; + }) + ); + + return detailedPending; +} + +export async function approveInstructorService(id) { + const updatedInstructor = await approveInstructorById(id); + if (!updatedInstructor) throw new Error("Instructor not found"); + return updatedInstructor; +} + +export async function rejectInstructorService(id) { + const updatedInstructor = await rejectInstructorById(id); + if (!updatedInstructor) throw new Error("Instructor not found"); + return updatedInstructor; +} diff --git a/services/authService.js b/services/authService.js index a139ed6..916cf5f 100644 --- a/services/authService.js +++ b/services/authService.js @@ -1,6 +1,6 @@ -import bcrypt from "bcrypt"; +import bcrypt from "bcryptjs"; import jwt from "jsonwebtoken"; -import {findUserByEmail, getUserPasswordFromEmail, createUser, getUserInfoFromEmail} from "../databases/userDatabase.js"; +import { findUserByEmail, getUserPasswordFromEmail, createUser, getUserInfoFromEmail } from "../databases/userDatabase.js"; // password check function function isStrongPassword(password) { @@ -22,28 +22,28 @@ function isStrongPassword(password) { } // signup -export async function signupService(name, email, entered_password) { +export async function signupService(name, email, entered_password, role, timeZone) { const password = entered_password.trim(); if (!isStrongPassword(password)) throw new Error("Password must contain at least 1 uppercase, 1 lowercase letter, 1 digit with minimum length of 8 characters."); - + const exists = await findUserByEmail(email); if (exists) throw new Error("Email already registered"); const hashed_password = await bcrypt.hash(password, 10); - const isCreated = await createUser(name, email, hashed_password); + const isCreated = await createUser(name, email, hashed_password, role, timeZone); if (!isCreated) throw new Error("Could not add user to database"); const userInfo = await getUserInfoFromEmail(email); - // Create JWT token + // Create JWT token const token = jwt.sign( { - id: userInfo.id, - email: userInfo.email, - role: userInfo.role + id: userInfo.id, + email: userInfo.email, + role: userInfo.role }, process.env.JWT_SECRET, { expiresIn: process.env.JWT_EXPIRES_IN } @@ -54,46 +54,58 @@ export async function signupService(name, email, entered_password) { message: "Signup successful", token, user: { - id: userInfo.id, - name: userInfo.name, - email: userInfo.email, - role: userInfo.role, - timeZone: userInfo.timeZone + id: userInfo.id, + name: userInfo.name, + email: userInfo.email, + role: userInfo.role, + time_zone: userInfo.time_zone } }; } // login export async function loginService(email, password) { + // 1️⃣ Check if user exists const exists = await findUserByEmail(email); if (!exists) throw new Error("User not found"); + // 2️⃣ Get hashed password const hashedPassword = await getUserPasswordFromEmail(email); + // 3️⃣ Compare password const match = await bcrypt.compare(password, hashedPassword); - if (!match) throw new Error("Invalid credentials"); + // 4️⃣ Get full user info const userInfo = await getUserInfoFromEmail(email); - // Create JWT token + // 5️⃣ Allow login for pending instructors + // They will see the pending upload form on frontend + if (userInfo.role === "instructor" && userInfo.status === "rejected") { + throw new Error("Your instructor account has been rejected."); + } + + // 6️⃣ Create JWT token const token = jwt.sign( { - id: userInfo.id, - email: userInfo.email, - role: userInfo.role + id: userInfo.id, + email: userInfo.email, + role: userInfo.role, + status: userInfo.status // include status for frontend decision }, process.env.JWT_SECRET, { expiresIn: process.env.JWT_EXPIRES_IN } ); + // 7️⃣ Return user info + token return { message: "Login successful", - token, // return the token to frontend + token, id: userInfo.id, name: userInfo.name, email: userInfo.email, role: userInfo.role, - timeZone: userInfo.timeZone + status: userInfo.status, + time_zone: userInfo.time_zone }; } diff --git a/services/instructorService.js b/services/instructorService.js new file mode 100644 index 0000000..19d63b4 --- /dev/null +++ b/services/instructorService.js @@ -0,0 +1,43 @@ +import { getInstructorDetails, insertInstructorDetails, updateInstructorDetails } from "../databases/userDatabase.js"; + +/** + * Save or update instructor profile including: + * - certifications (array of URLs) + * - demoMaterials (array of URLs) + * - subjectTags (array of strings) + * - educationLevels (array of strings) + */ +export async function saveInstructorFiles( + instructorId, + certifications = [], + demoMaterials = [], + subjectTags = [], + educationLevels = [] +) { + const details = await getInstructorDetails(instructorId); + + if (!details) { + // Insert new row + await insertInstructorDetails( + instructorId, + certifications, + demoMaterials, + subjectTags, + educationLevels + ); + } else { + // Append to existing arrays + const existingCerts = details.certifications || []; + const existingDemo = details.demo_material || []; + const existingSubjects = details.subject_tags || []; + const existingEducationLevels = details.education_level_tags || []; + + await updateInstructorDetails( + instructorId, + [...existingCerts, ...certifications], + [...existingDemo, ...demoMaterials], + [...existingSubjects, ...subjectTags], + [...existingEducationLevels, ...educationLevels] + ); + } +} diff --git a/services/studentService.js b/services/studentService.js new file mode 100644 index 0000000..683fdfb --- /dev/null +++ b/services/studentService.js @@ -0,0 +1,21 @@ +// services/studentService.js +import { + getStudentDetails, + insertStudentDetails, + updateStudentDetails +} from "../databases/userDatabase.js"; + +// Get student profile +export async function getStudentDetailsService(studentId) { + return await getStudentDetails(studentId); +} + +// Create student profile (first time) +export async function createStudentProfileService(studentId, educationLevel, subjectTags) { + return await insertStudentDetails(studentId, educationLevel, subjectTags); +} + +// Update existing student profile +export async function updateStudentProfileService(studentId, educationLevel, subjectTags) { + return await updateStudentDetails(studentId, educationLevel, subjectTags); +}