validateDto function

Object validateDto(
  1. Object dto
)

! throw BadRequest exception

Implementation

Object validateDto(Object dto) {
  /// build dto from the request body
  final _dto = dto;

  /// validate the dto
  final errs = palace_validators.validateDto(_dto);

  /// in case of any failure throw exception
  if (errs.isNotEmpty) {
    throw BadRequest(data: errs);
  }

  /// else every thing is fine return the dto
  return _dto;
}