feat(shared,api): add pause + sort_order columns and contracts
Adds server-side pause accounting and activity ordering primitives. - WorkSession contract gains paused_seconds (number) and paused_at (ISO string | null). - Activity contract gains sort_order (number); new ReorderActivitiesInput zod. - work_sessions += paused_seconds (int NOT NULL DEFAULT 0) + paused_at (timestamp_ms nullable). - activities += sort_order (int NOT NULL DEFAULT 0). - toWorkSession / toActivity map the new fields; generated migration 0003. The new fields are additive; existing api/worker/admin tests stay green. Products affected: SoleLog backend (apps/api), shared contracts (packages/shared)
This commit is contained in:
@@ -29,6 +29,7 @@ export const Activity = z.object({
|
||||
name: z.string(),
|
||||
insole_types: z.array(InsoleType),
|
||||
created_at: z.string(), // ISO-8601
|
||||
sort_order: z.number().int(),
|
||||
});
|
||||
export type Activity = z.infer<typeof Activity>;
|
||||
|
||||
@@ -41,6 +42,11 @@ export type CreateActivityInput = z.infer<typeof CreateActivityInput>;
|
||||
export const UpdateActivityInput = CreateActivityInput;
|
||||
export type UpdateActivityInput = z.infer<typeof UpdateActivityInput>;
|
||||
|
||||
export const ReorderActivitiesInput = z.object({
|
||||
ids: z.array(z.number().int()).min(1),
|
||||
});
|
||||
export type ReorderActivitiesInput = z.infer<typeof ReorderActivitiesInput>;
|
||||
|
||||
export const SessionStatus = z.enum(['active', 'completed', 'discarded']);
|
||||
export type SessionStatus = z.infer<typeof SessionStatus>;
|
||||
|
||||
@@ -56,6 +62,8 @@ export const WorkSession = z.object({
|
||||
start_time: z.string(), // ISO-8601
|
||||
end_time: z.string().nullable(),
|
||||
duration_seconds: z.number().int().nullable(),
|
||||
paused_seconds: z.number().int(),
|
||||
paused_at: z.string().nullable(), // ISO-8601; set while paused, null = running
|
||||
status: SessionStatus,
|
||||
source: z.enum(['app', 'manual']),
|
||||
notes: z.string().nullable(),
|
||||
|
||||
Reference in New Issue
Block a user