feat(schema): restore complete Ent schema files
This commit is contained in:
34
ent/schema/role_permission.go
Normal file
34
ent/schema/role_permission.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// RolePermission holds the schema definition for the RolePermission entity (many-to-many relationship).
|
||||
type RolePermission struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the RolePermission.
|
||||
func (RolePermission) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("role_id"),
|
||||
field.String("permission_id"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the RolePermission.
|
||||
func (RolePermission) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("role", Role.Type).
|
||||
Unique().
|
||||
Required().
|
||||
Field("role_id"),
|
||||
edge.To("permission", Permission.Type).
|
||||
Unique().
|
||||
Required().
|
||||
Field("permission_id"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user