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.
This commit is contained in:
2025-11-07 09:03:43 +01:00
parent 42b53b56cc
commit 97c3b76697
14 changed files with 553 additions and 9 deletions

View File

@@ -1,6 +1,12 @@
package schema
import "entgo.io/ent"
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Role holds the schema definition for the Role entity.
type Role struct {
@@ -9,10 +15,25 @@ type Role struct {
// Fields of the Role.
func (Role) Fields() []ent.Field {
return nil
return []ent.Field{
field.String("id").
Unique().
Immutable(),
field.String("name").
Unique().
NotEmpty(),
field.String("description").
Optional(),
field.Time("created_at").
Default(time.Now).
Immutable(),
}
}
// Edges of the Role.
func (Role) Edges() []ent.Edge {
return nil
return []ent.Edge{
edge.To("role_permissions", RolePermission.Type),
edge.To("user_roles", UserRole.Type),
}
}