chore: 更新依赖、配置和代码生成

主要更新:
- 更新 go.mod/go.sum 依赖
- 重新生成 Ent ORM 代码
- 更新 Wire 依赖注入配置
- 添加 docker-compose.override.yml 到 .gitignore
- 更新 README 文档(Simple Mode 说明和已知问题)
- 清理调试日志
- 其他代码优化和格式修复
This commit is contained in:
ianshaw
2026-01-03 06:37:08 -08:00
parent b1702de522
commit 112a2d0866
121 changed files with 3058 additions and 2948 deletions

View File

@@ -12,25 +12,25 @@ import (
"entgo.io/ent/schema/index"
)
// APIKey holds the schema definition for the APIKey entity.
type APIKey struct {
// ApiKey holds the schema definition for the ApiKey entity.
type ApiKey struct {
ent.Schema
}
func (APIKey) Annotations() []schema.Annotation {
func (ApiKey) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "api_keys"},
}
}
func (APIKey) Mixin() []ent.Mixin {
func (ApiKey) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
mixins.SoftDeleteMixin{},
}
}
func (APIKey) Fields() []ent.Field {
func (ApiKey) Fields() []ent.Field {
return []ent.Field{
field.Int64("user_id"),
field.String("key").
@@ -49,7 +49,7 @@ func (APIKey) Fields() []ent.Field {
}
}
func (APIKey) Edges() []ent.Edge {
func (ApiKey) Edges() []ent.Edge {
return []ent.Edge{
edge.From("user", User.Type).
Ref("api_keys").
@@ -64,7 +64,7 @@ func (APIKey) Edges() []ent.Edge {
}
}
func (APIKey) Indexes() []ent.Index {
func (ApiKey) Indexes() []ent.Index {
return []ent.Index{
// key 字段已在 Fields() 中声明 Unique(),无需重复索引
index.Fields("user_id"),

View File

@@ -77,7 +77,7 @@ func (Group) Fields() []ent.Field {
func (Group) Edges() []ent.Edge {
return []ent.Edge{
edge.To("api_keys", APIKey.Type),
edge.To("api_keys", ApiKey.Type),
edge.To("redeem_codes", RedeemCode.Type),
edge.To("subscriptions", UserSubscription.Type),
edge.To("usage_logs", UsageLog.Type),

View File

@@ -113,7 +113,7 @@ func (UsageLog) Edges() []ent.Edge {
Field("user_id").
Required().
Unique(),
edge.From("api_key", APIKey.Type).
edge.From("api_key", ApiKey.Type).
Ref("usage_logs").
Field("api_key_id").
Required().

View File

@@ -66,7 +66,7 @@ func (User) Fields() []ent.Field {
func (User) Edges() []ent.Edge {
return []ent.Edge{
edge.To("api_keys", APIKey.Type),
edge.To("api_keys", ApiKey.Type),
edge.To("redeem_codes", RedeemCode.Type),
edge.To("subscriptions", UserSubscription.Type),
edge.To("assigned_subscriptions", UserSubscription.Type),