import { EntityRepository } from '@mikro-orm/core';
import { APIKey } from '@/apps/_app/entities/apikey/_APIKey';

export class APIKeyRepository extends EntityRepository<APIKey> {
    async findAPIKeyByUserId(userId: number): Promise<APIKey | null> {
        return this.findOne({ user: userId });
    }

    async findAPIKeyByUserAndApp(userId: number, appId: number): Promise<APIKey | null> {
        return this.findOne({ user: userId, app: appId });
    }
}
