All checks were successful
Build and Push Docker Image / build (push) Successful in 28s
The repo was authored prettier-style (trailing-comma 'all') but .oxfmtrc.json was set to 'es5', so every formatted file diverged. Switch the config to 'all' to match the existing code, ignore docs/** and **/drizzle/** (prose + generated snapshots the formatter should not own), and reformat the source tree once for consistency. No behavioural change; all suites green (api 60, worker 28, admin 21).
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { WorkSession } from '@solelog/shared';
|
|
import type { workSessions } from '../db/schema';
|
|
|
|
type WorkSessionRow = typeof workSessions.$inferSelect;
|
|
|
|
export function toWorkSession(
|
|
row: WorkSessionRow,
|
|
opts: { activityName?: string | null; userName?: string | null; userEmail?: string | null } = {},
|
|
): WorkSession {
|
|
return {
|
|
id: row.id,
|
|
user_id: row.userId,
|
|
activity_id: row.activityId,
|
|
activity_name: opts.activityName ?? undefined,
|
|
user_name: opts.userName ?? undefined,
|
|
user_email: opts.userEmail ?? undefined,
|
|
insole_type: (row.insoleType ?? null) as WorkSession['insole_type'],
|
|
pair_count: row.pairCount,
|
|
start_time: new Date(row.startTime).toISOString(),
|
|
end_time: row.endTime ? new Date(row.endTime).toISOString() : null,
|
|
duration_seconds: row.durationSeconds ?? null,
|
|
paused_seconds: row.pausedSeconds ?? 0,
|
|
paused_at: row.pausedAt ? new Date(row.pausedAt).toISOString() : null,
|
|
status: row.status as WorkSession['status'],
|
|
source: row.source as WorkSession['source'],
|
|
notes: row.notes ?? null,
|
|
created_at: new Date(row.createdAt).toISOString(),
|
|
};
|
|
}
|