0a9588abb7
- 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
15 lines
505 B
TypeScript
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();
|
|
});
|
|
}
|
|
}
|