Introduces NEXUS Core architecture documentation, new API endpoints for escrow, payroll, talent profiles, time logs, and UI components for financial dashboards and compliance tracking. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: e82c1588-4c11-4961-b289-6ab581ed9691 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/aPpJgbb Replit-Helium-Checkpoint-Created: true
78 lines
2.2 KiB
TypeScript
78 lines
2.2 KiB
TypeScript
import type { VercelRequest, VercelResponse } from "@vercel/node";
|
|
import { getAdminClient } from "../_supabase";
|
|
|
|
export default async function handler(req: VercelRequest, res: VercelResponse) {
|
|
if (req.method !== 'GET') {
|
|
return res.status(405).json({ error: 'Method not allowed' });
|
|
}
|
|
|
|
const supabase = getAdminClient();
|
|
|
|
const authHeader = req.headers.authorization;
|
|
if (!authHeader?.startsWith('Bearer ')) {
|
|
return res.status(401).json({ error: 'Unauthorized' });
|
|
}
|
|
|
|
const token = authHeader.split(' ')[1];
|
|
const { data: { user }, error: authError } = await supabase.auth.getUser(token);
|
|
|
|
if (authError || !user) {
|
|
return res.status(401).json({ error: 'Invalid token' });
|
|
}
|
|
|
|
const { category, skills, experience, limit = 20, offset = 0 } = req.query;
|
|
|
|
const { data, error } = await supabase
|
|
.from('foundation_gig_radar')
|
|
.select('*')
|
|
.order('published_at', { ascending: false })
|
|
.range(Number(offset), Number(offset) + Number(limit) - 1);
|
|
|
|
if (error) {
|
|
return res.status(500).json({ error: error.message });
|
|
}
|
|
|
|
let filteredData = data || [];
|
|
|
|
if (category) {
|
|
filteredData = filteredData.filter(d => d.category === category);
|
|
}
|
|
|
|
if (skills) {
|
|
const skillsArray = (skills as string).split(',');
|
|
filteredData = filteredData.filter(d =>
|
|
d.required_skills.some((s: string) => skillsArray.includes(s))
|
|
);
|
|
}
|
|
|
|
if (experience) {
|
|
filteredData = filteredData.filter(d => d.required_experience === experience);
|
|
}
|
|
|
|
await supabase.from('nexus_compliance_events').insert({
|
|
entity_type: 'gig_radar',
|
|
entity_id: user.id,
|
|
event_type: 'gig_radar_accessed',
|
|
event_category: 'access',
|
|
actor_id: user.id,
|
|
actor_role: 'user',
|
|
realm_context: 'foundation',
|
|
description: 'Foundation user accessed Gig Radar',
|
|
payload: {
|
|
filters: { category, skills, experience },
|
|
results_count: filteredData.length
|
|
},
|
|
sensitive_data_accessed: false,
|
|
cross_entity_access: true,
|
|
legal_entity: 'non_profit'
|
|
});
|
|
|
|
return res.status(200).json({
|
|
data: filteredData,
|
|
meta: {
|
|
total: filteredData.length,
|
|
limit: Number(limit),
|
|
offset: Number(offset)
|
|
}
|
|
});
|
|
}
|