Skip to content

Commit f5111ee

Browse files
committed
added controller to getnextId
1 parent 92d3ab5 commit f5111ee

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.gb.didgen;
2+
3+
import com.gb.didgen.exception.ClockMovedBackException;
4+
import com.gb.didgen.exception.NodeIdOutOfBoundException;
5+
import com.gb.didgen.service.IdGenerator;
6+
import org.springframework.http.ResponseEntity;
7+
import org.springframework.web.bind.annotation.GetMapping;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
@RestController("/id")
11+
public class IdGeneratorController {
12+
13+
private IdGenerator idGenerator;
14+
15+
@GetMapping(produces = {"application/JSON"})
16+
public ResponseEntity<?> getNextId() throws NodeIdOutOfBoundException, ClockMovedBackException {
17+
return ResponseEntity.ok(idGenerator.generateId());
18+
}
19+
}

0 commit comments

Comments
 (0)