continue
This commit is contained in:
@@ -342,4 +342,32 @@ func HttpHandleGroupsGeWithoutMembers(response http.ResponseWriter, request *htt
|
|||||||
|
|
||||||
ctx := request.Context()
|
ctx := request.Context()
|
||||||
|
|
||||||
|
client, err := CacheGetClientById(clientId)
|
||||||
|
if err != nil {
|
||||||
|
client = &Client{Id: clientId}
|
||||||
|
err = DbSetClientById(ctx, client)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
CacheSaveClient(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
var groups [MaxGroupsForClient]*Group
|
||||||
|
var i uint32
|
||||||
|
|
||||||
|
for groupId := range client.Groups {
|
||||||
|
group, err := CacheGetGroup(groupId)
|
||||||
|
if err != nil {
|
||||||
|
group = &Group{Id: groupId}
|
||||||
|
err = DbSetClientByIdWithoutGroups(ctx, client)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
groups[i] = group
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -27,3 +27,13 @@ type Group struct {
|
|||||||
Color [3]uint8
|
Color [3]uint8
|
||||||
EnableClientColors bool
|
EnableClientColors bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GroupNoMembers struct {
|
||||||
|
Name string
|
||||||
|
CreatedAt time.Time
|
||||||
|
Id uint32
|
||||||
|
CreatorId uint32
|
||||||
|
OwnerId uint32
|
||||||
|
Color [3]uint8
|
||||||
|
EnableClientsColors bool
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user