♻️ refactor: add schema to all controllers in internal module

This commit is contained in:
2026-03-08 14:50:54 +07:00
parent 9f47f8f298
commit 595a79de34
8 changed files with 269 additions and 84 deletions

View File

@ -3,15 +3,18 @@ import { mainErrorHandler } from "../../../helpers/error/handler";
import { returnWriteResponse } from "../../../helpers/callback/httpResponse";
import { purgeUnusedSessionService } from "../services/http/purgeUnusedSession.service";
/**
* Controller for purging unused user sessions
*
* This controller handles the HTTP request for purging all unused user sessions. It will delete all unused sessions from the database based on their authentication status and deleted status.
* The response will indicate the success of the operation and may include details about the number of sessions purged if the environment is running in development mode.
*
* See OpenAPI documentation for request/response schema.
*/
export const purgeUnusedSessionController = async (ctx: Context) => {
try {
const result = await purgeUnusedSessionService();
return returnWriteResponse(
ctx.set,
200,
"Successfully purged all unused user sessions",
result,
);
return returnWriteResponse(ctx.set, 200, "Successfully purged all unused user sessions", result);
} catch (error) {
return mainErrorHandler(ctx.set, error);
}