toAccountUser (src/types.ts)

DeepSeek-Reasonix · workers/accounts/src/types.ts · typescript · MIT
auth, tag:knn-classified

Converts raw user database rows into typed account and public user objects for API responses.

// Source: https://github.com/esengine/DeepSeek-Reasonix | License: MIT | Copyright 2026 Reasonix Contributors
// Provided via justclaw.it.com; keep this notice with the code.
export type Role = "member" | "admin";
export type UserStatus = "active" | "suspended" | "deleted";

// A full `users` row as stored in D1.
export interface UserRow {
  id: number;
  handle: string;
  email: string;
  email_verified: number;
  password_hash: string | null;
  display_name: string;
  avatar_url: string;
  bio: string;
  role: Role;
  status: UserStatus;
  created_at: string;
  updated_at: string;
}

// The authenticated owner's view of their own account (login, /me). Camel-cased
// and free of the password hash, so it is safe to serialize directly.
export interface AccountUser {
  id: number;
  handle:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key