use uuid for everything

This commit is contained in:
2026-04-12 14:19:46 +02:00
parent 18ebfd0416
commit 3be9619cca
9 changed files with 72 additions and 68 deletions
+11 -11
View File
@@ -18,8 +18,8 @@ type User struct {
PasswordHash string
CreatedAt time.Time
WsConn *websocket.Conn
Id uint32
Groups map[uint32]struct{}
Id uuid.UUID
Groups map[uuid.UUID]struct{}
Connections map[uuid.UUID]*Connection
Color [3]uint8
}
@@ -30,9 +30,9 @@ type Connection struct {
CreatedAt time.Time `json:"createdAt"`
MessagesBuff [MaxDirectMsgCache]*Message `json:"-"`
NextBuffIdx uint32 `json:"-"`
RequestorId uint32 `json:"requestorId"`
RecipientId uint32 `json:"recipientId"`
UserWantingToElevate uint32 `json:"userWantingToElevate"` // TODO add to database
RequestorId uuid.UUID `json:"requestorId"`
RecipientId uuid.UUID `json:"recipientId"`
UserWantingToElevate uuid.UUID `json:"userWantingToElevate"` // TODO add to database
HaveOverflowed bool `json:"-"`
State ConnectionState.ConnectionState `json:"state"`
}
@@ -73,7 +73,7 @@ type Message struct {
Id uuid.UUID `json:"id"`
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
Sender uint32 `json:"sender"`
Sender uuid.UUID `json:"sender"`
Receiver uuid.UUID `json:"receiver"`
}
@@ -83,10 +83,10 @@ type Group struct {
CreatedAt time.Time `json:"createdAt"`
MessagesBuff [MaxDirectMsgCache]*Message `json:"-"`
NextBuffIdx uint32 `json:"-"`
Id uint32 `json:"-"`
CreatorId uint32 `json:"creatorId"`
OwnerId uint32 `json:"ownerId"`
Users map[uint32]struct{} `json:"-"`
Id uuid.UUID `json:"-"`
CreatorId uuid.UUID `json:"creatorId"`
OwnerId uuid.UUID `json:"ownerId"`
Users map[uuid.UUID]struct{} `json:"-"`
Color [3]uint8 `json:"color"`
EnableUserColors bool `json:"enableUserColors"`
HaveMessageBuffOverflowed bool `json:"-"`
@@ -94,7 +94,7 @@ type Group struct {
type LoginReturn struct {
Token string `json:"token"`
UserId uint32 `json:"userId"`
UserId uuid.UUID `json:"userId"`
}
type WsEventMessage struct {