[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
5
fork

Configure Feed

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

small bug fix

+24 -18
+4 -2
services/appview/src/routes/com/atproto/admin/getAccountInfos.ts
··· 9 9 import type * as ComAtprotoAdminDefs from '../../../../lexicon/types/com/atproto/admin/defs.js' 10 10 import type * as ComAtprotoRepoStrongRef from '../../../../lexicon/types/com/atproto/repo/strongRef.js' 11 11 12 - export const createGetAccountInfosRouter = (ctx: AppContext) => { 12 + export const createGetAccountInfosRouter = (_ctx: AppContext) => { 13 13 const router = new Hono() 14 14 15 15 // XRPC endpoint for Ozone integration: com.atproto.admin.getAccountInfos ··· 23 23 }), 24 24 ), 25 25 async (c) => { 26 - 26 + const { dids } = c.req.valid('json') 27 27 } 28 28 ) 29 + 30 + return router 29 31 }
+20 -16
services/appview/src/services/plugins/post.ts
··· 26 26 cid: CID, 27 27 record: unknown, 28 28 timestamp: string, 29 - opts?: { disableNotifs?: boolean }, 30 29 ) => Promise<PostDocument | null> 31 30 updateRecord: ( 32 31 uri: AtUri, ··· 49 48 cid: CID, 50 49 recordObj: unknown, 51 50 timestamp: string, 52 - opts = {}, 53 51 ): Promise<PostDocument | null> { 54 52 const record = recordObj as PostRecord 55 53 if (!record) return null ··· 121 119 122 120 // Update post data 123 121 const postData = { 122 + uri: uri.toString(), 124 123 cid: cid.toString(), 125 124 text: record.text, 126 125 facets: record.facets || [], ··· 129 128 langs: record.langs || [], 130 129 labels: record.labels || null, 131 130 tags: record.tags || [], 131 + authorDid: uri.hostname, 132 132 authorHandle: actor.handle || uri.hostname, 133 133 indexedAt: timestamp, 134 134 } ··· 150 150 } 151 151 }, 152 152 153 - async deleteRecord(uri: AtUri): Promise<void> { 153 + async deleteRecord(uri: AtUri, cascading = false): Promise<void> { 154 154 try { 155 + // Get the post to check author 155 156 const post = await db.models.Post.findOne({ uri: uri.toString() }) 156 - 157 - if (post) { 158 - // Delete the post 159 - await db.models.Post.deleteOne({ uri: uri.toString() }) 160 - 161 - // Decrement post count for actor 162 - await db.models.Actor.updateOne( 163 - { did: uri.hostname }, 164 - { $inc: { postsCount: -1 } } 165 - ) 166 - 167 - // Delete any associated likes, reposts, etc. as needed 168 - // This would be the cascading deletion logic 157 + if (!post) { 158 + logger.warn({ uri: uri.toString() }, 'Post not found for deletion') 159 + return 160 + } 161 + 162 + // Delete the post 163 + await db.models.Post.deleteOne({ uri: uri.toString() }) 164 + 165 + // Decrement post count for author 166 + await db.models.Actor.updateOne( 167 + { did: post.authorDid }, 168 + { $inc: { postsCount: -1 } } 169 + ) 170 + 171 + if (cascading) { 172 + // TODO: Handle cascading deletion (e.g. delete replies, reposts, etc.) 169 173 } 170 174 } catch (error) { 171 175 logger.error(