-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Integrate with Butter CMS #66
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've could seen some of the functions being moved from one dir to another like serializers, but I think that you've removed some code related to Saleor CMS and we should keep it
@@ -1,23 +1,3 @@ | |||
import type { LanguageCodeEnum } from "@nimara/codegen/schema"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why Saleor CMS types are being removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved types related to use case to folder use-case (same as search case).
@@ -1,12 +0,0 @@ | |||
import { cmsPageGetUseCase } from "#root/use-cases/cms-page/cms-page-get-use-case"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you delete the Saleor CMS infra? I've thought about keeping ButterCMS and Saleor infra and using one or another depending of the needs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved it to another file.
} from "../graphql/queries/generated"; | ||
import type { CMSMenuGetInfra, SaleorCMSMenuServiceConfig } from "../types"; | ||
|
||
const serializeMenuItem = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it still needed for Saleor CMS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is but I created separated file for serializers and move it there.
import type { MenuItem } from "@nimara/domain/objects/Menu"; | ||
import { loggingService } from "@nimara/infrastructure/logging/service"; | ||
|
||
export const getAttributes = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it is being removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not use it anymore (there is new serializer which returns fields of cms data).
? item.category[0].split("category[_id=")[1]?.split("]")[0] || "" | ||
: ""; | ||
|
||
const category: Category | null = categoryId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const category: Category | null = categoryId | |
const category = categoryId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one last very small change and you can merge
typeof item.page === "string" | ||
? item.page.split("/").filter(Boolean).pop() || "" | ||
: ""; | ||
const page: Page | null = item.page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const page: Page | null = item.page | |
const page = item.page |
items: MenuGet_menu_Menu_items_MenuItem[] | ButterCMSMenuItem[], | ||
source: "saleor" | "butterCms", | ||
): Menu => { | ||
if (source === "saleor") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To jest problem trochę. Powinniśmy używać kompozycji zamiast budować takie warunki.
Co myslisz o tym by stworzyć dwie funkcje: jedną dla saleor, drugą dla butter.
Wtedy jedna z nich moze byc uzyta w infrze buttera, a druga w infrze saleora.
Od poziomu infry powinnismy byc provider specifc, ale z wyraznym oddzieleniem kodu różnych providerów, by uniknąc tego ze zmiana dla jednego providera spowoduje bug dla drugiego.
fields: SelectionAttributeFragment[] | ButterCMSPageFields, | ||
source: "saleor" | "butterCms", | ||
): PageField[] => { | ||
if (source === "saleor") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tak samo. Nigdzie nie powinnismy miec conditional z nazwą providera.
); | ||
|
||
return { | ||
menu: serializeMenu( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tutaj i tak jesteśmy w kontekscie providera.
I want to merge this change because it integrates with ButterCMS.
Pull Request Checklist