MCPcopy Create free account
hub / github.com/TheOrcDev/github-creature / searchCreaturesByUsername

Function searchCreaturesByUsername

server/creatures.ts:120–139  ·  view source on GitHub ↗
(query: string)

Source from the content-addressed store, hash-verified

118}
119
120export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected