perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように

This commit is contained in:
syuilo
2023-10-16 10:45:22 +09:00
parent 15706c8c2b
commit 1fa1d31696
171 changed files with 442 additions and 537 deletions

View File

@@ -80,8 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const now = new Date();
await this.accessTokensRepository.insert({
id: this.idService.genId(),
createdAt: now,
id: this.idService.gen(now.getTime()),
lastUsedAt: now,
appId: session.appId,
userId: me.id,

View File

@@ -79,8 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Create session token document
const doc = await this.authSessionsRepository.insert({
id: this.idService.genId(),
createdAt: new Date(),
id: this.idService.gen(),
appId: app.id,
token: token,
}).then(x => this.authSessionsRepository.findOneByOrFail(x.identifiers[0]));