feat: database-first refactor, unified architecture and visual developer manual
Summary of changes: - Consolidated Studio+CMS and Experience+LMS into unified services. - Moved core business logic (enrollment, grading, auth) to PostgreSQL functions. - Implemented advanced auditing via DB triggers and session context. - Added gamification (XP/Levels/Leaderboards) and logic encapsulation. - Updated installation/diagnostic scripts for the new architecture. - Created a comprehensive Visual Developer Manual in README.md with hardware scaling.
This commit is contained in:
@@ -96,6 +96,8 @@ export interface User {
|
||||
email: string;
|
||||
full_name: string;
|
||||
role: string;
|
||||
xp?: number;
|
||||
level?: number;
|
||||
}
|
||||
|
||||
export interface AuthResponse {
|
||||
@@ -187,12 +189,21 @@ export const lmsApi = {
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getGamification(userId: string): Promise<{ points: number, badges: { id: string, name: string, description: string }[] }> {
|
||||
async getGamification(userId: string): Promise<{ points: number, level: number, badges: { id: string, name: string, description: string, earned_at: string }[] }> {
|
||||
const response = await fetch(`${API_BASE_URL}/users/${userId}/gamification`);
|
||||
if (!response.ok) throw new Error('Failed to fetch gamification data');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getLeaderboard(): Promise<User[]> {
|
||||
const token = localStorage.getItem('token');
|
||||
const response = await fetch(`${API_BASE_URL}/analytics/leaderboard`, {
|
||||
headers: { 'Authorization': `Bearer ${token}` }
|
||||
});
|
||||
if (!response.ok) throw new Error('Failed to fetch leaderboard');
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getBranding(orgId: string): Promise<Organization> {
|
||||
const response = await fetch(`${CMS_API_URL}/organizations/${orgId}/branding`);
|
||||
if (!response.ok) throw new Error('Failed to fetch branding');
|
||||
|
||||
Reference in New Issue
Block a user