Concern separation

This commit is contained in:
HugeFrog24
2024-10-13 02:58:18 +02:00
parent 41c9b8075b
commit 9f2b3df4c8
13 changed files with 1147 additions and 391 deletions

36
models.go Normal file
View File

@@ -0,0 +1,36 @@
package main
import (
"time"
"gorm.io/gorm"
)
type Message struct {
gorm.Model
ChatID int64
UserID int64
Username string
UserRole string
Text string
Timestamp time.Time
IsUser bool
}
type ChatMemory struct {
Messages []Message
Size int
}
type Role struct {
gorm.Model
Name string `gorm:"uniqueIndex"`
}
type User struct {
gorm.Model
TelegramID int64 `gorm:"uniqueIndex"`
Username string
RoleID uint
Role Role `gorm:"foreignKey:RoleID"`
}