diff --git a/frontends/nextjs/src/app/[tenant]/[package]/[...slug]/page.tsx b/frontends/nextjs/src/app/[tenant]/[package]/[...slug]/page.tsx
index c447b1ddb..131c81441 100644
--- a/frontends/nextjs/src/app/[tenant]/[package]/[...slug]/page.tsx
+++ b/frontends/nextjs/src/app/[tenant]/[package]/[...slug]/page.tsx
@@ -36,9 +36,9 @@ export default async function EntityPage({ params }: EntityPageProps) {
if (id === 'new') {
viewType = 'create'
- } else if (id && action === 'edit') {
+ } else if (id !== null && id !== undefined && action === 'edit') {
viewType = 'edit'
- } else if (id) {
+ } else if (id !== null && id !== undefined) {
viewType = 'detail'
}
@@ -49,7 +49,7 @@ export default async function EntityPage({ params }: EntityPageProps) {
{pkg}
{' / '}
{entity}
- {id && id !== 'new' && (
+ {(id !== null && id !== undefined) && id !== 'new' && (
<>
{' / '}
{id}
@@ -69,12 +69,12 @@ export default async function EntityPage({ params }: EntityPageProps) {
/>
)}
- {viewType === 'detail' && (
+ {viewType === 'detail' && id !== null && id !== undefined && (
)}
@@ -86,12 +86,12 @@ export default async function EntityPage({ params }: EntityPageProps) {
/>
)}
- {viewType === 'edit' && (
+ {viewType === 'edit' && id !== null && id !== undefined && (
)}
@@ -202,13 +202,13 @@ function EntityEditView({ tenant, pkg, entity, id }: {
export async function generateMetadata({ params }: EntityPageProps) {
const { tenant, package: pkg, slug } = await params
- const entity = slug?.[0] || 'unknown'
+ const entity = slug?.[0] ?? 'unknown'
const id = slug?.[1]
let title = `${entity} - ${pkg}`
if (id === 'new') {
title = `New ${entity} - ${pkg}`
- } else if (id) {
+ } else if (id !== null && id !== undefined) {
title = `${entity} #${id} - ${pkg}`
}
diff --git a/frontends/nextjs/src/app/[tenant]/[package]/tenant-context.tsx b/frontends/nextjs/src/app/[tenant]/[package]/tenant-context.tsx
index 3344b6a56..0957b81de 100644
--- a/frontends/nextjs/src/app/[tenant]/[package]/tenant-context.tsx
+++ b/frontends/nextjs/src/app/[tenant]/[package]/tenant-context.tsx
@@ -84,10 +84,10 @@ export function TenantProvider({
getTableName: (entity: string) => getTableName(packageId, entity),
buildApiUrl: (entity: string, id?: string, action?: string, pkg?: string) => {
- const targetPkg = pkg || packageId
+ const targetPkg = pkg ?? packageId
let url = `/api/v1/${tenant}/${targetPkg}/${entity}`
- if (id) url += `/${id}`
- if (action) url += `/${action}`
+ if (id !== null && id !== undefined) url += `/${id}`
+ if (action !== null && action !== undefined) url += `/${action}`
return url
},
@@ -110,7 +110,7 @@ export function TenantProvider({
export function useTenant(): TenantContextValue {
const context = useContext(TenantContext)
- if (!context) {
+ if (context === null || context === undefined) {
throw new Error('useTenant must be used within a TenantProvider')
}
diff --git a/frontends/nextjs/src/app/api/dbal/schema/route.ts b/frontends/nextjs/src/app/api/dbal/schema/route.ts
index d5641d3f4..da41b49dd 100644
--- a/frontends/nextjs/src/app/api/dbal/schema/route.ts
+++ b/frontends/nextjs/src/app/api/dbal/schema/route.ts
@@ -23,7 +23,7 @@ const getPrismaOutputPath = () => path.join(process.cwd(), '..', '..', '..', 'pr
* Note: This endpoint is for admin/system use.
* For tenant-scoped data, use /api/v1/{tenant}/{package}/{entity}
*/
-export async function GET() {
+export function GET() {
try {
const registryPath = getRegistryPath()
const registry = loadSchemaRegistry(registryPath)
@@ -92,7 +92,7 @@ export async function POST(request: Request) {
}
}
-async function handleScan(registry: SchemaRegistry, registryPath: string) {
+function handleScan(registry: SchemaRegistry, registryPath: string) {
// TODO: Import scanAllPackages when schema-scanner is implemented
// const { scanAllPackages } = await import('@/lib/schema/schema-scanner')
// const result = await scanAllPackages(registry)
@@ -113,7 +113,7 @@ function handleGenerate(registry: SchemaRegistry) {
const fragment = generatePrismaFragment(registry)
const prismaOutputPath = getPrismaOutputPath()
- if (!fragment.trim()) {
+ if (fragment.trim().length === 0) {
return NextResponse.json({
status: 'ok',
action: 'generate',
@@ -135,7 +135,7 @@ function handleGenerate(registry: SchemaRegistry) {
}
function handleApprove(registry: SchemaRegistry, registryPath: string, id?: string) {
- if (!id) {
+ if (id === null || id === undefined) {
return NextResponse.json(
{ status: 'error', error: 'Migration ID required' },
{ status: 400 }
diff --git a/frontends/nextjs/src/lib/db/error-logs/crud/add-error-log.ts b/frontends/nextjs/src/lib/db/error-logs/crud/add-error-log.ts
index 768502e75..9d9722593 100644
--- a/frontends/nextjs/src/lib/db/error-logs/crud/add-error-log.ts
+++ b/frontends/nextjs/src/lib/db/error-logs/crud/add-error-log.ts
@@ -13,15 +13,15 @@ export async function addErrorLog(log: Omit): Promise {
timestamp: BigInt(log.timestamp),
level: log.level,
message: log.message,
- stack: log.stack || null,
- context: log.context || null,
- userId: log.userId || null,
- username: log.username || null,
- tenantId: log.tenantId || null,
- source: log.source || null,
+ stack: log.stack ?? null,
+ context: log.context ?? null,
+ userId: log.userId ?? null,
+ username: log.username ?? null,
+ tenantId: log.tenantId ?? null,
+ source: log.source ?? null,
resolved: log.resolved,
- resolvedAt: log.resolvedAt ? BigInt(log.resolvedAt) : null,
- resolvedBy: log.resolvedBy || null,
+ resolvedAt: log.resolvedAt !== null && log.resolvedAt !== undefined ? BigInt(log.resolvedAt) : null,
+ resolvedBy: log.resolvedBy ?? null,
})
return id
diff --git a/frontends/nextjs/src/lib/db/god-credentials/index.ts b/frontends/nextjs/src/lib/db/god-credentials/index.ts
index faed1ba68..44fc29008 100644
--- a/frontends/nextjs/src/lib/db/god-credentials/index.ts
+++ b/frontends/nextjs/src/lib/db/god-credentials/index.ts
@@ -6,9 +6,8 @@ import { getAdapter } from '../core/dbal-client'
export async function getGodCredentialsExpiry(): Promise {
const adapter = getAdapter()
const result = await adapter.list('SystemConfig')
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const config = (result.data as any[]).find((c: any) => c.key === 'godCredentialsExpiry')
- return config?.value ? Number(config.value) : 0
+ const config = (result.data as Array<{ key: string; value?: string }>).find((c) => c.key === 'godCredentialsExpiry')
+ return (config?.value !== null && config?.value !== undefined) ? Number(config.value) : 0
}
/**
@@ -31,11 +30,10 @@ export async function setGodCredentialsExpiry(timestamp: number): Promise
export async function getFirstLoginFlags(): Promise> {
const adapter = getAdapter()
const result = await adapter.list('User')
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const users = result.data as any[]
+ const users = result.data as Array<{ id?: string; firstLogin?: boolean }>
const flags: Record = {}
for (const user of users) {
- if (user.id && user.firstLogin !== undefined) {
+ if (user.id !== null && user.id !== undefined && user.firstLogin !== undefined) {
flags[user.id] = Boolean(user.firstLogin)
}
}
@@ -56,9 +54,8 @@ export async function setFirstLoginFlag(userId: string, flag: boolean): Promise<
export async function getGodCredentialsExpiryDuration(): Promise {
const adapter = getAdapter()
const result = await adapter.list('SystemConfig')
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const config = (result.data as any[]).find((c: any) => c.key === 'godCredentialsExpiryDuration')
- return config?.value ? Number(config.value) : 300000 // Default 5 minutes
+ const config = (result.data as Array<{ key: string; value?: string }>).find((c) => c.key === 'godCredentialsExpiryDuration')
+ return (config?.value !== null && config?.value !== undefined) ? Number(config.value) : 300000 // Default 5 minutes
}
/**