Initialize Eigen HRIS project
- Add .gitignore, .yarnrc.yml, and initial project metadata (AGENTS.md, DESIGN.md, package.json, Yarn lock, Tailwind, PostCSS, Next.js config, TypeScript config) - Add CSV data files (users, employees, contracts, attendances) - Implement API routes for auth, employees, contracts, attendances, analytics, and file upload - Add core pages (dashboard, employees, attendances, profile, login, main layout) - Add UI components (avatar, avatar picker, badge, button, card, input, modal, select, sidebar, navigation shell, top header) - Add attendance features (table, clock widget, unified permit modal with file upload, upload API) - Add employee management (contract timeline with file upload, employee form modal, employee table) - Add dashboard widgets (leaderboard, early bird, latecomer, night owl, day status feed, date filter bar) - Add utilities (avatar generator, analytics calculations, CSV DB layer, auth context) - Add type definitions for auth, employee, contract, attendance, dashboard All changes are synchronized with documentation (AGENTS.md, DESIGN.md, walkthrough).
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { cookies } from 'next/headers';
|
||||
import { getUserById, getEmployeeById } from '@/lib/csv-db';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const cookieStore = cookies();
|
||||
const sessionCookie = cookieStore.get('eigen_session');
|
||||
|
||||
if (!sessionCookie?.value) {
|
||||
// Default demo superadmin session if no cookie yet
|
||||
const adminUser = await getUserById('USR-001');
|
||||
const adminEmployee = adminUser?.employee_id ? await getEmployeeById(adminUser.employee_id) : null;
|
||||
return NextResponse.json({
|
||||
authenticated: true,
|
||||
session: {
|
||||
user: adminUser,
|
||||
employee: adminEmployee,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const sessionData = JSON.parse(sessionCookie.value);
|
||||
return NextResponse.json({
|
||||
authenticated: true,
|
||||
session: sessionData,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return NextResponse.json({ authenticated: false, session: null }, { status: 200 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user