♻️ refactor: add schema to all controllers in internal module
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user