MCPcopy Create free account
hub / github.com/Y80/bmm / random

Function random

src/controllers/UserBookmark.controller.ts:224–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222 return await BookmarkHostCheckController.getUserCheckHostsTask(await getAuthedUserId())
223 },
224 async random() {
225 const list = await db.query.userBookmarks.findMany({
226 with: { relatedTagIds: true },
227 orderBy: sql`RANDOM()`,
228 limit: DEFAULT_BOOKMARK_PAGESIZE,
229 where: eq(userBookmarks.userId, await getAuthedUserId()),
230 })
231 return {
232 list: list.map((item) => ({
233 ...item,
234 relatedTagIds: item.relatedTagIds.map((el) => el.tId),
235 })),
236 }
237 },
238 /** 获取所有书签数量 */
239 async total() {
240 const userId = await getAuthedUserId()

Callers

nothing calls this directly

Calls 1

getAuthedUserIdFunction · 0.90

Tested by

no test coverage detected