Fix assert unreachable, remove unused variables (#13753)
Small code cleanup
This commit is contained in:
+12
-12
@@ -24,7 +24,7 @@ export type FieldMetadataDefaultValueFunctionNames =
|
||||
(typeof fieldMetadataDefaultValueFunctionName)[keyof typeof fieldMetadataDefaultValueFunctionName];
|
||||
|
||||
export class FieldMetadataDefaultValueString {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
value: string | null;
|
||||
}
|
||||
@@ -36,11 +36,11 @@ export class FieldMetadataDefaultValueRawJson {
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueRichTextV2 {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
blocknote: string | null;
|
||||
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
markdown: string | null;
|
||||
}
|
||||
@@ -52,52 +52,52 @@ export class FieldMetadataDefaultValueRichText {
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueNumber {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsNumber()
|
||||
value: number | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueBoolean {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsBoolean()
|
||||
value: boolean | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueStringArray {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsArray()
|
||||
@IsQuotedString({ each: true })
|
||||
value: string[] | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueDateTime {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsDate()
|
||||
value: Date | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueDate {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsDate()
|
||||
value: Date | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueCurrency {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsNumberString()
|
||||
amountMicros: string | null;
|
||||
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
currencyCode: string | null;
|
||||
}
|
||||
|
||||
export class FieldMetadataDefaultValueFullName {
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
firstName: string | null;
|
||||
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
@ValidateIf((_object, value) => value !== null)
|
||||
@IsQuotedString()
|
||||
lastName: string | null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,3 +1,5 @@
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
import {
|
||||
ConflictError,
|
||||
ForbiddenError,
|
||||
@@ -33,9 +35,7 @@ export const fieldMetadataGraphqlApiExceptionHandler = (error: Error) => {
|
||||
case FieldMetadataExceptionCode.LABEL_IDENTIFIER_FIELD_METADATA_ID_NOT_FOUND:
|
||||
throw error;
|
||||
default: {
|
||||
const _exhaustiveCheck: never = error.code;
|
||||
|
||||
throw error;
|
||||
return assertUnreachable(error.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user