refactor(backend): 存在確認のfindOneByexistに置き換え (#11224)

* refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え

* cleanup
This commit is contained in:
okayurisotto
2023-07-11 14:58:58 +09:00
committed by GitHub
parent 48d3341462
commit cf3e39178b
42 changed files with 287 additions and 200 deletions

View File

@@ -58,12 +58,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const accessToken = secureRndstr(32);
// Fetch exist access token
const exist = await this.accessTokensRepository.findOneBy({
appId: session.appId,
userId: me.id,
const exist = await this.accessTokensRepository.exist({
where: {
appId: session.appId,
userId: me.id,
},
});
if (exist == null) {
if (!exist) {
const app = await this.appsRepository.findOneByOrFail({ id: session.appId });
// Generate Hash