refactor: Upgrade typeorm to 0.3.x (#5151)
This commit is contained in:
committed by
GitHub
parent
6608e69457
commit
0a5ab560b1
@@ -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) } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user