Compare commits

...

3 Commits

Author SHA1 Message Date
alex 569a926bb9 added room user role and room id len 2023-03-11 21:55:48 +01:00
alex 241bb99dee rooms 2023-03-10 23:01:33 +01:00
alex 1fe2f33eba rooms 2023-03-09 22:34:47 +01:00
3 changed files with 18 additions and 2 deletions

View File

@ -14,6 +14,8 @@ const (
lenUserId = "36" // Same value as the one above
LenXAuthorizationHeader = 36 // used for api calls
lenSessionEncryptionKey = "32"
LenRoomId = 36
lenRoomId = "36" // Same value as the one above
minUsername = "2"
maxUsername = "24"
@ -32,6 +34,7 @@ const (
maxAccountStatus = "4" // Indicates the maximum compatible account status. Look for reference in the API
maxDescription = "128"
maxRoomState = "2" // Look for reference in the API
maxRoomUserRole = "2" // Look for reference in the API
accountNameRegex = "^[a-zA-Z0-9_.]+$"
)
@ -48,6 +51,8 @@ var (
"AccountStatus": "number,max=" + maxAccountStatus,
"Description": "max=" + maxDescription,
"RoomState": "number,max=" + maxRoomState,
"Role": "number,max=" + maxRoomUserRole,
"RoomId": "required,len=" + lenRoomId,
}
)

View File

@ -213,8 +213,19 @@ var (
DbMRoomUsers = table.New(table.Metadata{
Name: "room_users",
Columns: []string{
"room_id",
"user_id",
"room_id",
"role",
"joined_at",
},
PartKey: []string{"user_id", "room_id"},
})
DbMRoomUsersHelperPKRoomId = table.New(table.Metadata{
Name: "room_users",
Columns: []string{
"user_id",
"room_id",
"role",
"joined_at",
},

View File

@ -76,8 +76,8 @@ type Room struct {
// TABLE room_users
type RoomUsers struct {
RoomId string
UserId string
RoomId string
Role uint8
JoinedAt int64
}