From 8f57ca9d7625ae0736876b5b2505edb5aebc3359 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 Jun 2026 01:23:19 -0400 Subject: [PATCH] fix tests failure --- apps/api/src/swagger/openapi.ts | 25 +++++++++++++++---------- packages/database/client.d.ts | 1 + packages/database/client.js | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 packages/database/client.d.ts create mode 100644 packages/database/client.js diff --git a/apps/api/src/swagger/openapi.ts b/apps/api/src/swagger/openapi.ts index 33c0b2d..40e84f4 100644 --- a/apps/api/src/swagger/openapi.ts +++ b/apps/api/src/swagger/openapi.ts @@ -1,5 +1,7 @@ import { zodToJsonSchema } from 'zod-to-json-schema' +type JsonObject = Record + // ── Vehicles ───────────────────────────────────────────────────────────────── import { vehicleSchema, @@ -60,34 +62,37 @@ import { renterUpdateSchema, renterFcmTokenSchema } from '../modules/auth/auth.r // ───────────────────────────────────────────────────────────────────────────── -function s(schema: Parameters[0]): Record { - const { $schema, ...rest } = zodToJsonSchema(schema, { target: 'openApi3' }) as Record +function s(schema: unknown): JsonObject { + const { $schema, ...rest } = zodToJsonSchema( + schema as Parameters[0], + { target: 'openApi3' }, + ) as JsonObject return rest } -const idPath = (name = 'id') => ({ +const idPath = (name = 'id'): JsonObject => ({ name, in: 'path' as const, required: true, schema: { type: 'string' }, }) -const pagingParams = [ +const pagingParams: JsonObject[] = [ { name: 'page', in: 'query', schema: { type: 'integer', default: 1 } }, { name: 'pageSize', in: 'query', schema: { type: 'integer', default: 20 } }, ] -const jsonBody = (ref: string) => ({ +const jsonBody = (ref: string): JsonObject => ({ required: true, content: { 'application/json': { schema: { $ref: ref } } }, }) -const ok = { description: 'Success' } -const err4 = { description: 'Validation error', content: { 'application/json': { schema: { type: 'object', properties: { error: { type: 'string' } } } } } } -const err401 = { description: 'Unauthorized' } -const err404 = { description: 'Not found' } +const ok: JsonObject = { description: 'Success' } +const err4: JsonObject = { description: 'Validation error', content: { 'application/json': { schema: { type: 'object', properties: { error: { type: 'string' } } } } } } +const err401: JsonObject = { description: 'Unauthorized' } +const err404: JsonObject = { description: 'Not found' } -export const openApiDocument = { +export const openApiDocument: JsonObject = { openapi: '3.0.3', info: { title: 'RentalDriveGo API', diff --git a/packages/database/client.d.ts b/packages/database/client.d.ts new file mode 100644 index 0000000..9c0858e --- /dev/null +++ b/packages/database/client.d.ts @@ -0,0 +1 @@ +export * from './src/client' diff --git a/packages/database/client.js b/packages/database/client.js new file mode 100644 index 0000000..70f555b --- /dev/null +++ b/packages/database/client.js @@ -0,0 +1 @@ +module.exports = require('./src/client')