mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-21 15:37:21 +00:00
- ModuleManager: Central tracking for installed marketplace modules - DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module) - BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings - RootShell: Real root command execution utility - TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands - Terminal Pro module: Adds aliases (ll, la, h), command history - ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games - fade_in/fade_out animations for smooth transitions
119 lines
3.4 KiB
TypeScript
119 lines
3.4 KiB
TypeScript
export interface OpportunityPoster {
|
|
id: string;
|
|
username: string;
|
|
avatar_url: string;
|
|
bio?: string;
|
|
}
|
|
|
|
export interface Opportunity {
|
|
id: string;
|
|
title: string;
|
|
description: string;
|
|
job_type: string;
|
|
salary_min: number;
|
|
salary_max: number;
|
|
experience_level: string;
|
|
arm_affiliation: string;
|
|
ecosystem?: string;
|
|
posted_by_id: string;
|
|
aethex_creators: OpportunityPoster;
|
|
status: string;
|
|
created_at: string;
|
|
updated_at?: string;
|
|
aethex_applications?: { count: number };
|
|
}
|
|
|
|
export interface OpportunitiesResponse {
|
|
data: Opportunity[];
|
|
pagination: {
|
|
page: number;
|
|
limit: number;
|
|
total: number;
|
|
pages: number;
|
|
};
|
|
}
|
|
|
|
export interface CreateOpportunityData {
|
|
title: string;
|
|
description: string;
|
|
job_type: string;
|
|
salary_min?: number;
|
|
salary_max?: number;
|
|
experience_level?: string;
|
|
arm_affiliation: string;
|
|
ecosystem?: string;
|
|
}
|
|
|
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
|
|
|
export async function getOpportunities(filters?: {
|
|
arm?: string;
|
|
ecosystem?: string;
|
|
search?: string;
|
|
jobType?: string;
|
|
experienceLevel?: string;
|
|
sort?: "recent" | "oldest";
|
|
page?: number;
|
|
limit?: number;
|
|
}): Promise<OpportunitiesResponse> {
|
|
const params = new URLSearchParams();
|
|
if (filters?.arm) params.append("arm", filters.arm);
|
|
if (filters?.ecosystem) params.append("ecosystem", filters.ecosystem);
|
|
if (filters?.search) params.append("search", filters.search);
|
|
if (filters?.jobType) params.append("jobType", filters.jobType);
|
|
if (filters?.experienceLevel)
|
|
params.append("experienceLevel", filters.experienceLevel);
|
|
if (filters?.sort) params.append("sort", filters.sort);
|
|
if (filters?.page) params.append("page", String(filters.page));
|
|
if (filters?.limit) params.append("limit", String(filters.limit));
|
|
|
|
const response = await fetch(`${API_BASE}/api/opportunities?${params}`);
|
|
if (!response.ok) throw new Error("Failed to fetch opportunities");
|
|
return response.json();
|
|
}
|
|
|
|
export async function getOpportunityById(id: string): Promise<Opportunity> {
|
|
const response = await fetch(`${API_BASE}/api/opportunities/${id}`);
|
|
if (!response.ok) throw new Error("Opportunity not found");
|
|
return response.json();
|
|
}
|
|
|
|
export async function createOpportunity(
|
|
data: CreateOpportunityData,
|
|
): Promise<Opportunity> {
|
|
const response = await fetch(`${API_BASE}/api/opportunities`, {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(data),
|
|
});
|
|
if (!response.ok) throw new Error("Failed to create opportunity");
|
|
return response.json();
|
|
}
|
|
|
|
export async function updateOpportunity(
|
|
id: string,
|
|
data: Partial<CreateOpportunityData>,
|
|
): Promise<Opportunity> {
|
|
const response = await fetch(`${API_BASE}/api/opportunities/${id}`, {
|
|
method: "PUT",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(data),
|
|
});
|
|
if (!response.ok) throw new Error("Failed to update opportunity");
|
|
return response.json();
|
|
}
|
|
|
|
export async function closeOpportunity(id: string): Promise<void> {
|
|
const response = await fetch(`${API_BASE}/api/opportunities/${id}/close`, {
|
|
method: "POST",
|
|
});
|
|
if (!response.ok) throw new Error("Failed to close opportunity");
|
|
}
|
|
|
|
export async function getApplicationsForOpportunity(opportunityId: string) {
|
|
const response = await fetch(
|
|
`${API_BASE}/api/opportunities/${opportunityId}/applications`,
|
|
);
|
|
if (!response.ok) throw new Error("Failed to fetch applications");
|
|
return response.json();
|
|
}
|