import { Injectable } from '@nestjs/common';
import { PrismaService } from '@common/prisma/prisma.service';

@Injectable()
export class UserService {
  constructor(private readonly prisma: PrismaService) {}

  async getUserStats(userId: number) {
    const [watchlistCount, alertCount] = await Promise.all([
      this.prisma.watchlist.count({ where: { userId } }),
      this.prisma.priceAlert.count({ where: { userId } }),
    ]);

    return {
      watchlistCount,
      alertCount,
    };
  }
}
