This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| import numpy as np | |
| import pandas as pd | |
| RAW = Path(__file__).parent.parent / "data" / "raw" / "cochilco" | |
| _CONSUMO = RAW / "consumo_agua_2024.xlsx" | |
| _PROYECCION = RAW / "proyeccion_demanda_2025_2034.xlsx" | |
| _PRODUCCION = RAW / "produccion_empresa_tabla17.xlsx" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable, NestMiddleware, HttpException, HttpStatus } from '@nestjs/common'; | |
| import { Request, Response, NextFunction } from 'express'; | |
| @Injectable() | |
| export class RateLimitMiddleware implements NestMiddleware { | |
| private requests = new Map<string, { count: number; lastRequest: number }>(); | |
| private limit = 10; | |
| private windowMs = 60 * 1000; | |
| use(req: Request, res: Response, next: NextFunction) { |