feat(produser): added in the function to create a standard user based on there username
This commit is contained in:
36
server/services/prodUser/routes/getProdRoles.ts
Normal file
36
server/services/prodUser/routes/getProdRoles.ts
Normal 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;
|
||||
Reference in New Issue
Block a user