🚚 create backup folder

create backup folder for archive the old modules
This commit is contained in:
Rafi Arrafif
2025-07-18 23:20:15 +07:00
parent 8eb68cf0ba
commit 8532d7e104
40 changed files with 671 additions and 671 deletions

View File

@ -0,0 +1,35 @@
import { Context } from "elysia";
import { createUserSessionService } from "../services/createUserSession.service";
import { getUserHeaderInformation } from "../../../helpers/http/userHeader/getUserHeaderInformation";
import { mainErrorHandler } from "../../../helpers/error/handler";
import {
returnErrorResponse,
returnWriteResponse,
} from "../../../helpers/callback/httpResponse";
export const createUserSessionRole = async (
ctx: Context & { body: { userId?: string } }
) => {
// Validate request body
if (!ctx.body?.userId) {
return returnErrorResponse(ctx.set, 400, "User ID is required");
}
// Get user device and browser information
const userHeaderData = getUserHeaderInformation(ctx);
try {
const newUserSession = await createUserSessionService({
userId: ctx.body.userId,
userHeaderInformation: userHeaderData,
});
return returnWriteResponse(
ctx.set,
201,
"User session created",
newUserSession
);
} catch (error) {
return mainErrorHandler(ctx.set, error);
}
};