Removed some unused models and services
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { ActivityResponse } from './api/activity.response.model';
|
||||
|
||||
export interface Activity {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -7,10 +9,6 @@ export interface SubActivity {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
export interface ActivityResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function mapResponseToActivity(data: ActivityResponse): Activity {
|
||||
const { id, name } = data;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export interface ActivityResponse {
|
||||
aktivitets_id: string;
|
||||
aktivitets_namn: string;
|
||||
beskrivning?: string;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface ActivityResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
@@ -6,18 +6,6 @@ export interface GemensamPlanering {
|
||||
activityIds: number[];
|
||||
}
|
||||
|
||||
export interface Activity {
|
||||
activityId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface SubActivity {
|
||||
subActivityId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export function mapGemensamPlaneringToGemensamPlaneringPostRequest(
|
||||
gemensamPlanering: GemensamPlanering
|
||||
): GemensamPlaneringPostRequest {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '@msfa-environment';
|
||||
import { Activity, ActivityResponse, mapResponseToActivity } from '@msfa-models/activity.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ActivitiesApiService {
|
||||
private _apiBaseUrl = `${environment.api.url}`;
|
||||
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
public getActivities$(): Observable<Activity[]> {
|
||||
// endpoint ska uppdateras
|
||||
return this.httpClient.get<{ data: ActivityResponse[] }>(`${this._apiBaseUrl}/activities`).pipe(
|
||||
filter(response => !!response?.data),
|
||||
map(({ data }) => data.map(aktivitet => mapResponseToActivity(aktivitet)))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '@msfa-environment';
|
||||
import { Activity, mapResponseToActivity } from '@msfa-models/activity.model';
|
||||
import { ActivityResponse } from '@msfa-models/api/activity-response.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ActivityApiService {
|
||||
private _apiBaseUrl = `${environment.api.url}`;
|
||||
|
||||
public getActivities$(): Observable<Activity[]> {
|
||||
// endpoint ska uppdateras
|
||||
return this.httpClient.get<{ data: ActivityResponse[] }>(`${this._apiBaseUrl}/aktiviteter`).pipe(
|
||||
filter(response => !!response?.data),
|
||||
map(({ data }) => data.map(aktivitet => mapResponseToActivity(aktivitet)))
|
||||
);
|
||||
}
|
||||
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '@msfa-environment';
|
||||
import { Activity, ActivityResponse, mapResponseToActivity } from '@msfa-models/activity.model';
|
||||
import { Activity, mapResponseToActivity } from '@msfa-models/activity.model';
|
||||
import { ActivityResponse } from '@msfa-models/api/activity.response.model';
|
||||
import { GemensamPlaneringPostRequest } from '@msfa-models/api/gemensam-planering.request.model';
|
||||
import { Avrop } from '@msfa-models/avrop.model';
|
||||
import { CustomError, errorToCustomError } from '@msfa-models/error/custom-error';
|
||||
|
||||
Reference in New Issue
Block a user