feat: add services and separate further

This commit is contained in:
2026-04-29 13:25:38 +02:00
parent 6c28aea655
commit 8f6b1efea0
16 changed files with 318 additions and 168 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ package middleware
import (
"log/slog"
"net/http"
"orbits-server/internal/server/api/response"
"orbits-server/internal/server/api/assets"
"strings"
"time"
@@ -42,7 +42,7 @@ func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
authorizationHeader := c.GetHeader("Authorization")
if len(authorizationHeader) == 0 {
c.AbortWithStatusJSON(http.StatusUnauthorized, response.BasicResponse{
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.BasicResponse{
Msg: "Authorization header is required",
})
return
@@ -52,7 +52,7 @@ func AuthMiddleware() gin.HandlerFunc {
// The header must be a specific format, 0 being the bearer text and 1 being the token itself, making it 2 pieces total
// In the following if statement we verify both parts if the part after Bearer is empty its only 1 part for example
if len(headerParts) != 2 || headerParts[0] != "Bearer" {
c.AbortWithStatusJSON(http.StatusUnauthorized, response.BasicResponse{
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.BasicResponse{
Msg: "Authorization header is invalid",
})
return