Newer
Older
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { DegreeProgram } from '../models/degree-program';
import { AuditMetadata } from '../models/audit-metadata';
import { StudentDegreeProgram } from '../models/student-degree-program';
import { environment } from './../../../environments/environment';
const auditResponse: any = require('../../../assets/mock-data/audit-response.json');
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const HTTP_OPTIONS = {
headers: new HttpHeaders({
'Content-Type': 'applications/json',
}),
};
@Injectable({ providedIn: 'root' })
export class DarsApiService {
constructor(private http: HttpClient) {}
/**
* Get all degree programs, honors, and institution data.
*
* All the data for institutions, honors, and degree programs is static.
* The backend is going to cache all this data in S3 and create a single
* endpoint for us to hit and get all of it!
*/
public getStaticData(): Observable<DegreeProgram[]> {
return new Observable();
}
/**
* Get a students degree programs.
*/
public getStudentDegreePrograms(emplid: number) {
const url = `${environment.apiDarsUrl}/student-degree-programs/${emplid}`;
return this.http.get<StudentDegreeProgram[]>(url, HTTP_OPTIONS);
}
/**
* Get audit metadata for all audits a user has.
*/
public getAudits(): Observable<AuditMetadata[]> {
const url = `${environment.apiDarsUrl}/audit-metadata`;
return this.http.get<AuditMetadata[]>(url, HTTP_OPTIONS);
}
/**
* Get a single audit.
*/
public getAudit(reportId: number): Observable<any> {
// const url = `${environment.apiDarsUrl}/reports/${reportId}`;
// return this.http.get<any>(url, HTTP_OPTIONS);
return of({ auditResponse });