Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
|
3379eac5e7 | |
|
611b3f641c | |
|
494ae5e1a2 | |
|
ddeea128a4 | |
|
1944c40311 | |
|
761ee3794f | |
|
18f09017f1 |
|
@ -31,6 +31,7 @@ const (
|
|||
maxFcmToken = "164"
|
||||
maxAccountStatus = "4" // Indicates the maximum compatible account status. Look for reference in the API
|
||||
maxDescription = "128"
|
||||
maxRoomState = "2" // Look for reference in the API
|
||||
|
||||
accountNameRegex = "^[a-zA-Z0-9_.]+$"
|
||||
)
|
||||
|
@ -42,11 +43,11 @@ var (
|
|||
"Email": "required,email,min=" + minEmail + ",max=" + maxEmail,
|
||||
"Password": "required", // password length is checked later because it is sent in base64 format
|
||||
"UserId": "required,len=" + lenUserId,
|
||||
"TargetUserId": "required,len=" + lenUserId,
|
||||
"SessionEncryptionKey": "required,len=" + lenSessionEncryptionKey,
|
||||
"Token": "required,min=" + minFcmToken + ",max=" + maxFcmToken, // fcm token
|
||||
"AccountStatus": "number,max=" + maxAccountStatus,
|
||||
"Description": "max=" + maxDescription,
|
||||
"RoomState": "number,max=" + maxRoomState,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"strings"
|
||||
|
||||
gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper"
|
||||
gocnjhelper "git.ex.umbach.dev/ClickandJoin/go-cnj-helper"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
|
24
dbmodels.go
24
dbmodels.go
|
@ -198,16 +198,26 @@ var (
|
|||
PartKey: []string{"user_id"},
|
||||
})
|
||||
|
||||
DbMChats = table.New(table.Metadata{
|
||||
Name: "chats",
|
||||
DbMRooms = table.New(table.Metadata{
|
||||
Name: "rooms",
|
||||
Columns: []string{
|
||||
"user_first_id",
|
||||
"user_second_id",
|
||||
"id",
|
||||
"state",
|
||||
"sync_count",
|
||||
"last_messages",
|
||||
"blocked_state",
|
||||
"last_changes",
|
||||
"created_at",
|
||||
},
|
||||
PartKey: []string{"user_first_id", "user_second_id"},
|
||||
PartKey: []string{"id"},
|
||||
})
|
||||
|
||||
DbMRoomUsers = table.New(table.Metadata{
|
||||
Name: "room_users",
|
||||
Columns: []string{
|
||||
"room_id",
|
||||
"user_id",
|
||||
"role",
|
||||
"joined_at",
|
||||
},
|
||||
PartKey: []string{"room_id"},
|
||||
})
|
||||
)
|
||||
|
|
|
@ -63,16 +63,23 @@ type UserSignUpProcess struct {
|
|||
ExpiresAt int64
|
||||
}
|
||||
|
||||
// TABLE chats
|
||||
type Chat struct {
|
||||
UserFirstId string
|
||||
UserSecondId string
|
||||
// TABLE rooms
|
||||
type Room struct {
|
||||
Id string
|
||||
State uint8
|
||||
// Represents the current number of message activities in a chat. This includes reactions to messages, replying to messages, deleting messages, and more
|
||||
SyncCount int
|
||||
// Contains number X of last message activities. Needed e.g. for web
|
||||
LastMessages []string
|
||||
BlockedState uint8
|
||||
CreatedAt int64
|
||||
// Contains number X of last changes like messages, reactions, replies
|
||||
LastChanges []string
|
||||
CreatedAt int64
|
||||
}
|
||||
|
||||
// TABLE room_users
|
||||
type RoomUsers struct {
|
||||
RoomId string
|
||||
UserId string
|
||||
Role uint8
|
||||
JoinedAt int64
|
||||
}
|
||||
|
||||
// Representation of the event model
|
||||
|
|
Loading…
Reference in New Issue