<commit_before>﻿using MongoDB.Driver;
using AtomicChessPuzzles.Models;

namespace AtomicChessPuzzles.DbRepositories
{
    public class UserRepository : IUserRepository
    {
        MongoSettings settings;
        IMongoDatabase database;
        IMongoCollection<User> userCollection;

        public UserRepository()
        {
            settings = new MongoSettings();
        }

        private void GetDatabase()
        {
            MongoClient client = new MongoClient(settings.MongoConnectionString);
            userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName);
        }

        public void Add(User user)
        {
            userCollection.InsertOne(user);
        }

        public void Update(User user)
        {
            userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID), user);
        }

        public void Delete(User user)
        {<commit_msg>Remove unused variable in UserRepository<commit_after>﻿using MongoDB.Driver;
using AtomicChessPuzzles.Models;

namespace AtomicChessPuzzles.DbRepositories
{
    public class UserRepository : IUserRepository
    {
        MongoSettings settings;
        IMongoCollection<User> userCollection;

        public UserRepository()
        {
            settings = new MongoSettings();
        }

        private void GetDatabase()
        {
            MongoClient client = new MongoClient(settings.MongoConnectionString);
            userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName);
        }

        public void Add(User user)
        {
            userCollection.InsertOne(user);
        }

        public void Update(User user)
        {
            userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID), user);
        }

        public void Delete(User user)
        {
{'fraction_non_alphanumeric': 0.07872784150156413, 'fraction_numerical': 0.0, 'mean_word_length': 2.384479717813051, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4260557', 'n_tokens_mistral': 489, 'n_tokens_neox': 464, 'n_words': 98}