优化申诉仲裁流程和证据展示
This commit is contained in:
@@ -11,6 +11,7 @@ var (
|
||||
ErrInvalidDispute = errors.New("invalid dispute")
|
||||
ErrDisputeExists = errors.New("dispute already exists")
|
||||
ErrDisputeCannotHandle = errors.New("dispute cannot handle")
|
||||
ErrDisputeCannotCancel = errors.New("dispute cannot cancel")
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
@@ -45,6 +46,26 @@ func (s *Service) FindForUser(ctx context.Context, userID uint64, id uint64) (*D
|
||||
return s.repo.FindForUser(ctx, userID, id)
|
||||
}
|
||||
|
||||
func (s *Service) Cancel(ctx context.Context, userID uint64, id uint64) (*DisputeDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
if id == 0 {
|
||||
return nil, ErrInvalidDispute
|
||||
}
|
||||
return s.repo.Cancel(ctx, userID, id)
|
||||
}
|
||||
|
||||
func (s *Service) CancelByOrder(ctx context.Context, userID uint64, orderID uint64) (*DisputeDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
if orderID == 0 {
|
||||
return nil, ErrInvalidDispute
|
||||
}
|
||||
return s.repo.CancelByOrder(ctx, userID, orderID)
|
||||
}
|
||||
|
||||
func (s *Service) ListAdmin(ctx context.Context, page, pageSize int) (*PaginatedResult, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
|
||||
Reference in New Issue
Block a user