user report gtound work

This commit is contained in:
dimitar committed 2026-03-19 03:37:15 +01:00
1 parent 1be2de05fa
commit 74f0d0dbed
42 files changed
+8127 -5

No files matched your search

+155
View File
@@ -160,3 +160,158 @@ export interface TrainerClient {
gymId: string;
createdAt: Date;
}
export interface DailyNutrition {
id: string;
userId: string;
date: string; // YYYY-MM-DD
totalCalories: number;
calorieGoal: number;
meals?: Array<{
type: "breakfast" | "lunch" | "dinner" | "snack";
name: string;
calories: number;
time?: string;
}>;
createdAt: Date;
updatedAt: Date;
}
export interface MealEntry {
id: string;
userId: string;
dailyNutritionId?: string;
mealType: "breakfast" | "lunch" | "dinner" | "snack";
foodName: string;
calories: number;
protein?: number; // grams
carbs?: number; // grams
fats?: number; // grams
timestamp: Date;
createdAt: Date;
}
export interface DailyHydration {
id: string;
userId: string;
date: string; // YYYY-MM-DD
totalWater: number; // ml
waterGoal: number; // ml
entries?: Array<{
amount: number;
time: string;
}>;
createdAt: Date;
updatedAt: Date;
}
export interface FitnessProfileHistory {
id: string;
userId: string;
fitnessProfileId: string;
changeType:
| "weight"
| "height"
| "age"
| "activity_level"
| "goals"
| "medical"
| "other";
fieldName: string;
previousValue?: string;
newValue?: string;
changedAt: Date;
createdAt: Date;
}
export interface TrainerClientAssignment {
id: string;
trainerId: string;
clientId: string;
assignedAt: Date;
assignedBy?: string;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
}
// User Report Types
export interface WeeklyCheckInStats {
weekStart: string; // ISO 8601 date (YYYY-MM-DD)
weekEnd: string; // ISO 8601 date (YYYY-MM-DD)
totalCheckIns: number;
totalTimeMinutes: number;
averageDurationMinutes: number;
checkInsByType: {
type: AttendanceType;
count: number;
}[];
}
export interface NutritionSummary {
date: string; // YYYY-MM-DD
totalCalories: number;
calorieGoal: number;
caloriesDelta: number; // totalCalories - calorieGoal
mealsCount: number;
}
export interface HydrationSummary {
date: string; // YYYY-MM-DD
totalWater: number; // ml
waterGoal: number; // ml
hydrationPercentage: number; // (totalWater / waterGoal) * 100
}
export interface GoalSummary {
active: FitnessGoal[];
completed: FitnessGoal[];
totalActive: number;
totalCompleted: number;
averageProgress: number; // Average progress of active goals
}
export interface ProfileChangeSummary {
changeType: FitnessProfileHistory["changeType"];
fieldName: string;
previousValue?: string;
newValue?: string;
changedAt: Date;
}
export interface RecommendationSummary {
accepted: Recommendation[];
rejected: Recommendation[];
pending: Recommendation[];
totalAccepted: number;
totalRejected: number;
totalPending: number;
}
export interface UserReport {
userId: string;
user: User;
client?: Client | null;
fitnessProfile?: FitnessProfile | null;
reportPeriod: {
startDate: string; // ISO 8601
endDate: string; // ISO 8601
};
weeklyCheckIns: WeeklyCheckInStats[];
nutrition: {
dailySummaries: NutritionSummary[];
averageDailyCalories: number;
totalDays: number;
daysMetGoal: number; // Days where calories were within ±10% of goal
};
hydration: {
dailySummaries: HydrationSummary[];
averageDailyWater: number;
totalDays: number;
daysMetGoal: number; // Days where water goal was met
};
goals: GoalSummary;
profileHistory: ProfileChangeSummary[];
recommendations: RecommendationSummary;
generatedAt: Date;
}