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,134 @@
// Code generated by ent, DO NOT EDIT.
package reviews
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the reviews type in the database.
Label = "reviews"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldOrderID holds the string denoting the order_id field in the database.
FieldOrderID = "order_id"
// FieldFromUserID holds the string denoting the from_user_id field in the database.
FieldFromUserID = "from_user_id"
// FieldFromUserName holds the string denoting the from_user_name field in the database.
FieldFromUserName = "from_user_name"
// FieldFromUserAvatar holds the string denoting the from_user_avatar field in the database.
FieldFromUserAvatar = "from_user_avatar"
// FieldToUserID holds the string denoting the to_user_id field in the database.
FieldToUserID = "to_user_id"
// FieldRating holds the string denoting the rating field in the database.
FieldRating = "rating"
// FieldContent holds the string denoting the content field in the database.
FieldContent = "content"
// FieldSealed holds the string denoting the sealed field in the database.
FieldSealed = "sealed"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUnsealedAt holds the string denoting the unsealed_at field in the database.
FieldUnsealedAt = "unsealed_at"
// Table holds the table name of the reviews in the database.
Table = "reviews"
)
// Columns holds all SQL columns for reviews fields.
var Columns = []string{
FieldID,
FieldOrderID,
FieldFromUserID,
FieldFromUserName,
FieldFromUserAvatar,
FieldToUserID,
FieldRating,
FieldContent,
FieldSealed,
FieldCreatedAt,
FieldUnsealedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// FromUserNameValidator is a validator for the "from_user_name" field. It is called by the builders before save.
FromUserNameValidator func(string) error
// DefaultFromUserAvatar holds the default value on creation for the "from_user_avatar" field.
DefaultFromUserAvatar string
// DefaultContent holds the default value on creation for the "content" field.
DefaultContent string
// DefaultSealed holds the default value on creation for the "sealed" field.
DefaultSealed bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the Reviews queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByOrderID orders the results by the order_id field.
func ByOrderID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrderID, opts...).ToFunc()
}
// ByFromUserID orders the results by the from_user_id field.
func ByFromUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFromUserID, opts...).ToFunc()
}
// ByFromUserName orders the results by the from_user_name field.
func ByFromUserName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFromUserName, opts...).ToFunc()
}
// ByFromUserAvatar orders the results by the from_user_avatar field.
func ByFromUserAvatar(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFromUserAvatar, opts...).ToFunc()
}
// ByToUserID orders the results by the to_user_id field.
func ByToUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldToUserID, opts...).ToFunc()
}
// ByRating orders the results by the rating field.
func ByRating(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRating, opts...).ToFunc()
}
// ByContent orders the results by the content field.
func ByContent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldContent, opts...).ToFunc()
}
// BySealed orders the results by the sealed field.
func BySealed(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSealed, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUnsealedAt orders the results by the unsealed_at field.
func ByUnsealedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUnsealedAt, opts...).ToFunc()
}