Skip to content

Commit

Permalink
feat: add http oob support
Browse files Browse the repository at this point in the history
  • Loading branch information
XuCcc committed Mar 30, 2022
1 parent e9d9942 commit 7a17583
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/person/xu/oob/ldapoob/ApiController.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package person.xu.oob.ldapoob;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.Optional;
Expand All @@ -23,6 +24,20 @@ public void unregister(@PathVariable(name = "id") String id) {
recordRepository.deleteById(id);
}

@PostMapping("/{id}/access")
@ResponseStatus(code = HttpStatus.ACCEPTED)
public void access(@PathVariable(name = "id") String id) {
Optional<Record> record = recordRepository.findById(id);
record.ifPresent(r -> {
r.setAccess();
r.updateReceiveTime();
recordRepository.save(r);
}
);

}


@GetMapping("/{id}/access")
public boolean isAccess(@PathVariable(name = "id") String id) {
Optional<Record> record = recordRepository.findById(id);
Expand Down

0 comments on commit 7a17583

Please sign in to comment.