- Change attendance idx_attendance_user_date from unique to index (allow multiple shifts per day) - Reset migrations to single baseline init migration - Add seed script with admin user (admin/admin) - Update CLAUDE.md with migration workflow documentation - Various frontend fixes (queries, pages, hooks) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { queryOptions } from "@tanstack/react-query";
|
|
import { jsonQuery } from "../apiAdapter";
|
|
|
|
export interface LeaveRequest {
|
|
id: number;
|
|
leave_type: string;
|
|
date_from: string;
|
|
date_to: string;
|
|
total_days: number;
|
|
total_hours: number;
|
|
status: string;
|
|
notes?: string;
|
|
reviewer_note?: string;
|
|
created_at: string;
|
|
}
|
|
|
|
export const leaveRequestsOptions = (mine = true) =>
|
|
queryOptions({
|
|
queryKey: ["leave-requests", mine ? "mine" : "all"],
|
|
queryFn: () =>
|
|
jsonQuery<LeaveRequest[]>(
|
|
`/api/admin/leave-requests${mine ? "?mine=1" : ""}`,
|
|
),
|
|
});
|
|
|
|
export const leavePendingOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["leave", "pending"],
|
|
queryFn: () =>
|
|
jsonQuery<Record<string, unknown>[]>(
|
|
"/api/admin/leave-requests?status=pending",
|
|
),
|
|
});
|
|
|
|
export const leaveProcessedOptions = () =>
|
|
queryOptions({
|
|
queryKey: ["leave", "processed"],
|
|
queryFn: () =>
|
|
jsonQuery<Record<string, unknown>[]>(
|
|
"/api/admin/leave-requests?status=approved,rejected",
|
|
),
|
|
});
|