diff --git a/packages/nocodb/src/lib/controllers/auditController.ts b/packages/nocodb/src/lib/controllers/auditController.ts index 366fc70529..73ab7dafa4 100644 --- a/packages/nocodb/src/lib/controllers/auditController.ts +++ b/packages/nocodb/src/lib/controllers/auditController.ts @@ -9,9 +9,7 @@ export async function commentRow(req: Request, res) { await auditService.commentRow({ rowId: req.params.rowId, user: (req as any).user, - body: { - ...req.body, - }, + body: req.body, }) ); } @@ -20,9 +18,7 @@ export async function auditRowUpdate(req: Request, res) { res.json( await auditService.auditRowUpdate({ rowId: req.params.rowId, - body: { - ...req.body, - }, + body: req.body, }) ); } diff --git a/packages/nocodb/src/lib/controllers/dataControllers/bulkDataAliasController.ts b/packages/nocodb/src/lib/controllers/dataControllers/bulkDataAliasController.ts index 968ab16165..7aa016ef2e 100644 --- a/packages/nocodb/src/lib/controllers/dataControllers/bulkDataAliasController.ts +++ b/packages/nocodb/src/lib/controllers/dataControllers/bulkDataAliasController.ts @@ -1,10 +1,8 @@ import { Request, Response, Router } from 'express'; -import { bulkDataService } from '../../services' +import { bulkDataService } from '../../services'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import apiMetrics from '../../meta/helpers/apiMetrics'; - - async function bulkDataInsert(req: Request, res: Response) { res.json( await bulkDataService.bulkDataInsert({ @@ -63,7 +61,6 @@ async function bulkDataDeleteAll(req: Request, res: Response) { ); } - const router = Router({ mergeParams: true }); router.post( diff --git a/packages/nocodb/src/lib/controllers/dataControllers/dataAliasController.ts b/packages/nocodb/src/lib/controllers/dataControllers/dataAliasController.ts index cfa35fafe6..b5eda23c74 100644 --- a/packages/nocodb/src/lib/controllers/dataControllers/dataAliasController.ts +++ b/packages/nocodb/src/lib/controllers/dataControllers/dataAliasController.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from 'express'; -import { dataService } from '../../services' +import { dataService } from '../../services'; import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw'; import apiMetrics from '../../meta/helpers/apiMetrics'; import { parseHrtimeToSeconds } from '../../meta/api/helpers'; diff --git a/packages/nocodb/src/lib/controllers/dataControllers/dataAliasExportController.ts b/packages/nocodb/src/lib/controllers/dataControllers/dataAliasExportController.ts index d67f58f028..0b85b87801 100644 --- a/packages/nocodb/src/lib/controllers/dataControllers/dataAliasExportController.ts +++ b/packages/nocodb/src/lib/controllers/dataControllers/dataAliasExportController.ts @@ -7,7 +7,7 @@ import { extractCsvData, extractXlsxData, } from '../../services/dataService/helpers'; -import { getViewAndModelFromRequestByAliasOrId } from './helpers' +import { getViewAndModelFromRequestByAliasOrId } from './helpers'; async function excelDataExport(req: Request, res: Response) { const { model, view } = await getViewAndModelFromRequestByAliasOrId(req); diff --git a/packages/nocodb/src/lib/controllers/userController/userApis.ts b/packages/nocodb/src/lib/controllers/userController/userApis.ts index 574862e25a..70d17b40ef 100644 --- a/packages/nocodb/src/lib/controllers/userController/userApis.ts +++ b/packages/nocodb/src/lib/controllers/userController/userApis.ts @@ -137,13 +137,13 @@ export async function signup(req: Request, res: Response) { } async function successfulSignIn({ - user, - err, - info, - req, - res, - auditDescription, - }) { + user, + err, + info, + req, + res, + auditDescription, +}) { try { if (!user || !user.email) { if (err) { diff --git a/packages/nocodb/src/lib/meta/api/index.ts b/packages/nocodb/src/lib/meta/api/index.ts index 6b9176188a..a785e5ad77 100644 --- a/packages/nocodb/src/lib/meta/api/index.ts +++ b/packages/nocodb/src/lib/meta/api/index.ts @@ -1,4 +1,4 @@ -import { Tele } from 'nc-help'; +import { T } from 'nc-help'; import orgLicenseController from '../../controllers/orgLicenseController'; import orgTokenController from '../../controllers/orgTokenController'; import orgUserController from '../../controllers/orgUserController'; @@ -133,15 +133,15 @@ export default function (router: Router, server) { }).on('connection', (socket) => { clients[socket.id] = socket; const id = getHash( - (process.env.NC_SERVER_UUID || Tele.id) + + (process.env.NC_SERVER_UUID || T.id) + (socket?.handshake as any)?.user?.id ); socket.on('page', (args) => { - Tele.page({ ...args, id }); + T.page({ ...args, id }); }); socket.on('event', (args) => { - Tele.event({ ...args, id }); + T.event({ ...args, id }); }); socket.on('subscribe', (room) => { if (room in jobs) { diff --git a/packages/nocodb/src/lib/services/attachmentService.ts b/packages/nocodb/src/lib/services/attachmentService.ts index 1d1fc25f02..d65134e75b 100644 --- a/packages/nocodb/src/lib/services/attachmentService.ts +++ b/packages/nocodb/src/lib/services/attachmentService.ts @@ -1,8 +1,3 @@ - - - -// @ts-ignore -import { Request, Response, Router } from 'express'; import { nanoid } from 'nanoid'; import path from 'path'; import slash from 'slash'; diff --git a/packages/nocodb/src/lib/services/auditService.ts b/packages/nocodb/src/lib/services/auditService.ts index f5f2724ba3..886934cc84 100644 --- a/packages/nocodb/src/lib/services/auditService.ts +++ b/packages/nocodb/src/lib/services/auditService.ts @@ -1,10 +1,10 @@ -import { - AuditRowUpdatePayloadType, - CommentRowPayloadType, -} from 'nocodb-sdk/build/main/lib/CustomAPI'; import { validatePayload } from '../meta/api/helpers'; import Audit from '../models/Audit'; -import { AuditOperationSubTypes, AuditOperationTypes } from 'nocodb-sdk'; +import { + AuditOperationSubTypes, + AuditOperationTypes, + AuditRowUpdateReqType, +} from 'nocodb-sdk'; import Model from '../models/Model'; import { PagedResponseImpl } from '../meta/helpers/PagedResponse'; @@ -12,7 +12,7 @@ import DOMPurify from 'isomorphic-dompurify'; export async function commentRow(param: { rowId: string; - body: CommentRowPayloadType; + body: AuditRowUpdateReqType; user: any; }) { await validatePayload( @@ -29,7 +29,7 @@ export async function commentRow(param: { export async function auditRowUpdate(param: { rowId: string; - body: AuditRowUpdatePayloadType; + body: AuditRowUpdateReqType; }) { await validatePayload( 'swagger.json#/components/schemas/AuditRowUpdateReq', diff --git a/packages/nocodb/src/lib/services/dataService/export.ts b/packages/nocodb/src/lib/services/dataService/export.ts index 53afe1ff85..fa222f61ce 100644 --- a/packages/nocodb/src/lib/services/dataService/export.ts +++ b/packages/nocodb/src/lib/services/dataService/export.ts @@ -1,10 +1,6 @@ -import { - getViewAndModelByAliasOrId, - PathParams, -} from './helpers'; +import { getViewAndModelByAliasOrId, PathParams } from './helpers'; import { View } from '../../models'; - // Todo: bring logic from controller export async function excelDataExport( param: PathParams & { diff --git a/packages/nocodb/src/lib/services/projectUserService.ts b/packages/nocodb/src/lib/services/projectUserService.ts index 12e6a92735..675ba744a6 100644 --- a/packages/nocodb/src/lib/services/projectUserService.ts +++ b/packages/nocodb/src/lib/services/projectUserService.ts @@ -292,9 +292,8 @@ export async function sendInviteEmail( req: any ): Promise { try { - const template = ( - await import('./userService/ui/emailTemplates/invite') - ).default; + const template = (await import('./userService/ui/emailTemplates/invite')) + .default; const emailAdapter = await NcPluginMgrv2.emailAdapter(); diff --git a/packages/nocodb/src/lib/services/syncService/helpers/job.ts b/packages/nocodb/src/lib/services/syncService/helpers/job.ts index b956a5353c..8d6bc80ed7 100644 --- a/packages/nocodb/src/lib/services/syncService/helpers/job.ts +++ b/packages/nocodb/src/lib/services/syncService/helpers/job.ts @@ -679,8 +679,6 @@ export default async ( ); } - // debug - // console.log(JSON.stringify(tables, null, 2)); return tables; } @@ -1413,7 +1411,7 @@ export default async ( case UITypes.DateTime: case UITypes.CreateTime: case UITypes.LastModifiedTime: - rec[key] = dayjs(value).utc().format('YYYY-MM-DD HH:mm'); + rec[key] = dayjs(value).format('YYYY-MM-DD HH:mm'); break; case UITypes.Date: @@ -1422,7 +1420,7 @@ export default async ( rec[key] = null; logBasic(`:: Invalid date ${value}`); } else { - rec[key] = dayjs(value).utc().format('YYYY-MM-DD'); + rec[key] = dayjs(value).format('YYYY-MM-DD'); } break; diff --git a/packages/nocodb/src/lib/services/tableService.ts b/packages/nocodb/src/lib/services/tableService.ts index eb94a9c708..747f2d57b8 100644 --- a/packages/nocodb/src/lib/services/tableService.ts +++ b/packages/nocodb/src/lib/services/tableService.ts @@ -51,7 +51,7 @@ export async function tableUpdate(param: { if ('meta' in param.table) { await Model.updateMeta(param.tableId, param.table.meta); - return { msg: 'success' } + return true; } if (!param.table.table_name) { @@ -201,7 +201,6 @@ export async function tableDelete(param: { return table.delete(); } - export async function getTableWithAccessibleViews(param: { tableId: string; user: User;