🚧 Refactor basic services

This commit is contained in:
2025-12-14 02:19:50 +08:00
parent d16905c0a3
commit cc4c2189dc
126 changed files with 18164 additions and 4247 deletions

View File

@@ -0,0 +1,54 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
)
// Theme holds the schema definition for the Theme entity.
type Theme struct {
ent.Schema
}
// Annotations of the Theme.
func (Theme) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "themes"},
}
}
// Mixin of the Theme.
func (Theme) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.Time{},
}
}
// Fields of the Theme.
func (Theme) Fields() []ent.Field {
return []ent.Field{
field.String("key").
MaxLen(100).
NotEmpty().
Unique().
Comment("主题标识符"),
field.Enum("type").
Values("dark", "light").
Comment("主题类型"),
field.JSON("colors", map[string]interface{}{}).
Optional().
Comment("主题颜色配置"),
field.Time("deleted_at").
Optional().
Nillable().
Comment("软删除时间"),
}
}
// Edges of the Theme.
func (Theme) Edges() []ent.Edge {
return nil
}