(query: string)
| 118 | } |
| 119 | |
| 120 | export async function searchCreaturesByUsername(query: string) { |
| 121 | if (!query || query.length < 1) return []; |
| 122 | |
| 123 | try { |
| 124 | const results = await db.query.creatures.findMany({ |
| 125 | where: ilike(creatures.githubProfileUrl, `%github.com/${query}%`), |
| 126 | limit: 5, |
| 127 | orderBy: (creatures, { desc }) => desc(creatures.contributions), |
| 128 | }); |
| 129 | |
| 130 | return results.map((c) => ({ |
| 131 | username: c.githubProfileUrl.split("/").pop() ?? "", |
| 132 | name: c.name, |
| 133 | image: c.image, |
| 134 | })); |
| 135 | } catch (error) { |
| 136 | console.error(error); |
| 137 | return []; |
| 138 | } |
| 139 | } |
nothing calls this directly
no outgoing calls
no test coverage detected