added posts on feed and posts on map
This commit is contained in:
@@ -4,11 +4,13 @@ import com.krylov.refound.dto.MapMarkerDto;
|
||||
import com.krylov.refound.service.MapService;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/v1")
|
||||
@@ -17,8 +19,9 @@ public class MapController {
|
||||
private final MapService mapService;
|
||||
|
||||
@GetMapping("/posts/map")
|
||||
public List<MapMarkerDto> getMapMarkers(@RequestParam(required = false) String type, @RequestParam(required = false) String category) {
|
||||
return mapService.findAllWithCoordinates(type, category);
|
||||
public List<MapMarkerDto> getMapMarkers(@RequestParam double minLat, @RequestParam double maxLat, @RequestParam double minLng, @RequestParam double maxLng, @RequestParam(required = false) String type, @RequestParam(required = false) String category) {
|
||||
log.info("getMapMarkers");
|
||||
return mapService.findMarkers(minLat, maxLat, minLng, maxLng, type, category);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PostController {
|
||||
return service.getFeed(search, pageable);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@GetMapping("/{id:\\d+}")
|
||||
public List<PostResponse> getById(@PathVariable Long id) {
|
||||
log.info("get feed by id {}", id);
|
||||
return service.getPostsByUserId(id);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.krylov.refound.controller;
|
||||
|
||||
|
||||
import com.krylov.refound.ai.client.TextModerationClient;
|
||||
import com.krylov.refound.ai.dto.ModerationResponse;
|
||||
import com.krylov.refound.service.SchedulerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/test")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TestController {
|
||||
|
||||
private final SchedulerService schedulerService;
|
||||
private final TextModerationClient client;
|
||||
|
||||
@GetMapping("/test1")
|
||||
public Integer tested1() {
|
||||
|
||||
schedulerService.deleteExpiredPosts();
|
||||
return 200;
|
||||
}
|
||||
|
||||
@PostMapping("/test-ai")
|
||||
public ModerationResponse test(@RequestParam String text){
|
||||
|
||||
return client.moderate(text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user