fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean
This commit is contained in:
+11
-12
@@ -11,38 +11,37 @@ import (
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Role 角色,RBAC权限体系中的角色定义
|
||||
// Role holds the schema definition for the Role entity.
|
||||
type Role struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Role) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "role",
|
||||
Options: "COMMENT='角色表,RBAC权限体系中的角色定义,关联用户和权限资源'",
|
||||
},
|
||||
entsql.Annotation{Table: "role"},
|
||||
entsql.WithComments(true),
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the Role.
|
||||
func (Role) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive().Comment("主键ID"),
|
||||
field.String("name").MaxLen(20).NotEmpty().Unique().Comment("角色名,如 管理员/操作员/质检员,不超过20个字符"),
|
||||
field.Int("id").Positive(),
|
||||
field.String("name").MaxLen(20).NotEmpty().Unique().Comment("角色名, 不能超过20个字符"),
|
||||
field.String("description").SchemaType(
|
||||
map[string]string{
|
||||
dialect.MySQL: "text",
|
||||
dialect.Postgres: "varchar",
|
||||
}).MaxLen(60).Optional().Comment("角色描述,说明角色职责,不超过60个字符"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable().Comment("创建时间"),
|
||||
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Comment("更新时间"),
|
||||
}).MaxLen(60).Optional().Comment("描述, 不能超过60个字符"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable().Comment("创建时间"), // 创建时间
|
||||
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Comment("更新时间"), // 更新时间
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Role.
|
||||
func (Role) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("users", User.Type).Comment("拥有该角色的用户列表"),
|
||||
edge.To("permissions", Permission.Type).Comment("角色拥有的权限列表"),
|
||||
edge.To("users", User.Type),
|
||||
edge.To("permissions", Permission.Type),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user