• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torresj / community-api / 50

08 Aug 2025 12:18PM UTC coverage: 82.171% (-6.6%) from 88.761%
50

push

circleci

Jaime Torres Benavente
owner controller with get endpoint added

8 of 25 new or added lines in 4 files covered. (32.0%)

318 of 387 relevant lines covered (82.17%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/src/main/java/com/torresj/community/controllers/OwnerController.java
1
package com.torresj.community.controllers;
2

3
import com.torresj.community.dtos.OwnerDto;
4
import com.torresj.community.exceptions.CommunityNotFoundException;
5
import com.torresj.community.exceptions.UserNotFoundException;
6
import com.torresj.community.services.OwnerService;
7
import io.swagger.v3.oas.annotations.Operation;
8
import io.swagger.v3.oas.annotations.media.ArraySchema;
9
import io.swagger.v3.oas.annotations.media.Content;
10
import io.swagger.v3.oas.annotations.media.Schema;
11
import io.swagger.v3.oas.annotations.responses.ApiResponse;
12
import io.swagger.v3.oas.annotations.responses.ApiResponses;
13
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
14
import lombok.RequiredArgsConstructor;
15
import lombok.extern.slf4j.Slf4j;
16
import org.springframework.http.ResponseEntity;
17
import org.springframework.security.access.prepost.PreAuthorize;
18
import org.springframework.web.bind.annotation.GetMapping;
19
import org.springframework.web.bind.annotation.RequestMapping;
20
import org.springframework.web.bind.annotation.RestController;
21

22
import java.security.Principal;
23
import java.util.List;
24

25
@RestController
26
@RequestMapping("/v1/owners")
27
@Slf4j
1✔
28
@RequiredArgsConstructor
29
public class OwnerController {
30

31
    private final OwnerService ownerService;
32

33
    @Operation(summary = "Get owners")
34
    @ApiResponses(
35
            value = {
36
                    @ApiResponse(
37
                            responseCode = "200",
38
                            description = "Success",
39
                            content = {
40
                                    @Content(
41
                                            mediaType = "application/json",
42
                                            array = @ArraySchema(schema = @Schema(implementation = OwnerDto.class)))
43
                            }),
44
            })
45
    @GetMapping()
46
    @SecurityRequirement(name = "Bearer Authentication")
47
    @PreAuthorize("hasAnyRole('SUPERADMIN','ADMIN')")
48
    public ResponseEntity<List<OwnerDto>> get(Principal principal) throws UserNotFoundException, CommunityNotFoundException {
NEW
49
        log.info("Getting Owners for user {}", principal.getName());
×
NEW
50
        List<OwnerDto> owners = ownerService.get(principal.getName());
×
NEW
51
        log.info("Owners found: {}", owners.size());
×
NEW
52
        return ResponseEntity.ok(owners);
×
53
    }
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc