feat: 添加评价微服务,支持密封互评与订单状态联动

This commit is contained in:
zetaloop
2026-04-24 10:43:15 +08:00
parent 3b56910100
commit 6edf15996c
53 changed files with 7891 additions and 39 deletions
@@ -0,0 +1,42 @@
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
type Reviews struct {
ent.Schema
}
func (Reviews) Fields() []ent.Field {
return []ent.Field{
field.Int64("id").Unique().Immutable(),
field.Int64("order_id"),
field.Int64("from_user_id"),
field.String("from_user_name").MaxLen(100),
field.String("from_user_avatar").Optional().Default(""),
field.Int64("to_user_id"),
field.Int16("rating"),
field.String("content").Optional().Default(""),
field.Bool("sealed").Default(true),
field.Time("created_at").Default(time.Now).Immutable(),
field.Time("unsealed_at").Optional().Nillable(),
}
}
func (Reviews) Indexes() []ent.Index {
return []ent.Index{
index.Fields("order_id", "from_user_id").Unique(),
index.Fields("order_id"),
index.Fields("to_user_id", "created_at"),
index.Fields("from_user_id"),
}
}
func (Reviews) Edges() []ent.Edge {
return nil
}