2024-03-26 15:05:13 +00:00
|
|
|
package models
|
|
|
|
|
2024-03-30 09:10:36 +00:00
|
|
|
type ChannelType = uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
ChannelTypeDirect = ChannelType(iota)
|
|
|
|
ChannelTypeRealm
|
|
|
|
)
|
|
|
|
|
2024-03-26 15:05:13 +00:00
|
|
|
type Channel struct {
|
|
|
|
BaseModel
|
|
|
|
|
2024-03-30 09:10:36 +00:00
|
|
|
Alias string `json:"alias" gorm:"uniqueIndex"`
|
2024-03-26 15:05:13 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Members []ChannelMember `json:"members"`
|
2024-03-30 09:10:36 +00:00
|
|
|
Messages []Message `json:"messages"`
|
|
|
|
Type ChannelType `json:"type"`
|
2024-03-30 17:27:41 +00:00
|
|
|
Account Account `json:"account"`
|
2024-03-26 15:05:13 +00:00
|
|
|
AccountID uint `json:"account_id"`
|
2024-03-30 09:10:36 +00:00
|
|
|
RealmID uint `json:"realm_id"`
|
2024-03-26 15:05:13 +00:00
|
|
|
}
|
|
|
|
|
2024-04-06 08:08:33 +00:00
|
|
|
type NotifyLevel = int8
|
|
|
|
|
|
|
|
const (
|
|
|
|
NotifyLevelAll = NotifyLevel(iota)
|
|
|
|
NotifyLevelMentioned
|
|
|
|
NotifyLevelNone
|
|
|
|
)
|
|
|
|
|
2024-03-26 15:05:13 +00:00
|
|
|
type ChannelMember struct {
|
|
|
|
BaseModel
|
|
|
|
|
2024-04-06 08:08:33 +00:00
|
|
|
ChannelID uint `json:"channel_id"`
|
|
|
|
AccountID uint `json:"account_id"`
|
|
|
|
Channel Channel `json:"channel"`
|
|
|
|
Account Account `json:"account"`
|
|
|
|
Notify NotifyLevel `json:"notify"`
|
2024-03-30 09:10:36 +00:00
|
|
|
|
|
|
|
Messages []Message `json:"messages" gorm:"foreignKey:SenderID"`
|
2024-03-26 15:05:13 +00:00
|
|
|
}
|