PR comment followups (isNonEmptyString and rename WorkflowExecutionResult) (#13706)

Addressing two comments from Thomas and Charles
This commit is contained in:
Félix Malfait
2025-08-06 22:09:30 +02:00
committed by GitHub
parent eab72d8e67
commit 453a6167a5
8 changed files with 25 additions and 22 deletions
@@ -1,6 +1,7 @@
import { HttpService } from '@nestjs/axios';
import { Injectable } from '@nestjs/common';
import { isNonEmptyString } from '@sniptt/guards';
import { isDefined } from 'twenty-shared/utils';
import {
@@ -37,13 +38,13 @@ export class GeoMapService {
country?: string,
isFieldCity?: boolean,
): Promise<AutocompleteSanitizedResult[] | undefined> {
if (!isDefined(address) || address.trim().length === 0) {
if (!isNonEmptyString(address?.trim())) {
return [];
}
let url = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${encodeURIComponent(address)}&sessiontoken=${token}&key=${this.apiMapKey}`;
if (isDefined(country) && country !== '') {
if (isNonEmptyString(country)) {
url += `&components=country:${country}`;
}
if (isDefined(isFieldCity) && isFieldCity === true) {
@@ -1,7 +1,8 @@
import { isNonEmptyString } from '@sniptt/guards';
import { ValidateIf, ValidationOptions, isDefined } from 'class-validator';
export function IsOptionalOrEmptyString(validationOptions?: ValidationOptions) {
return ValidateIf((_obj, value) => {
return isDefined(value) && value !== '';
return isDefined(value) && isNonEmptyString(value);
}, validationOptions);
}