-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TimeTableGenerationService completed, added to main app module and in…
…jected into timetable component.
- Loading branch information
Showing
14 changed files
with
169 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
src/app/components/main-content/time-table/time-table.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export class PeriodOrLecture { | ||
|
||
/** | ||
* | ||
* @param periodName | ||
* @param periodNumber | ||
* @param periodStartandEndTime | ||
* @param isAllocated | ||
* @param subjectUniqueIdInDb | ||
* @param subjectFullName | ||
* @param tutorUniqueId | ||
* @param tutorFullName | ||
*/ | ||
constructor(public periodName: string, | ||
public periodNumber: number, | ||
public periodStartandEndTime: string, | ||
public isAllocated: boolean, | ||
public subjectUniqueIdInDb: string, | ||
public subjectFullName: string, | ||
public tutorUniqueId: string, | ||
public tutorFullName: string) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {PeriodOrLecture} from "./period-or-lecture"; | ||
export class ProgrammeDay { | ||
constructor(public dayName: string, | ||
public periodList: Array<PeriodOrLecture>) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {ProgrammeDay} from "./programme-day"; | ||
export class ProgrammeGroupPersonalTimeTableEntity { | ||
|
||
constructor(public programmeCode: string, | ||
public programmeDaysList: Array<ProgrammeDay>) { | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export class TimeTableGenerationRequest { | ||
|
||
/** | ||
* | ||
* @param timeTableName | ||
* @param yearGroup | ||
*/ | ||
constructor(public timeTableName: string, | ||
public yearGroup: number) { | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/models/time-table-main-entity-array-response-payload.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {GeneralResponsePayload} from "./general-response-payload"; | ||
import {TimeTableMainEntity} from "./time-table-main-entity"; | ||
/** | ||
* array of {@link TimeTableMainEntity} payload | ||
*/ | ||
export class TimeTableMainEntityArrayResponsePayload extends GeneralResponsePayload { | ||
|
||
constructor(status: number, message: string, responseObject: Array<TimeTableMainEntity>) { | ||
super(status, message, responseObject); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {GeneralResponsePayload} from "./general-response-payload"; | ||
import {TimeTableMainEntity} from "./time-table-main-entity"; | ||
export class TimeTableMainEntityResponsePayload extends GeneralResponsePayload { | ||
|
||
|
||
constructor(status: number, message: string, responseObject: TimeTableMainEntity) { | ||
super(status, message, responseObject); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {TutorPersonalTimeTableEntity} from "./tutor-personal-time-table-entity"; | ||
import {ProgrammeGroupPersonalTimeTableEntity} from "./programme-group-personal-time-table-entity"; | ||
export class TimeTableMainEntity { | ||
/** | ||
* | ||
* @param year | ||
* @param timeTableName | ||
* @param tutorPersonalTimeTableDocs | ||
* @param programmeGroupPersonalTimeTableDocs | ||
*/ | ||
constructor(public year: number, | ||
public timeTableName: string, | ||
public tutorPersonalTimeTableDocs: TutorPersonalTimeTableEntity, | ||
public programmeGroupPersonalTimeTableDocs: ProgrammeGroupPersonalTimeTableEntity) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {ProgrammeDay} from "./programme-day"; | ||
export class TutorPersonalTimeTableEntity { | ||
|
||
/** | ||
* | ||
* @param tutorUniqueIdInDb | ||
* @param programmeDaysList | ||
*/ | ||
constructor(public tutorUniqueIdInDb: string, | ||
public programmeDaysList: Array<ProgrammeDay>) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
|
||
import { TestBed, async, inject } from '@angular/core/testing'; | ||
import { TimeTableGenerationService } from './time-table-generation.service'; | ||
|
||
describe('TimeTableGenerationService', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [TimeTableGenerationService] | ||
}); | ||
}); | ||
|
||
it('should ...', inject([TimeTableGenerationService], (service: TimeTableGenerationService) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {Injectable} from "@angular/core"; | ||
import {Http, RequestOptions, Headers, Response} from "@angular/http"; | ||
import {Observable} from "rxjs"; | ||
import {UrlEndpoints} from "../helpers/url-endpoints"; | ||
import {TimeTableGenerationRequest} from "../models/time-table-generation-request"; | ||
import {TimeTableMainEntityResponsePayload} from "../models/time-table-main-entity-response-payload"; | ||
import {TimeTableMainEntityArrayResponsePayload} from "../models/time-table-main-entity-array-response-payload"; | ||
|
||
@Injectable() | ||
export class TimeTableGenerationService { | ||
|
||
constructor(private http : Http) { } | ||
|
||
generateTimeTable(timetableGenerationRequest: TimeTableGenerationRequest): Observable<TimeTableMainEntityResponsePayload> { | ||
let timeTableGenerationEndpoint:string = UrlEndpoints.TIMETABLE_GENERATION_ENDPOINT; | ||
let headers = new Headers({'Content-Type': 'application/json'}); | ||
let options = new RequestOptions({headers: headers}); | ||
return this.http.post(timeTableGenerationEndpoint, timetableGenerationRequest, options).map( | ||
(response: Response) => response.json()) | ||
.catch((e: any) => Observable.throw(e.json() || "server Error")); | ||
} | ||
|
||
getAllGeneratedTimeTables(): Observable<TimeTableMainEntityArrayResponsePayload> { | ||
let timeTableGenerationEndpoint = UrlEndpoints.TIMETABLE_GENERATION_ENDPOINT; | ||
let headers = new Headers({'Content-Type': 'application/json'}); | ||
let options = new RequestOptions({headers: headers}); | ||
return this.http.get(timeTableGenerationEndpoint, options).map( | ||
(response: Response) => response.json()) | ||
.catch((e: any) => Observable.throw(e.json() || "server Error")); | ||
} | ||
|
||
} |