Files
goplt/ent/schema/user_role.go
0x1d 97c3b76697 Restore complete Ent schema files
The schemas were incomplete (empty stubs). Restored complete schemas
from git history including refresh_token and user_role schemas, and
proper field definitions for auditlog and user entities.
2025-11-07 09:03:43 +01:00

35 lines
625 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// UserRole holds the schema definition for the UserRole entity (many-to-many relationship).
type UserRole struct {
ent.Schema
}
// Fields of the UserRole.
func (UserRole) Fields() []ent.Field {
return []ent.Field{
field.String("user_id"),
field.String("role_id"),
}
}
// Edges of the UserRole.
func (UserRole) Edges() []ent.Edge {
return []ent.Edge{
edge.To("user", User.Type).
Unique().
Required().
Field("user_id"),
edge.To("role", Role.Type).
Unique().
Required().
Field("role_id"),
}
}