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

a1y-developer / doc-formatter / 21100696464

17 Jan 2026 08:52PM UTC coverage: 79.513% (-4.3%) from 83.827%
21100696464

Pull #31

github

web-flow
Merge b37fb8b75 into 51c58ed18
Pull Request #31: chore: clean stuff

227 of 372 new or added lines in 15 files covered. (61.02%)

1599 of 2011 relevant lines covered (79.51%)

0.86 hits per line

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

77.14
/pkg/gateway/handler/auth/auth_handler.go
1
package auth
2

3
import (
4
        "net/http"
5

6
        "github.com/a1y/doc-formatter/pkg/gateway/domain/request"
7
        "github.com/a1y/doc-formatter/pkg/gateway/handler"
8
        "github.com/gin-gonic/gin"
9
)
10

11
// @Id                                Signup
12
// @Summary                Signup
13
// @Description        Create a new user account
14
// @Tags                        Auth
15
// @Accept                        json
16
// @Produce                json
17
// @Param                        body        body                request.SignupRequest                                                        true        "Signup payload"
18
// @Success                201                {object}        handler.Response{data=response.SignUpResponse}        "Success"
19
// @Failure                400                {object}        error                                                                                        "Bad Request"
20
// @Failure                401                {object}        error                                                                                        "Unauthorized"
21
// @Failure                429                {object}        error                                                                                        "Too Many Requests"
22
// @Failure                404                {object}        error                                                                                        "Not Found"
23
// @Failure                500                {object}        error                                                                                        "Internal Server Error"
24
// @Router                        /api/v1/auth/signup [post]
25
func (h *AuthHandler) Signup(c *gin.Context) {
1✔
26
        var requestPayload request.SignupRequest
1✔
27
        if err := requestPayload.Decode(c); err != nil {
2✔
28
                handler.HandleResultWithStatus(c, err, nil, http.StatusBadRequest)
1✔
29
                return
1✔
30
        }
1✔
31

32
        // Validate request payload
33
        if err := requestPayload.Validate(); err != nil {
1✔
NEW
34
                handler.HandleResultWithStatus(c, err, nil, http.StatusBadRequest)
×
NEW
35
                return
×
NEW
36
        }
×
37

38
        response, err := h.authManager.Signup(c.Request.Context(), requestPayload)
1✔
39
        if err != nil {
2✔
40
                handler.HandleResult(c, err, response)
1✔
41
                return
1✔
42
        }
1✔
43
        handler.HandleResultWithStatus(c, nil, response, http.StatusCreated)
1✔
44
}
45

46
// @Id                                Login
47
// @Summary                Login
48
// @Description        Login user and return JWT token
49
// @Tags                        Auth
50
// @Accept                        json
51
// @Produce                json
52
// @Param                        body        body                request.LoginRequest                                                        true        "Login payload"
53
// @Success                200                {object}        handler.Response{data=response.LoginResponse}        "Success"
54
// @Failure                400                {object}        error                                                                                        "Bad Request"
55
// @Failure                401                {object}        error                                                                                        "Unauthorized"
56
// @Failure                429                {object}        error                                                                                        "Too Many Requests"
57
// @Failure                404                {object}        error                                                                                        "Not Found"
58
// @Failure                500                {object}        error                                                                                        "Internal Server Error"
59
// @Router                        /api/v1/auth/login [post]
60
func (h *AuthHandler) Login(c *gin.Context) {
1✔
61
        var requestPayload request.LoginRequest
1✔
62
        if err := requestPayload.Decode(c); err != nil {
2✔
63
                handler.HandleResultWithStatus(c, err, nil, http.StatusBadRequest)
1✔
64
                return
1✔
65
        }
1✔
66

67
        // Validate request payload
68
        if err := requestPayload.Validate(); err != nil {
1✔
NEW
69
                handler.HandleResultWithStatus(c, err, nil, http.StatusBadRequest)
×
NEW
70
                return
×
NEW
71
        }
×
72

73
        response, err := h.authManager.Login(c.Request.Context(), requestPayload)
1✔
74
        if err != nil {
2✔
75
                if err.Error() == "invalid credentials" {
2✔
76
                        handler.HandleResultWithStatus(c, err, nil, http.StatusUnauthorized)
1✔
77
                        return
1✔
78
                }
1✔
NEW
79
                handler.HandleResult(c, err, nil)
×
NEW
80
                return
×
81
        }
82

83
        handler.HandleResult(c, err, response)
1✔
84
}
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