修复超时订单重置流程
This commit is contained in:
@@ -8,6 +8,19 @@ import (
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
func adminActionsForOrder(order model.RentalOrder) *AdminActionsDTO {
|
||||
target, ok := resetTargetForOrder(order)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return &AdminActionsDTO{
|
||||
ResetHandoff: &AdminActionDTO{
|
||||
Enabled: true,
|
||||
Label: target.Label,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (row orderRow) toAdminDTO() OrderDTO {
|
||||
rentedAt := row.RentedAt
|
||||
durationHours := orderDurationHours(row.RentalOrder)
|
||||
@@ -43,6 +56,7 @@ func (row orderRow) toAdminDTO() OrderDTO {
|
||||
Status: row.Status,
|
||||
HandoffStatus: row.HandoffStatus,
|
||||
SettlementStatus: row.SettlementStatus,
|
||||
AdminActions: adminActionsForOrder(row.RentalOrder),
|
||||
CreatedAt: row.CreatedAt,
|
||||
UpdatedAt: row.UpdatedAt,
|
||||
}
|
||||
@@ -50,6 +64,7 @@ func (row orderRow) toAdminDTO() OrderDTO {
|
||||
|
||||
func (row orderRow) toDTOForUser(userID uint64) OrderDTO {
|
||||
dto := row.toAdminDTO()
|
||||
dto.AdminActions = nil
|
||||
applyOrderPriceView(&dto, row.RentalOrder, userID)
|
||||
return dto
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user