Initial commit

This commit is contained in:
2026-05-05 10:53:52 +02:00
commit 419e59ef2f
2269 changed files with 313143 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { Injectable, inject } from '@angular/core';
import { Observable, of } from 'rxjs';
import { ApiService } from './api.service';
import { Enrollment, CourseProgress } from '../models/types';
@Injectable({
providedIn: 'root'
})
export class EnrollmentService {
private readonly api = inject(ApiService);
enroll(courseId: string, userId: string): Observable<Enrollment> {
return this.api.post<Enrollment>(`/api/courses/${courseId}/enroll`, { userId, courseId });
}
getEnrollments(userId: string): Observable<Enrollment[]> {
return this.api.get<Enrollment[]>(`/api/users/${userId}/enrollments`);
}
getCourseProgress(courseId: string, userId: string): Observable<CourseProgress> {
return this.api.get<CourseProgress>(`/api/courses/${courseId}/progress`, { userId });
}
markTopicProgress(topicId: string, userId: string, completed: boolean): Observable<void> {
return this.api.post<void>(`/api/topics/${topicId}/progress`, { userId, topicId, completed });
}
markResourceProgress(resourceId: string, userId: string, completed: boolean): Observable<void> {
return this.api.post<void>(`/api/resources/${resourceId}/progress`, { userId, resourceId, completed });
}
}