style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
+3
-4
@@ -3,7 +3,7 @@
|
||||
* Gerencia conexão e fornece helpers para cache e sessões
|
||||
*/
|
||||
|
||||
import { createClient, RedisClientType } from "redis";
|
||||
import { createClient, type RedisClientType } from "redis";
|
||||
|
||||
let client: RedisClientType | null = null;
|
||||
|
||||
@@ -13,7 +13,7 @@ let client: RedisClientType | null = null;
|
||||
function validateEnvVars() {
|
||||
if (!process.env.REDIS_DB) {
|
||||
throw new Error(
|
||||
"REDIS_DB não está definido. Configure a variável de ambiente REDIS_DB com a connection string do Redis."
|
||||
"REDIS_DB não está definido. Configure a variável de ambiente REDIS_DB com a connection string do Redis.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export async function isRedisConnected(): Promise<boolean> {
|
||||
* Fecha conexão com Redis
|
||||
*/
|
||||
export async function closeRedis(): Promise<void> {
|
||||
if (client && client.isOpen) {
|
||||
if (client?.isOpen) {
|
||||
await client.quit();
|
||||
client = null;
|
||||
console.log("🔌 Conexão Redis fechada");
|
||||
@@ -93,4 +93,3 @@ if (typeof process !== "undefined") {
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,7 +31,10 @@ export interface SessionData {
|
||||
/**
|
||||
* Cria ou atualiza uma sessão
|
||||
*/
|
||||
export async function setSession(sessionId: string, data: SessionData): Promise<void> {
|
||||
export async function setSession(
|
||||
sessionId: string,
|
||||
data: SessionData,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const client = getRedisClient();
|
||||
if (!client.isOpen) {
|
||||
@@ -54,7 +57,9 @@ export async function setSession(sessionId: string, data: SessionData): Promise<
|
||||
/**
|
||||
* Obtém dados de uma sessão
|
||||
*/
|
||||
export async function getSession(sessionId: string): Promise<SessionData | null> {
|
||||
export async function getSession(
|
||||
sessionId: string,
|
||||
): Promise<SessionData | null> {
|
||||
try {
|
||||
const client = getRedisClient();
|
||||
if (!client.isOpen) {
|
||||
@@ -146,4 +151,3 @@ export async function refreshSession(sessionId: string): Promise<void> {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user