wip
This commit is contained in:
parent
9ce6f99cad
commit
93ea327660
6 changed files with 92 additions and 86 deletions
|
|
@ -5,6 +5,8 @@ import { awaitAll } from '@/misc/prelude/await-all.js';
|
|||
import type { AbuseUserReport } from '@/models/entities/AbuseUserReport.js';
|
||||
import { UserEntityService } from './UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { Packed } from 'misskey-js';
|
||||
import { Serialized } from 'schema-type';
|
||||
|
||||
@Injectable()
|
||||
export class AbuseUserReportEntityService {
|
||||
|
|
@ -19,7 +21,7 @@ export class AbuseUserReportEntityService {
|
|||
@bindThis
|
||||
public async pack(
|
||||
src: AbuseUserReport['id'] | AbuseUserReport,
|
||||
) {
|
||||
): Promise<Serialized<Packed<'AbuseUserReport'>>> {
|
||||
const report = typeof src === 'object' ? src : await this.abuseUserReportsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
return await awaitAll({
|
||||
|
|
@ -46,7 +48,7 @@ export class AbuseUserReportEntityService {
|
|||
@bindThis
|
||||
public packMany(
|
||||
reports: any[],
|
||||
) {
|
||||
): Promise<Serialized<Packed<'AbuseUserReport'>>[]> {
|
||||
return Promise.all(reports.map(x => this.pack(x)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue