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

@@ -12,6 +12,7 @@ import type { MiUser } from '@/models/User.js';
import type { MiRole } from '@/models/Role.js';
import { bindThis } from '@/decorators.js';
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
import { IdService } from '@/core/IdService.js';
@Injectable()
export class RoleEntityService {
@@ -21,6 +22,8 @@ export class RoleEntityService {
@Inject(DI.roleAssignmentsRepository)
private roleAssignmentsRepository: RoleAssignmentsRepository,
private idService: IdService,
) {
}
@@ -51,7 +54,7 @@ export class RoleEntityService {
return await awaitAll({
id: role.id,
createdAt: role.createdAt.toISOString(),
createdAt: this.idService.parse(role.id).date.toISOString(),
updatedAt: role.updatedAt.toISOString(),
name: role.name,
description: role.description,