feat: add user submission functionality

This commit is contained in:
2026-07-05 21:45:45 +03:30
parent afb5045cf0
commit 7b44542ce7
48 changed files with 1459 additions and 55 deletions
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { Inject, Injectable } from '@nestjs/common';
import { REDIS } from '../constants/redis.constants';
import Redis from 'ioredis';
@@ -17,16 +16,22 @@ export class RedisService {
return this.redis;
}
async set(key: string, val: string, ttl?: number) {
async set<T>(key: string, val: T, ttl?: number) {
const payload = JSON.stringify(val);
if (ttl) {
await this.redis.set(key, val, 'EX', ttl);
await this.redis.set(key, payload, 'EX', ttl);
} else {
await this.redis.set(key, val);
await this.redis.set(key, payload);
}
}
async get(key: string) {
return await this.redis.get(key);
async get<T>(key: string): Promise<T | null> {
const value = await this.redis.get(key);
if (!value) return null;
return JSON.parse(value) as T;
}
async del(key: string) {