Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add beforeOperation.[create|update|delete] and afterOperation.[create|update|delete] operation routing for list hooks #8826

Merged
merged 8 commits into from
Sep 25, 2023
Prev Previous commit
less optional usage, fix tests
  • Loading branch information
dcousens committed Sep 25, 2023
commit da90b623c2d8559253bb091bd894726b652fc0fb
12 changes: 6 additions & 6 deletions packages/core/src/lib/core/initialise-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export type InitialisedField = {
cacheHint: CacheHint | undefined;
};
ui: {
label: string;
description: string;
views: string;
label: string | null;
description: string | null;
views: string | null;
createView: {
fieldMode: MaybeSessionFunction<'edit' | 'hidden', any>;
};
Expand Down Expand Up @@ -348,9 +348,9 @@ function getListsWithInitialisedFields(
},
},
ui: {
label: f.label ?? '',
description: f.ui?.description ?? '',
views: f.ui?.views ?? '',
label: f.label ?? null,
description: f.ui?.description ?? null,
views: f.ui?.views ?? null,
createView: {
fieldMode: _isEnabled.create ? fieldModes.create : 'hidden',
},
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/lib/create-admin-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,22 @@ export function createAdminMeta(
description: field.ui.description ?? null,
viewsIndex: getViewId(field.views),
customViewsIndex:
field.ui?.views === undefined
field.ui.views === null
? null
: (assertValidView(field.views, `lists.${listKey}.fields.${fieldKey}.ui.views`),
getViewId(field.ui.views)),
fieldMeta: null,
listKey: listKey,
search: list.ui.searchableFields.get(fieldKey) ?? null,
createView: {
fieldMode: normalizeMaybeSessionFunction(field.ui?.createView.fieldMode),
fieldMode: normalizeMaybeSessionFunction(field.ui.createView.fieldMode),
},
itemView: {
fieldMode: field.ui?.itemView.fieldMode,
fieldPosition: field.ui?.itemView?.fieldPosition || 'form',
fieldMode: field.ui.itemView.fieldMode,
fieldPosition: field.ui.itemView.fieldPosition,
},
listView: {
fieldMode: normalizeMaybeSessionFunction(field.ui?.listView?.fieldMode),
fieldMode: normalizeMaybeSessionFunction(field.ui.listView.fieldMode),
},
isFilterable: normalizeIsOrderFilter(
field.input?.where ? field.graphql.isEnabled.filter : false,
Expand Down