(githubUsername: string)
| 6 | import { creatures, InsertCreature } from "@/db/schema"; |
| 7 | |
| 8 | export async function getCreatureByGithubUsername(githubUsername: string) { |
| 9 | const githubUrl = `https://github.com/${githubUsername}`; |
| 10 | console.log(githubUrl); |
| 11 | try { |
| 12 | const creature = await db.query.creatures.findFirst({ |
| 13 | where: (creatures, { eq }) => eq(creatures.githubProfileUrl, githubUrl), |
| 14 | }); |
| 15 | return creature; |
| 16 | } catch (error) { |
| 17 | console.error(error); |
| 18 | throw new Error("Failed to get creature"); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | export async function saveCreature(creature: InsertCreature) { |
| 23 | try { |
no outgoing calls
no test coverage detected