From 5709afe0d3ce3bd0ef9ce4b5ae5ae7d489070b2b Mon Sep 17 00:00:00 2001 From: = Date: Wed, 2 Jul 2025 19:49:07 +0530 Subject: [PATCH] feat: lint errors fix --- backend/src/auto-start-migrations.ts | 56 +++++++++---------- .../ee/services/audit-log/audit-log-dal.ts | 1 - .../AuditLogsPage/components/LogsFilter.tsx | 2 +- frontend/src/pages/project/layout.tsx | 42 +++++++------- .../redirects/redirect-approval-page.tsx | 14 ++--- 5 files changed, 55 insertions(+), 60 deletions(-) diff --git a/backend/src/auto-start-migrations.ts b/backend/src/auto-start-migrations.ts index 4df6aa1cf..88f6dea69 100644 --- a/backend/src/auto-start-migrations.ts +++ b/backend/src/auto-start-migrations.ts @@ -44,17 +44,17 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs }); } } - // if (auditLogDb) { - // const hasMigrationTableInAuditLog = await auditLogDb.schema.hasTable(migrationTable); - // if (hasMigrationTableInAuditLog) { - // const firstFile = (await auditLogDb(migrationTable).where({}).first()) as { name: string }; - // if (firstFile?.name?.includes(".ts")) { - // await auditLogDb(migrationTable).update({ - // name: auditLogDb.raw("REPLACE(name, '.ts', '.mjs')") - // }); - // } - // } - // } + if (auditLogDb) { + const hasMigrationTableInAuditLog = await auditLogDb.schema.hasTable(migrationTable); + if (hasMigrationTableInAuditLog) { + const firstFile = (await auditLogDb(migrationTable).where({}).first()) as { name: string }; + if (firstFile?.name?.includes(".ts")) { + await auditLogDb(migrationTable).update({ + name: auditLogDb.raw("REPLACE(name, '.ts', '.mjs')") + }); + } + } + } } const shouldRunMigration = Boolean( @@ -65,23 +65,23 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs return; } - // if (auditLogDb) { - // await auditLogDb.transaction(async (tx) => { - // await tx.raw("SELECT pg_advisory_xact_lock(?)", [PgSqlLock.BootUpMigration]); - // logger.info("Running audit log migrations."); - // - // const didPreviousInstanceRunMigration = !(await auditLogDb.migrate - // .status(migrationConfig) - // .catch(migrationStatusCheckErrorHandler)); - // if (didPreviousInstanceRunMigration) { - // logger.info("No audit log migrations pending: Applied by previous instance. Skipping migration process."); - // return; - // } - // - // await auditLogDb.migrate.latest(migrationConfig); - // logger.info("Finished audit log migrations."); - // }); - // } + if (auditLogDb) { + await auditLogDb.transaction(async (tx) => { + await tx.raw("SELECT pg_advisory_xact_lock(?)", [PgSqlLock.BootUpMigration]); + logger.info("Running audit log migrations."); + + const didPreviousInstanceRunMigration = !(await auditLogDb.migrate + .status(migrationConfig) + .catch(migrationStatusCheckErrorHandler)); + if (didPreviousInstanceRunMigration) { + logger.info("No audit log migrations pending: Applied by previous instance. Skipping migration process."); + return; + } + + await auditLogDb.migrate.latest(migrationConfig); + logger.info("Finished audit log migrations."); + }); + } await applicationDb.transaction(async (tx) => { await tx.raw("SELECT pg_advisory_xact_lock(?)", [PgSqlLock.BootUpMigration]); diff --git a/backend/src/ee/services/audit-log/audit-log-dal.ts b/backend/src/ee/services/audit-log/audit-log-dal.ts index 5e0a2ef05..2df779795 100644 --- a/backend/src/ee/services/audit-log/audit-log-dal.ts +++ b/backend/src/ee/services/audit-log/audit-log-dal.ts @@ -61,7 +61,6 @@ export const auditLogDALFactory = (db: TDbClient) => { }, tx ) => { - try { // Find statements const sqlQuery = (tx || db.replicaNode())(TableName.AuditLog) diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx index f47597dcb..48d37a5b9 100644 --- a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx +++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx @@ -1,6 +1,6 @@ /* eslint-disable no-nested-ternary */ import { useMemo } from "react"; -import { Controller, useForm, UseFormGetValues } from "react-hook-form"; +import { Controller, useForm } from "react-hook-form"; import { faCaretDown, faCheckCircle, faFilterCircleXmark } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { zodResolver } from "@hookform/resolvers/zod"; diff --git a/frontend/src/pages/project/layout.tsx b/frontend/src/pages/project/layout.tsx index f803329ca..8f85cb1a5 100644 --- a/frontend/src/pages/project/layout.tsx +++ b/frontend/src/pages/project/layout.tsx @@ -1,41 +1,37 @@ -import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute } from "@tanstack/react-router"; -import { BreadcrumbTypes } from '@app/components/v2' -import { workspaceKeys } from '@app/hooks/api' -import { - fetchUserProjectPermissions, - roleQueryKeys, -} from '@app/hooks/api/roles/queries' -import { fetchWorkspaceById } from '@app/hooks/api/workspace/queries' -import { ProjectLayout } from '@app/layouts/ProjectLayout' -import { ProjectSelect } from '@app/layouts/ProjectLayout/components/ProjectSelect' +import { BreadcrumbTypes } from "@app/components/v2"; +import { workspaceKeys } from "@app/hooks/api"; +import { fetchUserProjectPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries"; +import { fetchWorkspaceById } from "@app/hooks/api/workspace/queries"; +import { ProjectLayout } from "@app/layouts/ProjectLayout"; +import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect"; export const Route = createFileRoute( - '/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout', + "/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout" )({ component: ProjectLayout, beforeLoad: async ({ params, context }) => { const project = await context.queryClient.ensureQueryData({ queryKey: workspaceKeys.getWorkspaceById(params.projectId), - queryFn: () => fetchWorkspaceById(params.projectId), - }) + queryFn: () => fetchWorkspaceById(params.projectId) + }); await context.queryClient.ensureQueryData({ queryKey: roleQueryKeys.getUserProjectPermissions({ - workspaceId: params.projectId, + workspaceId: params.projectId }), - queryFn: () => - fetchUserProjectPermissions({ workspaceId: params.projectId }), - }) + queryFn: () => fetchUserProjectPermissions({ workspaceId: params.projectId }) + }); return { project, breadcrumbs: [ { type: BreadcrumbTypes.Component, - component: ProjectSelect, - }, - ], - } - }, -}) + component: ProjectSelect + } + ] + }; + } +}); diff --git a/frontend/src/pages/secret-manager/redirects/redirect-approval-page.tsx b/frontend/src/pages/secret-manager/redirects/redirect-approval-page.tsx index db60e8fa7..8fe2c51cf 100644 --- a/frontend/src/pages/secret-manager/redirects/redirect-approval-page.tsx +++ b/frontend/src/pages/secret-manager/redirects/redirect-approval-page.tsx @@ -1,14 +1,14 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' +import { createFileRoute, redirect } from "@tanstack/react-router"; // this is done as part of migration for multi product inside project export const Route = createFileRoute( - '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/approval', + "/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/approval" )({ beforeLoad: ({ params, search }) => { throw redirect({ - to: '/projects/$projectId/secret-manager/approval', + to: "/projects/$projectId/secret-manager/approval", params, - search, - }) - }, -}) + search + }); + } +});