| 170 | })); |
| 171 | |
| 172 | export const getUserApiKeys = async (): Promise<{ name: string; createdAt: Date; lastUsedAt: Date | null }[] | ServiceError> => sew(() => |
| 173 | withAuth(async ({ org, user, prisma }) => { |
| 174 | const apiKeys = await prisma.apiKey.findMany({ |
| 175 | where: { |
| 176 | orgId: org.id, |
| 177 | createdById: user.id, |
| 178 | }, |
| 179 | orderBy: { |
| 180 | createdAt: 'desc', |
| 181 | } |
| 182 | }); |
| 183 | |
| 184 | return apiKeys.map((apiKey) => ({ |
| 185 | name: apiKey.name, |
| 186 | createdAt: apiKey.createdAt, |
| 187 | lastUsedAt: apiKey.lastUsedAt, |
| 188 | })); |
| 189 | })); |
| 190 | |
| 191 | export const getRepos = async ({ |
| 192 | where, |