Skip to content

Commit 5675078

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents fcdbac2 + 39d5187 commit 5675078

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

adminforth/documentation/docs/tutorial/07-Plugins/05-upload.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ model apartments {
9999
Migrate 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
105105
Add column to `aparts` resource configuration:

adminforth/documentation/docs/tutorial/07-Plugins/11-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ model adminuser {
8484
2. 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

9090
3. Configure the plugin with `emailConfirmedField`:

adminforth/documentation/docs/tutorial/07-Plugins/16-email-invite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ model adminuser {
143143
Run 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

149149
Then update your resource configuration:

adminforth/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

adminforth/spa/src/components/Filters.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
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"

adminforth/types/Back.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)