perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように
This commit is contained in:
parent
15706c8c2b
commit
1fa1d31696
171 changed files with 442 additions and 537 deletions
|
@ -11,6 +11,7 @@ import type { Packed } from '@/misc/json-schema.js';
|
|||
import type { } from '@/models/Blocking.js';
|
||||
import type { MiClip } from '@/models/Clip.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { UserEntityService } from './UserEntityService.js';
|
||||
|
||||
@Injectable()
|
||||
|
@ -23,6 +24,7 @@ export class ClipEntityService {
|
|||
private clipFavoritesRepository: ClipFavoritesRepository,
|
||||
|
||||
private userEntityService: UserEntityService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -36,7 +38,7 @@ export class ClipEntityService {
|
|||
|
||||
return await awaitAll({
|
||||
id: clip.id,
|
||||
createdAt: clip.createdAt.toISOString(),
|
||||
createdAt: this.idService.parse(clip.id).date.toISOString(),
|
||||
lastClippedAt: clip.lastClippedAt ? clip.lastClippedAt.toISOString() : null,
|
||||
userId: clip.userId,
|
||||
user: this.userEntityService.pack(clip.user ?? clip.userId),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue