diff --git a/Back/skydiveLogs-api.Model/Gear.cs b/Back/skydiveLogs-api.Model/Gear.cs index c28e15a..a310fce 100644 --- a/Back/skydiveLogs-api.Model/Gear.cs +++ b/Back/skydiveLogs-api.Model/Gear.cs @@ -8,7 +8,7 @@ namespace skydiveLogs_api.Model { public int Id { get; set; } - public string Mame { get; set; } + public string Name { get; set; } public string Manufacturer { get; set; } diff --git a/Back/skydiveLogs-api/Controllers/GearController.cs b/Back/skydiveLogs-api/Controllers/GearController.cs index 6675066..2093200 100644 --- a/Back/skydiveLogs-api/Controllers/GearController.cs +++ b/Back/skydiveLogs-api/Controllers/GearController.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; using AutoMapper; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using skydiveLogs_api.Business.Interface; using skydiveLogs_api.DataContract; diff --git a/Back/skydiveLogs-api/Data/JumpsDb.db b/Back/skydiveLogs-api/Data/JumpsDb.db index 635ee15..3236cbe 100644 Binary files a/Back/skydiveLogs-api/Data/JumpsDb.db and b/Back/skydiveLogs-api/Data/JumpsDb.db differ diff --git a/Front/skydivelogs-app/src/app/app.component.html b/Front/skydivelogs-app/src/app/app.component.html index 64cd39d..7366528 100644 --- a/Front/skydivelogs-app/src/app/app.component.html +++ b/Front/skydivelogs-app/src/app/app.component.html @@ -15,13 +15,16 @@ diff --git a/Front/skydivelogs-app/src/app/app.module.ts b/Front/skydivelogs-app/src/app/app.module.ts index 703b538..980c962 100644 --- a/Front/skydivelogs-app/src/app/app.module.ts +++ b/Front/skydivelogs-app/src/app/app.module.ts @@ -1,23 +1,24 @@ -import { BrowserModule } from '@angular/platform-browser'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; +import { BrowserModule } from "@angular/platform-browser"; +import { NgModule } from "@angular/core"; +import { RouterModule, Routes } from "@angular/router"; +import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http"; -import { AppComponent } from './app.component'; +import { AppComponent } from "./app.component"; -import { SummaryComponent } from './summary/summary.component'; -import { ListOfJumpsComponent } from './list-of-jumps/list-of-jumps.component'; -import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component'; -import { NewJumpComponent } from './new-jump/new-jump.component'; -import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component'; -import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component'; +import { SummaryComponent } from "./summary/summary.component"; +import { ListOfJumpsComponent } from "./list-of-jumps/list-of-jumps.component"; +import { ListOfDzsComponent } from "./list-of-dzs/list-of-dzs.component"; +import { NewJumpComponent } from "./new-jump/new-jump.component"; +import { ListOfAircraftsComponent } from "./list-of-aircrafts/list-of-aircrafts.component"; +import { ListOfJumpTypesComponent } from "./list-of-jump-types/list-of-jump-types.component"; +import { ListOfGearsComponent } from "./list-of-gears/list-of-gears.component"; -import { DateService } from '../services/date.service'; -import { ServiceApiGet } from '../services/service-api-get.service'; -import { ServiceApiPost } from '../services/service-api-post.service'; -import { ServiceComm } from '../services/service-comm.service'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { FormsModule } from '@angular/forms'; +import { DateService } from "../services/date.service"; +import { ServiceApiGet } from "../services/service-api-get.service"; +import { ServiceApiPost } from "../services/service-api-post.service"; +import { ServiceComm } from "../services/service-comm.service"; +import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; +import { FormsModule } from "@angular/forms"; import { MatPaginatorModule, MatTableModule, @@ -30,17 +31,18 @@ import { MatInputModule, MatButtonModule, MatIconModule -} from '@angular/material'; -import { RequestCache } from '../services/request-cache.service'; -import { CachingInterceptor } from '../services/caching-interceptor.service'; +} from "@angular/material"; +import { RequestCache } from "../services/request-cache.service"; +import { CachingInterceptor } from "../services/caching-interceptor.service"; const appRoutes: Routes = [ - { path: 'summary', component: SummaryComponent }, - { path: 'jumpsList', component: ListOfJumpsComponent }, - { path: 'dz', component: ListOfDzsComponent }, - { path: 'newjump', component: NewJumpComponent }, - { path: 'aircraftList', component: ListOfAircraftsComponent }, - { path: 'jumpTypeList', component: ListOfJumpTypesComponent } + { path: "summary", component: SummaryComponent }, + { path: "jumps", component: ListOfJumpsComponent }, + { path: "dzs", component: ListOfDzsComponent }, + { path: "newjump", component: NewJumpComponent }, + { path: "aircrafts", component: ListOfAircraftsComponent }, + { path: "jumpTypes", component: ListOfJumpTypesComponent }, + { path: "gears", component: ListOfGearsComponent } ]; @NgModule({ @@ -51,7 +53,8 @@ const appRoutes: Routes = [ ListOfDzsComponent, NewJumpComponent, ListOfAircraftsComponent, - ListOfJumpTypesComponent + ListOfJumpTypesComponent, + ListOfGearsComponent ], imports: [ RouterModule.forRoot( @@ -84,4 +87,4 @@ const appRoutes: Routes = [ ], bootstrap: [AppComponent] }) -export class AppModule { } +export class AppModule {} diff --git a/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.css b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.css new file mode 100644 index 0000000..1922e7f --- /dev/null +++ b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.css @@ -0,0 +1,3 @@ +table { + width: 100%; +} diff --git a/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.html b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.html new file mode 100644 index 0000000..c25ba42 --- /dev/null +++ b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID{{element.id}}Name{{element.name}} iciLatitude{{element.latitude}}Longitude{{element.longitude}}AddressE-mail{{element.email}}Type{{element.type}}
+ diff --git a/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.spec.ts b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.spec.ts new file mode 100644 index 0000000..5817440 --- /dev/null +++ b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ListOfGearsComponent } from './list-of-gears.component'; + +describe('ListOfGearsComponent', () => { + let component: ListOfGearsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ListOfGearsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ListOfGearsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.ts b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.ts new file mode 100644 index 0000000..15ace6b --- /dev/null +++ b/Front/skydivelogs-app/src/app/list-of-gears/list-of-gears.component.ts @@ -0,0 +1,44 @@ +import { Component, OnInit, ViewChild } from "@angular/core"; +import { MatPaginator, MatTableDataSource } from "@angular/material"; + +import { ServiceApiGet } from "../../services/service-api-get.service"; +import { ServiceComm } from "../../services/service-comm.service"; +import { GearResp } from "../../models/gear"; + +@Component({ + selector: "app-list-of-gears", + templateUrl: "./list-of-gears.component.html", + styleUrls: ["./list-of-gears.component.css"] +}) +export class ListOfGearsComponent implements OnInit { + public displayedColumns: Array = [ + "id", + "name", + "latitude", + "longitude", + "address", + "email", + "type" + ]; + public dataSourceTable; + public resultsLength = 0; + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + + constructor( + private serviceApi: ServiceApiGet, + private serviceComm: ServiceComm + ) {} + + ngOnInit() { + this.serviceComm.updatedComponentTitle("List of gears"); + this.getListOfGears(); + } + + getListOfGears() { + this.serviceApi.getListOfGears().subscribe(data => { + this.dataSourceTable = new MatTableDataSource(data); + this.dataSourceTable.paginator = this.paginator; + this.resultsLength = data.length; + }); + } +} diff --git a/Front/skydivelogs-app/src/models/aircraft.ts b/Front/skydivelogs-app/src/models/aircraft.ts index d8d8856..f99115d 100644 --- a/Front/skydivelogs-app/src/models/aircraft.ts +++ b/Front/skydivelogs-app/src/models/aircraft.ts @@ -1,17 +1,17 @@ export class AircraftReq { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public name: number; + public id: number; + public name: number; } export class AircraftResp { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public name: number; -} \ No newline at end of file + public id: number; + public name: number; +} diff --git a/Front/skydivelogs-app/src/models/dropzone.ts b/Front/skydivelogs-app/src/models/dropzone.ts index 70713c0..4d650d3 100644 --- a/Front/skydivelogs-app/src/models/dropzone.ts +++ b/Front/skydivelogs-app/src/models/dropzone.ts @@ -1,29 +1,29 @@ export class DropZoneResp { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public latitude: string; - public longitude: string; - public name: string; - public address: string; - public website: string; - public email: string; - public type: Array; + public id: number; + public latitude: string; + public longitude: string; + public name: string; + public address: string; + public website: string; + public email: string; + public type: Array; } export class DropZoneReq { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public latitude: string; - public longitude: string; - public name: string; - public address: string; - public website: string; - public email: string; - public type: Array; + public id: number; + public latitude: string; + public longitude: string; + public name: string; + public address: string; + public website: string; + public email: string; + public type: Array; } diff --git a/Front/skydivelogs-app/src/models/gear.ts b/Front/skydivelogs-app/src/models/gear.ts new file mode 100644 index 0000000..4b02c53 --- /dev/null +++ b/Front/skydivelogs-app/src/models/gear.ts @@ -0,0 +1,17 @@ +export class GearReq { + constructor(data: any) { + Object.assign(this, data); + } + + public id: number; + public name: number; +} + +export class GearResp { + constructor(data: any) { + Object.assign(this, data); + } + + public id: number; + public name: number; +} diff --git a/Front/skydivelogs-app/src/models/jump.ts b/Front/skydivelogs-app/src/models/jump.ts index 45ee0ed..41d4519 100644 --- a/Front/skydivelogs-app/src/models/jump.ts +++ b/Front/skydivelogs-app/src/models/jump.ts @@ -1,33 +1,33 @@ export class JumpReq { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public jumpTypeId: number; - public aircraftId: number; - public dropZoneId: number; - public gearId: number; - public exitAltitude: number; - public deployAltitude: number; - public withCutaway: boolean; - public notes: string; - public jumpDate: Date; + public id: number; + public jumpTypeId: number; + public aircraftId: number; + public dropZoneId: number; + public gearId: number; + public exitAltitude: number; + public deployAltitude: number; + public withCutaway: boolean; + public notes: string; + public jumpDate: Date; } export class JumpResp { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public jumpTypeId: number; - public aircraftId: number; - public dropZoneId: number; - public gearId: number; - public exitAltitude: number; - public deployAltitude: number; - public withCutaway: boolean; - public notes: string; - public jumpDate: Date; + public id: number; + public jumpTypeId: number; + public aircraftId: number; + public dropZoneId: number; + public gearId: number; + public exitAltitude: number; + public deployAltitude: number; + public withCutaway: boolean; + public notes: string; + public jumpDate: Date; } diff --git a/Front/skydivelogs-app/src/models/jumpType.ts b/Front/skydivelogs-app/src/models/jumpType.ts index b4ac2b7..12332b5 100644 --- a/Front/skydivelogs-app/src/models/jumpType.ts +++ b/Front/skydivelogs-app/src/models/jumpType.ts @@ -1,17 +1,17 @@ export class JumpTypeReq { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public name: number; + public id: number; + public name: number; } export class JumpTypeResp { - constructor(data: any) { - Object.assign(this, data); - } + constructor(data: any) { + Object.assign(this, data); + } - public id: number; - public name: number; -} \ No newline at end of file + public id: number; + public name: number; +} diff --git a/Front/skydivelogs-app/src/models/stats.ts b/Front/skydivelogs-app/src/models/stats.ts new file mode 100644 index 0000000..215accb --- /dev/null +++ b/Front/skydivelogs-app/src/models/stats.ts @@ -0,0 +1,50 @@ +import { Observable } from "rxjs"; + +export class StatsResp { + public statsByDz: Observable; + public statsByAircraft: Observable; + public statsByRig: Observable; + public statsByJumpType: Observable; + public statsByYear: Observable; +} + +export class StatsByDzResp { + constructor(data: any) { + Object.assign(this, data); + } + + public label: string; + public nb: number; +} +export class StatsByAircraftResp { + constructor(data: any) { + Object.assign(this, data); + } + + public label: string; + public nb: number; +} +export class StatsByRigResp { + constructor(data: any) { + Object.assign(this, data); + } + + public label: string; + public nb: number; +} +export class StatsByJumpTypeResp { + constructor(data: any) { + Object.assign(this, data); + } + + public label: string; + public nb: number; +} +export class StatsByYearResp { + constructor(data: any) { + Object.assign(this, data); + } + + public label: string; + public nb: number; +} diff --git a/Front/skydivelogs-app/src/models/statsresp.ts b/Front/skydivelogs-app/src/models/statsresp.ts deleted file mode 100644 index 81a425f..0000000 --- a/Front/skydivelogs-app/src/models/statsresp.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Observable } from 'rxjs'; - -export class StatsResp { - public statsByDz: Observable; - public statsByAircraft: Observable; - public statsByRig: Observable; - public statsByJumpType: Observable; - public statsByYear: Observable; -} - - -export class StatsByDzResp { - constructor(data: any) { - Object.assign(this, data); - } - - public label: string; - public nb: number; -} -export class StatsByAircraftResp { - constructor(data: any) { - Object.assign(this, data); - } - - public label: string; - public nb: number; -} -export class StatsByRigResp { - constructor(data: any) { - Object.assign(this, data); - } - - public label: string; - public nb: number; -} -export class StatsByJumpTypeResp { - constructor(data: any) { - Object.assign(this, data); - } - - public label: string; - public nb: number; -} -export class StatsByYearResp { - constructor(data: any) { - Object.assign(this, data); - } - - public label: string; - public nb: number; -} \ No newline at end of file diff --git a/Front/skydivelogs-app/src/services/service-api-get.service.ts b/Front/skydivelogs-app/src/services/service-api-get.service.ts index 0ab072f..fa454f5 100644 --- a/Front/skydivelogs-app/src/services/service-api-get.service.ts +++ b/Front/skydivelogs-app/src/services/service-api-get.service.ts @@ -1,12 +1,15 @@ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { Injectable } from "@angular/core"; +import { HttpClient, HttpHeaders } from "@angular/common/http"; +import { Observable } from "rxjs"; +import { map } from "rxjs/operators"; +import { environment } from "../environments/environment"; + +import { DropZoneResp } from "../models/dropzone"; +import { JumpResp } from "../models/jump"; +import { AircraftResp } from "../models/aircraft"; +import { JumpTypeResp } from "../models/jumpType"; +import { GearResp } from "../models/gear"; -import { DropZoneResp } from '../models/dropzone'; -import { JumpResp } from '../models/jump'; -import { AircraftResp } from '../models/aircraft'; -import { JumpTypeResp } from '../models/jumpType'; import { StatsResp, StatsByDzResp, @@ -14,20 +17,20 @@ import { StatsByJumpTypeResp, StatsByRigResp, StatsByYearResp -} from '../models/statsresp'; -import { environment } from '../environments/environment'; +} from "../models/stats"; @Injectable() export class ServiceApiGet { private readonly headers = new HttpHeaders({ - 'Access-Control-Allow-Origin': environment.urlApi + "Access-Control-Allow-Origin": environment.urlApi }); - constructor(private http: HttpClient) { } + constructor(private http: HttpClient) {} public getListOfDropZones(): Observable> { - return this.http.get>(`${environment.urlApi}/api/DropZone`, { - headers: this.headers - }) + return this.http + .get>(`${environment.urlApi}/api/DropZone`, { + headers: this.headers + }) .pipe( map(response => { const details = response.map(data => new DropZoneResp(data)); @@ -56,6 +59,12 @@ export class ServiceApiGet { ); } + public getListOfGears(): Observable> { + return this.http.get>(`${environment.urlApi}/api/Gear`, { + headers: this.headers + }); + } + public getStatsOfJumps(): StatsResp { const resultat = new StatsResp(); resultat.statsByDz = this.http.get(