perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように
This commit is contained in:
@@ -36,7 +36,6 @@ describe('AnnouncementService', () => {
|
||||
const un = secureRndstr(16);
|
||||
return usersRepository.insert({
|
||||
id: genAidx(new Date()),
|
||||
createdAt: new Date(),
|
||||
username: un,
|
||||
usernameLower: un,
|
||||
...data,
|
||||
@@ -44,10 +43,9 @@ describe('AnnouncementService', () => {
|
||||
.then(x => usersRepository.findOneByOrFail(x.identifiers[0]));
|
||||
}
|
||||
|
||||
function createAnnouncement(data: Partial<MiAnnouncement> = {}) {
|
||||
function createAnnouncement(data: Partial<MiAnnouncement & { createdAt: Date }> = {}) {
|
||||
return announcementsRepository.insert({
|
||||
id: genAidx(new Date()),
|
||||
createdAt: new Date(),
|
||||
id: genAidx(data.createdAt ?? new Date()),
|
||||
updatedAt: null,
|
||||
title: 'Title',
|
||||
text: 'Text',
|
||||
|
Reference in New Issue
Block a user