perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように
This commit is contained in:
parent
15706c8c2b
commit
1fa1d31696
171 changed files with 442 additions and 537 deletions
|
@ -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',
|
||||
|
|
|
@ -38,7 +38,6 @@ describe('RoleService', () => {
|
|||
const un = secureRndstr(16);
|
||||
return usersRepository.insert({
|
||||
id: genAidx(new Date()),
|
||||
createdAt: new Date(),
|
||||
username: un,
|
||||
usernameLower: un,
|
||||
...data,
|
||||
|
@ -49,7 +48,6 @@ describe('RoleService', () => {
|
|||
function createRole(data: Partial<MiRole> = {}) {
|
||||
return rolesRepository.insert({
|
||||
id: genAidx(new Date()),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastUsedAt: new Date(),
|
||||
description: '',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue