dev vouch dev on at. thats about it atvouch.dev
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

check if record exists before creation

Luna 4111e06a b0c67ba3

+22 -1
+2
Makefile
··· 13 13 14 14 .PHONY: frontend 15 15 frontend: 16 + cd ./frontend && bunx tsc 16 17 cd ./frontend && OAUTH_BASE_URL=$(OAUTH_BASE_URL) bunx vite build 17 18 18 19 .PHONY: local-frontend 19 20 local-frontend: 21 + cd ./frontend && bunx tsc 20 22 cd ./frontend && bunx vite 21 23 22 24 test:
+20 -1
frontend/src/api.ts
··· 58 58 }); 59 59 const subjectDid = (resolveResp.data as unknown as { did: string }).did; 60 60 61 - // Create vouch record (rkey is the subject DID, so duplicates are impossible) 61 + // Check if a vouch already exists for this subject 62 + try { 63 + const existing = await rpc.get("com.atproto.repo.getRecord", { 64 + params: { 65 + repo: agent.sub, 66 + collection: "dev.atvouch.graph.vouch", 67 + rkey: subjectDid, 68 + }, 69 + }); 70 + if (existing.data) { 71 + throw new Error(`You have already vouched for ${handle}`); 72 + } 73 + } catch (e) { 74 + if (e instanceof Error && e.message.includes("already vouched")) { 75 + throw e; 76 + } 77 + // Record doesn't exist, proceed with creation 78 + } 79 + 80 + // Create vouch record 62 81 const createResp = await rpc.call("com.atproto.repo.createRecord", { 63 82 data: { 64 83 repo: agent.sub,