feat: 更新用户、订单、媒体资产和租户模型,添加新的字段类型和结构体

This commit is contained in:
2025-12-29 12:01:22 +08:00
parent 0d0aee87b1
commit d648a1e45b
13 changed files with 141 additions and 92 deletions

View File

@@ -8,6 +8,7 @@ import (
"context"
"time"
"quyun/v2/database/fields"
"quyun/v2/pkg/consts"
"go.ipao.vip/gen"
@@ -19,27 +20,27 @@ const TableNameUser = "users"
// User mapped from table <users>
type User struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
Username string `gorm:"column:username;type:character varying(255);not null" json:"username"`
Password string `gorm:"column:password;type:character varying(255);not null" json:"password"`
Roles types.Array[consts.Role] `gorm:"column:roles;type:text[];default:{user}" json:"roles"`
Status string `gorm:"column:status;type:character varying(50);default:active" json:"status"`
Metas types.JSON `gorm:"column:metas;type:jsonb;default:{}" json:"metas"`
Balance int64 `gorm:"column:balance;type:bigint" json:"balance"`
BalanceFrozen int64 `gorm:"column:balance_frozen;type:bigint" json:"balance_frozen"`
VerifiedAt time.Time `gorm:"column:verified_at;type:timestamp with time zone" json:"verified_at"`
Nickname string `gorm:"column:nickname;type:character varying(255)" json:"nickname"`
Avatar string `gorm:"column:avatar;type:character varying(512)" json:"avatar"`
Gender consts.Gender `gorm:"column:gender;type:character varying(32);default:secret" json:"gender"`
Bio string `gorm:"column:bio;type:character varying(512)" json:"bio"`
Birthday types.Date `gorm:"column:birthday;type:date" json:"birthday"`
Location types.JSON `gorm:"column:location;type:jsonb;default:{}" json:"location"`
Points int64 `gorm:"column:points;type:bigint" json:"points"`
Phone string `gorm:"column:phone;type:character varying(32)" json:"phone"`
IsRealNameVerified bool `gorm:"column:is_real_name_verified;type:boolean" json:"is_real_name_verified"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp with time zone" json:"deleted_at"`
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
Username string `gorm:"column:username;type:character varying(255);not null" json:"username"`
Password string `gorm:"column:password;type:character varying(255);not null" json:"password"`
Roles types.Array[consts.Role] `gorm:"column:roles;type:text[];default:{user}" json:"roles"`
Status consts.UserStatus `gorm:"column:status;type:character varying(50);default:active" json:"status"`
Metas types.JSON `gorm:"column:metas;type:jsonb;default:{}" json:"metas"`
Balance int64 `gorm:"column:balance;type:bigint" json:"balance"`
BalanceFrozen int64 `gorm:"column:balance_frozen;type:bigint" json:"balance_frozen"`
VerifiedAt time.Time `gorm:"column:verified_at;type:timestamp with time zone" json:"verified_at"`
Nickname string `gorm:"column:nickname;type:character varying(255)" json:"nickname"`
Avatar string `gorm:"column:avatar;type:character varying(512)" json:"avatar"`
Gender consts.Gender `gorm:"column:gender;type:character varying(32);default:secret" json:"gender"`
Bio string `gorm:"column:bio;type:character varying(512)" json:"bio"`
Birthday types.Date `gorm:"column:birthday;type:date" json:"birthday"`
Location types.JSONType[fields.UserLocation] `gorm:"column:location;type:jsonb;default:{}" json:"location"`
Points int64 `gorm:"column:points;type:bigint" json:"points"`
Phone string `gorm:"column:phone;type:character varying(32)" json:"phone"`
IsRealNameVerified bool `gorm:"column:is_real_name_verified;type:boolean" json:"is_real_name_verified"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp with time zone" json:"deleted_at"`
}
// Quick operations without importing query package