import { DataSource } from 'typeorm';
import { MetaEntity } from '../../../entities';

export async function handleGetCurrentUserId(dataSource: DataSource): Promise<string | null> {
  const metaRepo = dataSource.getRepository(MetaEntity);
  const metaRow = await metaRepo.findOne({ where: { key: 'currentUserId' } });

  return metaRow?.value?.trim() || null;
}
