@goscribe/server 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -444,10 +444,10 @@ export const worksheets = router({
|
|
|
444
444
|
answer,
|
|
445
445
|
difficulty: (input.difficulty.toUpperCase()) as any,
|
|
446
446
|
order: i,
|
|
447
|
+
type,
|
|
447
448
|
meta: {
|
|
448
|
-
type,
|
|
449
449
|
options: options.length > 0 ? options : undefined,
|
|
450
|
-
|
|
450
|
+
markScheme: problem.mark_scheme || undefined,
|
|
451
451
|
},
|
|
452
452
|
},
|
|
453
453
|
});
|
package/src/routers/workspace.ts
CHANGED
|
@@ -344,6 +344,34 @@ export const workspace = router({
|
|
|
344
344
|
});
|
|
345
345
|
return true;
|
|
346
346
|
}),
|
|
347
|
+
getFileUploadUrl: authedProcedure
|
|
348
|
+
.input(z.object({
|
|
349
|
+
workspaceId: z.string(),
|
|
350
|
+
filename: z.string(),
|
|
351
|
+
contentType: z.string(),
|
|
352
|
+
size: z.number(),
|
|
353
|
+
}))
|
|
354
|
+
.query(async ({ ctx, input }) => {
|
|
355
|
+
const objectKey = `workspace_${ctx.session.user.id}/${input.workspaceId}-file_${input.filename}`;
|
|
356
|
+
await ctx.db.fileAsset.create({
|
|
357
|
+
data: {
|
|
358
|
+
workspaceId: input.workspaceId,
|
|
359
|
+
name: input.filename,
|
|
360
|
+
mimeType: input.contentType,
|
|
361
|
+
size: input.size,
|
|
362
|
+
userId: ctx.session.user.id,
|
|
363
|
+
bucket: 'media',
|
|
364
|
+
objectKey: objectKey,
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
const { data: signedUrlData, error: signedUrlError } = await supabaseClient.storage
|
|
368
|
+
.from('media')
|
|
369
|
+
.createSignedUploadUrl(objectKey); // 5 minutes
|
|
370
|
+
if (signedUrlError) {
|
|
371
|
+
throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: `Failed to generate upload URL: ${signedUrlError.message}` });
|
|
372
|
+
}
|
|
373
|
+
return signedUrlData.signedUrl;
|
|
374
|
+
}),
|
|
347
375
|
uploadAndAnalyzeMedia: authedProcedure
|
|
348
376
|
.input(z.object({
|
|
349
377
|
workspaceId: z.string(),
|