chore(deps): upgrade Angular 19 → 20
- ng update @angular/core@20 @angular/cli@20 @angular/material@20 @angular-eslint@20 @angular/google-maps@20 - Remove ng-chartist (abandoned, incompatible with Angular 20): replace <x-chartist> with <app-bars-chart> in dropzones-bar and jumps-by-month - Migrate all constructor injection to inject() function (ng generate @angular/core:inject, 67 files) - TypeScript 5.5 → 5.9.3 - DOCUMENT import moved from @angular/common to @angular/core (automatic migration) - tsconfig moduleResolution updated to "bundler"
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -7,19 +7,15 @@ import { AeronefByImat, AeronefByYear } from '@models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AeronefsService {
|
||||
private apiService = inject(ApiService);
|
||||
|
||||
private _apiDomain = '/skydive';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
getAllByImat(): Observable<Array<AeronefByImat>> {
|
||||
return this.apiService.get(`${this._apiDomain}/aeronefs/allByImat`)
|
||||
.pipe(map(data => data.aeronefs));
|
||||
return this.apiService.get(`${this._apiDomain}/aeronefs/allByImat`).pipe(map((data) => data.aeronefs));
|
||||
}
|
||||
|
||||
getAllByImatByYear(): Observable<Array<AeronefByYear>> {
|
||||
return this.apiService.get(`${this._apiDomain}/aeronefs/allByImatByYear`)
|
||||
.pipe(map(data => data.aeronefs));
|
||||
return this.apiService.get(`${this._apiDomain}/aeronefs/allByImatByYear`).pipe(map((data) => data.aeronefs));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
|
||||
import { CalculatorResult, WeightSizeRange, weightSizes } from '@models';
|
||||
import { UtilitiesService } from '@services';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CalculatorService {
|
||||
private _utilitiesService = inject(UtilitiesService);
|
||||
|
||||
public coeffKgLbs: number = this._utilitiesService.getCoeffKgLbs();
|
||||
public coeffFtM: number = this._utilitiesService.getCoeffFtM();
|
||||
|
||||
constructor(
|
||||
private _utilitiesService: UtilitiesService
|
||||
) { }
|
||||
|
||||
private _getTableColumn(jumps: number): number {
|
||||
let column: number = 0;
|
||||
weightSizes[0].ranges.some((range: WeightSizeRange) => {
|
||||
if (jumps >= range.start && jumps <= range.end) {
|
||||
column = (range.num-1)
|
||||
column = range.num - 1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -40,11 +38,11 @@ export class CalculatorService {
|
||||
}
|
||||
|
||||
private _isInRange(nb: number, range: WeightSizeRange): boolean {
|
||||
return (nb >= range.start && nb <= range.end);
|
||||
return nb >= range.start && nb <= range.end;
|
||||
}
|
||||
|
||||
private _reduceLimit(surface: number, percentOff: number): number {
|
||||
return Math.ceil(surface * (100 - percentOff) / 100);
|
||||
return Math.ceil((surface * (100 - percentOff)) / 100);
|
||||
}
|
||||
|
||||
public canopySizeCalc(weight: number, jumps: number): CalculatorResult {
|
||||
@@ -54,12 +52,12 @@ export class CalculatorService {
|
||||
const maxRange = 1600;
|
||||
const result: CalculatorResult = {
|
||||
min: 59,
|
||||
min11: 34
|
||||
min11: 34,
|
||||
};
|
||||
if (jumps > maxRange) {
|
||||
return result;
|
||||
}
|
||||
const index: number = (this._getTableLine(weight) - this._getTableLine(0));
|
||||
const index: number = this._getTableLine(weight) - this._getTableLine(0);
|
||||
result.min = weightSizes[index].ranges[this._getTableColumn(jumps)].value!;
|
||||
result.min11 = this._reduceLimit(result.min, 11);
|
||||
|
||||
@@ -67,7 +65,7 @@ export class CalculatorService {
|
||||
}
|
||||
|
||||
public convertFeet2Meters(size: number): number {
|
||||
return (size * this._utilitiesService.getCoeffFtM());
|
||||
return size * this._utilitiesService.getCoeffFtM();
|
||||
}
|
||||
|
||||
public getCanopySizes(weight: number, reduce = false): number[] {
|
||||
@@ -77,11 +75,11 @@ export class CalculatorService {
|
||||
if (weight > 110) {
|
||||
weight = 110;
|
||||
}
|
||||
const line = (weight - this._getTableLine(0));
|
||||
const line = weight - this._getTableLine(0);
|
||||
const data = weightSizes[line];
|
||||
if (reduce) {
|
||||
return data.ranges.map((range: WeightSizeRange): number => {
|
||||
return Math.ceil(range.value! * (100 - 11) / 100);
|
||||
return Math.ceil((range.value! * (100 - 11)) / 100);
|
||||
});
|
||||
} else {
|
||||
return data.ranges.map((range: WeightSizeRange): number => {
|
||||
@@ -91,7 +89,7 @@ export class CalculatorService {
|
||||
}
|
||||
|
||||
public getCharge(canopySize: number, nakedWeight: number, equipementWeight: number): number {
|
||||
return (((nakedWeight + equipementWeight) * this.coeffKgLbs) / canopySize);
|
||||
return ((nakedWeight + equipementWeight) * this.coeffKgLbs) / canopySize;
|
||||
}
|
||||
|
||||
public getRangeNum(jumps: number): number {
|
||||
@@ -125,5 +123,4 @@ export class CalculatorService {
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -7,29 +7,25 @@ import { CanopyBySize, CanopyByYear, CanopyModelBySize, CanopyModelByYear } from
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CanopiesService {
|
||||
private apiService = inject(ApiService);
|
||||
|
||||
private _apiDomain = '/skydive';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
getAllBySize(): Observable<Array<CanopyBySize>> {
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySize`)
|
||||
.pipe(map(data => data.canopies));
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySize`).pipe(map((data) => data.canopies));
|
||||
}
|
||||
|
||||
getAllBySizeByYear(): Observable<Array<CanopyByYear>> {
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySizeByYear`)
|
||||
.pipe(map(data => data.canopies));
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySizeByYear`).pipe(map((data) => data.canopies));
|
||||
}
|
||||
|
||||
getAllBySizeByModel(): Observable<Array<CanopyModelBySize>> {
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySizeByModel`)
|
||||
.pipe(map(data => data.canopies));
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySizeByModel`).pipe(map((data) => data.canopies));
|
||||
}
|
||||
|
||||
getAllBySizeByModelByYear(): Observable<Array<CanopyModelByYear>> {
|
||||
return this.apiService.get(`${this._apiDomain}/canopies/allBySizeByModelByYear`)
|
||||
.pipe(map(data => data.canopies));
|
||||
return this.apiService
|
||||
.get(`${this._apiDomain}/canopies/allBySizeByModelByYear`)
|
||||
.pipe(map((data) => data.canopies));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -7,19 +7,15 @@ import { DropZoneByOaci, DropZoneByYear } from '@models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DropZonesService {
|
||||
private apiService = inject(ApiService);
|
||||
|
||||
private _apiDomain = '/skydive';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
getAllByOaci(): Observable<Array<DropZoneByOaci>> {
|
||||
return this.apiService.get(`${this._apiDomain}/dropzones/allByOaci`)
|
||||
.pipe(map(data => data.dropzones));
|
||||
return this.apiService.get(`${this._apiDomain}/dropzones/allByOaci`).pipe(map((data) => data.dropzones));
|
||||
}
|
||||
|
||||
getAllByOaciByYear(): Observable<Array<DropZoneByYear>> {
|
||||
return this.apiService.get(`${this._apiDomain}/dropzones/allByOaciByYear`)
|
||||
.pipe(map(data => data.dropzones));
|
||||
return this.apiService.get(`${this._apiDomain}/dropzones/allByOaciByYear`).pipe(map((data) => data.dropzones));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApiService } from '../api.service';
|
||||
import {
|
||||
Jump, JumpByCategorie, JumpByDate, JumpByDay, JumpByModule, JumpFile,
|
||||
JumpList, JumpListConfig, JumpListFilters, JumpPageData,
|
||||
X2Data, SkydiverIdJumps
|
||||
Jump,
|
||||
JumpByCategorie,
|
||||
JumpByDate,
|
||||
JumpByDay,
|
||||
JumpByModule,
|
||||
JumpFile,
|
||||
JumpList,
|
||||
JumpListConfig,
|
||||
JumpListFilters,
|
||||
JumpPageData,
|
||||
X2Data,
|
||||
SkydiverIdJumps,
|
||||
} from '@models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class JumpsService {
|
||||
private apiService = inject(ApiService);
|
||||
|
||||
private _apiDomain = '/skydive';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
query(config: JumpListConfig): Observable<JumpList> {
|
||||
// Convert any filters over to Angular's URLSearchParams
|
||||
@@ -49,13 +57,14 @@ export class JumpsService {
|
||||
*/
|
||||
const params: JumpListFilters = {} as JumpListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService
|
||||
.get(
|
||||
`${this._apiDomain}/jumps`,
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
);
|
||||
return this.apiService.get(
|
||||
`${this._apiDomain}/jumps`,
|
||||
new HttpParams({ fromObject: <
|
||||
{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}
|
||||
>params }),
|
||||
);
|
||||
}
|
||||
|
||||
get(slug: string): Observable<JumpPageData> {
|
||||
@@ -67,79 +76,98 @@ export class JumpsService {
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<Jump>> {
|
||||
return this.apiService.get(`${this._apiDomain}/jumps`).pipe(map(data => data.jumps));
|
||||
return this.apiService.get(`${this._apiDomain}/jumps`).pipe(map((data) => data.jumps));
|
||||
}
|
||||
|
||||
getAllByDate(): Observable<Array<JumpByDate>> {
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByDate`).pipe(map(data => data.jumps));
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByDate`).pipe(map((data) => data.jumps));
|
||||
}
|
||||
|
||||
getAllByCategorie(): Observable<Array<JumpByCategorie>> {
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByCategorie`).pipe(map(data => data.jumps));
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByCategorie`).pipe(map((data) => data.jumps));
|
||||
}
|
||||
|
||||
getAllByDay(config: JumpListConfig): Observable<Array<JumpByDay>> {
|
||||
const params: JumpListFilters = {} as JumpListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByDay`, new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params }))
|
||||
.pipe(map(data => data.days));
|
||||
return this.apiService
|
||||
.get(
|
||||
`${this._apiDomain}/jumps/allByDay`,
|
||||
new HttpParams({ fromObject: <
|
||||
{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}
|
||||
>params }),
|
||||
)
|
||||
.pipe(map((data) => data.days));
|
||||
}
|
||||
|
||||
getAllByModule(): Observable<Array<JumpByModule>> {
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByModule`).pipe(map(data => data.jumps));
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allByModule`).pipe(map((data) => data.jumps));
|
||||
}
|
||||
|
||||
getAllFromSkydiverIdApi(config: JumpListConfig): Observable<SkydiverIdJumps> {
|
||||
const params: JumpListFilters = {} as JumpListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/allFromSkydiverIdApi`, new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params }))
|
||||
.pipe(map(data => data.jumps));
|
||||
return this.apiService
|
||||
.get(
|
||||
`${this._apiDomain}/jumps/allFromSkydiverIdApi`,
|
||||
new HttpParams({ fromObject: <
|
||||
{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}
|
||||
>params }),
|
||||
)
|
||||
.pipe(map((data) => data.jumps));
|
||||
}
|
||||
|
||||
getLastJump(): Observable<Jump> {
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/last`).pipe(map(data => data.jump));
|
||||
return this.apiService.get(`${this._apiDomain}/jumps/last`).pipe(map((data) => data.jump));
|
||||
}
|
||||
|
||||
create(jump: Jump): Observable<Jump> {
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/`, { jump: jump }).pipe(map(data => data.jump));
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/`, { jump: jump }).pipe(map((data) => data.jump));
|
||||
}
|
||||
|
||||
update(jump: Jump): Observable<Jump> {
|
||||
return this.apiService.put(`${this._apiDomain}/jumps/${jump.slug}`, { jump: jump }).pipe(map(data => data.jump));
|
||||
return this.apiService
|
||||
.put(`${this._apiDomain}/jumps/${jump.slug}`, { jump: jump })
|
||||
.pipe(map((data) => data.jump));
|
||||
}
|
||||
|
||||
destroy(slug: string): Observable<boolean> {
|
||||
return this.apiService.delete(`${this._apiDomain}/jumps/${slug}`).pipe(map(data => data.deleted));
|
||||
return this.apiService.delete(`${this._apiDomain}/jumps/${slug}`).pipe(map((data) => data.deleted));
|
||||
}
|
||||
|
||||
save(jump: Jump): Observable<Jump> {
|
||||
// If we're updating an existing jump
|
||||
if (jump.slug) {
|
||||
return this.apiService.put(`${this._apiDomain}/jumps/${jump.slug}`, { jump: jump }).pipe(map(data => data.jump));
|
||||
return this.apiService
|
||||
.put(`${this._apiDomain}/jumps/${jump.slug}`, { jump: jump })
|
||||
.pipe(map((data) => data.jump));
|
||||
|
||||
// Otherwise, create a new jump
|
||||
} else {
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/`, { jump: jump }).pipe(map(data => data.jump));
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/`, { jump: jump }).pipe(map((data) => data.jump));
|
||||
}
|
||||
}
|
||||
|
||||
saveX2Data(slug: string, file: JumpFile, data: X2Data): Observable<Jump> {
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/data/${slug}`, { file: file, data: data })
|
||||
.pipe(map(data => data.jump));
|
||||
return this.apiService
|
||||
.post(`${this._apiDomain}/jumps/data/${slug}`, { file: file, data: data })
|
||||
.pipe(map((data) => data.jump));
|
||||
}
|
||||
|
||||
saveFile(slug: string, file: JumpFile): Observable<JumpFile> {
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/file/${slug}`, { file: file })
|
||||
.pipe(map(data => data.file));
|
||||
return this.apiService
|
||||
.post(`${this._apiDomain}/jumps/file/${slug}`, { file: file })
|
||||
.pipe(map((data) => data.file));
|
||||
}
|
||||
|
||||
saveKml(slug: string, file: JumpFile): Observable<JumpFile> {
|
||||
return this.apiService.post(`${this._apiDomain}/jumps/kml/${slug}`, { file: file })
|
||||
.pipe(map(data => data.file));
|
||||
return this.apiService
|
||||
.post(`${this._apiDomain}/jumps/kml/${slug}`, { file: file })
|
||||
.pipe(map((data) => data.file));
|
||||
}
|
||||
|
||||
getAeronefs() {
|
||||
@@ -163,5 +191,4 @@ export class JumpsService {
|
||||
]
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -7,22 +7,23 @@ import { Qcm, QcmCategory, QcmQuestion } from '@models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class QcmService {
|
||||
private apiService = inject(ApiService);
|
||||
|
||||
private _apiDomain = '/skydive';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
get(type: string): Observable<Qcm> {
|
||||
return this.apiService.get(`${this._apiDomain}/qcm/type/${type}`).pipe(map(data => data.qcm));
|
||||
return this.apiService.get(`${this._apiDomain}/qcm/type/${type}`).pipe(map((data) => data.qcm));
|
||||
}
|
||||
|
||||
saveChoices(question: object): Observable<QcmQuestion> {
|
||||
return this.apiService.post(`${this._apiDomain}/qcm/choices`, { question: question })
|
||||
.pipe(map(data => data.question));
|
||||
return this.apiService
|
||||
.post(`${this._apiDomain}/qcm/choices`, { question: question })
|
||||
.pipe(map((data) => data.question));
|
||||
}
|
||||
|
||||
saveQuestions(category: object): Observable<QcmCategory> {
|
||||
return this.apiService.post(`${this._apiDomain}/qcm/questions`, { category: category })
|
||||
.pipe(map(data => data.category));
|
||||
return this.apiService
|
||||
.post(`${this._apiDomain}/qcm/questions`, { category: category })
|
||||
.pipe(map((data) => data.category));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user