feat(schema): restore complete Ent schema files
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package schema
|
||||
|
||||
import "entgo.io/ent"
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Permission holds the schema definition for the Permission entity.
|
||||
type Permission struct {
|
||||
@@ -9,10 +13,20 @@ type Permission struct {
|
||||
|
||||
// Fields of the Permission.
|
||||
func (Permission) Fields() []ent.Field {
|
||||
return nil
|
||||
return []ent.Field{
|
||||
field.String("id").
|
||||
Unique().
|
||||
Immutable(),
|
||||
field.String("name").
|
||||
Unique().
|
||||
NotEmpty().
|
||||
Comment("Format: module.resource.action"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Permission.
|
||||
func (Permission) Edges() []ent.Edge {
|
||||
return nil
|
||||
return []ent.Edge{
|
||||
edge.To("role_permissions", RolePermission.Type),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user