server: refactor code

This commit is contained in:
fantasticit 2022-05-21 15:35:47 +08:00
parent 1dbbe990d3
commit 6550d7cb14
2 changed files with 2 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import { UserEntity } from '@entities/user.entity';
import { ViewEntity } from '@entities/view.entity';
import { WikiEntity } from '@entities/wiki.entity';
import { WikiUserEntity } from '@entities/wiki-user.entity';
import { getLogFileName } from '@helpers/log.helper';
import { getLogFileName, ONE_DAY } from '@helpers/log.helper';
import { CollectorModule } from '@modules/collector.module';
import { CommentModule } from '@modules/comment.module';
import { DocumentModule } from '@modules/document.module';
@ -53,8 +53,6 @@ const MODULES = [
ViewModule,
];
const ONE_DAY = 24 * 60 * 60 * 1000;
@Module({
imports: [
ConfigModule.forRoot({

View File

@ -1,6 +1,6 @@
import { dateFormat } from './date.helper';
const ONE_DAY = 24 * 60 * 60 * 1000;
export const ONE_DAY = 24 * 60 * 60 * 1000;
export function getLogFileName(date: Date | number, offsetDay = 0) {
return dateFormat(new Date(new Date(date).valueOf() - offsetDay * ONE_DAY), 'yyyy-MM-dd') + '.log';