user UpdatedAt
This commit is contained in:
		@@ -2,23 +2,24 @@ package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Image struct {
 | 
			
		||||
	ID                int     `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name              string  `json:"name"`
 | 
			
		||||
	Width             int     `json:"width"`
 | 
			
		||||
	Height            int     `json:"height"`
 | 
			
		||||
	Prompt            string  `json:"prompt"`
 | 
			
		||||
	NegativePrompt    string  `json:"negative_prompt"`
 | 
			
		||||
	NumInferenceSteps int     `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
 | 
			
		||||
	GuidanceScale     float32 `json:"guidance_scale"`      // Scale for classifier-free guidance (minimum: 1; maximum: 20)
 | 
			
		||||
	Scheduler         string  `json:"scheduler"`           // (DDIM|K_EULER|DPMSolverMultistep|K_EULER_ANCESTRAL|PNDM|KLMS)
 | 
			
		||||
	Seed              int     `json:"seed"`                // Random seed (minimum: 0; maximum: 2147483647)
 | 
			
		||||
	FromImage         string  `json:"from_image"`          // Image to start from
 | 
			
		||||
	CreatedAt         string  `json:"created_at"`
 | 
			
		||||
	UpdatedAt         string  `json:"updated_at"`
 | 
			
		||||
	UserID            int     `json:"user_id"`
 | 
			
		||||
	ID                int       `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name              string    `json:"name"`
 | 
			
		||||
	Width             int       `json:"width"`
 | 
			
		||||
	Height            int       `json:"height"`
 | 
			
		||||
	Prompt            string    `json:"prompt"`
 | 
			
		||||
	NegativePrompt    string    `json:"negative_prompt"`
 | 
			
		||||
	NumInferenceSteps int       `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
 | 
			
		||||
	GuidanceScale     float32   `json:"guidance_scale"`      // Scale for classifier-free guidance (minimum: 1; maximum: 20)
 | 
			
		||||
	Scheduler         string    `json:"scheduler"`           // (DDIM|K_EULER|DPMSolverMultistep|K_EULER_ANCESTRAL|PNDM|KLMS)
 | 
			
		||||
	Seed              int       `json:"seed"`                // Random seed (minimum: 0; maximum: 2147483647)
 | 
			
		||||
	FromImage         string    `json:"from_image"`          // Image to start from
 | 
			
		||||
	UserID            int       `json:"user_id"`
 | 
			
		||||
	CreatedAt         time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt         time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,22 +3,23 @@ package models
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Model struct {
 | 
			
		||||
	ID           int    `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name         string `json:"name"`
 | 
			
		||||
	Type         string `json:"type"`                     // (lora|ckp|hyper|ti)
 | 
			
		||||
	TriggerWords string `json:"trigger_words"`            // 觸發詞
 | 
			
		||||
	BaseModel    string `json:"base_model"`               // (SD1.5|SD2)
 | 
			
		||||
	ModelPath    string `json:"model_path"`               // 模型路徑
 | 
			
		||||
	Status       string `json:"status" default:"initial"` // (initial|ready|waiting|running|success|error)
 | 
			
		||||
	Progress     int    `json:"progress"`                 // (0-100)
 | 
			
		||||
	Image        string `json:"image"`                    // 封面圖片實際地址
 | 
			
		||||
	Tags         string `json:"tags"`
 | 
			
		||||
	CreatedAt    string `json:"created_at"`
 | 
			
		||||
	UpdatedAt    string `json:"updated_at"`
 | 
			
		||||
	UserID       int    `json:"user_id"`
 | 
			
		||||
	ID           int       `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name         string    `json:"name"`
 | 
			
		||||
	Type         string    `json:"type"`                     // (lora|ckp|hyper|ti)
 | 
			
		||||
	TriggerWords string    `json:"trigger_words"`            // 觸發詞
 | 
			
		||||
	BaseModel    string    `json:"base_model"`               // (SD1.5|SD2)
 | 
			
		||||
	ModelPath    string    `json:"model_path"`               // 模型路徑
 | 
			
		||||
	Status       string    `json:"status" default:"initial"` // (initial|ready|waiting|running|success|error)
 | 
			
		||||
	Progress     int       `json:"progress"`                 // (0-100)
 | 
			
		||||
	Image        string    `json:"image"`                    // 封面圖片實際地址
 | 
			
		||||
	Tags         string    `json:"tags"`
 | 
			
		||||
	UserID       int       `json:"user_id"`
 | 
			
		||||
	CreatedAt    time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt    time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,18 +2,19 @@ package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Server struct {
 | 
			
		||||
	ID        int    `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string `json:"name"`
 | 
			
		||||
	Type      string `json:"type"` // (訓練|推理)
 | 
			
		||||
	IP        string `json:"ip"`
 | 
			
		||||
	Port      int    `json:"port"`
 | 
			
		||||
	Username  string `json:"username"`
 | 
			
		||||
	Password  string `json:"password"`
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	ID        int       `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string    `json:"name"`
 | 
			
		||||
	Type      string    `json:"type"` // (訓練|推理)
 | 
			
		||||
	IP        string    `json:"ip"`
 | 
			
		||||
	Port      int       `json:"port"`
 | 
			
		||||
	Username  string    `json:"username"`
 | 
			
		||||
	Password  string    `json:"password"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,13 +2,14 @@ package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Tag struct {
 | 
			
		||||
	ID        int    `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string `json:"name"`
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	ID        int       `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string    `json:"name"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,16 @@
 | 
			
		||||
package models
 | 
			
		||||
 | 
			
		||||
import "time"
 | 
			
		||||
 | 
			
		||||
type Task struct {
 | 
			
		||||
	ID        int    `json:"id"`
 | 
			
		||||
	Name      string `json:"name"`
 | 
			
		||||
	Type      string `json:"type"`     // 任務類型(訓練|推理)
 | 
			
		||||
	Status    string `json:"status"`   // (initial|ready|waiting|running|success|error)
 | 
			
		||||
	Progress  int    `json:"progress"` // (0-100)
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	UserID    int    `json:"user_id"`
 | 
			
		||||
	ID        int       `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string    `json:"name"`
 | 
			
		||||
	Type      string    `json:"type"`     // 任務類型(訓練|推理)
 | 
			
		||||
	Status    string    `json:"status"`   // (initial|ready|waiting|running|success|error)
 | 
			
		||||
	Progress  int       `json:"progress"` // (0-100)
 | 
			
		||||
	UserID    int       `json:"user_id"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//// 推理任務
 | 
			
		||||
 
 | 
			
		||||
@@ -4,16 +4,17 @@ import (
 | 
			
		||||
	"crypto/md5"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type User struct {
 | 
			
		||||
	ID        int    `json:"id" gorm:"primary_key"`
 | 
			
		||||
	Name      string `json:"name"`
 | 
			
		||||
	Email     string `json:"email"`
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	Password  string `json:"-"`
 | 
			
		||||
	Slat      string `json:"-"`
 | 
			
		||||
	ID        int       `json:"id"`
 | 
			
		||||
	Name      string    `json:"name"`
 | 
			
		||||
	Email     string    `json:"email"`
 | 
			
		||||
	Password  string    `json:"-"`
 | 
			
		||||
	Slat      string    `json:"-"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,15 +3,16 @@ package models
 | 
			
		||||
import (
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Account struct {
 | 
			
		||||
	ID        int    `json:"id"`
 | 
			
		||||
	Name      string `json:"name"`
 | 
			
		||||
	Email     string `json:"email"`
 | 
			
		||||
	SessionID string `json:"session_id"`
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	ID        int       `json:"id"`
 | 
			
		||||
	Name      string    `json:"name"`
 | 
			
		||||
	Email     string    `json:"email"`
 | 
			
		||||
	SessionID string    `json:"session_id"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func AccountRead(w http.ResponseWriter, r *http.Request, cb func(account *Account)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,15 +2,16 @@ package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"main/configs"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Session struct {
 | 
			
		||||
	ID        string `json:"id" gorm:"primary_key"`
 | 
			
		||||
	IP        string `json:"ip"`
 | 
			
		||||
	UserID    int    `json:"user_id"`
 | 
			
		||||
	UserAgent string `json:"user_agent"`
 | 
			
		||||
	CreatedAt string `json:"created_at"`
 | 
			
		||||
	UpdatedAt string `json:"updated_at"`
 | 
			
		||||
	ID        string    `json:"id" gorm:"primary_key"`
 | 
			
		||||
	IP        string    `json:"ip"`
 | 
			
		||||
	UserID    int       `json:"user_id"`
 | 
			
		||||
	UserAgent string    `json:"user_agent"`
 | 
			
		||||
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;autoCreateTime"`
 | 
			
		||||
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user