feat: create and delete api keys

This commit is contained in:
Henry
2025-05-31 23:59:48 +01:00
parent e61dd4e27e
commit 1d00aa78b4
11 changed files with 153 additions and 24 deletions

View File

@@ -26,6 +26,13 @@ export const userRouter = createTRPCRouter({
name: z.string().nullable(),
image: z.string().nullable(),
stripeCustomerId: z.string().nullable(),
apiKey: z
.object({
id: z.number(),
prefix: z.string().nullable(),
key: z.string(),
})
.nullable(),
}),
)
.query(async ({ ctx }) => {
@@ -46,7 +53,12 @@ export const userRouter = createTRPCRouter({
});
}
return result;
const apiKey = result.apiKeys[0];
return {
...result,
apiKey: apiKey ?? null,
};
}),
update: protectedProcedure
.meta({