Fix PrintModal to fetch library file sliced_for_model

- Added query to fetch library file details in PrintModal
- Updated backend FileResponse schema to include metadata fields (print_name, print_time_seconds, filament_used_grams, sliced_for_model)
- Updated backend get_file endpoint to extract and return metadata fields
- Updated frontend LibraryFile interface to include metadata fields
- Now slicedForModel is properly extracted from both archives and library files

Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-04 03:06:54 +00:00
co-authored by cadtoolbox
parent 5b1e3e7a2b
commit 4cf58f9805
6 changed files with 68 additions and 35 deletions
+5
View File
@@ -3802,6 +3802,11 @@ export interface LibraryFile {
created_by_username: string | null;
created_at: string;
updated_at: string;
// Metadata fields
print_name: string | null;
print_time_seconds: number | null;
filament_used_grams: number | null;
sliced_for_model: string | null;
}
export interface LibraryFileListItem {
+8 -1
View File
@@ -180,8 +180,15 @@ export function PrintModal({
enabled: !!archiveId && !isLibraryFile,
});
// Fetch library file details to get sliced_for_model
const { data: libraryFileDetails } = useQuery({
queryKey: ['library-file', libraryFileId],
queryFn: () => api.getLibraryFile(libraryFileId!),
enabled: isLibraryFile && !!libraryFileId,
});
// Get sliced_for_model from archive or library file
const slicedForModel = archiveDetails?.sliced_for_model || null;
const slicedForModel = archiveDetails?.sliced_for_model || libraryFileDetails?.sliced_for_model || null;
// Fetch plates for archives
const { data: archivePlatesData, isError: archivePlatesError } = useQuery({