added full api

This commit is contained in:
blaisadmin
2026-04-14 22:41:17 -04:00
parent e0ab66d21a
commit 37c8265320
17 changed files with 3146 additions and 978 deletions
+128
View File
@@ -0,0 +1,128 @@
export type WorkspaceType = 'standard' | 'rescue';
export type WorkspaceRole = 'owner' | 'manager' | 'staff' | 'viewer';
export type BillingPlan = 'rescue_free' | 'household_basic' | 'household_plus' | 'household_macaw';
export type ProviderKey = 'google' | 'microsoft' | 'apple';
export type IntegrationTokenScope = 'read_only' | 'read_write';
export type UserRow = {
id: string;
email: string;
password_hash: string | null;
name: string;
created_at: string;
};
export type WorkspaceRow = {
id: number;
name: string;
workspace_type: WorkspaceType;
billing_email: string | null;
billing_plan: BillingPlan;
created_at: string;
updated_at: string;
};
export type WorkspaceMemberRow = {
id: string;
workspace_id: number;
user_id: string | null;
invite_email: string;
name: string;
role: WorkspaceRole;
accepted_at: string | null;
created_at: string;
};
export type AuthSessionRow = {
id: string;
user_id: string;
active_workspace_id: number;
token_hash: string;
expires_at: string;
created_at: string;
};
export type AuthAccountRow = {
id: string;
user_id: string;
provider_key: ProviderKey;
provider_subject: string;
provider_email: string | null;
created_at: string;
};
export type OAuthStateRow = {
id: string;
provider_key: ProviderKey;
code_verifier: string;
redirect_to: string;
expires_at: string;
};
export type MagicLinkTokenRow = {
id: string;
email: string;
name: string | null;
token_hash: string;
redirect_to: string;
expires_at: string;
created_at: string;
};
export type IntegrationTokenRow = {
id: string;
user_id: string;
workspace_id: number;
name: string;
token_hash: string;
token_prefix: string;
scope: IntegrationTokenScope;
last_used_at: string | null;
expires_at: string | null;
revoked_at: string | null;
created_at: string;
};
export type BirdRow = {
id: string;
workspace_id: number;
name: string;
tag_id: string;
species: string;
date_of_birth: string | null;
gotcha_day: string | null;
chart_color: string;
photo_data_url: string | null;
notify_on_dob: boolean;
notify_on_gotcha_day: boolean;
created_at: string;
latest_weight_grams: string | null;
latest_recorded_on: string | null;
};
export type WeightRow = {
id: string;
bird_id: string;
weight_grams: string;
recorded_on: string;
notes: string | null;
};
export type VetVisitRow = {
id: string;
bird_id: string;
visited_on: string;
clinic_name: string;
reason: string;
notes: string | null;
};
export type AuthContext = {
user: UserRow;
session: AuthSessionRow;
workspace: WorkspaceRow;
membership: WorkspaceMemberRow;
token: string;
authType: 'session' | 'integration_token';
integrationToken?: IntegrationTokenRow;
};