Ignore:
Timestamp:
01/15/24 00:11:01 (10 months ago)
Author:
gjoko kostadinov <gjokokostadinov@…>
Branches:
master
Children:
943857c
Parents:
e8999eb
Message:

Add services search functionality.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/controllers/rest/ServiceApi.java

    re8999eb rf29cd58  
    11package edu.gjoko.schedlr.controllers.rest;
    22
     3import edu.gjoko.schedlr.dto.ServiceDto;
    34import edu.gjoko.schedlr.entity.Service;
     5import edu.gjoko.schedlr.mappers.ServiceDtoMapper;
    46import edu.gjoko.schedlr.services.ServicesService;
    57import lombok.AllArgsConstructor;
     
    1820
    1921    private ServicesService service;
     22    private ServiceDtoMapper serviceDtoMapper;
    2023    @PostMapping(path="/delete")
    2124    public void saveBusiness(@RequestBody List<Service> serviceList) {
     
    3437        service.saveOrUpdateServices(serviceList, ownerId);
    3538    }
     39
     40    @GetMapping
     41    public List<ServiceDto> searchServicesByKeyWord(@RequestParam(value = "searchKeyword", required = false) String searchKeyWord) {
     42        return service.getServicesByKeyword(searchKeyWord)
     43                .stream()
     44                .map(serviceDtoMapper::serviceToServiceDto)
     45                .toList();
     46    }
    3647}
Note: See TracChangeset for help on using the changeset viewer.