Files
aurak/server/src/i18n/i18n.middleware.ts
T
Developer 0a9588abb7 feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params)
- Add findByTemplateId method to service
- Add GET /by-template/:templateId endpoint to controller
- Service already includes CRUD for QuestionBank and QuestionBankItem
2026-04-23 17:19:11 +08:00

15 lines
505 B
TypeScript

import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { i18nStore } from './i18n.store';
import { DEFAULT_LANGUAGE } from '../common/constants';
@Injectable()
export class I18nMiddleware implements NestMiddleware {
use(req: Request, res: Response, next: NextFunction) {
const language = req.headers['x-user-language'] || DEFAULT_LANGUAGE;
i18nStore.run({ language: String(language) }, () => {
next();
});
}
}