chore: 登录失败也记录日志

This commit is contained in:
xiaojunnuo
2026-07-12 22:28:51 +08:00
parent bab1df2c78
commit bfb3ee4c43
18 changed files with 78 additions and 57 deletions
@@ -18,4 +18,5 @@ export type AuditLogContext = {
scope?: string;
userId?: number;
username?: string;
success?: boolean;
};
@@ -0,0 +1,13 @@
import { createRequestParamDecorator } from "@midwayjs/core";
export const AuditLog = (opts: { enabled?: boolean }) => {
return createRequestParamDecorator(ctx => {
if (!ctx.auditLog) {
ctx.auditLog = {};
}
if (opts.enabled !== undefined) {
ctx.auditLog.enabled = opts.enabled || true;
}
return ctx.auditLog;
});
};
@@ -0,0 +1 @@
export * from "./decoractor.js";
@@ -7,3 +7,4 @@ export * from "./result.js";
export * from "./base-service.js";
export * from "./audit.js";
export * from "./mode.js";
export * from "./core/index.js";