Skip to content

Commit 491ebaf

Browse files
author
Roman Tsypuk
committed
updated proxy
1 parent 8cb326a commit 491ebaf

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

api-gateway-service/src/main/resources/application.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ zuul:
88
client:
99
path: /client-service/**
1010
serviceId: client-service
11-
1211
ignored-services: '*'

client-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<artifactId>storage-service-client</artifactId>
5555
<version>0.0.1-SNAPSHOT</version>
5656
</dependency>
57-
</dependencies>
57+
</dependencies>
5858

5959
<dependencyManagement>
6060
<dependencies>

client-service/src/main/java/com/lohika/jclub/client/ClientController.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
import com.lohika.jclub.storage.client.StorageServiceClient;
55

66
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.data.domain.Pageable;
8+
import org.springframework.data.web.PagedResourcesAssembler;
79
import org.springframework.hateoas.PagedResources;
810
import org.springframework.web.bind.annotation.GetMapping;
911
import org.springframework.web.bind.annotation.RestController;
1012

13+
import java.util.Collection;
14+
1115
import lombok.extern.slf4j.Slf4j;
1216

1317
@Slf4j
@@ -19,6 +23,19 @@ public class ClientController {
1923

2024
@GetMapping("/apartments")
2125
public PagedResources<Apartment> getApartments() {
22-
return storageServiceClient.list();
26+
PagedResources<Apartment> list = storageServiceClient.list();
27+
Collection<Apartment> content = list.getContent();
28+
return new PagedResources<>(content, list.getMetadata());
29+
//TODO wrap appratments with resources. generate links to client service.
30+
}
31+
32+
33+
@GetMapping("/apartmentsPaged")
34+
public PagedResources<Apartment> getApartmentsPaged(Pageable pageable,
35+
PagedResourcesAssembler assembler) {
36+
PagedResources<Apartment> list = storageServiceClient.list();
37+
Collection<Apartment> content = list.getContent();
38+
return new PagedResources<>(content, list.getMetadata());
39+
2340
}
2441
}

storage-service-client/src/main/java/com/lohika/jclub/storage/client/Apartment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.lohika.jclub.storage.client;
22

3+
import org.springframework.hateoas.ResourceSupport;
4+
35
import lombok.AllArgsConstructor;
46
import lombok.Builder;
57
import lombok.Data;

0 commit comments

Comments
 (0)