a lot of things
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
import { ContentfulStatusCode } from "hono/utils/http-status";
|
||||
import { z } from "zod";
|
||||
import { apiResponse } from "../../../modules/api-utils/apiResponse";
|
||||
import { createRoute } from "../../../modules/api-utils/createRoute";
|
||||
import { authMiddleware } from "../../middleware/authorization";
|
||||
|
||||
const updateSchema = z
|
||||
.object({
|
||||
name: z.string().optional(),
|
||||
image: z.string().optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export default createRoute(
|
||||
"patch",
|
||||
["/@me"],
|
||||
async (c) => {
|
||||
const updatedUser = await c.get("user")?.update(await c.req.json());
|
||||
const body = updateSchema.parse(await c.req.json());
|
||||
const updatedUser = await c.get("user")?.update(body);
|
||||
const response = apiResponse.successful(
|
||||
"Successfully updated user.",
|
||||
updatedUser?.toJson(),
|
||||
|
||||
Reference in New Issue
Block a user