mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-12 03:19:39 +08:00
feat!: (WIP) decouple storage, users, and configuration files to support multiple users
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ReceivedFile struct {
|
||||
gorm.Model
|
||||
Processing bool
|
||||
ChatID int64 `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
|
||||
MessageID int `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
|
||||
Processing bool
|
||||
// Which chat the file is from
|
||||
ChatID int64 `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
|
||||
// Which message the file is from
|
||||
MessageID int `gorm:"uniqueIndex:idx_chat_id_message_id;not null"`
|
||||
ReplyMessageID int
|
||||
ReplyChatID int64
|
||||
FileName string
|
||||
@@ -16,7 +19,18 @@ type ReceivedFile struct {
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
UserID int64 `gorm:"uniqueIndex"`
|
||||
Silent bool
|
||||
DefaultStorage string
|
||||
ChatID int64 `gorm:"uniqueIndex"` // Telegram user ID
|
||||
Silent bool
|
||||
DefaultStorageID uint
|
||||
Storages []*StorageModel `gorm:"many2many:user_storages;"`
|
||||
}
|
||||
|
||||
type StorageModel struct {
|
||||
gorm.Model
|
||||
Type string
|
||||
Name string // just for display
|
||||
Desc string
|
||||
Active bool
|
||||
Config datatypes.JSON
|
||||
Users []*User `gorm:"many2many:user_storages;"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user