feat: implement structured logging for server and client
Server: - Add pino and pino-http for structured logging - Create @Logged class decorator using Proxy pattern for automatic method logging - Add pino redact config for sensitive data (password, token, etc.) - Move AuthMiddleware to controllers folder (per architecture diagram) - Add LoggingMiddleware for HTTP request logging - Replace console.log/error with structured logger in controllers and app.ts - Decorate all repositories and GPTAdapter with @Logged Client: - Add react-native-logs with namespaced loggers (apiLogger, storeLogger) - Add request/response logging to ApiClient with duration tracking
This commit is contained in:
20
apps/server/src/controllers/AuthMiddleware.ts
Normal file
20
apps/server/src/controllers/AuthMiddleware.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import { verifyToken, TokenPayload } from "../utils/jwt";
|
||||
|
||||
export interface AuthenticatedRequest extends Request {
|
||||
user?: TokenPayload;
|
||||
}
|
||||
|
||||
export function authenticate(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response,
|
||||
next: NextFunction,
|
||||
): void {
|
||||
// TODO: Implement real JWT verification
|
||||
// Fake user for testing purposes
|
||||
req.user = {
|
||||
userId: "fake-user-id",
|
||||
email: "test@example.com",
|
||||
};
|
||||
next();
|
||||
}
|
||||
Reference in New Issue
Block a user