STL Model Viewer

This commit is contained in:
2025-12-25 17:55:58 +00:00
parent 8142b22b21
commit 91a9aa9c54
11 changed files with 1161 additions and 251 deletions

View File

@@ -0,0 +1,22 @@
import { PrintJob } from '$lib/models/PrintJob';
import { connectDB } from '$lib/server/db';
import type { PageServerLoad } from './$types';
import { redirect } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ locals }) => {
if (!locals.user) throw redirect(303, '/login');
await connectDB();
// Get all prints with STL files
const printsWithSTL = await PrintJob.find({
user_id: locals.user.id,
stl_file: { $exists: true, $nin: [null, ''] }
})
.sort({ date: -1 })
.lean();
return {
models: JSON.parse(JSON.stringify(printsWithSTL))
};
};