fix: 优化后台体验与导出日志交互
This commit is contained in:
@@ -5,6 +5,7 @@ import { PrismaService } from '../prisma/prisma.service';
|
||||
import { StorageService } from '../storage/storage.service';
|
||||
import { BusinessException } from '../common/exceptions/business.exception';
|
||||
import { buildPage } from '../common/utils/pagination.util';
|
||||
import { buildOrderBy } from '../common/utils/sort.util';
|
||||
import { AuditArtworkDto, CreateArtworkDto, QueryArtworkDto, UpdateArtworkDto } from './dto/artwork.dto';
|
||||
|
||||
interface MediaItem {
|
||||
@@ -68,6 +69,7 @@ export class ArtworkService {
|
||||
if (query.auditStatus) where.auditStatus = query.auditStatus;
|
||||
if (query.templateId) where.templateId = query.templateId;
|
||||
|
||||
const orderBy = buildOrderBy(query.sortField, query.sortOrder, ['createdAt', 'updatedAt'] as const, { id: 'desc' });
|
||||
const [rows, total] = await this.prisma.$transaction([
|
||||
this.prisma.artwork.findMany({
|
||||
where,
|
||||
@@ -75,7 +77,7 @@ export class ArtworkService {
|
||||
template: { select: { id: true, name: true } },
|
||||
_count: { select: { traceCodes: true } },
|
||||
},
|
||||
orderBy: { id: 'desc' },
|
||||
orderBy,
|
||||
skip: query.skip,
|
||||
take: query.take,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user