From 25d47bc3be9e8eca01cb681c2f059201c83cdcd6 Mon Sep 17 00:00:00 2001 From: Rampeur Date: Thu, 9 May 2024 02:21:19 +0200 Subject: [PATCH] Linting --- src/app/components/qcm/qcm.component.ts | 2 +- .../shared/accordion/accordion.directive.ts | 9 +- .../accordion/accordionanchor.directive.ts | 2 +- .../accordion/accordionlink.directive.ts | 8 +- .../helpers-chart/bar-chart.component.html | 2 +- .../bar-horizontal-chart.component.html | 2 +- .../helpers-chart/bars-chart.component.html | 2 +- .../helpers-jump/history-table.component.ts | 8 +- .../helpers-jump/jump-list.component.ts | 3 +- .../helpers-jump/jump-preview.component.ts | 2 +- .../helpers-jump/jump-table.component.html | 56 +--- .../shared/show-authed.directive.ts | 3 +- src/app/core/guards/admin.guard.ts | 4 +- src/app/core/guards/auth.guard.ts | 4 +- src/app/core/guards/noauth.guard.ts | 4 +- src/app/core/models/application-list.model.ts | 6 + src/app/core/models/canopysize.model.ts | 13 - src/app/core/models/chart.model.ts | 10 +- src/app/core/models/index.ts | 2 +- src/app/core/services/api.service.ts | 3 +- src/app/core/services/applications.service.ts | 8 +- src/app/core/services/backend.service.ts | 244 ------------------ src/app/core/services/index.ts | 1 - src/app/core/services/jumps.service.ts | 4 +- src/environments/environment.development.ts | 6 +- src/environments/environment.local.ts | 6 +- src/environments/environment.ts | 6 +- 27 files changed, 49 insertions(+), 371 deletions(-) create mode 100644 src/app/core/models/application-list.model.ts delete mode 100644 src/app/core/models/canopysize.model.ts delete mode 100755 src/app/core/services/backend.service.ts diff --git a/src/app/components/qcm/qcm.component.ts b/src/app/components/qcm/qcm.component.ts index d015151..ff68741 100644 --- a/src/app/components/qcm/qcm.component.ts +++ b/src/app/components/qcm/qcm.component.ts @@ -1,6 +1,6 @@ import { Component, DestroyRef, inject, OnInit, OnDestroy } from '@angular/core'; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; -import { FormControl, FormGroup, FormBuilder, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { /*FormControl,*/ FormGroup, FormBuilder, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; diff --git a/src/app/components/shared/accordion/accordion.directive.ts b/src/app/components/shared/accordion/accordion.directive.ts index 5b49919..0615641 100755 --- a/src/app/components/shared/accordion/accordion.directive.ts +++ b/src/app/components/shared/accordion/accordion.directive.ts @@ -1,9 +1,4 @@ -import { - Directive, - OnInit, - AfterViewInit, - AfterContentChecked -} from '@angular/core'; +import { Directive, AfterContentChecked } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { AccordionLinkDirective } from './accordionlink.directive'; @@ -51,7 +46,7 @@ export class AccordionDirective implements AfterContentChecked { ngAfterContentChecked(): void { this.router.events .pipe(filter(event => event instanceof NavigationEnd)) - .subscribe(e => this.checkOpenLinks()); + .subscribe(() => this.checkOpenLinks()); } constructor(private router: Router) { diff --git a/src/app/components/shared/accordion/accordionanchor.directive.ts b/src/app/components/shared/accordion/accordionanchor.directive.ts index d8fe1e5..2207736 100755 --- a/src/app/components/shared/accordion/accordionanchor.directive.ts +++ b/src/app/components/shared/accordion/accordionanchor.directive.ts @@ -14,7 +14,7 @@ export class AccordionAnchorDirective { } @HostListener('click', ['$event']) - onClick(e: any) { + onClick() { this.navlink.toggle(); } } diff --git a/src/app/components/shared/accordion/accordionlink.directive.ts b/src/app/components/shared/accordion/accordionlink.directive.ts index 60b97cf..daf7ffe 100755 --- a/src/app/components/shared/accordion/accordionlink.directive.ts +++ b/src/app/components/shared/accordion/accordionlink.directive.ts @@ -15,7 +15,7 @@ import { AccordionDirective } from './accordion.directive'; }) export class AccordionLinkDirective implements OnInit, OnDestroy { @Input() - public group: any; + public group!: string; @HostBinding('class.selected') @Input() @@ -37,15 +37,15 @@ export class AccordionLinkDirective implements OnInit, OnDestroy { this.nav = nav; } - ngOnInit(): any { + ngOnInit() { this.nav.addLink(this); } - ngOnDestroy(): any { + ngOnDestroy(){ this.nav.removeGroup(this); } - toggle(): any { + toggle() { this.selected = !this.selected; } } diff --git a/src/app/components/shared/helpers-chart/bar-chart.component.html b/src/app/components/shared/helpers-chart/bar-chart.component.html index 7437707..14e95f9 100755 --- a/src/app/components/shared/helpers-chart/bar-chart.component.html +++ b/src/app/components/shared/helpers-chart/bar-chart.component.html @@ -3,7 +3,7 @@ diff --git a/src/app/components/shared/helpers-chart/bar-horizontal-chart.component.html b/src/app/components/shared/helpers-chart/bar-horizontal-chart.component.html index 0cbcdc1..d85b0c2 100755 --- a/src/app/components/shared/helpers-chart/bar-horizontal-chart.component.html +++ b/src/app/components/shared/helpers-chart/bar-horizontal-chart.component.html @@ -3,7 +3,7 @@ diff --git a/src/app/components/shared/helpers-chart/bars-chart.component.html b/src/app/components/shared/helpers-chart/bars-chart.component.html index 3cad6ff..aa9fc82 100755 --- a/src/app/components/shared/helpers-chart/bars-chart.component.html +++ b/src/app/components/shared/helpers-chart/bars-chart.component.html @@ -3,7 +3,7 @@ diff --git a/src/app/components/shared/helpers-jump/history-table.component.ts b/src/app/components/shared/helpers-jump/history-table.component.ts index 6f1c1a8..1ccc304 100644 --- a/src/app/components/shared/helpers-jump/history-table.component.ts +++ b/src/app/components/shared/helpers-jump/history-table.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges, AfterContentChecked } from '@angular/core'; +import { Component, Input, AfterContentChecked } from '@angular/core'; import { NgIf, NgFor } from '@angular/common'; @Component({ @@ -10,7 +10,7 @@ import { NgIf, NgFor } from '@angular/common'; templateUrl: './history-table.component.html', styleUrls: [] }) -export class HistoryTableComponent implements OnChanges, AfterContentChecked { +export class HistoryTableComponent implements AfterContentChecked { public seriesColTotal: number[] = []; public grandTotal: number = 0; @@ -22,10 +22,10 @@ export class HistoryTableComponent implements OnChanges, AfterContentChecked { @Input() rows: Array> = []; @Input() colors: string[] = []; - ngOnChanges() { + /*ngOnChanges() { //this._loadHistoryTable(); //console.log('onChanges'); - } + }*/ ngAfterContentChecked() { if (this.rows !== undefined && this.rows.length) { diff --git a/src/app/components/shared/helpers-jump/jump-list.component.ts b/src/app/components/shared/helpers-jump/jump-list.component.ts index 75bbc2d..1f087c2 100644 --- a/src/app/components/shared/helpers-jump/jump-list.component.ts +++ b/src/app/components/shared/helpers-jump/jump-list.component.ts @@ -1,11 +1,10 @@ -import { Component, OnInit, OnDestroy, Input, computed, Signal, WritableSignal } from '@angular/core'; +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; import { NgClass, DatePipe } from '@angular/common'; import { RouterLink } from '@angular/router'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { Observable, Subscription } from 'rxjs'; -import { take } from 'rxjs/operators'; import { Errors, Jump, JumpList, JumpListConfig } from 'src/app/core/models'; import { JumpsService } from 'src/app/core/services'; diff --git a/src/app/components/shared/helpers-jump/jump-preview.component.ts b/src/app/components/shared/helpers-jump/jump-preview.component.ts index 50778e6..04133e8 100644 --- a/src/app/components/shared/helpers-jump/jump-preview.component.ts +++ b/src/app/components/shared/helpers-jump/jump-preview.component.ts @@ -39,7 +39,7 @@ export class JumpPreviewComponent implements OnDestroy { deleteJump() { this.isDeleting = true; - const jump$: Observable = this.jumpsService.destroy(this.jump.slug); + const jump$: Observable = this.jumpsService.destroy(this.jump.slug); this._jump = jump$.subscribe({ next: () => { this.router.navigateByUrl('/'); diff --git a/src/app/components/shared/helpers-jump/jump-table.component.html b/src/app/components/shared/helpers-jump/jump-table.component.html index 3f6444c..513eec7 100644 --- a/src/app/components/shared/helpers-jump/jump-table.component.html +++ b/src/app/components/shared/helpers-jump/jump-table.component.html @@ -311,58 +311,4 @@ - - + \ No newline at end of file diff --git a/src/app/components/shared/show-authed.directive.ts b/src/app/components/shared/show-authed.directive.ts index b082749..277311d 100644 --- a/src/app/components/shared/show-authed.directive.ts +++ b/src/app/components/shared/show-authed.directive.ts @@ -11,7 +11,8 @@ export class ShowAuthedDirective implements OnInit, OnDestroy { private _auth: Subscription = new Subscription(); constructor( - private templateRef: TemplateRef, + //private templateRef: TemplateRef, + private templateRef: TemplateRef, private userService: UserService, private viewContainer: ViewContainerRef ) { } diff --git a/src/app/core/guards/admin.guard.ts b/src/app/core/guards/admin.guard.ts index 345f0b3..bf3cf4d 100644 --- a/src/app/core/guards/admin.guard.ts +++ b/src/app/core/guards/admin.guard.ts @@ -1,10 +1,10 @@ import { inject } from '@angular/core'; -import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router'; +import { CanActivateFn, Router } from '@angular/router'; import { map, take } from 'rxjs/operators'; import { UserService } from 'src/app/core/services'; -export const adminGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { +export const adminGuard: CanActivateFn = () => { const router = inject(Router); const userService = inject(UserService); return userService.currentUser.pipe(take(1)).pipe(map(data => { diff --git a/src/app/core/guards/auth.guard.ts b/src/app/core/guards/auth.guard.ts index b48f793..f21497a 100644 --- a/src/app/core/guards/auth.guard.ts +++ b/src/app/core/guards/auth.guard.ts @@ -1,10 +1,10 @@ import { inject } from '@angular/core'; -import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router'; +import { CanActivateFn, Router } from '@angular/router'; import { map, take } from 'rxjs/operators'; import { UserService } from 'src/app/core/services'; -export const authGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { +export const authGuard: CanActivateFn = () => { const router = inject(Router); const userService = inject(UserService); return userService.isAuthenticated.pipe(take(1)).pipe(map(data => { diff --git a/src/app/core/guards/noauth.guard.ts b/src/app/core/guards/noauth.guard.ts index 5894327..1d422b2 100644 --- a/src/app/core/guards/noauth.guard.ts +++ b/src/app/core/guards/noauth.guard.ts @@ -1,11 +1,11 @@ import { inject } from '@angular/core'; -import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router'; +import { CanActivateFn } from '@angular/router'; import { Observable } from 'rxjs'; import { map, take } from 'rxjs/operators'; import { UserService } from 'src/app/core/services'; -export const noauthGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable => { +export const noauthGuard: CanActivateFn = (): Observable => { /* const router = inject(Router); const userService = inject(UserService); diff --git a/src/app/core/models/application-list.model.ts b/src/app/core/models/application-list.model.ts new file mode 100644 index 0000000..da75041 --- /dev/null +++ b/src/app/core/models/application-list.model.ts @@ -0,0 +1,6 @@ +import { Application } from './application.model'; + +export interface ApplicationList { + applications: Array; + applicationsCount: number; +} diff --git a/src/app/core/models/canopysize.model.ts b/src/app/core/models/canopysize.model.ts deleted file mode 100644 index 93a8325..0000000 --- a/src/app/core/models/canopysize.model.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface CanopySize { - id: string; - key: any; - value: any; - doc?: CanopySizeDoc; -} -export interface CanopySizeDoc { - _id: string; - _rev: string; - type: string; - weight: number; - values: []; -} diff --git a/src/app/core/models/chart.model.ts b/src/app/core/models/chart.model.ts index dc5a6f8..ffee021 100644 --- a/src/app/core/models/chart.model.ts +++ b/src/app/core/models/chart.model.ts @@ -3,27 +3,27 @@ import { ChartConfiguration, ChartOptions } from 'chart.js'; export interface BarConfig { barChartData: ChartConfiguration<'bar'>['data'], barChartOptions: ChartConfiguration<'bar'>['options'], - barChartPlugins: any[], + barChartPlugins: ChartConfiguration<'bar'>['plugins'], barChartLegend: boolean } export interface CircleConfig { circleChartLabels: string[], circleChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'], - circleChartOptions: ChartConfiguration<'doughnut'>['options'], - circleChartPlugins: ChartConfiguration<'doughnut'>['plugins'], + circleChartOptions: ChartConfiguration<'doughnut'>['options'], + circleChartPlugins: ChartConfiguration<'doughnut'>['plugins'], circleChartLegend: boolean } export interface DoughnutConfig { doughnutChartLabels: string[], doughnutChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'], - doughnutChartOptions: ChartConfiguration<'doughnut'>['options'], + doughnutChartOptions: ChartConfiguration<'doughnut'>['options'], doughnutChartLegend: boolean } export interface LineConfig { lineChartData: ChartConfiguration<'line'>['data'], - lineChartOptions: ChartOptions<'line'>, + lineChartOptions: ChartOptions<'line'>, lineChartLegend: boolean } diff --git a/src/app/core/models/index.ts b/src/app/core/models/index.ts index 5e7d7a6..25c978e 100644 --- a/src/app/core/models/index.ts +++ b/src/app/core/models/index.ts @@ -1,10 +1,10 @@ export * from './aeronef.model'; export * from './aeronef-list.model'; export * from './application.model'; +export * from './application-list.model'; export * from './application-list-config.model'; export * from './calculator.model'; export * from './canopy.model'; -export * from './canopysize.model'; export * from './chart.model'; export * from './dropzone.model'; export * from './errors.model'; diff --git a/src/app/core/services/api.service.ts b/src/app/core/services/api.service.ts index fcd8589..3db27da 100644 --- a/src/app/core/services/api.service.ts +++ b/src/app/core/services/api.service.ts @@ -1,8 +1,9 @@ import { Injectable } from '@angular/core'; -//import { environment } from 'src/environments/environment'; import { HttpClient, HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; +//import { environment } from 'src/environments/environment'; + @Injectable({ providedIn: 'root' }) export class ApiService { constructor( diff --git a/src/app/core/services/applications.service.ts b/src/app/core/services/applications.service.ts index 6bbaa0a..1a363cd 100644 --- a/src/app/core/services/applications.service.ts +++ b/src/app/core/services/applications.service.ts @@ -3,7 +3,7 @@ import { HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; import { ApiService } from './api.service'; -import { Application, ApplicationListConfig, ApplicationListFilters } from 'src/app/core/models'; +import { Application, ApplicationList, ApplicationListConfig, ApplicationListFilters } from 'src/app/core/models'; import { map } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) @@ -12,7 +12,7 @@ export class ApplicationsService { private apiService: ApiService ) { } - query(config: ApplicationListConfig): Observable<{ applications: Application[], applicationsCount: number }> { + query(config: ApplicationListConfig): Observable { // Convert any filters over to Angular's URLSearchParams const params: ApplicationListFilters = { apikey: config.filters.apikey, @@ -34,8 +34,8 @@ export class ApplicationsService { .pipe(map(data => data.application)); } - destroy(slug: string) { - return this.apiService.delete(`/applications/${slug}`); + destroy(slug: string): Observable { + return this.apiService.delete(`/applications/${slug}`).pipe(map(data => data.deleted)); } save(application: Application): Observable { diff --git a/src/app/core/services/backend.service.ts b/src/app/core/services/backend.service.ts deleted file mode 100755 index 0db6342..0000000 --- a/src/app/core/services/backend.service.ts +++ /dev/null @@ -1,244 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Observable } from 'rxjs'; - -import { Jump } from 'src/app/core/models'; -import { environment } from 'src/environments/environment'; - -export interface JumpDoc { - _id?: string; - _rev?: string; - type: string; - date: string; - numero: number, - lieu?: string; - oaci?: string; - aeronef?: string; - imat?: string; - hauteur?: number, - voile?: string; - taille?: number, - categorie?: string; - module?: string; - participants?: number, - programme?: string; - accessoires?: string; - zone?: string; - dossier?: string; - video?: string; -} - -export interface JumpViewResults { - rows: Array; - total_rows: number; -} - -@Injectable({ providedIn: 'root' }) -export class BackendService { - private _couchdbUrl = environment.couchdbUrl; - private _couchdbDatabase = environment.couchdbDatabase; - private _couchdbDesign = environment.couchdbDesign; - private _couchdbCredential = environment.couchdbCredential; - //private _couchdbUrl = "http://couchdb.unespace.com/material_grow/_design/netgrowing_app/_view/allDevices"; - - httpOptions = { - headers: new HttpHeaders({ - 'Content-Type': 'application/json', - 'Authorization': 'Basic ' + this._couchdbCredential - }) - } - - constructor(private _http: HttpClient) { } - - writeDoc(doc: Object): Promise { - const url = this._couchdbUrl + '/' + this._couchdbDatabase; - return this._http.post(url, doc, this.httpOptions).toPromise(); - } - - updateDoc(doc: JumpDoc): Promise { - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/${doc._id}`; - return this._http.put(url, doc, this.httpOptions).toPromise(); - } - - deleteDoc(id: string, rev: string): Promise { - //const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/' + id + '?rev=' + rev; - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/${id}?rev=${rev}`; - return this._http.delete(url, this.httpOptions).toPromise(); - } - - /* get all docs from couchDB view 'allJumps' */ - getJumps(): Observable { - //const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_design/' + this._couchdbDesign + '/_view/allJumps/'; - //return this._http.get(url, this.httpOptions); - const payload = { - "include_docs": false, - "reduce": false, - "descending": false - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumps/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'allJumpsByDate' */ - getJumpsByDate(level: number): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": level - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumpsByDate/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterAeronef' */ - getAeronefs(): Observable { - const payload = { - "reduce": true, - "group": true - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterAeronef/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterAeronefByDate' */ - getAeronefsByDate(level: number): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": level - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterAeronefByDate/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterCanopyModel' */ - getCanopyModels(): Observable { - const payload = { - "reduce": true, - "group": true - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopyModel/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterCanopyModelByDate' */ - getCanopyModelsByDate(level: number): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": level - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopyModelByDate/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterCanopySize' */ - getCanopySizes(): Observable { - const payload = { - "reduce": true, - "group": true - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopySize/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'filterCanopySizeByDate' */ - getCanopySizesByDate(level: number): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": level - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopySizeByDate/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'allDropZones' */ - getDropZones(): Observable { - const payload = { - "reduce": true, - "group": true - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allDropZones/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'allDropZonesByDate' */ - getDropZonesByDate(level: number): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": level - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allDropZonesByDate/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'allJumps' */ - getTotalJumps(): Observable { - const payload = { - "reduce": true, - "group": true, - "group_level": 1 - } - const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumps/`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'allDevices' */ - getDeviceActivities(deviceId: string, limit: number, start: number, end: number): Observable { - const payload = { - "selector": { - "type": { - "$eq": "activity" - }, - "device_id": { - "$eq": deviceId - }, - "created_time": { - "$gte": start, - "$lte": end - } - }, - "fields": [ - "created_time", - "device_id", - "values" - ], - "sort": [ - { - "created_time": "desc" - } - ], - "limit": limit - } - //const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_find'; - const url = `${this._couchdbUrl}/material_grow/_find`; - return this._http.post(url, payload, this.httpOptions); - } - - /* get all docs from couchDB view 'getDevicesActivities' */ - getDevicesActivities(key: string, limit: number, start: any, end: any): Observable { - /* - const payload = { - "start_key": [deviceId, end], - "end_key": [deviceId, start], - "descending": true, - "limit": limit, - "reduce": false - } - const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_design/' + this._couchdbDesign + '/_view/allActivitiesByDevice/'; - */ - const payload = { - "start_key": [key, 1, start], - "end_key": [key, 1, end], - "limit": limit, - "descending": true, - "include_docs": true, - "reduce": false - } - const url = `${this._couchdbUrl}/netgrowing/_design/app/_view/getDevicesActivities`; - return this._http.post(url, payload, this.httpOptions); - } - -} \ No newline at end of file diff --git a/src/app/core/services/index.ts b/src/app/core/services/index.ts index 166feae..9ddf580 100644 --- a/src/app/core/services/index.ts +++ b/src/app/core/services/index.ts @@ -1,7 +1,6 @@ export * from './aeronefs.service'; export * from './api.service'; export * from './applications.service'; -export * from './backend.service'; export * from './calculator.service'; export * from './canopies.service'; export * from './dropzones.service'; diff --git a/src/app/core/services/jumps.service.ts b/src/app/core/services/jumps.service.ts index c11096e..8375b5c 100644 --- a/src/app/core/services/jumps.service.ts +++ b/src/app/core/services/jumps.service.ts @@ -111,8 +111,8 @@ export class JumpsService { return this.apiService.put(`/jumps/${jump.slug}`, { jump: jump }).pipe(map(data => data.jump)); } - destroy(slug: string) { - return this.apiService.delete(`/jumps/${slug}`); + destroy(slug: string): Observable { + return this.apiService.delete(`/jumps/${slug}`).pipe(map(data => data.deleted)); } save(jump: Jump): Observable { diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index 35ee638..45c9a7f 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -3,9 +3,5 @@ export const environment = { api_url: 'http://localhost:3200/api', //'https://api.rampeur.com/api' api_key: '9f5a9b80a39b4788be2f12941b766aba', use_api_key: true, - refresh_interval: 30000, - couchdbUrl: 'http://couchdb.unespace.com', - couchdbDatabase: 'headupdb', - couchdbDesign: 'headup_app', - couchdbCredential: 'cmFtcGV1cjpES3hwMjRQUw==' + refresh_interval: 30000 }; diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 35ee638..45c9a7f 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -3,9 +3,5 @@ export const environment = { api_url: 'http://localhost:3200/api', //'https://api.rampeur.com/api' api_key: '9f5a9b80a39b4788be2f12941b766aba', use_api_key: true, - refresh_interval: 30000, - couchdbUrl: 'http://couchdb.unespace.com', - couchdbDatabase: 'headupdb', - couchdbDesign: 'headup_app', - couchdbCredential: 'cmFtcGV1cjpES3hwMjRQUw==' + refresh_interval: 30000 }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 5344293..0a10d3e 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -3,9 +3,5 @@ export const environment = { api_url: 'http://localhost:3200/api', //'https://api.rampeur.com/api' api_key: '9f5a9b80a39b4788be2f12941b766aba', use_api_key: true, - refresh_interval: 30000, - couchdbUrl: 'http://couchdb.unespace.com', - couchdbDatabase: 'headupdb', - couchdbDesign: 'headup_app', - couchdbCredential: 'cmFtcGV1cjpES3hwMjRQUw==' + refresh_interval: 30000 };