| package model |
|
|
| import ( |
| "time" |
| ) |
|
|
| |
| type TokenRecord struct { |
| ID uint `json:"id" gorm:"primaryKey"` |
| Token string `json:"token" gorm:"type:text"` |
| RefreshToken string `json:"refresh_token" gorm:"type:text"` |
| TokenExpiry time.Time `json:"token_expiry"` |
| Description string `json:"description"` |
| Email string `json:"email"` |
| PlanType string `json:"plan_type"` |
| SubscriptionStartDate time.Time `json:"subscription_start_date"` |
| GeneratedCount int `json:"generated_count" gorm:"default:0"` |
| LastGeneratedAt time.Time `json:"last_generated_at"` |
| AutoGenerate bool `json:"auto_generate" gorm:"default:true"` |
| Threshold int `json:"threshold" gorm:"default:10"` |
| GenerateBatch int `json:"generate_batch" gorm:"default:30"` |
| IsActive bool `json:"is_active" gorm:"default:true"` |
| Status string `json:"status" gorm:"default:'active'"` |
| BanReason string `json:"ban_reason"` |
| HasRefreshToken bool `json:"has_refresh_token" gorm:"default:false"` |
| TotalSuccess int `json:"total_success" gorm:"default:0"` |
| TotalFail int `json:"total_fail" gorm:"default:0"` |
| TotalTasks int `json:"total_tasks" gorm:"default:0"` |
| RunningTasks int `json:"running_tasks" gorm:"-"` |
| CreatedAt time.Time `json:"created_at"` |
| UpdatedAt time.Time `json:"updated_at"` |
| } |
|
|
| |
| type GenerationTask struct { |
| ID uint `json:"id" gorm:"primaryKey"` |
| TokenRecordID uint `json:"token_record_id" gorm:"index;not null"` |
| Token string `json:"-" gorm:"type:text"` |
| BatchSize int `json:"batch_size"` |
| SuccessCount int `json:"success_count" gorm:"default:0"` |
| FailCount int `json:"fail_count" gorm:"default:0"` |
| Status string `json:"status" gorm:"default:'pending'"` |
| StartedAt time.Time `json:"started_at"` |
| CompletedAt time.Time `json:"completed_at"` |
| ErrorMessage string `json:"error_message"` |
| CreatedAt time.Time `json:"created_at"` |
| UpdatedAt time.Time `json:"updated_at"` |
| } |