fix: resolve TypeScript compilation errors in API
- Add explicit IRouter type to all route files - Add explicit Express type to app.ts - Fix env.ts by moving getCorsOrigins after parsing - Fix token.ts SignOptions type for expiresIn - Cast req.params.id to String() in controllers Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import jwt from 'jsonwebtoken';
|
||||
import jwt, { type SignOptions } from 'jsonwebtoken';
|
||||
import type { JWTPayload } from '@horux/shared';
|
||||
import { env } from '../config/env.js';
|
||||
|
||||
export function generateAccessToken(payload: Omit<JWTPayload, 'iat' | 'exp'>): string {
|
||||
return jwt.sign(payload, env.JWT_SECRET, {
|
||||
expiresIn: env.JWT_EXPIRES_IN,
|
||||
});
|
||||
const options: SignOptions = {
|
||||
expiresIn: env.JWT_EXPIRES_IN as SignOptions['expiresIn'],
|
||||
};
|
||||
return jwt.sign(payload, env.JWT_SECRET, options);
|
||||
}
|
||||
|
||||
export function generateRefreshToken(payload: Omit<JWTPayload, 'iat' | 'exp'>): string {
|
||||
return jwt.sign(payload, env.JWT_SECRET, {
|
||||
expiresIn: env.JWT_REFRESH_EXPIRES_IN,
|
||||
});
|
||||
const options: SignOptions = {
|
||||
expiresIn: env.JWT_REFRESH_EXPIRES_IN as SignOptions['expiresIn'],
|
||||
};
|
||||
return jwt.sign(payload, env.JWT_SECRET, options);
|
||||
}
|
||||
|
||||
export function verifyToken(token: string): JWTPayload {
|
||||
|
||||
Reference in New Issue
Block a user