Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { db } from "../../db/postgre.js";
|
||||
import { Users } from "../index.js";
|
||||
import { AbuseUserReport } from "../entities/abuse-user-report.js";
|
||||
import { awaitAll } from "../../prelude/await-all.js";
|
||||
export const AbuseUserReportRepository = db.getRepository(AbuseUserReport).extend({
|
||||
async pack (src) {
|
||||
const report = typeof src === "object" ? src : await this.findOneByOrFail({
|
||||
id: src
|
||||
});
|
||||
return await awaitAll({
|
||||
id: report.id,
|
||||
createdAt: report.createdAt.toISOString(),
|
||||
comment: report.comment,
|
||||
resolved: report.resolved,
|
||||
reporterId: report.reporterId,
|
||||
targetUserId: report.targetUserId,
|
||||
assigneeId: report.assigneeId,
|
||||
reporter: Users.pack(report.reporter || report.reporterId, null, {
|
||||
detail: true
|
||||
}),
|
||||
targetUser: Users.pack(report.targetUser || report.targetUserId, null, {
|
||||
detail: true
|
||||
}),
|
||||
assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, {
|
||||
detail: true
|
||||
}) : null,
|
||||
forwarded: report.forwarded
|
||||
});
|
||||
},
|
||||
packMany (reports) {
|
||||
return Promise.all(reports.map((x)=>this.pack(x)));
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user