feat: update display name
This commit is contained in:
@@ -62,11 +62,13 @@ export const userRouter = createTRPCRouter({
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
image: z.string(),
|
||||
name: z.string().optional(),
|
||||
image: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
.output(
|
||||
z.object({
|
||||
name: z.string().nullable(),
|
||||
image: z.string().nullable(),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -48,13 +48,13 @@ export const create = async (
|
||||
export const update = async (
|
||||
db: SupabaseClient<Database>,
|
||||
userId: string,
|
||||
updates: { image: string | null },
|
||||
updates: { image?: string; name?: string },
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("user")
|
||||
.update({ image: updates.image })
|
||||
.update({ image: updates.image, name: updates.name })
|
||||
.eq("id", userId)
|
||||
.select(`image`)
|
||||
.select(`image, name`)
|
||||
.single();
|
||||
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user