refactor: Upgrade typeorm to 0.3.x (#5151)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-13 18:12:22 +01:00
committed by GitHub
parent 6608e69457
commit 0a5ab560b1
85 changed files with 579 additions and 636 deletions

View File

@@ -1,15 +1,16 @@
import { EntityManager, In } from 'typeorm';
import { EntityManager, FindOptionsWhere, In } from 'typeorm';
import * as Db from '@/Db';
import { User } from '@db/entities/User';
export class UserService {
static async get(user: Partial<User>): Promise<User | undefined> {
return Db.collections.User.findOne(user, {
static async get(where: FindOptionsWhere<User>): Promise<User | null> {
return Db.collections.User.findOne({
relations: ['globalRole'],
where,
});
}
static async getByIds(transaction: EntityManager, ids: string[]) {
return transaction.find(User, { id: In(ids) });
return transaction.find(User, { where: { id: In(ids) } });
}
}