added proper types to structs, return empty arrays instead of null

This commit is contained in:
slawk0
2025-02-07 23:29:03 +01:00
parent 7342c5b483
commit 68873dc44c
4 changed files with 46 additions and 44 deletions

View File

@@ -3,6 +3,7 @@ package model
import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"time"
)
type UserClaims struct {
@@ -11,15 +12,17 @@ type UserClaims struct {
jwt.RegisteredClaims
}
type Contact struct {
ID int `json:"contact_id"`
ConversationID uuid.UUID `json:"conversation_id"`
UserID uuid.UUID `json:"user_id"`
Username string `json:"username"`
Type string `json:"type"`
LastMessageID int `json:"last_message_id"`
LastMessage string `json:"last_message"`
LastMessageTime string `json:"last_message_time"`
LastMessageSender string `json:"last_message_sender"`
ID int `json:"contact_id"`
ConversationID uuid.UUID `json:"conversation_id"`
UserID uuid.UUID `json:"user_id"`
Username string `json:"username"`
LastActive *time.Time `json:"last_active"`
Type string `json:"type"`
LastReadMessageID *int `json:"last_read_message_id"`
LastMessageID *int `json:"last_message_id"`
LastMessage *time.Time `json:"last_message"`
LastMessageTime *string `json:"last_message_time"`
LastMessageSender *string `json:"last_message_sender"`
}
type ContactSuggestion struct {
@@ -27,9 +30,9 @@ type ContactSuggestion struct {
}
type Message struct {
MessageID int `json:"message_id"`
Message string `json:"message"`
SentAt string `json:"sent_at"`
Sender string `json:"sender"`
AttachmentUrl string `json:"attachment_url"`
MessageID int `json:"message_id"`
Message string `json:"message"`
SentAt time.Time `json:"sent_at"`
Sender string `json:"sender"`
AttachmentUrl *string `json:"attachment_url"`
}