-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
import { Server } from '../../../../lexicon' | ||
import AppContext from '../../../../context' | ||
import { InvalidRequestError } from '@atproto/xrpc-server' | ||
|
||
export default function (server: Server, ctx: AppContext) { | ||
server.com.atproto.admin.searchRepos({ | ||
auth: ctx.roleVerifier, | ||
handler: async ({ params }) => { | ||
throw new InvalidRequestError('@TODO') | ||
// const db = ctx.db | ||
// const moderationService = ctx.services.moderation(db) | ||
// const { limit, cursor } = params | ||
// // prefer new 'q' query param over deprecated 'term' | ||
// const query = params.q ?? params.term | ||
// const { results, cursor: resCursor } = await ctx.services | ||
// .actor(db) | ||
// .getSearchResults({ query, limit, cursor, includeSoftDeleted: true }) | ||
// return { | ||
// encoding: 'application/json', | ||
// body: { | ||
// cursor: resCursor, | ||
// repos: await moderationService.views.repo(results), | ||
// }, | ||
// } | ||
const res = await ctx.appviewAgent.api.com.atproto.admin.searchRepos( | ||
params, | ||
) | ||
const db = ctx.db | ||
const moderationService = ctx.services.moderation(db) | ||
const views = await moderationService.views.repos( | ||
res.data.repos.map((r) => r.did), | ||
) | ||
const repos = res.data.repos.map((r) => ({ | ||
...r, | ||
moderation: views.get(r.did)?.moderation ?? {}, | ||
})) | ||
return { | ||
encoding: 'application/json', | ||
body: { | ||
cursor: res.data.cursor, | ||
repos, | ||
}, | ||
} | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters