27 lines
942 B
TypeScript
27 lines
942 B
TypeScript
import { Hono } from "hono/tiny";
|
|
import { createRoute } from "../../../modules/api-utils/createRoute";
|
|
import { companies } from "../../../managers/companies";
|
|
import { apiResponse } from "../../../modules/api-utils/apiResponse";
|
|
import { ContentfulStatusCode } from "hono/utils/http-status";
|
|
import { authMiddleware } from "../../middleware/authorization";
|
|
|
|
/* /v1/company/companies/[id]/configurations */
|
|
export default createRoute(
|
|
"get",
|
|
["/companies/:identifier/configurations"],
|
|
|
|
async (c) => {
|
|
const company = await companies.fetch(c.req.param("identifier"));
|
|
const configurations = await company.fetchConfigurations();
|
|
|
|
const response = apiResponse.successful(
|
|
"Company Configurations Fetched Successfully!",
|
|
configurations,
|
|
);
|
|
return c.json(response, response.status as ContentfulStatusCode);
|
|
},
|
|
authMiddleware({
|
|
permissions: ["company.fetch", "company.fetch.configurations"],
|
|
}),
|
|
);
|