Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,30 @@
import { db } from "../../db/postgre.js";
import { App } from "../entities/app.js";
import { AccessTokens } from "../index.js";
export const AppRepository = db.getRepository(App).extend({
async pack (src, me, options) {
const opts = Object.assign({
detail: false,
includeSecret: false,
includeProfileImageIds: false
}, options);
const app = typeof src === "object" ? src : await this.findOneByOrFail({
id: src
});
return {
id: app.id,
name: app.name,
callbackUrl: app.callbackUrl,
permission: app.permission,
...opts.includeSecret ? {
secret: app.secret
} : {},
...me ? {
isAuthorized: await AccessTokens.countBy({
appId: app.id,
userId: me.id
}).then((count)=>count > 0)
} : {}
};
}
});