Companies are now listing properly
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { ContentfulStatusCode } from "hono/utils/http-status";
|
||||
import { apiResponse } from "../../../modules/api-utils/apiResponse";
|
||||
import { createRoute } from "../../../modules/api-utils/createRoute";
|
||||
import { authMiddleware } from "../../middleware/authorization";
|
||||
|
||||
// /v1/user/@me
|
||||
export default createRoute(
|
||||
"get",
|
||||
["/@me"],
|
||||
(c) => {
|
||||
const response = apiResponse.successful(
|
||||
"Fetched user.",
|
||||
c.get("user")?.toJson(),
|
||||
);
|
||||
return c.json(response, response.status as ContentfulStatusCode);
|
||||
},
|
||||
authMiddleware({ scopes: ["user.read"] }),
|
||||
);
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as fetch } from "./fetch";
|
||||
export { default as update } from "./update";
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ContentfulStatusCode } from "hono/utils/http-status";
|
||||
import { apiResponse } from "../../../modules/api-utils/apiResponse";
|
||||
import { createRoute } from "../../../modules/api-utils/createRoute";
|
||||
import { authMiddleware } from "../../middleware/authorization";
|
||||
|
||||
export default createRoute(
|
||||
"patch",
|
||||
["/@me"],
|
||||
async (c) => {
|
||||
const updatedUser = await c.get("user")?.update(await c.req.json());
|
||||
const response = apiResponse.successful(
|
||||
"Successfully updated user.",
|
||||
updatedUser?.toJson(),
|
||||
);
|
||||
|
||||
return c.json(response, response.status as ContentfulStatusCode);
|
||||
},
|
||||
authMiddleware({ scopes: ["user.write"] }),
|
||||
);
|
||||
Reference in New Issue
Block a user