From cb273480208ea221117271a05d4bd75bd0324c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Wed, 29 Sep 2021 13:04:04 +0200 Subject: [PATCH] Adding basic components and API service --- Frontend/package-lock.json | 14 ++++---- Frontend/package.json | 2 +- Frontend/src/app/app.module.ts | 16 ++++++++- .../components/change/change.component.css | 0 .../components/change/change.component.html | 1 + .../change/change.component.spec.ts | 25 +++++++++++++ .../app/components/change/change.component.ts | 16 +++++++++ .../datepicker/datepicker.component.css | 0 .../datepicker/datepicker.component.html | 1 + .../datepicker/datepicker.component.spec.ts | 25 +++++++++++++ .../datepicker/datepicker.component.ts | 15 ++++++++ .../src/app/components/day/day.component.css | 0 .../src/app/components/day/day.component.html | 1 + .../app/components/day/day.component.spec.ts | 25 +++++++++++++ .../src/app/components/day/day.component.ts | 16 +++++++++ .../event-detail/event-detail.component.css | 0 .../event-detail/event-detail.component.html | 1 + .../event-detail.component.spec.ts | 25 +++++++++++++ .../event-detail/event-detail.component.ts | 15 ++++++++ .../app/components/event/event.component.css | 0 .../app/components/event/event.component.html | 1 + .../components/event/event.component.spec.ts | 25 +++++++++++++ .../app/components/event/event.component.ts | 16 +++++++++ .../app/components/week/week.component.css | 0 .../app/components/week/week.component.html | 1 + .../components/week/week.component.spec.ts | 25 +++++++++++++ .../src/app/components/week/week.component.ts | 16 +++++++++ Frontend/src/app/mocks/mock.service.ts | 8 ++--- Frontend/src/app/models/change.ts | 16 +++++++++ Frontend/src/app/models/event.ts | 9 +++++ .../landingpage/landingpage.component.html | 2 +- .../landingpage/landingpage.component.ts | 15 +++++++- .../src/app/services/api/api.service.spec.ts | 16 +++++++++ Frontend/src/app/services/api/api.service.ts | 36 +++++++++++++++++++ 34 files changed, 369 insertions(+), 15 deletions(-) create mode 100644 Frontend/src/app/components/change/change.component.css create mode 100644 Frontend/src/app/components/change/change.component.html create mode 100644 Frontend/src/app/components/change/change.component.spec.ts create mode 100644 Frontend/src/app/components/change/change.component.ts create mode 100644 Frontend/src/app/components/datepicker/datepicker.component.css create mode 100644 Frontend/src/app/components/datepicker/datepicker.component.html create mode 100644 Frontend/src/app/components/datepicker/datepicker.component.spec.ts create mode 100644 Frontend/src/app/components/datepicker/datepicker.component.ts create mode 100644 Frontend/src/app/components/day/day.component.css create mode 100644 Frontend/src/app/components/day/day.component.html create mode 100644 Frontend/src/app/components/day/day.component.spec.ts create mode 100644 Frontend/src/app/components/day/day.component.ts create mode 100644 Frontend/src/app/components/event-detail/event-detail.component.css create mode 100644 Frontend/src/app/components/event-detail/event-detail.component.html create mode 100644 Frontend/src/app/components/event-detail/event-detail.component.spec.ts create mode 100644 Frontend/src/app/components/event-detail/event-detail.component.ts create mode 100644 Frontend/src/app/components/event/event.component.css create mode 100644 Frontend/src/app/components/event/event.component.html create mode 100644 Frontend/src/app/components/event/event.component.spec.ts create mode 100644 Frontend/src/app/components/event/event.component.ts create mode 100644 Frontend/src/app/components/week/week.component.css create mode 100644 Frontend/src/app/components/week/week.component.html create mode 100644 Frontend/src/app/components/week/week.component.spec.ts create mode 100644 Frontend/src/app/components/week/week.component.ts create mode 100644 Frontend/src/app/models/change.ts create mode 100644 Frontend/src/app/models/event.ts create mode 100644 Frontend/src/app/services/api/api.service.spec.ts create mode 100644 Frontend/src/app/services/api/api.service.ts diff --git a/Frontend/package-lock.json b/Frontend/package-lock.json index c1d5dfa..9fce1d6 100644 --- a/Frontend/package-lock.json +++ b/Frontend/package-lock.json @@ -27,7 +27,7 @@ "@angular/cli": "~12.2.6", "@angular/compiler-cli": "~12.2.0", "@types/jasmine": "~3.8.0", - "@types/node": "^12.11.1", + "@types/node": "^12.20.27", "jasmine-core": "~3.8.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", @@ -2576,9 +2576,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "12.20.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.25.tgz", - "integrity": "sha512-hcTWqk7DR/HrN9Xe7AlJwuCaL13Vcd9/g/T54YrJz4Q3ESM5mr33YCzW2bOfzSIc3aZMeGBvbLGvgN6mIJ0I5Q==", + "version": "12.20.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.27.tgz", + "integrity": "sha512-qZdePUDSLAZRXXV234bLBEUM0nAQjoxbcSwp1rqSMUe1rZ47mwU6OjciR/JvF1Oo8mc0ys6GE0ks0HGgqAZoGg==", "dev": true }, "node_modules/@types/parse-json": { @@ -17878,9 +17878,9 @@ "dev": true }, "@types/node": { - "version": "12.20.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.25.tgz", - "integrity": "sha512-hcTWqk7DR/HrN9Xe7AlJwuCaL13Vcd9/g/T54YrJz4Q3ESM5mr33YCzW2bOfzSIc3aZMeGBvbLGvgN6mIJ0I5Q==", + "version": "12.20.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.27.tgz", + "integrity": "sha512-qZdePUDSLAZRXXV234bLBEUM0nAQjoxbcSwp1rqSMUe1rZ47mwU6OjciR/JvF1Oo8mc0ys6GE0ks0HGgqAZoGg==", "dev": true }, "@types/parse-json": { diff --git a/Frontend/package.json b/Frontend/package.json index 8f63c02..dfbcbba 100644 --- a/Frontend/package.json +++ b/Frontend/package.json @@ -29,7 +29,7 @@ "@angular/cli": "~12.2.6", "@angular/compiler-cli": "~12.2.0", "@types/jasmine": "~3.8.0", - "@types/node": "^12.11.1", + "@types/node": "^12.20.27", "jasmine-core": "~3.8.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", diff --git a/Frontend/src/app/app.module.ts b/Frontend/src/app/app.module.ts index 1151274..3de1e98 100644 --- a/Frontend/src/app/app.module.ts +++ b/Frontend/src/app/app.module.ts @@ -6,16 +6,30 @@ import {AppComponent} from './app.component'; import {AppRouting} from './app.routing'; import {LandingpageComponent} from './pages/landingpage/landingpage.component'; import {PageNotFoundComponent} from './pages/page-not-found/page-not-found.component'; +import {WeekComponent} from './components/week/week.component'; +import {DayComponent} from './components/day/day.component'; +import {EventComponent} from './components/event/event.component'; +import {ChangeComponent} from './components/change/change.component'; +import {DatepickerComponent} from './components/datepicker/datepicker.component'; +import {EventDetailComponent} from './components/event-detail/event-detail.component'; +import {HttpClientModule} from '@angular/common/http'; @NgModule({ declarations: [ AppComponent, LandingpageComponent, - PageNotFoundComponent + PageNotFoundComponent, + WeekComponent, + DayComponent, + EventComponent, + ChangeComponent, + DatepickerComponent, + EventDetailComponent ], imports: [ BrowserModule, AppRouting, + HttpClientModule, NgbModule ], providers: [], diff --git a/Frontend/src/app/components/change/change.component.css b/Frontend/src/app/components/change/change.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/change/change.component.html b/Frontend/src/app/components/change/change.component.html new file mode 100644 index 0000000..5ca2bbc --- /dev/null +++ b/Frontend/src/app/components/change/change.component.html @@ -0,0 +1 @@ +

change works!

diff --git a/Frontend/src/app/components/change/change.component.spec.ts b/Frontend/src/app/components/change/change.component.spec.ts new file mode 100644 index 0000000..db0e9ae --- /dev/null +++ b/Frontend/src/app/components/change/change.component.spec.ts @@ -0,0 +1,25 @@ +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {ChangeComponent} from './change.component'; + +describe('ChangeComponent', () => { + let component: ChangeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ChangeComponent] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ChangeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/change/change.component.ts b/Frontend/src/app/components/change/change.component.ts new file mode 100644 index 0000000..b9a77a4 --- /dev/null +++ b/Frontend/src/app/components/change/change.component.ts @@ -0,0 +1,16 @@ +import {Component, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-change', + templateUrl: './change.component.html', + styleUrls: ['./change.component.css'] +}) +export class ChangeComponent implements OnInit { + + constructor() { + } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/components/datepicker/datepicker.component.css b/Frontend/src/app/components/datepicker/datepicker.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/datepicker/datepicker.component.html b/Frontend/src/app/components/datepicker/datepicker.component.html new file mode 100644 index 0000000..2ecfa1c --- /dev/null +++ b/Frontend/src/app/components/datepicker/datepicker.component.html @@ -0,0 +1 @@ +

datepicker works!

diff --git a/Frontend/src/app/components/datepicker/datepicker.component.spec.ts b/Frontend/src/app/components/datepicker/datepicker.component.spec.ts new file mode 100644 index 0000000..5b28862 --- /dev/null +++ b/Frontend/src/app/components/datepicker/datepicker.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DatepickerComponent } from './datepicker.component'; + +describe('DatepickerComponent', () => { + let component: DatepickerComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DatepickerComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DatepickerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/datepicker/datepicker.component.ts b/Frontend/src/app/components/datepicker/datepicker.component.ts new file mode 100644 index 0000000..8fa936b --- /dev/null +++ b/Frontend/src/app/components/datepicker/datepicker.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-datepicker', + templateUrl: './datepicker.component.html', + styleUrls: ['./datepicker.component.css'] +}) +export class DatepickerComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/components/day/day.component.css b/Frontend/src/app/components/day/day.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/day/day.component.html b/Frontend/src/app/components/day/day.component.html new file mode 100644 index 0000000..f03a62e --- /dev/null +++ b/Frontend/src/app/components/day/day.component.html @@ -0,0 +1 @@ +

day works!

diff --git a/Frontend/src/app/components/day/day.component.spec.ts b/Frontend/src/app/components/day/day.component.spec.ts new file mode 100644 index 0000000..6491c67 --- /dev/null +++ b/Frontend/src/app/components/day/day.component.spec.ts @@ -0,0 +1,25 @@ +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {DayComponent} from './day.component'; + +describe('DayComponent', () => { + let component: DayComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [DayComponent] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DayComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/day/day.component.ts b/Frontend/src/app/components/day/day.component.ts new file mode 100644 index 0000000..dcf282e --- /dev/null +++ b/Frontend/src/app/components/day/day.component.ts @@ -0,0 +1,16 @@ +import {Component, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-day', + templateUrl: './day.component.html', + styleUrls: ['./day.component.css'] +}) +export class DayComponent implements OnInit { + + constructor() { + } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/components/event-detail/event-detail.component.css b/Frontend/src/app/components/event-detail/event-detail.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/event-detail/event-detail.component.html b/Frontend/src/app/components/event-detail/event-detail.component.html new file mode 100644 index 0000000..ef28185 --- /dev/null +++ b/Frontend/src/app/components/event-detail/event-detail.component.html @@ -0,0 +1 @@ +

event-detail works!

diff --git a/Frontend/src/app/components/event-detail/event-detail.component.spec.ts b/Frontend/src/app/components/event-detail/event-detail.component.spec.ts new file mode 100644 index 0000000..d517c4f --- /dev/null +++ b/Frontend/src/app/components/event-detail/event-detail.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EventDetailComponent } from './event-detail.component'; + +describe('EventDetailComponent', () => { + let component: EventDetailComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ EventDetailComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(EventDetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/event-detail/event-detail.component.ts b/Frontend/src/app/components/event-detail/event-detail.component.ts new file mode 100644 index 0000000..59e8402 --- /dev/null +++ b/Frontend/src/app/components/event-detail/event-detail.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-event-detail', + templateUrl: './event-detail.component.html', + styleUrls: ['./event-detail.component.css'] +}) +export class EventDetailComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/components/event/event.component.css b/Frontend/src/app/components/event/event.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/event/event.component.html b/Frontend/src/app/components/event/event.component.html new file mode 100644 index 0000000..8a7c90c --- /dev/null +++ b/Frontend/src/app/components/event/event.component.html @@ -0,0 +1 @@ +

event works!

diff --git a/Frontend/src/app/components/event/event.component.spec.ts b/Frontend/src/app/components/event/event.component.spec.ts new file mode 100644 index 0000000..310b41f --- /dev/null +++ b/Frontend/src/app/components/event/event.component.spec.ts @@ -0,0 +1,25 @@ +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {EventComponent} from './event.component'; + +describe('EventComponent', () => { + let component: EventComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [EventComponent] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(EventComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/event/event.component.ts b/Frontend/src/app/components/event/event.component.ts new file mode 100644 index 0000000..1fd3f65 --- /dev/null +++ b/Frontend/src/app/components/event/event.component.ts @@ -0,0 +1,16 @@ +import {Component, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-event', + templateUrl: './event.component.html', + styleUrls: ['./event.component.css'] +}) +export class EventComponent implements OnInit { + + constructor() { + } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/components/week/week.component.css b/Frontend/src/app/components/week/week.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Frontend/src/app/components/week/week.component.html b/Frontend/src/app/components/week/week.component.html new file mode 100644 index 0000000..80639e8 --- /dev/null +++ b/Frontend/src/app/components/week/week.component.html @@ -0,0 +1 @@ +

week works!

diff --git a/Frontend/src/app/components/week/week.component.spec.ts b/Frontend/src/app/components/week/week.component.spec.ts new file mode 100644 index 0000000..0837a71 --- /dev/null +++ b/Frontend/src/app/components/week/week.component.spec.ts @@ -0,0 +1,25 @@ +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {WeekComponent} from './week.component'; + +describe('WeekComponent', () => { + let component: WeekComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [WeekComponent] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(WeekComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Frontend/src/app/components/week/week.component.ts b/Frontend/src/app/components/week/week.component.ts new file mode 100644 index 0000000..3c0cebd --- /dev/null +++ b/Frontend/src/app/components/week/week.component.ts @@ -0,0 +1,16 @@ +import {Component, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-week', + templateUrl: './week.component.html', + styleUrls: ['./week.component.css'] +}) +export class WeekComponent implements OnInit { + + constructor() { + } + + ngOnInit(): void { + } + +} diff --git a/Frontend/src/app/mocks/mock.service.ts b/Frontend/src/app/mocks/mock.service.ts index 1ef8de2..c8ea37e 100644 --- a/Frontend/src/app/mocks/mock.service.ts +++ b/Frontend/src/app/mocks/mock.service.ts @@ -1,19 +1,19 @@ import {Observable} from 'rxjs'; export abstract class AbstractMockObservableService { - protected _observable: Observable; + protected _observable: Observable | undefined; protected _fakeContent: any; protected _fakeError: any; - set error(err) { + set error(err: any) { this._fakeError = err; } - set content(data) { + set content(data: any) { this._fakeContent = data; } - get subscription(): Observable { + get subscription(): Observable | undefined { return this._observable; } diff --git a/Frontend/src/app/models/change.ts b/Frontend/src/app/models/change.ts new file mode 100644 index 0000000..1b09280 --- /dev/null +++ b/Frontend/src/app/models/change.ts @@ -0,0 +1,16 @@ +export interface Change { + change_id: string; + event_id: string; + change_timestamp: Date; + is_deleted: boolean; + new_summary: string; + new_description: string; + new_start: Date; + new_end: Date; + new_last_modified: Date; + new_created: Date; + new_location: string; + new_organizer: string; + new_categories: string; + new_recurring: string; +} diff --git a/Frontend/src/app/models/event.ts b/Frontend/src/app/models/event.ts new file mode 100644 index 0000000..aec0a68 --- /dev/null +++ b/Frontend/src/app/models/event.ts @@ -0,0 +1,9 @@ +import {Change} from './change'; + +export interface Event { + event_id: string; + event_uid: string; + latest_event_summary: string; + latest_start_date: Date; + changes: Change[]; +} diff --git a/Frontend/src/app/pages/landingpage/landingpage.component.html b/Frontend/src/app/pages/landingpage/landingpage.component.html index 1bd8d85..a845ee7 100644 --- a/Frontend/src/app/pages/landingpage/landingpage.component.html +++ b/Frontend/src/app/pages/landingpage/landingpage.component.html @@ -2,7 +2,7 @@

TINF19B4 RaPla Changes

- + Events: {{eventCount}}