<commit_before>import "sequelize";
import { User } from '../../lib/model';
import database from "../database/database";

export function getAll(): Promise<User[]> {
    return database.users.findAll() as any;
}

export function getById(id: number): Promise<User> {
    return database.users.findById(id) as any;
}

export function create(user: User): Promise<User> {
    user.id = null;
    return database.users.create(user) as any;
}

export function getByAttr(attr: string, value: string): Promise<User> {
    return database.users.findOne({where: {attr: value}}) as any;
}<commit_msg>attr is unknown property in user model<commit_after>import "sequelize";
import { User } from '../../lib/model';
import database from "../database/database";

export function getAll(): Promise<User[]> {
    return database.users.findAll() as any;
}

export function getById(id: number): Promise<User> {
    return database.users.findById(id) as any;
}

export function create(user: User): Promise<User> {
    user.id = null;
    return database.users.create(user) as any;
}

export function getByAttr(attr: string, value: string): Promise<User> {
    return database.users.findOne({where: {[attr]: value}}) as any;
}
{'fraction_non_alphanumeric': 0.14962593516209477, 'fraction_numerical': 0.0, 'mean_word_length': 4.548387096774194, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1765207', 'n_tokens_mistral': 362, 'n_tokens_neox': 362, 'n_words': 108}