Files
publisher-dashboard/packages/db
igm e43c006bb1 Fix merge conflicts and add withTransaction helper
- Add withTransaction helper that gracefully handles nested transactions
  (reuses existing transaction in tests, starts new one otherwise)
- Update auth procedures to use withTransaction instead of direct .transaction()
- Add email config to all e2e test contexts (required by merged code)
- Remove duplicate verification token code from signup procedure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:07:14 +08:00
..
2026-01-12 13:59:34 +08:00

@reviq/db

Database client and helper functions for the RevIQ platform.

Usage

import { createDb } from "@reviq/db";

const db = createDb(process.env.DATABASE_URL);

// Use db with Kysely queries
const users = await db.selectFrom("users").selectAll().execute();

// Clean up when done
await db.destroy();

Exports

Client

  • createDb(url) - Create a Kysely database instance

Helper Functions

  • executeBootstrap(trx, input) - Bootstrap a new database with superuser and org
  • generateToken() - Generate an API token
  • hashToken(token) - Hash a token for storage
  • parseToken(token) - Parse and validate a token
  • TOKEN_PREFIX - The reviq_ prefix for API tokens

Types

  • Database - Re-exported from @reviq/db-schema
  • BootstrapInput / BootstrapResult - Types for bootstrap operation