chore: commit oxfmt formatting changes and verify artifacts

This commit is contained in:
2026-07-02 15:55:09 +08:00
parent 34726cc46d
commit 4f4cee157a
77 changed files with 5576 additions and 1400 deletions

View File

@@ -5,9 +5,7 @@ import { OperationLog } from '../entities/operation-log.entity';
@Injectable()
export class OperationLogsService {
constructor(
@InjectRepository(OperationLog) private repo: Repository<OperationLog>,
) {}
constructor(@InjectRepository(OperationLog) private repo: Repository<OperationLog>) {}
async log(params: {
userId?: number;
@@ -33,16 +31,20 @@ export class OperationLogsService {
page?: number;
pageSize?: number;
}) {
const qb = this.repo.createQueryBuilder('log')
.orderBy('log.createdAt', 'DESC');
const qb = this.repo.createQueryBuilder('log').orderBy('log.createdAt', 'DESC');
if (query?.module) qb.andWhere('log.module = :module', { module: query.module });
if (query?.userId) qb.andWhere('log.userId = :userId', { userId: query.userId });
if (query?.startDate) qb.andWhere('log.createdAt >= :startDate', { startDate: query.startDate });
if (query?.endDate) qb.andWhere('log.createdAt <= :endDate', { endDate: query.endDate + ' 23:59:59' });
if (query?.startDate)
qb.andWhere('log.createdAt >= :startDate', { startDate: query.startDate });
if (query?.endDate)
qb.andWhere('log.createdAt <= :endDate', { endDate: query.endDate + ' 23:59:59' });
const page = query?.page || 1;
const pageSize = query?.pageSize || 50;
const [data, total] = await qb.skip((page - 1) * pageSize).take(pageSize).getManyAndCount();
const [data, total] = await qb
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
return { data, total, page, pageSize };
}
}