Skip to content

Commit

Permalink
fix: import table add projection field option
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxing9 committed Jan 6, 2025
1 parent b3b3caa commit aeb61ca
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export class ImportOpenApiService {
baseId: string,
tableId: string,
inplaceImportRo: IInplaceImportOptionRo,
maxRowCount?: number
maxRowCount?: number,
projection?: string[]
) {
const userId = this.cls.get('user.id');
const { attachmentUrl, fileType, insertConfig, notification = false } = inplaceImportRo;
Expand All @@ -144,14 +145,18 @@ export class ImportOpenApiService {
throw new BadRequestException('table is not found');
});

const fieldRaws = await this.prismaService.field.findMany({
let fieldRaws = await this.prismaService.field.findMany({
where: { tableId, deletedTime: null, hasError: null },
select: {
id: true,
type: true,
},
});

if (projection?.length) {
fieldRaws = fieldRaws.filter(({ id }) => projection.includes(id));
}

if (!tableRaw || !fieldRaws) {
return;
}
Expand Down

0 comments on commit aeb61ca

Please sign in to comment.