Add validation to mailman service

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-03-13 15:28:10 +01:00
parent 7ed9c6c2e6
commit dc8e6d0817
5 changed files with 137 additions and 25 deletions

View File

@@ -170,6 +170,14 @@ func Invalidf(ctx context.Context, format string, a ...any) *gqlerror.Error {
return Invalid(ctx, fmt.Errorf(format, a...))
}
func InvalidValidationErrors(ctx context.Context, errs validator.ValidationErrors) gqlerror.List {
gqlErrors := make(gqlerror.List, 0, len(errs))
for _, ve := range errs {
gqlErrors = append(gqlErrors, Invalid(ctx, ve))
}
return gqlErrors
}
func Internal(ctx context.Context) *gqlerror.Error {
return &gqlerror.Error{
Message: "An internal server error occurred. Please try again later.",