mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-23 12:31:32 +08:00
从内部项目迁移模型配置和镜像配置模块,包括个人用户设置和团队级管理, 涵盖完整 CRUD、健康检查、供应商模型列表、所有权模型和 Swagger 注释。 - Ent schema: model, image, team_model, team_image, team_group_model, team_group_image - Domain 层: 接口、请求/响应类型、From 转换器 - Setting 模块: 个人模型/镜像 repo、usecase(代理重试、健康检查)、handler - Team 模块: 团队模型/镜像 repo、usecase、handler(TeamAuth + 审计中间件) - SQL 迁移: 000002_model_image up/down
42 lines
893 B
Go
42 lines
893 B
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/entsql"
|
|
"entgo.io/ent/schema"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// TeamModel holds the schema definition for the TeamModel entity.
|
|
type TeamModel struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (TeamModel) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{
|
|
entsql.Table("team_models"),
|
|
}
|
|
}
|
|
|
|
// Fields of the TeamModel.
|
|
func (TeamModel) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.UUID("id", uuid.UUID{}),
|
|
field.UUID("team_id", uuid.UUID{}),
|
|
field.UUID("model_id", uuid.UUID{}),
|
|
field.Time("created_at").Default(time.Now),
|
|
}
|
|
}
|
|
|
|
// Edges of the TeamModel.
|
|
func (TeamModel) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.To("team", Team.Type).Field("team_id").Unique().Required(),
|
|
edge.To("model", Model.Type).Field("model_id").Unique().Required(),
|
|
}
|
|
}
|