Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Mar 1, 2024
2 parents 10ea095 + 95e6525 commit e0ea7e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import git.tracehub.pmo.security.ClaimOf;
import git.tracehub.pmo.security.IdProvider;
import git.tracehub.pmo.security.IdpToken;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -84,6 +85,7 @@ public class ProjectController {
* @return List of projects
*/
@GetMapping
@Operation(summary = "Get projects by user")
public List<Project> byUser(@AuthenticationPrincipal final Jwt jwt) {
return this.projects.byUser(
new ClaimOf(jwt, "preferred_username").value()
Expand All @@ -97,6 +99,7 @@ public List<Project> byUser(@AuthenticationPrincipal final Jwt jwt) {
* @return Project
*/
@GetMapping("/{id}")
@Operation(summary = "Get project by id")
@PreAuthorize("@hasProject.validate(#id)")
public Project byId(@PathVariable final UUID id) {
return this.projects.byId(id);
Expand All @@ -111,6 +114,7 @@ public Project byId(@PathVariable final UUID id) {
* @checkstyle MethodBodyCommentsCheck (20 lines)
*/
@PostMapping
@Operation(summary = "Create a new project")
@PreAuthorize("hasAuthority('user_github') || hasAuthority('user_gitlab')")
@ResponseStatus(HttpStatus.CREATED)
public Project employ(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import git.tracehub.pmo.secret.Keys;
import git.tracehub.pmo.secret.Secret;
import git.tracehub.pmo.secret.Secrets;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -84,6 +85,7 @@ public SecretController(
* @return List of keys
*/
@GetMapping("/keys")
@Operation(summary = "Get keys by project")
public List<Key> byProject(@RequestParam final UUID project) {
return this.keys.byProject(project);
}
Expand All @@ -95,6 +97,7 @@ public List<Key> byProject(@RequestParam final UUID project) {
* @return Secret
*/
@GetMapping
@Operation(summary = "Get value by key")
public Secret byValue(final Key key) {
return this.secrets.value(key);
}
Expand All @@ -106,6 +109,7 @@ public Secret byValue(final Key key) {
* @return Secret
*/
@PutMapping
@Operation(summary = "Update secret")
public Secret update(@RequestBody @Valid final RqSecret secret) {
return this.secrets.update(new SecretFromReq(secret));
}
Expand All @@ -117,6 +121,7 @@ public Secret update(@RequestBody @Valid final RqSecret secret) {
* @return Secret
*/
@PostMapping
@Operation(summary = "Create a new secret")
@ResponseStatus(HttpStatus.CREATED)
public Secret create(@RequestBody @Valid final RqSecret secret) {
return this.secrets.create(new SecretFromReq(secret));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import git.tracehub.pmo.controller.request.TicketFromReq;
import git.tracehub.pmo.ticket.Ticket;
import git.tracehub.pmo.ticket.Tickets;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -64,6 +65,7 @@ public class TicketController {
* @return Ticket
*/
@GetMapping
@Operation(summary = "Get ticket by job path or issue number")
public Ticket byJob(
@RequestParam final String repo,
@RequestParam final Optional<String> job,
Expand All @@ -89,6 +91,7 @@ public Ticket byJob(
* @return Ticket
*/
@PostMapping
@Operation(summary = "Create a new ticket")
@ResponseStatus(HttpStatus.CREATED)
public Ticket create(@RequestBody @Valid final RqTicket ticket) {
return this.tickets.create(new TicketFromReq(ticket));
Expand Down

0 comments on commit e0ea7e6

Please sign in to comment.