import { IAdapter, RepositoryBuilder } from "@/contexts/common/domain";
import { UniqueID } from "@shared/contexts";
import { IProfileRepository, Profile } from "../domain";

export const findProfileByID = async (
  id: UniqueID,
  adapter: IAdapter,
  repository: RepositoryBuilder<IProfileRepository>
): Promise<Profile | null> => {
  return await adapter
    .startTransaction()
    .complete(async (t) => repository({ transaction: t }).getById(id));
};
