feat: service/controller prototype

This commit is contained in:
2025-06-19 18:37:19 +03:00
parent 912470b6e2
commit 87878f15a3
12 changed files with 258 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
package controllers
import (
"easywish/internal/models"
"easywish/internal/services"
"net/http"
"github.com/gin-gonic/gin"
@@ -28,9 +30,28 @@ func RegistrationComplete(c *gin.Context) {
// @Tags Auth
// @Accept json
// @Produce json
// @Param request body models.LoginRequest true "desc"
// @Success 200 {object} models.LoginResponse "desc"
// @Router /auth/login [post]
func Login(c *gin.Context) {
c.Status(http.StatusNotImplemented)
var request models.LoginRequest
if err := c.ShouldBindJSON(&request); err != nil {
c.Status(http.StatusBadRequest)
return
}
auths := services.NewAuthService()
result, err := auths.Login(request)
if err != nil {
c.Status(http.StatusTeapot)
return
}
c.JSON(http.StatusFound, result)
}
// @Summary Receive new tokens via refresh token