2025-04-24 13:58:05 -05:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2025-04-27 23:14:37 -05:00
|
|
|
"fmt"
|
2025-04-24 13:58:05 -05:00
|
|
|
"log"
|
|
|
|
"net/http"
|
2025-04-29 17:54:32 -05:00
|
|
|
"strconv"
|
2025-04-24 13:58:05 -05:00
|
|
|
|
|
|
|
authdiscord "example.com/auth/discord"
|
|
|
|
configserver "example.com/config/server"
|
2025-04-29 17:54:32 -05:00
|
|
|
character "example.com/database/character"
|
|
|
|
customization "example.com/database/customization"
|
2025-04-27 23:14:37 -05:00
|
|
|
function "example.com/database/function"
|
2025-04-29 17:54:32 -05:00
|
|
|
functionset "example.com/database/functionset"
|
2025-04-27 23:14:37 -05:00
|
|
|
functiontag "example.com/database/functiontag"
|
|
|
|
group "example.com/database/group"
|
2025-04-29 17:54:32 -05:00
|
|
|
inventoryslot "example.com/database/inventoryslot"
|
|
|
|
item "example.com/database/item"
|
|
|
|
itemtag "example.com/database/itemtag"
|
|
|
|
person "example.com/database/person"
|
|
|
|
role "example.com/database/role"
|
|
|
|
schematic "example.com/database/schematic"
|
|
|
|
tier "example.com/database/tier"
|
2025-04-28 12:38:15 -05:00
|
|
|
user "example.com/database/user"
|
2025-04-24 13:58:05 -05:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/xyproto/randomstring"
|
|
|
|
"golang.org/x/oauth2"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
var GlobalDatabase *gorm.DB
|
|
|
|
var GlobalConfig configserver.AppConfig
|
|
|
|
var GlobalOAuth *oauth2.Config
|
|
|
|
|
2025-04-24 20:17:30 -05:00
|
|
|
// Private Functions
|
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
func objectIDStringsToInts(context *gin.Context, objectIDs []string) *[]int {
|
|
|
|
var objectIDInts []int
|
|
|
|
for _, objectID := range objectIDs {
|
|
|
|
objectIDInt, err := strconv.Atoi(objectID)
|
|
|
|
if err != nil {
|
|
|
|
objectIDInts = append(objectIDInts, objectIDInt)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &objectIDInts
|
|
|
|
}
|
|
|
|
|
2025-04-24 17:08:09 -05:00
|
|
|
// Authentication Workflow
|
|
|
|
|
|
|
|
func AuthCallback(context *gin.Context) {
|
|
|
|
oauthState := randomstring.CookieFriendlyString(32)
|
|
|
|
context.Set("state", oauthState)
|
|
|
|
var err error
|
|
|
|
oauthToken, err := GlobalOAuth.Exchange(context.Request.Context(), context.Query("code"))
|
|
|
|
if err != nil {
|
2025-04-27 23:14:37 -05:00
|
|
|
context.Redirect(http.StatusInternalServerError, GlobalConfig.GetFrontendRootDomain())
|
2025-04-24 17:08:09 -05:00
|
|
|
}
|
|
|
|
oauthTokenJSON, _ := json.Marshal(oauthToken)
|
|
|
|
context.SetCookie("discord-oauthtoken", string(oauthTokenJSON), 0, "", GlobalConfig.API.Domain, false, false)
|
|
|
|
context.Set("discord-oauthtoken", string(oauthTokenJSON))
|
|
|
|
CreateOrUpdateUser(context)
|
2025-04-27 23:14:37 -05:00
|
|
|
context.Redirect(http.StatusTemporaryRedirect, fmt.Sprintf("%sdashboard", GlobalConfig.GetFrontendRootDomain()))
|
2025-04-24 17:08:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func AuthLoginRedirect(context *gin.Context) {
|
2025-04-24 13:58:05 -05:00
|
|
|
context.Redirect(302, GlobalOAuth.AuthCodeURL(context.GetString("state")))
|
|
|
|
}
|
|
|
|
|
2025-04-24 17:08:09 -05:00
|
|
|
func AuthLogoutRedirect(context *gin.Context) {
|
2025-04-24 13:58:05 -05:00
|
|
|
oauthTokenJSON, err := context.Cookie("discord-oauthtoken")
|
|
|
|
if err == nil {
|
2025-04-29 00:42:57 -05:00
|
|
|
user.Logout(GlobalDatabase, oauthTokenJSON)
|
2025-04-24 13:58:05 -05:00
|
|
|
context.SetCookie("discord-oauthtoken", "", -1, "", GlobalConfig.API.Domain, false, true)
|
|
|
|
} else {
|
|
|
|
log.Println(err)
|
|
|
|
}
|
2025-04-27 23:14:37 -05:00
|
|
|
context.Redirect(http.StatusTemporaryRedirect, GlobalConfig.GetFrontendRootDomain())
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
|
2025-04-24 17:08:09 -05:00
|
|
|
func CreateOrUpdateUser(context *gin.Context) {
|
2025-04-25 17:39:40 -05:00
|
|
|
oauthTokenJSON := context.GetString("discord-oauthtoken")
|
|
|
|
err := error(nil)
|
|
|
|
if oauthTokenJSON == "" {
|
|
|
|
oauthTokenJSON, err = context.Cookie("discord-oauthtoken")
|
|
|
|
if err != nil {
|
|
|
|
log.Printf("This really shouldn't happen. %s", err)
|
|
|
|
context.AbortWithStatus(http.StatusInternalServerError)
|
|
|
|
}
|
2025-04-24 17:08:09 -05:00
|
|
|
}
|
|
|
|
var oauthToken *oauth2.Token
|
|
|
|
err = json.Unmarshal([]byte(oauthTokenJSON), &oauthToken)
|
|
|
|
if err != nil {
|
|
|
|
log.Println(err)
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
2025-04-27 23:14:37 -05:00
|
|
|
var currentDiscordUser authdiscord.DiscordUser
|
|
|
|
currentDiscordUser.GetDiscordUser(context, oauthToken, GlobalConfig, GlobalOAuth)
|
2025-04-28 12:38:15 -05:00
|
|
|
updatedDatabaseUser := user.User{
|
2025-04-24 17:08:09 -05:00
|
|
|
DisplayName: currentDiscordUser.Global_Name,
|
|
|
|
Username: currentDiscordUser.Username,
|
|
|
|
Id: currentDiscordUser.Id,
|
|
|
|
Avatar: currentDiscordUser.Avatar,
|
|
|
|
AvatarDecoration: currentDiscordUser.Avatar_Decoration_Data.Asset,
|
|
|
|
LoginToken: string(oauthTokenJSON),
|
|
|
|
LoggedIn: true,
|
2025-04-25 20:14:46 -05:00
|
|
|
ApiKey: nil,
|
2025-04-24 17:08:09 -05:00
|
|
|
}
|
2025-04-28 12:38:15 -05:00
|
|
|
if user.Exists(GlobalDatabase, currentDiscordUser.Id) {
|
|
|
|
dbOAuthToken := user.GetTokenFromUserId(GlobalDatabase, currentDiscordUser.Id)
|
|
|
|
if user.GetLoggedInFromDiscordId(GlobalDatabase, currentDiscordUser.Id) {
|
2025-04-24 17:08:09 -05:00
|
|
|
context.SetCookie("discord-oauthtoken", dbOAuthToken, 0, "", GlobalConfig.API.Domain, false, false)
|
2025-04-25 17:39:40 -05:00
|
|
|
updatedDatabaseUser.LoginToken = string(dbOAuthToken)
|
2025-04-25 00:25:58 -05:00
|
|
|
} else {
|
|
|
|
context.SetCookie("discord-oauthtoken", string(oauthTokenJSON), 0, "", GlobalConfig.API.Domain, false, false)
|
|
|
|
}
|
2025-04-28 12:38:15 -05:00
|
|
|
err := updatedDatabaseUser.Update(GlobalDatabase)
|
2025-04-25 00:25:58 -05:00
|
|
|
if err != nil {
|
|
|
|
log.Println(err)
|
|
|
|
context.AbortWithStatus(http.StatusInternalServerError)
|
2025-04-24 17:08:09 -05:00
|
|
|
}
|
|
|
|
} else {
|
2025-04-28 12:38:15 -05:00
|
|
|
err := updatedDatabaseUser.Create(GlobalDatabase)
|
2025-04-24 17:08:09 -05:00
|
|
|
if err != nil {
|
|
|
|
log.Println(err)
|
|
|
|
context.Copy().AbortWithStatus(http.StatusInternalServerError)
|
|
|
|
}
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
// Create Endpoints (post/)
|
|
|
|
|
|
|
|
func CreateGroup(context *gin.Context) {
|
|
|
|
GetUserLoggedIn(context)
|
2025-04-25 00:25:58 -05:00
|
|
|
isAuthorized := context.GetBool("is-authorized")
|
|
|
|
if isAuthorized {
|
2025-04-29 00:42:57 -05:00
|
|
|
name, nameOk := context.GetQuery("name")
|
|
|
|
if nameOk {
|
|
|
|
group.Create(GlobalDatabase, name)
|
2025-04-25 00:25:58 -05:00
|
|
|
context.Status(http.StatusOK)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusUnauthorized)
|
|
|
|
}
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
func CreateFunction(context *gin.Context) {
|
|
|
|
GetUserLoggedIn(context)
|
2025-04-25 17:39:40 -05:00
|
|
|
isAuthorized := context.GetBool("is-authorized")
|
|
|
|
if isAuthorized {
|
2025-04-27 23:14:37 -05:00
|
|
|
name, nameOk := context.GetQuery("name")
|
2025-04-29 00:42:57 -05:00
|
|
|
tags := context.QueryArray("tags")
|
|
|
|
requirements := context.QueryArray("requirements")
|
2025-04-27 23:14:37 -05:00
|
|
|
if nameOk {
|
2025-04-29 00:42:57 -05:00
|
|
|
function.Create(GlobalDatabase, name, tags, requirements)
|
2025-04-25 17:39:40 -05:00
|
|
|
context.Status(http.StatusOK)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusUnauthorized)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
func CreateFunctionTag(context *gin.Context) {
|
|
|
|
GetUserLoggedIn(context)
|
2025-04-25 17:39:40 -05:00
|
|
|
isAuthorized := context.GetBool("is-authorized")
|
|
|
|
if isAuthorized {
|
|
|
|
name := context.Query("name")
|
|
|
|
if name != "" {
|
2025-04-29 00:42:57 -05:00
|
|
|
functiontag.Create(GlobalDatabase, name)
|
2025-04-25 17:39:40 -05:00
|
|
|
context.Status(http.StatusOK)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusUnauthorized)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
// Update Endpoints (put/)
|
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
func UpdateFunction(context *gin.Context) {
|
|
|
|
GetUserLoggedIn(context)
|
|
|
|
isAuthorized := context.GetBool("is-authorized")
|
|
|
|
if isAuthorized {
|
|
|
|
name, nameOk := context.GetQuery("name")
|
|
|
|
tags := context.QueryArray("tags")
|
|
|
|
requirements := context.QueryArray("requirements")
|
|
|
|
if nameOk {
|
|
|
|
function.Update(GlobalDatabase, name, tags, requirements)
|
|
|
|
context.Status(http.StatusOK)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusUnauthorized)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-24 20:17:30 -05:00
|
|
|
// Read Endpoints (get/)
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
func GetDiscordUser(context *gin.Context) {
|
2025-04-24 13:58:05 -05:00
|
|
|
oauthTokenJSON, err := context.Cookie("discord-oauthtoken")
|
|
|
|
if err == nil {
|
|
|
|
var oauthToken *oauth2.Token
|
|
|
|
err := json.Unmarshal([]byte(oauthTokenJSON), &oauthToken)
|
|
|
|
if err == nil {
|
|
|
|
if oauthToken.Valid() {
|
2025-04-28 12:38:15 -05:00
|
|
|
var discordUser authdiscord.DiscordUser
|
|
|
|
discordUser.GetDiscordUser(context, oauthToken, GlobalConfig, GlobalOAuth)
|
|
|
|
if user.GetLoggedInFromDiscordId(GlobalDatabase, discordUser.Id) {
|
|
|
|
context.JSON(http.StatusOK, discordUser)
|
2025-04-24 13:58:05 -05:00
|
|
|
} else {
|
2025-04-27 23:14:37 -05:00
|
|
|
context.Redirect(http.StatusTemporaryRedirect, fmt.Sprintf("%slogout", GlobalConfig.GetAPIRootDomain()))
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
return
|
2025-04-24 17:08:09 -05:00
|
|
|
} else {
|
|
|
|
log.Println(err)
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
log.Println(err)
|
2025-04-24 17:08:09 -05:00
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
log.Println(err)
|
2025-04-24 17:08:09 -05:00
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
2025-04-27 23:14:37 -05:00
|
|
|
context.Redirect(http.StatusTemporaryRedirect, GlobalConfig.GetFrontendRootDomain())
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
|
2025-04-29 00:42:57 -05:00
|
|
|
func GetUserLoggedIn(context *gin.Context) {
|
2025-04-24 13:58:05 -05:00
|
|
|
oauthTokenJSON, err := context.Cookie("discord-oauthtoken")
|
|
|
|
if err == nil {
|
|
|
|
var oauthToken *oauth2.Token
|
|
|
|
err := json.Unmarshal([]byte(oauthTokenJSON), &oauthToken)
|
|
|
|
if err == nil {
|
|
|
|
if oauthToken.Valid() {
|
2025-04-28 12:38:15 -05:00
|
|
|
if user.GetLoggedInFromOAuthToken(GlobalDatabase, oauthTokenJSON) {
|
2025-04-24 13:58:05 -05:00
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"message": true,
|
|
|
|
})
|
2025-04-25 00:25:58 -05:00
|
|
|
context.Set("is-authorized", true)
|
|
|
|
return
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
context.JSON(http.StatusUnauthorized, gin.H{
|
|
|
|
"message": false,
|
|
|
|
})
|
2025-04-25 00:25:58 -05:00
|
|
|
context.Set("is-authorized", false)
|
2025-04-24 13:58:05 -05:00
|
|
|
}
|
2025-04-24 17:08:09 -05:00
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
func GetObjects(context *gin.Context) {
|
|
|
|
objectIDs, idOk := context.GetQueryArray("id")
|
|
|
|
if idOk {
|
|
|
|
switch objectType := context.Param("object"); objectType {
|
|
|
|
case "persons":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"persons": person.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "groups":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"groups": group.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "characters":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"characters": character.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "roles":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"roles": role.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "tiers":
|
|
|
|
objectIDInts := objectIDStringsToInts(context, objectIDs)
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"tiers": tier.Get(GlobalDatabase, *objectIDInts),
|
|
|
|
})
|
|
|
|
case "function-sets":
|
|
|
|
objectIDInts := objectIDStringsToInts(context, objectIDs)
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"function_sets": functionset.Get(GlobalDatabase, *objectIDInts),
|
|
|
|
})
|
|
|
|
case "functions":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"functions": function.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "function-tags":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"function_tags": functiontag.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "inventory-slot":
|
|
|
|
objectIDInts := objectIDStringsToInts(context, objectIDs)
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"inventory_slot": inventoryslot.Get(GlobalDatabase, *objectIDInts),
|
|
|
|
})
|
|
|
|
case "items":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"items": item.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "item-tags":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"item_tags": itemtag.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "customizations":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"customizations": customization.Get(GlobalDatabase, objectIDs),
|
|
|
|
})
|
|
|
|
case "schematics":
|
|
|
|
objectIDInts := objectIDStringsToInts(context, objectIDs)
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"schematics": schematic.Get(GlobalDatabase, *objectIDInts),
|
|
|
|
})
|
|
|
|
}
|
2025-04-24 20:17:30 -05:00
|
|
|
} else {
|
2025-04-29 00:42:57 -05:00
|
|
|
context.Status(http.StatusBadRequest)
|
2025-04-24 20:17:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
func GetAllObjects(context *gin.Context) {
|
|
|
|
switch objectType := context.Param("object"); objectType {
|
|
|
|
case "persons":
|
2025-04-27 23:14:37 -05:00
|
|
|
context.JSON(http.StatusOK, gin.H{
|
2025-04-29 17:54:32 -05:00
|
|
|
"persons": person.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "groups":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"groups": group.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "characters":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"characters": character.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "roles":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"roles": role.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "tiers":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"tiers": tier.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "function-sets":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"function_sets": functionset.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "functions":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"functions": function.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "function-tags":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"function_tags": functiontag.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "inventory-slot":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"inventory_slot": inventoryslot.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "items":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"items": item.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "item-tags":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"item_tags": itemtag.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "customizations":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"customizations": customization.GetAll(GlobalDatabase),
|
|
|
|
})
|
|
|
|
case "schematics":
|
|
|
|
context.JSON(http.StatusOK, gin.H{
|
|
|
|
"schematics": schematic.GetAll(GlobalDatabase),
|
2025-04-27 23:14:37 -05:00
|
|
|
})
|
2025-04-25 17:39:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
// Delete Endpoints (delete/)
|
2025-04-25 17:39:40 -05:00
|
|
|
|
2025-04-29 17:54:32 -05:00
|
|
|
func DeleteFunction(context *gin.Context) {
|
|
|
|
GetUserLoggedIn(context)
|
|
|
|
isAuthorized := context.GetBool("is-authorized")
|
|
|
|
if isAuthorized {
|
|
|
|
functionNames, ok := context.GetQueryArray("name")
|
|
|
|
if ok {
|
|
|
|
function.Delete(GlobalDatabase, functionNames)
|
|
|
|
context.Status(http.StatusOK)
|
|
|
|
} else {
|
|
|
|
context.AbortWithStatus(http.StatusBadRequest)
|
|
|
|
}
|
2025-04-25 17:39:40 -05:00
|
|
|
} else {
|
2025-04-29 17:54:32 -05:00
|
|
|
context.AbortWithStatus(http.StatusUnauthorized)
|
2025-04-25 17:39:40 -05:00
|
|
|
}
|
|
|
|
}
|