removed user request and added user connection init to ws
parent
74188bc007
commit
55f38bfeb5
|
@ -7,10 +7,11 @@ import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Groups []*Group
|
var Groups []Group
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
Category string `json:"category"`
|
Category string `json:"category"`
|
||||||
|
Id string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
GlobalInputs []GlobalInputs `json:"globalInputs"`
|
GlobalInputs []GlobalInputs `json:"globalInputs"`
|
||||||
Tasks []Task `json:"tasks"`
|
Tasks []Task `json:"tasks"`
|
||||||
|
@ -75,7 +76,9 @@ func ReadGroups() {
|
||||||
|
|
||||||
json.Unmarshal(content, &group)
|
json.Unmarshal(content, &group)
|
||||||
|
|
||||||
Groups = append(Groups, &group)
|
group.Id = entry.Name()
|
||||||
|
|
||||||
|
Groups = append(Groups, group)
|
||||||
|
|
||||||
log.Info().Msgf("Group: %s", group)
|
log.Info().Msgf("Group: %s", group)
|
||||||
log.Info().Msgf("Number of groups: %d", len(Groups))
|
log.Info().Msgf("Number of groups: %d", len(Groups))
|
||||||
|
|
|
@ -3,6 +3,7 @@ package structs
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"janex/admin-dashboard-backend/grouptasks"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gofiber/websocket/v2"
|
"github.com/gofiber/websocket/v2"
|
||||||
|
@ -78,6 +79,11 @@ func (socketClient *SocketClient) writeMessage(messageType int, message SendSock
|
||||||
}
|
}
|
||||||
|
|
||||||
type InitUserSocketConnection struct {
|
type InitUserSocketConnection struct {
|
||||||
|
User UserData
|
||||||
|
GroupTasks []grouptasks.Group
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserData struct {
|
||||||
Username string
|
Username string
|
||||||
Email string
|
Email string
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package socketserver
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"janex/admin-dashboard-backend/grouptasks"
|
||||||
"janex/admin-dashboard-backend/modules/cache"
|
"janex/admin-dashboard-backend/modules/cache"
|
||||||
"janex/admin-dashboard-backend/modules/database"
|
"janex/admin-dashboard-backend/modules/database"
|
||||||
"janex/admin-dashboard-backend/modules/structs"
|
"janex/admin-dashboard-backend/modules/structs"
|
||||||
|
@ -45,8 +46,11 @@ func RunHub() {
|
||||||
newSocketClient.SendMessage(structs.SendSocketMessage{
|
newSocketClient.SendMessage(structs.SendSocketMessage{
|
||||||
Cmd: utils.SentInitUserSocketConnection,
|
Cmd: utils.SentInitUserSocketConnection,
|
||||||
Body: structs.InitUserSocketConnection{
|
Body: structs.InitUserSocketConnection{
|
||||||
Username: user.Username,
|
User: structs.UserData{
|
||||||
Email: user.Email,
|
Username: user.Username,
|
||||||
|
Email: user.Email,
|
||||||
|
},
|
||||||
|
GroupTasks: grouptasks.Groups,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue