needed save users that can view channel instead of checking

This commit is contained in:
2026-04-26 15:09:35 +02:00
parent f22bb43346
commit 9c73a01101
8 changed files with 130 additions and 39 deletions
+10 -5
View File
@@ -20,7 +20,8 @@ var minClient *minio.Client
type DataType uint8
const (
File DataType = iota
ConnectionFile DataType = iota
HubChannelFile
UserAvatar
UserProfileBg
)
@@ -28,14 +29,16 @@ const (
type DataTypePrefix string
const (
FilePrefix DataTypePrefix = "upload/"
UserAvatarPrefix DataTypePrefix = "userAvatar/"
UserProfileBgPrefix DataTypePrefix = "userProfileBg/"
ConnectionFilePrefix DataTypePrefix = "connection/"
HubChannelFilePrefix DataTypePrefix = "hub/"
UserAvatarPrefix DataTypePrefix = "userAvatar/"
UserProfileBgPrefix DataTypePrefix = "userProfileBg/"
)
type GetKeyOptions struct {
UserId uuid.UUID
ConnectionId uuid.UUID
ChannelId uuid.UUID
MimeType string
UploadType DataType
}
@@ -49,12 +52,14 @@ func GetKey(opts GetKeyOptions) string {
key := "/" + strconv.FormatInt(time.Now().UnixMilli(), 10) + extensions[0]
switch opts.UploadType {
case HubChannelFile:
return string(HubChannelFilePrefix) + opts.ChannelId.String() + key
case UserAvatar:
return string(UserAvatarPrefix) + opts.UserId.String() + key
case UserProfileBg:
return string(UserProfileBgPrefix) + opts.UserId.String() + key
default:
return string(FilePrefix) + opts.ConnectionId.String() + key
return string(ConnectionFilePrefix) + opts.ConnectionId.String() + key
}
}