dashpresshq/dashpress

View on GitHub
src/backend/lib/request/validations/implementations/entity-id.ts

Summary

Maintainability
A
0 mins
Test Coverage
B
84%
import type { ValidationImplType } from "./types";

export const entityIdFilterValidationImpl: ValidationImplType<string> = async (
  req
) => {
  // This needs to go through some validation, uuid, integer,
  const value = req.query.id;

  if (Array.isArray(value)) {
    return value[0];
  }
  return value;
};