forked from mirrors/misskey
refactor: migrate to typeorm 3.0 (#8443)
* wip * wip * wip * Update following.ts * wip * wip * wip * Update resolve-user.ts * maxQueryExecutionTime * wip * wip
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
import { EntityRepository, Repository } from 'typeorm';
|
||||
import { db } from '@/db/postgre.js';
|
||||
import { Users } from '../index.js';
|
||||
import { Blocking } from '@/models/entities/blocking.js';
|
||||
import { awaitAll } from '@/prelude/await-all.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
|
||||
@EntityRepository(Blocking)
|
||||
export class BlockingRepository extends Repository<Blocking> {
|
||||
public async pack(
|
||||
export const BlockingRepository = db.getRepository(Blocking).extend({
|
||||
async pack(
|
||||
src: Blocking['id'] | Blocking,
|
||||
me?: { id: User['id'] } | null | undefined
|
||||
): Promise<Packed<'Blocking'>> {
|
||||
const blocking = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
||||
const blocking = typeof src === 'object' ? src : await this.findOneByOrFail({ id: src });
|
||||
|
||||
return await awaitAll({
|
||||
id: blocking.id,
|
||||
@@ -21,12 +20,12 @@ export class BlockingRepository extends Repository<Blocking> {
|
||||
detail: true,
|
||||
}),
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
public packMany(
|
||||
packMany(
|
||||
blockings: any[],
|
||||
me: { id: User['id'] }
|
||||
) {
|
||||
return Promise.all(blockings.map(x => this.pack(x, me)));
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user