-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGetDwellingByIdRestApi.java
More file actions
34 lines (27 loc) · 1.08 KB
/
GetDwellingByIdRestApi.java
File metadata and controls
34 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.dddheroes.heroesofddd.creaturerecruitment.read.getdwellingbyid;
import com.dddheroes.heroesofddd.creaturerecruitment.read.DwellingReadModel;
import org.axonframework.queryhandling.QueryGateway;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.CompletableFuture;
@RestController
@RequestMapping("games/{gameId}")
class GetDwellingByIdRestApi {
private final QueryGateway queryGateway;
GetDwellingByIdRestApi(QueryGateway queryGateway) {
this.queryGateway = queryGateway;
}
@GetMapping("/dwellings/{dwellingId}")
CompletableFuture<DwellingReadModel> getDwellings(
@PathVariable String gameId,
@PathVariable String dwellingId
) {
var query = GetDwellingById.query(gameId, dwellingId);
return queryGateway.query(
query,
DwellingReadModel.class
);
}
}