Files
yokowu d4aecca9db feat: 添加模型和镜像管理模块(Phase 2 迁移)
从内部项目迁移模型配置和镜像配置模块,包括个人用户设置和团队级管理,
涵盖完整 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
2026-03-16 21:11:42 +08:00

316 lines
12 KiB
Go

// Code generated by ent, DO NOT EDIT.
package team
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the team type in the database.
Label = "team"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldMemberLimit holds the string denoting the member_limit field in the database.
FieldMemberLimit = "member_limit"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// EdgeGroups holds the string denoting the groups edge name in mutations.
EdgeGroups = "groups"
// EdgeMembers holds the string denoting the members edge name in mutations.
EdgeMembers = "members"
// EdgeModels holds the string denoting the models edge name in mutations.
EdgeModels = "models"
// EdgeImages holds the string denoting the images edge name in mutations.
EdgeImages = "images"
// EdgeTeamMembers holds the string denoting the team_members edge name in mutations.
EdgeTeamMembers = "team_members"
// EdgeTeamModels holds the string denoting the team_models edge name in mutations.
EdgeTeamModels = "team_models"
// EdgeTeamImages holds the string denoting the team_images edge name in mutations.
EdgeTeamImages = "team_images"
// Table holds the table name of the team in the database.
Table = "teams"
// GroupsTable is the table that holds the groups relation/edge.
GroupsTable = "team_groups"
// GroupsInverseTable is the table name for the TeamGroup entity.
// It exists in this package in order to avoid circular dependency with the "teamgroup" package.
GroupsInverseTable = "team_groups"
// GroupsColumn is the table column denoting the groups relation/edge.
GroupsColumn = "team_id"
// MembersTable is the table that holds the members relation/edge. The primary key declared below.
MembersTable = "team_members"
// MembersInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
MembersInverseTable = "users"
// ModelsTable is the table that holds the models relation/edge. The primary key declared below.
ModelsTable = "team_models"
// ModelsInverseTable is the table name for the Model entity.
// It exists in this package in order to avoid circular dependency with the "model" package.
ModelsInverseTable = "models"
// ImagesTable is the table that holds the images relation/edge. The primary key declared below.
ImagesTable = "team_images"
// ImagesInverseTable is the table name for the Image entity.
// It exists in this package in order to avoid circular dependency with the "image" package.
ImagesInverseTable = "images"
// TeamMembersTable is the table that holds the team_members relation/edge.
TeamMembersTable = "team_members"
// TeamMembersInverseTable is the table name for the TeamMember entity.
// It exists in this package in order to avoid circular dependency with the "teammember" package.
TeamMembersInverseTable = "team_members"
// TeamMembersColumn is the table column denoting the team_members relation/edge.
TeamMembersColumn = "team_id"
// TeamModelsTable is the table that holds the team_models relation/edge.
TeamModelsTable = "team_models"
// TeamModelsInverseTable is the table name for the TeamModel entity.
// It exists in this package in order to avoid circular dependency with the "teammodel" package.
TeamModelsInverseTable = "team_models"
// TeamModelsColumn is the table column denoting the team_models relation/edge.
TeamModelsColumn = "team_id"
// TeamImagesTable is the table that holds the team_images relation/edge.
TeamImagesTable = "team_images"
// TeamImagesInverseTable is the table name for the TeamImage entity.
// It exists in this package in order to avoid circular dependency with the "teamimage" package.
TeamImagesInverseTable = "team_images"
// TeamImagesColumn is the table column denoting the team_images relation/edge.
TeamImagesColumn = "team_id"
)
// Columns holds all SQL columns for team fields.
var Columns = []string{
FieldID,
FieldDeletedAt,
FieldName,
FieldMemberLimit,
FieldCreatedAt,
FieldUpdatedAt,
}
var (
// MembersPrimaryKey and MembersColumn2 are the table columns denoting the
// primary key for the members relation (M2M).
MembersPrimaryKey = []string{"user_id", "team_id"}
// ModelsPrimaryKey and ModelsColumn2 are the table columns denoting the
// primary key for the models relation (M2M).
ModelsPrimaryKey = []string{"team_id", "model_id"}
// ImagesPrimaryKey and ImagesColumn2 are the table columns denoting the
// primary key for the images relation (M2M).
ImagesPrimaryKey = []string{"team_id", "image_id"}
)
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "github.com/chaitin/MonkeyCode/backend/db/runtime"
var (
Hooks [1]ent.Hook
Interceptors [1]ent.Interceptor
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
)
// OrderOption defines the ordering options for the Team queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByMemberLimit orders the results by the member_limit field.
func ByMemberLimit(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMemberLimit, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByGroupsCount orders the results by groups count.
func ByGroupsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newGroupsStep(), opts...)
}
}
// ByGroups orders the results by groups terms.
func ByGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByMembersCount orders the results by members count.
func ByMembersCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newMembersStep(), opts...)
}
}
// ByMembers orders the results by members terms.
func ByMembers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newMembersStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByModelsCount orders the results by models count.
func ByModelsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newModelsStep(), opts...)
}
}
// ByModels orders the results by models terms.
func ByModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newModelsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByImagesCount orders the results by images count.
func ByImagesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newImagesStep(), opts...)
}
}
// ByImages orders the results by images terms.
func ByImages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newImagesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTeamMembersCount orders the results by team_members count.
func ByTeamMembersCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTeamMembersStep(), opts...)
}
}
// ByTeamMembers orders the results by team_members terms.
func ByTeamMembers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTeamMembersStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTeamModelsCount orders the results by team_models count.
func ByTeamModelsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTeamModelsStep(), opts...)
}
}
// ByTeamModels orders the results by team_models terms.
func ByTeamModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTeamModelsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByTeamImagesCount orders the results by team_images count.
func ByTeamImagesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTeamImagesStep(), opts...)
}
}
// ByTeamImages orders the results by team_images terms.
func ByTeamImages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTeamImagesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newGroupsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GroupsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, GroupsTable, GroupsColumn),
)
}
func newMembersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(MembersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, MembersTable, MembersPrimaryKey...),
)
}
func newModelsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ModelsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, ModelsTable, ModelsPrimaryKey...),
)
}
func newImagesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ImagesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, ImagesTable, ImagesPrimaryKey...),
)
}
func newTeamMembersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TeamMembersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TeamMembersTable, TeamMembersColumn),
)
}
func newTeamModelsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TeamModelsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TeamModelsTable, TeamModelsColumn),
)
}
func newTeamImagesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TeamImagesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, TeamImagesTable, TeamImagesColumn),
)
}