import { MongoHelper } from "../helpers/mongo-helper";

export class AccountMongoRepository implements AddAccountRepository, loadAccountByEmailRepository, UpdateAccessTokenRepository {
    async add(account: AddAccountModel): Promise<AccountModel> {
        const accountCollection = await MongoHelper.getCollection('accounts')
        const result = await accountCollection.insertOne(account)
        const accountData = await accountCollection.findOne(result.insertedId)
        return MongoHelper.map(accountData);
    }
