File tree Expand file tree Collapse file tree 6 files changed +10
-6
lines changed
documentation/docs/tutorial/07-Plugins Expand file tree Collapse file tree 6 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ model apartments {
9999Migrate prisma schema:
100100
101101` ` ` bash
102- npx prisma migrate dev -- name add - apartment - image
102+ npm run makemigration -- -- name add - apartment - image ; npm run migrate : local
103103` ` `
104104
105105Add column to ` aparts ` resource configuration:
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ model adminuser {
84842 . Run the migration:
8585
8686``` bash
87- npx prisma migrate dev --name add-email-confirmed-to-adminuser
87+ npm run makemigration -- --name add-email-confirmed-to-adminuser ; npm run migrate:local
8888```
8989
90903 . Configure the plugin with ` emailConfirmedField ` :
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ model adminuser {
143143Run the migration:
144144
145145``` bash
146- npx prisma migrate dev --name add-email-confirmed
146+ npm run makemigration -- --name add-email-confirmed ; npm run migrate:local
147147```
148148
149149Then update your resource configuration:
Original file line number Diff line number Diff line change @@ -522,6 +522,8 @@ class AdminForth implements IAdminForth {
522522 return { error : err } ;
523523 }
524524
525+ const recordWithVirtualColumns = { ...record } ;
526+
525527 // execute hook if needed
526528 for ( const hook of listify ( resource . hooks ?. create ?. beforeSave ) ) {
527529 console . log ( '🪲 Hook beforeSave' , hook ) ;
@@ -563,7 +565,7 @@ class AdminForth implements IAdminForth {
563565 return { error } ;
564566 }
565567
566- const primaryKey = record [ resource . columns . find ( ( col ) => col . primaryKey ) . name ] ;
568+ const primaryKey = createdRecord [ resource . columns . find ( ( col ) => col . primaryKey ) . name ] ;
567569
568570 // execute hook if needed
569571 for ( const hook of listify ( resource . hooks ?. create ?. afterSave ) ) {
@@ -574,6 +576,7 @@ class AdminForth implements IAdminForth {
574576 record : createdRecord ,
575577 adminUser,
576578 adminforth : this ,
579+ recordWithVirtualColumns,
577580 extra,
578581 } ) ;
579582
Original file line number Diff line number Diff line change 1818 </h5 >
1919
2020 <div class =" py-4 " >
21- <ul class =" space-y-3 font-medium" >
21+ <ul class =" space-y-3 font-medium text-sm " >
2222 <li v-for =" c in columnsWithFilter" :key =" c" >
2323 <div class =" flex flex-col" >
2424 <div class =" flex justify-between items-center" >
25- <p class =" dark:text-gray-400 h-7 my-1" >{{ c.label }}</p >
25+ <p class =" dark:text-gray-400 my-1" >{{ c.label }}</p >
2626 <Tooltip v-if =" filtersStore.filters.find(f => f.field === c.name)" >
2727 <button
2828 class =" flex items-center justify-center w-7 h-7 my-1 hover:border rounded-md hover:bg-gray-100 dark:hover:bg-gray-700"
Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ export type AfterCreateSaveFunction = (params: {
568568 adminUser : AdminUser ,
569569 record : any ,
570570 adminforth : IAdminForth ,
571+ recordWithVirtualColumns ?: any ,
571572 extra ?: HttpExtra ,
572573} ) => Promise < { ok : boolean , error ?: string } > ;
573574
You can’t perform that action at this time.
0 commit comments