add basic controller auth
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import jwt from "jsonwebtoken";
|
||||
import { Context } from "elysia";
|
||||
import { JWTAuthToken } from "./types";
|
||||
import { returnErrorResponse } from "../../callback/httpResponse";
|
||||
import { parse } from "cookie";
|
||||
import { returnErrorResponse } from "../../../callback/httpResponse";
|
||||
|
||||
/**
|
||||
* Verifies the authentication cookie from the request header.
|
||||
@ -0,0 +1,7 @@
|
||||
import { Context } from "elysia";
|
||||
import { loginViaPasswordService } from "../services/loginViaPassword.service";
|
||||
|
||||
export const loginViaPassword = async (ctx: Context) => {
|
||||
const result = loginViaPasswordService(ctx);
|
||||
return result;
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
import Elysia from "elysia";
|
||||
import { loginViaPassword } from "./controller/loginViaPassword.controller";
|
||||
|
||||
export const authModule = new Elysia({ prefix: "/auth" }).post(
|
||||
"/legacy",
|
||||
loginViaPassword
|
||||
);
|
||||
|
||||
5
src/modules/auth/services/loginViaPassword.service.ts
Normal file
5
src/modules/auth/services/loginViaPassword.service.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { Context } from "elysia";
|
||||
|
||||
export const loginViaPasswordService = async (ctx: Context) => {
|
||||
return "OK PASSED";
|
||||
};
|
||||
@ -5,9 +5,9 @@ import {
|
||||
returnWriteResponse,
|
||||
} from "../../../helpers/callback/httpResponse";
|
||||
import { createUserRoleSchema } from "../userRole.schema";
|
||||
import { JWTDecodeToken } from "../../../helpers/jwt/decodeToken";
|
||||
import { createUserRoleService } from "../services/createUserRole.service";
|
||||
import { handlePrismaError } from "../../../utils/databases/prisma/error/handler";
|
||||
import { JWTDecodeToken } from "../../../helpers/cookies/jwt/decodeToken";
|
||||
|
||||
/**
|
||||
* @function createUserRole
|
||||
|
||||
@ -23,7 +23,7 @@ for (const folder of readdirSync(modulesPath, { withFileTypes: true })) {
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`Module ${folder.name} not found. Please check the module path or name.`
|
||||
`Module ${folder.name} not found. Please check the module path or name: ${error}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user