Merge branch 'dev/methapon' into develop

This commit is contained in:
Methapon2001 2024-03-12 15:18:30 +07:00
commit 81b4e25086
3 changed files with 6 additions and 4 deletions

View file

@ -5,8 +5,10 @@ export function calculateAge(start: Date, end = new Date()) {
let month = end.getMonth() - start.getMonth();
let day = end.getDate() - start.getDate();
if (month < 0) year -= 1;
if (month < 0) month += 12;
if (month < 0) {
month += 12;
year -= 1;
}
if (day < 0) {
month -= 1;
day =

View file

@ -5,7 +5,7 @@ import { RequestWithUser } from "./user";
export function authRole(
role: string | string[],
errorMessage = "คุณไม่มีสิทธิในการเข้าถึงทรัพยากรดังกล่าว",
errorMessage: string = "คุณไม่มีสิทธิในการเข้าถึงทรัพยากรดังกล่าว",
) {
return (req: RequestWithUser, _res: express.Response, next: express.NextFunction) => {
if ((Array.isArray(role) && role.includes("*")) || role === "*") return next();

View file

@ -1,7 +1,7 @@
{
"entryFile": "src/app.ts",
"noImplicitAdditionalProperties": "throw-on-extras",
"controllerPathGlobs": ["src/controllers/*Controller.ts"],
"controllerPathGlobs": ["src/controllers/**/*Controller.ts"],
"spec": {
"outputDirectory": "src",
"specVersion": 3,