Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): upload image attachments before sending #8048

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/8048/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 37 changed files with 128 additions and 0 deletions (loading 36).

x
0 of 37 viewed, 37 left
128 additions and 0 deletionsapps/server/src/assets/AttachmentUpload.test.tsAdded
View file
@@ -0,0 +1,128 @@
+// @effect-diagnostics nodeBuiltinImport:off
+import * as NodeFS from "node:fs";
+import * as NodePath from "node:path";
+​
+import * as NodeServices from "@effect/platform-node/NodeServices";
+import { describe, expect, it } from "@effect/vitest";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+import * as TestClock from "effect/testing/TestClock";
+​
+import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
+import * as ServerConfig from "../config.ts";
+import { parseThreadSegmentFromAttachmentId } from "../attachmentStore.ts";
+import {
+ ATTACHMENT_UPLOAD_ROUTE_PREFIX,
+ deletePendingAttachment,
+ issueAttachmentUploadUrl,
+ storeAttachmentUpload,
+ validateAttachmentUploadToken,
+} from "./AttachmentUpload.ts";
+​
+const testLayer = ServerSecretStore.layer.pipe(
+ Layer.provideMerge(ServerConfig.layerTest(process.cwd(), { prefix: "t3-attachment-upload-" })),
+ Layer.provideMerge(NodeServices.layer),
+);
+​
+const uploadInput = {
+ name: "screenshot.png",
+ mimeType: "image/png",
+ sizeBytes: 6,