From b9b464c1053732e93ad0d769833eccf9c0c107e5 Mon Sep 17 00:00:00 2001
From: Petr Kachanovsky
Date: Tue, 18 Mar 2025 10:42:35 +0200
Subject: [PATCH] fix: add fillOnCreate function type
---
adminforth/types/Common.ts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/adminforth/types/Common.ts b/adminforth/types/Common.ts
index d6b04a0c2..c283d1d9e 100644
--- a/adminforth/types/Common.ts
+++ b/adminforth/types/Common.ts
@@ -556,6 +556,11 @@ export interface AdminForthForeignResourceCommon {
unsetLabel?: string,
}
+export type FillOnCreateFunction = (params: {
+ initialRecord: any,
+ adminUser: AdminUser,
+}) => any;
+
/**
* Column describes one field in the table or collection in database.
*/
@@ -686,7 +691,7 @@ export interface AdminForthResourceColumnInputCommon {
/**
* Called on the backend when the record is saved to a database. Value returned by `fillOnCreate` will be saved to the database.
*/
- fillOnCreate?: Function,
+ fillOnCreate?: FillOnCreateFunction,
/**
* Single value that will be substituted in create form. User can change it before saving the record.