init
This commit is contained in:
@@ -120,6 +120,10 @@ function buildRunningPrompt(activity: RunningActivity, previousRuns: PreviousRun
|
||||
}
|
||||
}
|
||||
|
||||
if (activity.notes) {
|
||||
lines.push(``, `Notatki zawodnika: ${activity.notes}`);
|
||||
}
|
||||
|
||||
if (previousRuns.length > 0) {
|
||||
lines.push(``, `Poprzednie biegi (od najnowszego):`);
|
||||
for (const { run, analysis } of previousRuns) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 } }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user