Ignore:
Timestamp:
11/11/21 12:59:26 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
59329aa
Parents:
6c1585f
Message:

add location to planner

Location:
trip-planner-front/src/app/_services
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/_services/location.service.ts

    r6c1585f rceaed42  
    22import { Injectable } from "@angular/core";
    33import { Observable } from "rxjs";
     4import { PlannerLocationDto } from "../_models/dto/plannerLocationDto";
     5import { Location } from "../_models/location";
    46
    57@Injectable({
     
    911    constructor(private httpClient : HttpClient){}
    1012
    11     getLocationsFromCity(cityId: number, companionId: number, lengthOfStay: number, categoryIds: string): Observable<Object[]>{
     13    getLocationsFromCity(cityId: number, companionId: number, lengthOfStay: number, categoryIds: string): Observable<Location[]>{
    1214        let url = "http://localhost:8080/api/city/locations";
    1315        return this.httpClient.get<Location[]>(url + '?cityId=' + cityId + '&companionId=' + companionId + '&lengthOfStay=' + lengthOfStay + '&categoryIds='+ categoryIds);
     
    1820        return this.httpClient.get<Location[]>(url + '?regionId=' + regionId + '&companionId=' + companionId + '&lengthOfStay=' + lengthOfStay + '&categoryIds='+ categoryIds);
    1921    }
     22
     23    postLocationToPlanner(plannerLocationDto : PlannerLocationDto) : Observable<Location>{
     24        let url = "http://localhost:8080/api/add-location";
     25        return this.httpClient.put<Location>(url, plannerLocationDto);
     26    }
     27
     28    getLocationsFroPlanner(plannerId : number) : Observable<Location[]>{
     29        let url = "http://localhost:8080/api/planner/locations";
     30        return this.httpClient.get<Location[]>(url + '?plannerId=' + plannerId);
     31    }
    2032}
  • trip-planner-front/src/app/_services/planner.service.ts

    r6c1585f rceaed42  
    99})
    1010export class PlannerService{
     11   
    1112    constructor(private httpClient: HttpClient){
    1213    }
     14
    1315    getAllPlanners():Observable<Planner[]>{
    1416        let url = "http://localhost:8080/api/planners";
     
    1618    }
    1719
    18     postInitialPlanner(planner: Planner, locationList: Location[]): Observable<Object>{     
     20    postInitialPlanner(planner: Planner): Observable<Object>{     
    1921        let url = "http://localhost:8080/api/planner/new";
    2022        return this.httpClient.post<Planner>(url, planner);
     
    3032        return this.httpClient.get<Planner>(url);
    3133    }
     34
     35
    3236}
Note: See TracChangeset for help on using the changeset viewer.