api
Some checks failed
Cloudflare Worker API Template / Deploy to ${{ github.ref_name }} environment (pull_request) Failing after 15s

This commit is contained in:
purvarao
2025-11-27 19:14:46 +05:30
parent 07a983d24f
commit 1ecaf8ff95
7 changed files with 420 additions and 33 deletions

39
src/types/index.ts Normal file
View File

@@ -0,0 +1,39 @@
import { Context } from 'hono';
// Define the structure of user data from the database
export interface UserData {
id: number;
uid: string;
email: string;
firebase_uid?: string;
firstname?: string;
lastname?: string;
company_name?: string;
created_at: string;
updated_at: string;
}
// Define the structure of the environment variables
export interface Env {
CF_TEMPLATE_DB?: D1Database; // D1Database type from @cloudflare/workers-types
DECRYPT_API_URL?: string;
DECRYPT_API_KEY?: string;
}
// Extend the Hono context with our custom types
export interface CustomContext extends Context {
env: Env;
get: (key: string) => string | undefined;
set: (key: string, value: any) => void;
}
// Response type for the user profile endpoint
export interface UserProfileResponse {
id: number;
name: string;
email: string;
color: string;
leaveBalances: {
[key: string]: number;
};
}