- Migrated from Python pre-commit to NodeJS-native solution - Reorganized documentation structure - Set up Husky + lint-staged for efficient pre-commit hooks - Fixed Dockerfile healthcheck issue - Added comprehensive documentation index
115 lines
2.5 KiB
TypeScript
115 lines
2.5 KiB
TypeScript
import { AccountStatus } from './services/auth/auth.constants';
|
|
|
|
export interface CouchDBDocument {
|
|
_id: string;
|
|
_rev: string;
|
|
}
|
|
|
|
export enum UserRole {
|
|
USER = 'USER',
|
|
ADMIN = 'ADMIN',
|
|
}
|
|
|
|
export interface User extends CouchDBDocument {
|
|
username: string;
|
|
avatar?: string; // Base64 encoded image
|
|
email?: string;
|
|
password?: string; // For email-based authentication
|
|
emailVerified?: boolean;
|
|
status?: AccountStatus; // Account status: PENDING, ACTIVE, SUSPENDED
|
|
role?: UserRole; // User role for admin functionality
|
|
createdAt?: Date;
|
|
lastLoginAt?: Date;
|
|
}
|
|
|
|
export enum Frequency {
|
|
Daily = 'Daily',
|
|
TwiceADay = 'Twice a day',
|
|
ThreeTimesADay = 'Three times a day',
|
|
EveryXHours = 'Every X hours',
|
|
}
|
|
|
|
export interface Medication extends CouchDBDocument {
|
|
name: string;
|
|
dosage: string;
|
|
frequency: Frequency;
|
|
hoursBetween?: number;
|
|
startTime: string; // "HH:mm" format
|
|
notes?: string;
|
|
icon?: string;
|
|
}
|
|
|
|
export interface Dose {
|
|
id: string; // A unique ID for the dose instance, e.g., `${medicationId}-${isoDate}`
|
|
medicationId: string;
|
|
scheduledTime: Date;
|
|
}
|
|
|
|
export enum DoseStatus {
|
|
UPCOMING = 'UPCOMING',
|
|
TAKEN = 'TAKEN',
|
|
MISSED = 'MISSED',
|
|
SNOOZED = 'SNOOZED',
|
|
}
|
|
|
|
export interface HistoricalDose {
|
|
id: string;
|
|
medication: Medication;
|
|
scheduledTime: Date;
|
|
status: DoseStatus;
|
|
takenAt?: string;
|
|
}
|
|
|
|
export interface UserSettings extends CouchDBDocument {
|
|
notificationsEnabled: boolean;
|
|
hasCompletedOnboarding: boolean;
|
|
}
|
|
|
|
export interface TakenDoses extends CouchDBDocument {
|
|
doses: Record<string, string>; // key: dose.id, value: ISO timestamp
|
|
}
|
|
|
|
export interface CustomReminder extends CouchDBDocument {
|
|
title: string;
|
|
icon: string;
|
|
frequencyMinutes: number;
|
|
startTime: string; // "HH:mm"
|
|
endTime: string; // "HH:mm"
|
|
}
|
|
|
|
// Represents a single occurrence of a custom reminder on a given day
|
|
export interface ReminderInstance {
|
|
id: string; // e.g., `${reminderId}-${isoDate}-${time}`
|
|
reminderId: string;
|
|
title: string;
|
|
icon: string;
|
|
scheduledTime: Date;
|
|
}
|
|
|
|
export type ScheduleItem = Dose | ReminderInstance;
|
|
|
|
export interface DailyStat {
|
|
date: string; // YYYY-MM-DD
|
|
adherence: number; // 0-100
|
|
}
|
|
|
|
export interface MedicationStat {
|
|
medication: Medication;
|
|
taken: number;
|
|
missed: number;
|
|
upcoming: number;
|
|
adherence: number; // 0-100
|
|
lastTakenAt?: string;
|
|
}
|
|
|
|
export enum OAuthProvider {
|
|
GOOGLE = 'google',
|
|
GITHUB = 'github',
|
|
}
|
|
|
|
export interface OAuthState {
|
|
provider: OAuthProvider;
|
|
redirectUri: string;
|
|
state: string;
|
|
}
|