Files
goalfylearning-admin/internal/models/user_project_quota.go

28 lines
1.3 KiB
Go

package models
import (
"time"
"gorm.io/gorm"
)
// UserProjectQuota 用户资源配额上限
// 仅记录用户在项目/虚拟机/进程三个资源维度的数量上限
type UserProjectQuota struct {
ID uint `gorm:"primarykey;column:id" json:"id"`
UserID string `gorm:"type:varchar(64);uniqueIndex;not null;column:user_id" json:"user_id"`
ProjectLimit int `gorm:"not null;default:0;column:project_limit" json:"project_limit"`
CoderVMLimit int `gorm:"not null;default:0;column:coder_vm_limit" json:"coder_vm_limit"`
BrowserVMLimit int `gorm:"not null;default:0;column:browser_vm_limit" json:"browser_vm_limit"`
ProcessLimit int `gorm:"not null;default:0;column:process_limit" json:"process_limit"`
Enabled bool `gorm:"not null;default:true;column:enabled" json:"enabled"`
Description string `gorm:"type:varchar(255);column:description" json:"description"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index;column:deleted_at" json:"deleted_at"`
}
func (UserProjectQuota) TableName() string {
return "user_project_quota"
}