This commit is contained in:
Dominik Klarkowski
2026-06-22 11:32:27 +02:00
parent bf8624c954
commit d908965c95
16 changed files with 642 additions and 103 deletions

View File

@@ -72,6 +72,16 @@ export async function getDashboardAnalysis(userId: string): Promise<AiAnalysis |
);
}
export async function listAnalysesForCalendar(
userId: string
): Promise<AiAnalysis[]> {
const collection = await getCollection();
return collection
.find({ userId, targetType: "dashboard", targetId: DASHBOARD_TARGET_ID })
.sort({ createdAt: -1 })
.toArray();
}
export async function saveDashboardAnalysis(
userId: string,
summary: string,

View File

@@ -47,6 +47,7 @@ export type RunningActivity = RunningActivityInput & {
_id: ObjectId;
userId: string;
createdAt: Date;
notes?: string;
routePoints?: RoutePoint[];
elevationProfile?: number[];
runMetrics?: RunMetrics;
@@ -90,6 +91,18 @@ export async function getRunningActivity(
return collection.findOne({ _id: new ObjectId(id), userId });
}
export async function setRunningActivityNotes(
userId: string,
id: string,
notes: string
): Promise<void> {
const collection = await getCollection();
await collection.updateOne(
{ _id: new ObjectId(id), userId },
{ $set: { notes: notes.trim() || undefined } }
);
}
export async function setRunningActivityMetrics(
userId: string,
garminActivityId: number,

View File

@@ -69,3 +69,15 @@ export async function getStrengthWorkout(
const collection = await getCollection();
return collection.findOne({ _id: new ObjectId(id), userId });
}
export async function setStrengthWorkoutNotes(
userId: string,
id: string,
notes: string
): Promise<void> {
const collection = await getCollection();
await collection.updateOne(
{ _id: new ObjectId(id), userId },
{ $set: { notes: notes.trim() || undefined } }
);
}