package controllers import ( "easywish/internal/models" "easywish/internal/services" "net/http" "github.com/gin-gonic/gin" ) // @Summary Register an account // @Tags Auth // @Accept json // @Produce json // @Router /auth/registrationBegin [post] func RegistrationBegin(c *gin.Context) { var request models.RegistrationBeginRequest 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) c.Status(http.StatusNotImplemented) } // @Summary Confirm with code, finish creating the account // @Tags Auth // @Accept json // @Produce json // @Router /auth/registrationComplete [post] func RegistrationComplete(c *gin.Context) { c.Status(http.StatusNotImplemented) } // @Summary Acquire tokens via login credentials (and 2FA code if needed) // @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) { 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 // @Tags Auth // @Accept json // @Produce json // @Router /auth/refresh [post] func Refresh(c *gin.Context) { c.Status(http.StatusNotImplemented) } // @Summary Request password reset email // @Tags Auth // @Accept json // @Produce json // @Router /auth/passwordResetBegin [post] func PasswordResetBegin(c *gin.Context) { c.Status(http.StatusNotImplemented) } // @Summary Complete password reset with email code and provide 2FA code or backup code if needed // @Tags Auth // @Accept json // @Produce json // @Router /auth/passwordResetComplete [post] func PasswordResetComplete(c *gin.Context) { c.Status(http.StatusNotImplemented) }