mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
добавлен биллинг и тарифы
добавлена интеграция с юкасса
This commit is contained in:
@@ -65,7 +65,11 @@ type RMSServer struct {
|
||||
RootGroupGUID *uuid.UUID `gorm:"type:uuid" json:"root_group_guid"`
|
||||
AutoProcess bool `gorm:"default:false" json:"auto_process"`
|
||||
|
||||
// Billing / Stats
|
||||
// Billing
|
||||
Balance int `gorm:"default:0" json:"balance"`
|
||||
PaidUntil *time.Time `json:"paid_until"`
|
||||
|
||||
// Stats
|
||||
InvoiceCount int `gorm:"default:0" json:"invoice_count"`
|
||||
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
@@ -77,10 +81,12 @@ type Repository interface {
|
||||
// Users
|
||||
GetOrCreateUser(telegramID int64, username, first, last string) (*User, error)
|
||||
GetUserByTelegramID(telegramID int64) (*User, error)
|
||||
GetUserByID(id uuid.UUID) (*User, error)
|
||||
|
||||
// ConnectServer - Основной метод подключения.
|
||||
// Реализует логику: Новый URL -> Owner, Старый URL -> Operator.
|
||||
ConnectServer(userID uuid.UUID, url, login, encryptedPass, name string) (*RMSServer, error)
|
||||
GetServerByURL(url string) (*RMSServer, error)
|
||||
GetServerByID(id uuid.UUID) (*RMSServer, error)
|
||||
|
||||
SaveServerSettings(server *RMSServer) error
|
||||
|
||||
@@ -106,7 +112,10 @@ type Repository interface {
|
||||
AddUserToServer(serverID, userID uuid.UUID, role Role) error
|
||||
RemoveUserFromServer(serverID, userID uuid.UUID) error
|
||||
|
||||
// Billing & Stats
|
||||
IncrementInvoiceCount(serverID uuid.UUID) error
|
||||
UpdateBalance(serverID uuid.UUID, amountChange int, newPaidUntil *time.Time) error
|
||||
DecrementBalance(serverID uuid.UUID) error
|
||||
|
||||
// Super Admin Functions
|
||||
GetAllServersSystemWide() ([]RMSServer, error)
|
||||
|
||||
Reference in New Issue
Block a user