Skip to content

Commit 1ec8a19

Browse files
committed
fix: do not allowed pass backend olnly fields to the front
1 parent 5989e7c commit 1ec8a19

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ export default class UploadPlugin extends AdminForthPlugin {
258258
if (!resourceConfig.columns.find((column: any) => column.name === field)) {
259259
const similar = suggestIfTypo(resourceConfig.columns.map((column: any) => column.name), field);
260260
throw new Error(`Field "${field}" specified in generationPrompt not found in resource "${resourceConfig.label}". ${similar ? `Did you mean "${similar}"?` : ''}`);
261+
} else {
262+
let column = resourceConfig.columns.find((column: any) => column.name === field);
263+
if (column.backendOnly === true) {
264+
throw new Error(`Field "${field}" specified in generationPrompt is marked as backendOnly in resource "${resourceConfig.label}". Please remove backendOnly or choose another field.`);
265+
}
261266
}
262267
});
263268
}

0 commit comments

Comments
 (0)