feat(produser): added in the function to create a standard user based on there username

This commit is contained in:
2025-06-12 21:10:46 -05:00
parent 3283972809
commit 99ad79c662
13 changed files with 438 additions and 35 deletions

View File

@@ -0,0 +1,36 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../globalUtils/tryCatch.js";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { prodUser } from "../controller/produser.js";
import { getProdRoles } from "../controller/getprodRoles.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["admin"],
summary: "Returns the current prod roles",
method: "get",
path: "/prodrole",
responses: responses(),
}),
async (c) => {
const { data, error } = await tryCatch(getProdRoles());
apiHit(c, { endpoint: "/prodrole" });
if (error) {
return c.json({
success: false,
message: "Error getting new role.",
});
}
return c.json({
success: data.success,
message: data.message,
data: data.data,
});
}
);
export default app;