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

torresj / community-api / 28

16 Jun 2025 10:53AM UTC coverage: 74.063% (-8.8%) from 82.813%
28

push

circleci

Jaime Torres Benavente
fixing test errors

237 of 320 relevant lines covered (74.06%)

0.74 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/LoginController.java
1
package com.torresj.community.controllers;
2

3
import com.torresj.community.dtos.RequestLoginDto;
4
import com.torresj.community.dtos.ResponseLoginDto;
5
import com.torresj.community.exceptions.LoginException;
6
import com.torresj.community.services.LoginService;
7
import io.swagger.v3.oas.annotations.Operation;
8
import io.swagger.v3.oas.annotations.media.Content;
9
import io.swagger.v3.oas.annotations.media.Schema;
10
import io.swagger.v3.oas.annotations.responses.ApiResponse;
11
import io.swagger.v3.oas.annotations.responses.ApiResponses;
12
import lombok.RequiredArgsConstructor;
13
import lombok.extern.slf4j.Slf4j;
14
import org.springframework.http.ResponseEntity;
15
import org.springframework.web.bind.annotation.PostMapping;
16
import org.springframework.web.bind.annotation.RequestBody;
17
import org.springframework.web.bind.annotation.RequestMapping;
18
import org.springframework.web.bind.annotation.RestController;
19

20
@RestController
21
@RequestMapping("/v1/login")
22
@Slf4j
1✔
23
@RequiredArgsConstructor
24
public class LoginController {
25

26
    private final LoginService loginService;
27

28
    @Operation(summary = "Login with user and password")
29
    @ApiResponses(
30
            value = {
31
                    @ApiResponse(
32
                            responseCode = "200",
33
                            description = "Login successful",
34
                            content = {
35
                                    @Content(
36
                                            mediaType = "application/json",
37
                                            schema = @Schema(implementation = ResponseLoginDto.class))
38
                            }),
39
                    @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content),
40
                    @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content)
41
            })
42
    @PostMapping
43
    ResponseEntity<ResponseLoginDto> login(
44
            @io.swagger.v3.oas.annotations.parameters.RequestBody(
45
                    description = "Login DTO with user and password",
46
                    required = true,
47
                    content = @Content(schema = @Schema(implementation = RequestLoginDto.class)))
48
            @RequestBody RequestLoginDto loginDto) throws LoginException {
49
        log.info("[LOGIN] Attempt to login for {}", loginDto.username());
×
50
        ResponseLoginDto response = loginService.login(loginDto.username(), loginDto.password());
×
51
        log.info("[LOGIN] Login success");
×
52
        return ResponseEntity.ok(response);
×
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