diff --git a/packages/nocodb-nest/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb-nest/src/db/formulav2/formulaQueryBuilderv2.ts index 6953c880bb..11a8d6939c 100644 --- a/packages/nocodb-nest/src/db/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb-nest/src/db/formulav2/formulaQueryBuilderv2.ts @@ -3,7 +3,10 @@ import { jsepCurlyHook, UITypes } from 'nocodb-sdk'; import mapFunctionName from '../mapFunctionName'; import genRollupSelectv2 from '../genRollupSelectv2'; import FormulaColumn from '../../models/FormulaColumn'; -import { convertDateFormatForConcat, validateDateWithUnknownFormat } from '../../helpers/formulaFnHelper'; +import { + convertDateFormatForConcat, + validateDateWithUnknownFormat, +} from '../../helpers/formulaFnHelper'; import { CacheGetType, CacheScope } from '../../utils/globals'; import NocoCache from '../../cache/NocoCache'; import type { XKnex } from '../CustomKnex'; @@ -640,7 +643,7 @@ async function _formulaQueryBuilder( arg, columnIdToUidt, query, - knex.clientType() + knex.clientType(), ); } else { // sqlite3: special handling - See BinaryExpression @@ -657,9 +660,9 @@ async function _formulaQueryBuilder( } } return query; - }) + }), ) - ).join()})${colAlias}`.replace(/\?/g, '\\?') + ).join()})${colAlias}`.replace(/\?/g, '\\?'), ), }; } else if (pt.type === 'Literal') { @@ -741,13 +744,13 @@ async function _formulaQueryBuilder( pt.left?.arguments?.[0], columnIdToUidt, left, - knex.clientType() + knex.clientType(), ); right = await convertDateFormatForConcat( pt.right?.arguments?.[0], columnIdToUidt, right, - knex.clientType() + knex.clientType(), ); // handle NULL values when calling CONCAT for sqlite3 diff --git a/packages/nocodb-nest/src/db/functionMappings/pg.ts b/packages/nocodb-nest/src/db/functionMappings/pg.ts index b6897f0265..353d15b542 100644 --- a/packages/nocodb-nest/src/db/functionMappings/pg.ts +++ b/packages/nocodb-nest/src/db/functionMappings/pg.ts @@ -16,10 +16,10 @@ const pg = { return { builder: args.knex.raw( `POSITION(${args.knex.raw( - (await args.fn(args.pt.arguments[1])).builder.toQuery() + (await args.fn(args.pt.arguments[1])).builder.toQuery(), )} in ${args.knex.raw( - (await args.fn(args.pt.arguments[0])).builder.toQuery() - )})${args.colAlias}` + (await args.fn(args.pt.arguments[0])).builder.toQuery(), + )})${args.colAlias}`, ), }; }, @@ -160,13 +160,13 @@ const pg = { `${( await Promise.all( args.pt.arguments.map(async (ar) => - (await args.fn(ar, '', 'OR')).builder.toQuery() - ) + (await args.fn(ar, '', 'OR')).builder.toQuery(), + ), ) - ).join(' OR ')}` + ).join(' OR ')}`, ) .wrap('(', ')') - .toQuery()} THEN TRUE ELSE FALSE END ${args.colAlias}` + .toQuery()} THEN TRUE ELSE FALSE END ${args.colAlias}`, ), }; }, diff --git a/packages/nocodb-nest/src/helpers/convertDateFormat.ts b/packages/nocodb-nest/src/helpers/convertDateFormat.ts index 4b3d681a5c..97057840f3 100644 --- a/packages/nocodb-nest/src/helpers/convertDateFormat.ts +++ b/packages/nocodb-nest/src/helpers/convertDateFormat.ts @@ -1,23 +1,23 @@ export function convertDateFormat(date_format: string, type: string) { - if (date_format === 'YYYY-MM-DD') { - if (type === 'mysql2' || type === 'sqlite3') return '%Y-%m-%d'; - } else if (date_format === 'YYYY/MM/DD') { - if (type === 'mysql2' || type === 'sqlite3') return '%Y/%m/%d'; - } else if (date_format === 'DD-MM-YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%d/%m/%Y'; - } else if (date_format === 'MM-DD-YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%d-%m-%Y'; - } else if (date_format === 'DD/MM/YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%d/%m/%Y'; - } else if (date_format === 'MM/DD/YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%m-%d-%Y'; - } else if (date_format === 'DD MM YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%d %m %Y'; - } else if (date_format === 'MM DD YYYY') { - if (type === 'mysql2' || type === 'sqlite3') return '%m %d %Y'; - } else if (date_format === 'YYYY MM DD') { - if (type === 'mysql2' || type === 'sqlite3') return '%Y %m %d'; - } - // pg / mssql - return date_format; - } \ No newline at end of file + if (date_format === 'YYYY-MM-DD') { + if (type === 'mysql2' || type === 'sqlite3') return '%Y-%m-%d'; + } else if (date_format === 'YYYY/MM/DD') { + if (type === 'mysql2' || type === 'sqlite3') return '%Y/%m/%d'; + } else if (date_format === 'DD-MM-YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%d/%m/%Y'; + } else if (date_format === 'MM-DD-YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%d-%m-%Y'; + } else if (date_format === 'DD/MM/YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%d/%m/%Y'; + } else if (date_format === 'MM/DD/YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%m-%d-%Y'; + } else if (date_format === 'DD MM YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%d %m %Y'; + } else if (date_format === 'MM DD YYYY') { + if (type === 'mysql2' || type === 'sqlite3') return '%m %d %Y'; + } else if (date_format === 'YYYY MM DD') { + if (type === 'mysql2' || type === 'sqlite3') return '%Y %m %d'; + } + // pg / mssql + return date_format; +} diff --git a/packages/nocodb-nest/src/helpers/formulaFnHelper.ts b/packages/nocodb-nest/src/helpers/formulaFnHelper.ts index d03068361e..39e2dda6df 100644 --- a/packages/nocodb-nest/src/helpers/formulaFnHelper.ts +++ b/packages/nocodb-nest/src/helpers/formulaFnHelper.ts @@ -60,7 +60,7 @@ export async function convertDateFormatForConcat( o, columnIdToUidt, query, - clientType + clientType, ) { if ( o?.type === 'Identifier' && @@ -76,24 +76,24 @@ export async function convertDateFormatForConcat( if (clientType === 'mysql2') { query = `DATE_FORMAT(${query}, '${convertDateFormat( meta.date_format, - clientType + clientType, )}')`; } else if (clientType === 'pg') { query = `TO_CHAR(${query}, '${convertDateFormat( meta.date_format, - clientType + clientType, )}')`; } else if (clientType === 'sqlite3') { query = `strftime('${convertDateFormat( meta.date_format, - clientType + clientType, )}', ${query})`; } else if (clientType === 'mssql') { query = `FORMAT(${query}, '${convertDateFormat( meta.date_format, - clientType + clientType, )}')`; } } return query; -} \ No newline at end of file +} diff --git a/packages/nocodb-nest/src/modules/project-users/project-users.service.ts b/packages/nocodb-nest/src/modules/project-users/project-users.service.ts index 670f03a1f6..069be8c982 100644 --- a/packages/nocodb-nest/src/modules/project-users/project-users.service.ts +++ b/packages/nocodb-nest/src/modules/project-users/project-users.service.ts @@ -1,5 +1,10 @@ import { Injectable } from '@nestjs/common'; -import { AuditOperationSubTypes, AuditOperationTypes, OrgUserRoles, PluginCategory } from 'nocodb-sdk' +import { + AuditOperationSubTypes, + AuditOperationTypes, + OrgUserRoles, + PluginCategory, +} from 'nocodb-sdk'; import { T } from 'nc-help'; import { v4 as uuidv4 } from 'uuid'; import * as ejs from 'ejs'; @@ -283,7 +288,7 @@ export class ProjectUsersService { await Audit.insert({ op_type: AuditOperationTypes.AUTHENTICATION, - op_sub_type: AuditOperationSubTypes.RESEND_INVITE , + op_sub_type: AuditOperationSubTypes.RESEND_INVITE, user: user.email, description: `resent a invite to ${user.email} `, ip: param.req.clientIp, diff --git a/packages/nocodb-nest/src/modules/tables/tables.service.ts b/packages/nocodb-nest/src/modules/tables/tables.service.ts index 92df3849eb..ee1977f6c4 100644 --- a/packages/nocodb-nest/src/modules/tables/tables.service.ts +++ b/packages/nocodb-nest/src/modules/tables/tables.service.ts @@ -1,4 +1,3 @@ - import { Injectable } from '@nestjs/common'; import DOMPurify from 'isomorphic-dompurify'; import { diff --git a/packages/nocodb-nest/src/modules/users/users.service.ts b/packages/nocodb-nest/src/modules/users/users.service.ts index b9641a5c7b..9f9f3c18af 100644 --- a/packages/nocodb-nest/src/modules/users/users.service.ts +++ b/packages/nocodb-nest/src/modules/users/users.service.ts @@ -1,6 +1,11 @@ import { promisify } from 'util'; import { Injectable } from '@nestjs/common'; -import { AuditOperationSubTypes, AuditOperationTypes, OrgUserRoles, validatePassword } from 'nocodb-sdk' +import { + AuditOperationSubTypes, + AuditOperationTypes, + OrgUserRoles, + validatePassword, +} from 'nocodb-sdk'; import { v4 as uuidv4 } from 'uuid'; import { isEmail } from 'validator'; import { T } from 'nc-help'; diff --git a/packages/nocodb-nest/src/plugins/vultr/index.ts b/packages/nocodb-nest/src/plugins/vultr/index.ts index b95e2bd607..773841132b 100644 --- a/packages/nocodb-nest/src/plugins/vultr/index.ts +++ b/packages/nocodb-nest/src/plugins/vultr/index.ts @@ -25,7 +25,7 @@ const config: XcPluginConfig = { label: 'Host Name', placeholder: 'e.g.: ewr1.vultrobjects.com', type: XcType.SingleLineText, - required: true + required: true, }, { key: 'access_key',