setup unifi wlans
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { createRoute } from "../../modules/api-utils/createRoute";
|
||||
import { credentials } from "../../managers/credentials";
|
||||
import { apiResponse } from "../../modules/api-utils/apiResponse";
|
||||
import { ContentfulStatusCode } from "hono/utils/http-status";
|
||||
import { authMiddleware } from "../middleware/authorization";
|
||||
|
||||
/* GET /v1/credential/credentials/:id/sub-credentials */
|
||||
export default createRoute(
|
||||
"get",
|
||||
["/credentials/:id/sub-credentials"],
|
||||
|
||||
async (c) => {
|
||||
const parentId = c.req.param("id");
|
||||
|
||||
// Verify the parent credential exists
|
||||
await credentials.fetch(parentId);
|
||||
|
||||
const subCredentials = await credentials.fetchSubCredentials(parentId);
|
||||
|
||||
const response = apiResponse.successful(
|
||||
"Sub-Credentials Fetched Successfully!",
|
||||
subCredentials.map((sc) => sc.toJson()),
|
||||
);
|
||||
return c.json(response, response.status as ContentfulStatusCode);
|
||||
},
|
||||
authMiddleware({
|
||||
permissions: ["credential.fetch", "credential.sub_credentials.fetch"],
|
||||
}),
|
||||
);
|
||||
Reference in New Issue
Block a user