47 lines
993 B
Go
47 lines
993 B
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/entsql"
|
|
"entgo.io/ent/schema"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
)
|
|
|
|
type DisputeTimeline struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (DisputeTimeline) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{
|
|
entsql.Table("dispute_timeline"),
|
|
}
|
|
}
|
|
|
|
func (DisputeTimeline) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int64("id").Unique().Immutable(),
|
|
field.Int64("dispute_id"),
|
|
field.String("event_type").MaxLen(30),
|
|
field.Int64("actor_id").Optional(),
|
|
field.String("actor_name").MaxLen(100).Optional(),
|
|
field.JSON("details", map[string]any{}).
|
|
SchemaType(map[string]string{dialect.Postgres: "jsonb"}).
|
|
Optional(),
|
|
field.Time("created_at").Default(time.Now).Immutable(),
|
|
}
|
|
}
|
|
|
|
func (DisputeTimeline) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("dispute_id", "created_at"),
|
|
}
|
|
}
|
|
|
|
func (DisputeTimeline) Edges() []ent.Edge {
|
|
return nil
|
|
}
|