Skip to content

Commit

Permalink
feat: inplace import auth validate
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxing9 committed Mar 29, 2024
1 parent 15e1b40 commit 67969e5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class ImportController {
}

@Patch(':tableId')
@Permissions('table|import')
async inplaceImportTable(
@Param('tableId') tableId: string,
@Body(new ZodValidationPipe(inplaceImportOptionRoSchema))
Expand Down
21 changes: 20 additions & 1 deletion apps/nestjs-backend/test/table-import.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ describe('/import/{tableId} OpenAPI ImportController (e2e) (Patch)', () => {
name: 'field_6',
},
],
records: [],
});
const tableId = tableRes.data.id;
const fields = tableRes?.data?.fields;
Expand Down Expand Up @@ -349,6 +350,24 @@ describe('/import/{tableId} OpenAPI ImportController (e2e) (Patch)', () => {

bases.push([baseId, tableId]);

expect(records?.length).toBe(5);
const tableRecords = records?.map((r) => r.fields);

const assertRecords = [
{
field_1: 1,
field_2: 'string_1',
field_3: true,
field_4: '2022-11-10T08:00:00.000Z',
field_6: 'long\ntext',
},
{
field_1: 2,
field_2: 'string_2',
field_4: '2022-11-11T08:00:00.000Z',
},
];

expect(records?.length).toBe(2);
expect(tableRecords).toEqual(assertRecords);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function FieldSelector(props: IFieldSelector) {
}

return (
<Popover open={open} onOpenChange={setOpen} modal={true}>
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger className="w-full" asChild>
<Button
variant="outline"
Expand Down

0 comments on commit 67969e5

Please sign in to comment.