Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -11,7 +11,7 @@ import { FileFolder } from './interfaces/file-folder.interface';
|
||||
|
||||
type AllowedFolders = KebabCase<keyof typeof FileFolder>;
|
||||
|
||||
export function checkFilePath(filePath: string): string {
|
||||
export const checkFilePath = (filePath: string): string => {
|
||||
const allowedFolders = Object.values(FileFolder).map((value) =>
|
||||
kebabCase(value),
|
||||
);
|
||||
@ -28,9 +28,9 @@ export function checkFilePath(filePath: string): string {
|
||||
}
|
||||
|
||||
return sanitizedFilePath;
|
||||
}
|
||||
};
|
||||
|
||||
export function checkFilename(filename: string) {
|
||||
export const checkFilename = (filename: string) => {
|
||||
const sanitizedFilename = basename(filename.replace(/\0/g, ''));
|
||||
|
||||
if (
|
||||
@ -43,4 +43,4 @@ export function checkFilename(filename: string) {
|
||||
}
|
||||
|
||||
return basename(sanitizedFilename);
|
||||
}
|
||||
};
|
||||
|
||||
@ -5,12 +5,12 @@
|
||||
* @param uuid
|
||||
* @returns
|
||||
*/
|
||||
export function uuidToBase36(uuid: string): string {
|
||||
export const uuidToBase36 = (uuid: string): string => {
|
||||
const hexString = uuid.replace(/-/g, '');
|
||||
const base10Number = BigInt('0x' + hexString);
|
||||
const base36String = base10Number.toString(36);
|
||||
return base36String;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sanitizes a column name by replacing all non-alphanumeric characters with an underscore.
|
||||
@ -19,9 +19,8 @@ export function uuidToBase36(uuid: string): string {
|
||||
* @param columnName
|
||||
* @returns string
|
||||
*/
|
||||
export function sanitizeColumnName(columnName: string): string {
|
||||
return columnName.replace(/[^a-zA-Z0-9]/g, '_');
|
||||
}
|
||||
export const sanitizeColumnName = (columnName: string): string =>
|
||||
columnName.replace(/[^a-zA-Z0-9]/g, '_');
|
||||
|
||||
/**
|
||||
* Converts a field type to a postgres type. Field types are defined in the UI.
|
||||
@ -29,7 +28,7 @@ export function sanitizeColumnName(columnName: string): string {
|
||||
* @param fieldType
|
||||
* @returns string
|
||||
*/
|
||||
export function convertFieldTypeToPostgresType(fieldType: string): string {
|
||||
export const convertFieldTypeToPostgresType = (fieldType: string): string => {
|
||||
switch (fieldType) {
|
||||
case 'text':
|
||||
return 'text';
|
||||
@ -44,4 +43,4 @@ export function convertFieldTypeToPostgresType(fieldType: string): string {
|
||||
default:
|
||||
return 'text';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -44,12 +44,12 @@ import { EnvironmentService } from 'src/integrations/environment/environment.ser
|
||||
|
||||
import { UserService } from './user.service';
|
||||
|
||||
function getHMACKey(email?: string, key?: string | null) {
|
||||
const getHMACKey = (email?: string, key?: string | null) => {
|
||||
if (!email || !key) return null;
|
||||
|
||||
const hmac = crypto.createHmac('sha256', key);
|
||||
return hmac.update(email).digest('hex');
|
||||
}
|
||||
};
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Resolver(() => User)
|
||||
|
||||
Reference in New Issue
Block a user