diff --git a/clients/fireback-react/src/sdk/fireback/core/react-tools.tsx b/clients/fireback-react/src/sdk/fireback/core/react-tools.tsx index 3e1f3811..7b3547c8 100644 --- a/clients/fireback-react/src/sdk/fireback/core/react-tools.tsx +++ b/clients/fireback-react/src/sdk/fireback/core/react-tools.tsx @@ -314,6 +314,7 @@ export function RemoteQueryProvider({ defaultExecFn, socket, credentialStorage, + prefix, }: { children: React.ReactNode; remote?: string; @@ -325,6 +326,7 @@ export function RemoteQueryProvider({ defaultExecFn?: any; socket?: boolean; credentialStorage?: CredentialStorage; + prefix?: string; }) { const [checked, setChecked] = useState(false); const [session, setSession$] = useState(); @@ -369,7 +371,7 @@ export function RemoteQueryProvider({ headers: { authorization: token || session?.token, }, - prefix: remote, + prefix: remote + prefix, }; if (selectedWorkspaceInternal) { diff --git a/modules/workspaces/codegen/react-native-new/src/modules/fireback/sdk/core/react-tools.tsx b/modules/workspaces/codegen/react-native-new/src/modules/fireback/sdk/core/react-tools.tsx index 04c0fd35..c623e4b0 100644 --- a/modules/workspaces/codegen/react-native-new/src/modules/fireback/sdk/core/react-tools.tsx +++ b/modules/workspaces/codegen/react-native-new/src/modules/fireback/sdk/core/react-tools.tsx @@ -314,6 +314,7 @@ export function RemoteQueryProvider({ defaultExecFn, socket, credentialStorage, + prefix, }: { children: React.ReactNode; remote?: string; @@ -325,6 +326,7 @@ export function RemoteQueryProvider({ defaultExecFn?: any; socket?: boolean; credentialStorage?: CredentialStorage; + prefix?: string; }) { const [checked, setChecked] = useState(false); const [session, setSession$] = useState(); @@ -369,7 +371,7 @@ export function RemoteQueryProvider({ headers: { authorization: token || session?.token, }, - prefix: remote, + prefix: remote + prefix, }; if (selectedWorkspaceInternal) { diff --git a/modules/workspaces/codegen/react-new/package-lock.json b/modules/workspaces/codegen/react-new/package-lock.json index 0c41b12c..361da604 100644 --- a/modules/workspaces/codegen/react-new/package-lock.json +++ b/modules/workspaces/codegen/react-new/package-lock.json @@ -42,6 +42,7 @@ "react-error-boundary": "^4.0.13", "react-phone-input-2": "^2.15.1", "react-query": "^3.39.3", + "react-resizable-panels": "^2.1.7", "react-router-dom": "^6.9.0", "react-scripts": "5", "react-select": "^5.7.2", @@ -17104,6 +17105,15 @@ "node": ">=0.10.0" } }, + "node_modules/react-resizable-panels": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.1.7.tgz", + "integrity": "sha512-JtT6gI+nURzhMYQYsx8DKkx6bSoOGFp7A3CwMrOb8y5jFHFyqwo9m68UhmXRw57fRVJksFn1TSlm3ywEQ9vMgA==", + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/react-router": { "version": "6.22.2", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.2.tgz", diff --git a/modules/workspaces/codegen/react-new/package.json b/modules/workspaces/codegen/react-new/package.json index 0fdb4cee..be5a4351 100644 --- a/modules/workspaces/codegen/react-new/package.json +++ b/modules/workspaces/codegen/react-new/package.json @@ -47,6 +47,7 @@ "react-error-boundary": "^4.0.13", "react-phone-input-2": "^2.15.1", "react-query": "^3.39.3", + "react-resizable-panels": "^2.1.7", "react-router-dom": "^6.9.0", "react-scripts": "5", "react-select": "^5.7.2", diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/apps/core/WithFireback.tsx b/modules/workspaces/codegen/react-new/src/modules/fireback/apps/core/WithFireback.tsx index 7813790e..9680953a 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/apps/core/WithFireback.tsx +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/apps/core/WithFireback.tsx @@ -10,6 +10,7 @@ import { RemoteQueryProvider as FirebackQueryProvider } from "../../sdk/core/rea export function WithFireback({ children, queryClient, + prefix, mockServer, config, }: { @@ -17,15 +18,16 @@ export function WithFireback({ queryClient: QueryClient; config: AppConfig; mockServer: any; + prefix?: string; }) { const { locale } = useLocale(); const t = useT(); - return ( { data?: T | null; @@ -100,6 +100,14 @@ export const CommonEntityManager = ({ }).catch((err) => httpErrorHanlder(err, t)); }; + const formWorking = + getSingleHook?.query?.isLoading || + false || + postHook?.query?.isLoading || + false || + patchHook?.query?.isLoading || + false; + useCommonCrudActions({ // onCancel: onCancel, onSave() { @@ -132,22 +140,24 @@ export const CommonEntityManager = ({ > {/*
{JSON.stringify(form.values, null, 2)}
*/} {/* */} -
- -
-
- {/* */} - + )} + + ); +}; diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/components/forms/form-uploader/FormUploader.tsx b/modules/workspaces/codegen/react-new/src/modules/fireback/components/forms/form-uploader/FormUploader.tsx index f9430ce5..0e0547a4 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/components/forms/form-uploader/FormUploader.tsx +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/components/forms/form-uploader/FormUploader.tsx @@ -9,6 +9,8 @@ import { useRef } from "react"; interface FormUploaderProps { onChange?: (value: FileEntity[]) => void; value?: FileEntity[] | any; + label?: string; + hint?: string; } function AttachmentViewer({ attachments }: { attachments: FileEntity[] }) { @@ -17,6 +19,9 @@ function AttachmentViewer({ attachments }: { attachments: FileEntity[] }) { return (
{(attachments || []).map((attachment) => { + if (!attachment) { + return
No attachment data
; + } return (
{attachment.type} @@ -43,7 +48,7 @@ function AttachmentViewer({ attachments }: { attachments: FileEntity[] }) { ); } -export const FormUploader = ({ onChange, value }: FormUploaderProps) => { +export const FormUploader = ({ onChange, value, label }: FormUploaderProps) => { const readonly = !!onChange; const { upload } = useFileUploader(); const data = useRef([]); @@ -74,7 +79,6 @@ export const FormUploader = ({ onChange, value }: FormUploaderProps) => { label: "Attach documents about the payment", extentions: ["*"], onCaptureFile(files) { - alert("hi"); Promise.all(uploadFn(files)).then((result) => {}); }, }); @@ -93,6 +97,7 @@ export const FormUploader = ({ onChange, value }: FormUploaderProps) => { return (
+ {label && } {readonly !== false && (
diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/components/layouts/useResponsiveThreshold.tsx b/modules/workspaces/codegen/react-new/src/modules/fireback/components/layouts/useResponsiveThreshold.tsx new file mode 100644 index 00000000..b2b93bc9 --- /dev/null +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/components/layouts/useResponsiveThreshold.tsx @@ -0,0 +1,56 @@ +import { useEffect, useState } from "react"; + +// Define types for the threshold and callback functions +type Threshold = { name: string; value: number }; +type Callback = (thresholdName: string) => void; + +function useResponsiveThresholds( + selector: string, + thresholds: Threshold[], + onEnter?: Callback, + onLeave?: Callback +): string | null { + const [currentThreshold, setCurrentThreshold] = useState(null); + + useEffect(() => { + const element = document.querySelector(selector); + if (!element) return; + + let lastThreshold: string | null = null; + + const resizeObserver = new ResizeObserver((entries) => { + for (const entry of entries) { + const width = entry.contentRect.width; + let newThreshold: string | null = null; + + // Determine the current threshold based on width + for (const { name, value } of thresholds) { + if (width < value) { + newThreshold = name; + break; + } + } + + // If the new threshold is different from the last, trigger enter/leave + if (newThreshold !== lastThreshold) { + if (newThreshold && onEnter) onEnter(newThreshold); // Entering a new threshold + if (lastThreshold && onLeave) onLeave(lastThreshold); // Leaving the last threshold + setCurrentThreshold(newThreshold); + lastThreshold = newThreshold; + } + } + }); + + resizeObserver.observe(element); + + // Clean up when component unmounts + return () => { + resizeObserver.unobserve(element); + resizeObserver.disconnect(); + }; + }, [selector, thresholds, onEnter, onLeave]); + + return currentThreshold; +} + +export default useResponsiveThresholds; diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/definitions/definitions.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/definitions/definitions.ts index a9dca48c..cdacc07d 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/definitions/definitions.ts +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/definitions/definitions.ts @@ -3,6 +3,7 @@ import { FormikProps } from "formik"; export enum KeyboardAction { NewEntity = "new_entity", + SidebarToggle = "sidebarToggle", NewChildEntity = "new_child_entity", EditEntity = "edit_entity", ViewQuestions = "view_questions", @@ -176,7 +177,6 @@ export interface Context { acceptLanguage: string; method: string; itemsPerPage: number; - jsonQuery?: string; startIndex?: number; paramValues: Array; } diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/hooks/uiStateContext.tsx b/modules/workspaces/codegen/react-new/src/modules/fireback/hooks/uiStateContext.tsx index dbedbc54..b677b442 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/hooks/uiStateContext.tsx +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/hooks/uiStateContext.tsx @@ -2,32 +2,127 @@ * Tools for authentication based on fireback ABAC plugin */ -import React, { useContext, useState } from "react"; +import React, { useContext, useEffect, useRef, useState } from "react"; +import { useResizeThreshold } from "./useResizeThreshold"; export interface IUIStateProvider { sidebarVisible: boolean; toggleSidebar: () => void; + setSidebarRef: (ref: any) => void; + updateSidebarSize: (size: number) => void; + sidebarItemSelected: () => void; + hide: () => void; + show: () => void; } export const UIStateContext = React.createContext({ sidebarVisible: false, toggleSidebar() {}, + setSidebarRef(ref) {}, + sidebarItemSelected() {}, + updateSidebarSize() {}, + hide() {}, + show() {}, }); export function useUiState() { return useContext(UIStateContext); } +// Hook to set a numeric value in localStorage +function usePostSidebarState() { + return (newValue) => { + if (typeof newValue === "number") { + localStorage.setItem("sidebarState", newValue.toString()); + } else { + console.error("Sidebar state must be a number."); + } + }; +} + +// Hook to get the numeric value from localStorage +function useGetSidebarState() { + const [state, setState] = useState(null); + + useEffect(() => { + const fetchState = async () => { + const savedValue = localStorage.getItem("sidebarState"); + setState(savedValue !== null ? parseFloat(savedValue) : null); + }; + + fetchState(); + }, []); + + return state; +} + export function UIStateProvider({ children }: { children: React.ReactNode }) { - const [sidebarVisible, setSidebarVisibility] = useState(false); + const panelRef = useRef(null); // This is the panel on the sidebar + const [sidebarVisible, setSidebarVisibility] = useState(false); + + const sidebarState = useGetSidebarState(); // Get the value + const setSidebarState = usePostSidebarState(); // Mutate the value + + useEffect(() => { + if (sidebarState || sidebarState === 0) { + panelRef.current?.resize(sidebarState); + } + }, [sidebarState]); + + const resize = (valuePrecentage: number) => { + setSidebarState(valuePrecentage); + panelRef.current?.resize(valuePrecentage); + }; + + useResizeThreshold(768, (exceeded) => { + resize(exceeded ? 0 : 20); + }); const toggleSidebar = () => { - setSidebarVisibility((s) => !s); + const isVisible = panelRef.current?.getSize(); + if (isVisible) { + resize(0); + setSidebarVisibility(false); + } else { + resize(20); + setSidebarVisibility(true); + } + }; + + const setSidebarRef = (ref) => { + panelRef.current = ref; + }; + + const hide = () => { + resize(0); + setSidebarVisibility(false); + }; + + const updateSidebarSize = (size: number) => { + resize(size); + }; + + const show = () => { + if (panelRef.current) { + resize(20); + setSidebarVisibility(true); + } + }; + + const sidebarItemSelected = () => { + if (window.innerWidth < 500) { + hide(); + } }; return ( { + let timeout; + + const checkThreshold = () => { + const currentWidth = window.innerWidth; + const isBelow = currentWidth < threshold; + + if ( + (lastWidth.current >= threshold && isBelow) || // Crossed from above to below + (lastWidth.current < threshold && !isBelow) // Crossed from below to above + ) { + callback(isBelow); + } + + lastWidth.current = currentWidth; + }; + + const debouncedResize = () => { + clearTimeout(timeout); + timeout = setTimeout(checkThreshold, debounceDelay); + }; + + window.addEventListener("resize", debouncedResize); + + // Initial check + checkThreshold(); + + // Cleanup + return () => { + window.removeEventListener("resize", debouncedResize); + clearTimeout(timeout); + }; + }, [threshold, callback, debounceDelay]); +} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/mock/api/sidebar.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/mock/api/sidebar.ts index da25e0a0..22912449 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/mock/api/sidebar.ts +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/mock/api/sidebar.ts @@ -16,7 +16,7 @@ export class SidebarMockServer { ): Promise>> { return { data: { - items: AppMenuEntities, + items: AppMenuEntities as any, }, }; } diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/mock/database/memory-db.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/mock/database/memory-db.ts index 9695e140..775c9078 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/mock/database/memory-db.ts +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/mock/database/memory-db.ts @@ -75,7 +75,7 @@ export class MemoryEntity { constructor(private content: T[]) {} items(ctx?: Context): T[] { - const jsonQuery = JSON.parse(ctx.jsonQuery); + const jsonQuery = JSON.parse((ctx as any).jsonQuery); let filtered = filterData(this.content, jsonQuery); return filtered.filter((item, index) => { if (index < ctx.startIndex - 1) { diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/core/react-tools.tsx b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/core/react-tools.tsx index 3e1f3811..7b3547c8 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/core/react-tools.tsx +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/core/react-tools.tsx @@ -314,6 +314,7 @@ export function RemoteQueryProvider({ defaultExecFn, socket, credentialStorage, + prefix, }: { children: React.ReactNode; remote?: string; @@ -325,6 +326,7 @@ export function RemoteQueryProvider({ defaultExecFn?: any; socket?: boolean; credentialStorage?: CredentialStorage; + prefix?: string; }) { const [checked, setChecked] = useState(false); const [session, setSession$] = useState(); @@ -369,7 +371,7 @@ export function RemoteQueryProvider({ headers: { authorization: token || session?.token, }, - prefix: remote, + prefix: remote + prefix, }; if (selectedWorkspaceInternal) { diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/BrandEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/BrandEntity.ts deleted file mode 100644 index bd9cd521..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/BrandEntity.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type BrandEntityKeys = - keyof typeof BrandEntity.Fields; -export class BrandEntity extends BaseEntity { - public children?: BrandEntity[] | null; - public name?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/brand/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/brand/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/brand/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/brands`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "brand/edit/:uniqueId", - Rcreate: "brand/new", - Rsingle: "brand/:uniqueId", - Rquery: "brands", - }; - public static definition = { - "name": "brand", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "validate": "required", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ] -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/CategoryEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/CategoryEntity.ts deleted file mode 100644 index 30eadbfe..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/CategoryEntity.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type CategoryEntityKeys = - keyof typeof CategoryEntity.Fields; -export class CategoryEntity extends BaseEntity { - public children?: CategoryEntity[] | null; - public name?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/category/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/category/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/category/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/categories`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "category/edit/:uniqueId", - Rcreate: "category/new", - Rsingle: "category/:uniqueId", - Rquery: "categories", - }; - public static definition = { - "name": "category", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "validate": "required", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ] -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountCodeEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountCodeEntity.ts deleted file mode 100644 index 50a18e5f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountCodeEntity.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -import { - CategoryEntity, -} from "./CategoryEntity" -import { - ProductSubmissionEntity, -} from "./ProductSubmissionEntity" -// In this section we have sub entities related to this object -// Class body -export type DiscountCodeEntityKeys = - keyof typeof DiscountCodeEntity.Fields; -export class DiscountCodeEntity extends BaseEntity { - public children?: DiscountCodeEntity[] | null; - public series?: string | null; - public limit?: number | null; - public valid?: any | null; - public validStart?: string[] | null; - public validEnd?: string[] | null; - public appliedProducts?: ProductSubmissionEntity[] | null; - appliedProductsListId?: string[] | null; - public excludedProducts?: ProductSubmissionEntity[] | null; - excludedProductsListId?: string[] | null; - public appliedCategories?: CategoryEntity[] | null; - appliedCategoriesListId?: string[] | null; - public excludedCategories?: CategoryEntity[] | null; - excludedCategoriesListId?: string[] | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-code/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/discount-code/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-code/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-codes`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "discount-code/edit/:uniqueId", - Rcreate: "discount-code/new", - Rsingle: "discount-code/:uniqueId", - Rquery: "discount-codes", - }; - public static definition = { - "name": "discountCode", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "series", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "limit", - "type": "int64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "valid", - "type": "daterange", - "computedType": "any", - "gormMap": {} - }, - { - "name": "appliedProducts", - "type": "many2many", - "target": "ProductSubmissionEntity", - "computedType": "ProductSubmissionEntity[]", - "gormMap": {} - }, - { - "name": "excludedProducts", - "type": "many2many", - "target": "ProductSubmissionEntity", - "computedType": "ProductSubmissionEntity[]", - "gormMap": {} - }, - { - "name": "appliedCategories", - "type": "many2many", - "target": "CategoryEntity", - "computedType": "CategoryEntity[]", - "gormMap": {} - }, - { - "name": "excludedCategories", - "type": "many2many", - "target": "CategoryEntity", - "computedType": "CategoryEntity[]", - "gormMap": {} - } - ], - "cliDescription": "List of all discount codes inside the application" -} -public static Fields = { - ...BaseEntity.Fields, - series: 'series', - limit: 'limit', - validStart: 'validStart', - validEnd: 'validEnd', - valid: 'valid', - appliedProductsListId: 'appliedProductsListId', - appliedProducts$: 'appliedProducts', - appliedProducts: ProductSubmissionEntity.Fields, - excludedProductsListId: 'excludedProductsListId', - excludedProducts$: 'excludedProducts', - excludedProducts: ProductSubmissionEntity.Fields, - appliedCategoriesListId: 'appliedCategoriesListId', - appliedCategories$: 'appliedCategories', - appliedCategories: CategoryEntity.Fields, - excludedCategoriesListId: 'excludedCategoriesListId', - excludedCategories$: 'excludedCategories', - excludedCategories: CategoryEntity.Fields, -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountScopeEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountScopeEntity.ts deleted file mode 100644 index df289b25..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountScopeEntity.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type DiscountScopeEntityKeys = - keyof typeof DiscountScopeEntity.Fields; -export class DiscountScopeEntity extends BaseEntity { - public children?: DiscountScopeEntity[] | null; - public name?: string | null; - public description?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-scope/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/discount-scope/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-scope/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-scopes`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "discount-scope/edit/:uniqueId", - Rcreate: "discount-scope/new", - Rsingle: "discount-scope/:uniqueId", - Rquery: "discount-scopes", - }; - public static definition = { - "name": "discountScope", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ], - "cliDescription": "Determine if the discount applies to the entire basket (total order) or per item, etc" -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountTypeEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountTypeEntity.ts deleted file mode 100644 index cda1244f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/DiscountTypeEntity.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type DiscountTypeEntityKeys = - keyof typeof DiscountTypeEntity.Fields; -export class DiscountTypeEntity extends BaseEntity { - public children?: DiscountTypeEntity[] | null; - public name?: string | null; - public description?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-type/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/discount-type/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-type/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/discount-types`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "discount-type/edit/:uniqueId", - Rcreate: "discount-type/new", - Rsingle: "discount-type/:uniqueId", - Rquery: "discount-types", - }; - public static definition = { - "name": "discountType", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ], - "cliDescription": "Types of the discounts" -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderEntity.ts deleted file mode 100644 index 78cca7f6..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderEntity.ts +++ /dev/null @@ -1,229 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -import { - CurrencyEntity, -} from "../currency/CurrencyEntity" -import { - DiscountCodeEntity, -} from "./DiscountCodeEntity" -import { - OrderStatusEntity, -} from "./OrderStatusEntity" -import { - PaymentStatusEntity, -} from "./PaymentStatusEntity" -import { - ProductSubmissionEntity, -} from "./ProductSubmissionEntity" -// In this section we have sub entities related to this object -export class OrderTotalPrice extends BaseEntity { - public amount?: number | null; - public currency?: CurrencyEntity | null; - currencyId?: string | null; -} -export class OrderItems extends BaseEntity { - public quantity?: number | null; - public price?: number | null; - public product?: ProductSubmissionEntity | null; - productId?: string | null; - public productSnapshot?: any | null; -} -// Class body -export type OrderEntityKeys = - keyof typeof OrderEntity.Fields; -export class OrderEntity extends BaseEntity { - public children?: OrderEntity[] | null; - public totalPrice?: OrderTotalPrice | null; - public shippingAddress?: string | null; - public paymentStatus?: PaymentStatusEntity | null; - paymentStatusId?: string | null; - public orderStatus?: OrderStatusEntity | null; - orderStatusId?: string | null; - public invoiceNumber?: string | null; - public discountCode?: DiscountCodeEntity | null; - discountCodeId?: string | null; - public items?: OrderItems[] | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/order/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/orders`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "order/edit/:uniqueId", - Rcreate: "order/new", - Rsingle: "order/:uniqueId", - Rquery: "orders", - rTotalPriceCreate: "order/:linkerId/total_price/new", - rTotalPriceEdit: "order/:linkerId/total_price/edit/:uniqueId", - editTotalPrice(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/${linkerId}/total_price/edit/${uniqueId}`; - }, - createTotalPrice(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/${linkerId}/total_price/new`; - }, - rItemsCreate: "order/:linkerId/items/new", - rItemsEdit: "order/:linkerId/items/edit/:uniqueId", - editItems(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/${linkerId}/items/edit/${uniqueId}`; - }, - createItems(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order/${linkerId}/items/new`; - }, - }; - public static definition = { - "permissions": [ - { - "name": "Confirm Order", - "key": "confirm", - "description": "Allows a person in the workspace to confirm an order" - } - ], - "name": "order", - "http": {}, - "gormMap": {}, - "fields": [ - { - "linkedTo": "OrderEntity", - "name": "totalPrice", - "type": "object", - "computedType": "OrderTotalPrice", - "gormMap": {}, - "fullName": "OrderTotalPrice", - "fields": [ - { - "name": "amount", - "type": "float64", - "validate": "required", - "computedType": "number", - "gormMap": {} - }, - { - "name": "currency", - "type": "one", - "target": "CurrencyEntity", - "module": "currency", - "computedType": "CurrencyEntity", - "gormMap": {} - } - ] - }, - { - "description": "Final computed shipping address which will be print on the product", - "name": "shippingAddress", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "paymentStatus", - "type": "one", - "target": "PaymentStatusEntity", - "validate": "required", - "computedType": "PaymentStatusEntity", - "gormMap": {} - }, - { - "name": "orderStatus", - "type": "one", - "target": "OrderStatusEntity", - "validate": "required", - "computedType": "OrderStatusEntity", - "gormMap": {} - }, - { - "name": "invoiceNumber", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "discountCode", - "type": "one", - "target": "DiscountCodeEntity", - "computedType": "DiscountCodeEntity", - "gormMap": {} - }, - { - "linkedTo": "OrderEntity", - "name": "items", - "type": "array", - "computedType": "OrderItems[]", - "gormMap": {}, - "fullName": "OrderItems", - "fields": [ - { - "name": "quantity", - "type": "float64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "price", - "type": "float64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "product", - "type": "one", - "target": "ProductSubmissionEntity", - "computedType": "ProductSubmissionEntity", - "gormMap": {} - }, - { - "name": "productSnapshot", - "type": "json", - "computedType": "any", - "gormMap": {} - } - ] - } - ], - "cliDescription": "Placed orders by users, history, and their status" -} -public static Fields = { - ...BaseEntity.Fields, - totalPrice$: 'totalPrice', - totalPrice: { - ...BaseEntity.Fields, - amount: 'amount', - currencyId: 'currencyId', - currency$: 'currency', - currency: CurrencyEntity.Fields, - }, - shippingAddress: 'shippingAddress', - paymentStatusId: 'paymentStatusId', - paymentStatus$: 'paymentStatus', - paymentStatus: PaymentStatusEntity.Fields, - orderStatusId: 'orderStatusId', - orderStatus$: 'orderStatus', - orderStatus: OrderStatusEntity.Fields, - invoiceNumber: 'invoiceNumber', - discountCodeId: 'discountCodeId', - discountCode$: 'discountCode', - discountCode: DiscountCodeEntity.Fields, - items$: 'items', - items: { - ...BaseEntity.Fields, - quantity: 'quantity', - price: 'price', - productId: 'productId', - product$: 'product', - product: ProductSubmissionEntity.Fields, - productSnapshot: 'productSnapshot', - }, -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderStatusEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderStatusEntity.ts deleted file mode 100644 index 5efdcaf1..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/OrderStatusEntity.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type OrderStatusEntityKeys = - keyof typeof OrderStatusEntity.Fields; -export class OrderStatusEntity extends BaseEntity { - public children?: OrderStatusEntity[] | null; - public name?: string | null; - public description?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order-status/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/order-status/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/order-status/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/order-statuses`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "order-status/edit/:uniqueId", - Rcreate: "order-status/new", - Rsingle: "order-status/:uniqueId", - Rquery: "order-statuses", - }; - public static definition = { - "name": "orderStatus", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ], - "cliDescription": "Status of an order" -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentMethodEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentMethodEntity.ts deleted file mode 100644 index 8636cfc7..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentMethodEntity.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type PaymentMethodEntityKeys = - keyof typeof PaymentMethodEntity.Fields; -export class PaymentMethodEntity extends BaseEntity { - public children?: PaymentMethodEntity[] | null; - public name?: string | null; - public description?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-method/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/payment-method/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-method/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-methods`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "payment-method/edit/:uniqueId", - Rcreate: "payment-method/new", - Rsingle: "payment-method/:uniqueId", - Rquery: "payment-methods", - }; - public static definition = { - "name": "paymentMethod", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ], - "cliDescription": "Method of payment" -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentStatusEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentStatusEntity.ts deleted file mode 100644 index 3ce142cc..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/PaymentStatusEntity.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type PaymentStatusEntityKeys = - keyof typeof PaymentStatusEntity.Fields; -export class PaymentStatusEntity extends BaseEntity { - public children?: PaymentStatusEntity[] | null; - public name?: string | null; - public description?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-status/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/payment-status/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-status/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/payment-statuses`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "payment-status/edit/:uniqueId", - Rcreate: "payment-status/new", - Rsingle: "payment-status/:uniqueId", - Rquery: "payment-statuses", - }; - public static definition = { - "name": "paymentStatus", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ], - "cliDescription": "Status of an payment" -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductEntity.ts deleted file mode 100644 index 84e03fd8..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductEntity.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -export class ProductFields extends BaseEntity { - public product?: ProductEntity | null; - productId?: string | null; - public name?: string | null; - public type?: string | null; -} -// Class body -export type ProductEntityKeys = - keyof typeof ProductEntity.Fields; -export class ProductEntity extends BaseEntity { - public children?: ProductEntity[] | null; - public name?: string | null; - public description?: string | null; - public uiSchema?: any | null; - public jsonSchema?: any | null; - public fields?: ProductFields[] | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/product/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/products`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "product/edit/:uniqueId", - Rcreate: "product/new", - Rsingle: "product/:uniqueId", - Rquery: "products", - rFieldsCreate: "product/:linkerId/fields/new", - rFieldsEdit: "product/:linkerId/fields/edit/:uniqueId", - editFields(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product/${linkerId}/fields/edit/${uniqueId}`; - }, - createFields(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product/${linkerId}/fields/new`; - }, - }; - public static definition = { - "name": "product", - "prependScript": "func CastProductFieldsFromJson(schema *workspaces.JSON) ([]*ProductFields, *workspaces.IError) {\r\n form := workspaces.JSONSchema{}\r\n\r\n if err := form.FromJson(schema); err != nil {\r\n return nil, workspaces.GormErrorToIError(err)\r\n }\r\n\r\n fields := []*ProductFields{}\r\n for key, field := range workspaces.FlattenFields(\"\", form.Properties) {\r\n key := key\r\n field := field\r\n fields = append(fields, \u0026ProductFields{\r\n Type: \u0026field.Type,\r\n Name: \u0026key,\r\n })\r\n }\r\n\r\n return fields, nil\r\n}\r\n\r\n\r\nfunc ComputeValueFromInterface(row *ProductSubmissionValues, value interface{}) {\r\n\r\n\tswitch value := value.(type) {\r\n\tcase int64:\r\n\r\n\t\trow.ValueInt64 = \u0026value\r\n\tcase float64:\r\n\t\trow.ValueFloat64 = \u0026value\r\n\tcase string:\r\n\t\trow.ValueString = \u0026value\r\n\tcase bool:\r\n\t\trow.ValueBoolean = \u0026value\r\n\t}\r\n\r\n}\r\n\r\nfunc FindFieldId(fields []*ProductFields, fieldName string) string {\r\n\tfor _, field := range fields {\r\n\t\tif *field.Name == fieldName {\r\n\t\t\treturn field.UniqueId\r\n\t\t}\r\n\t}\r\n\treturn \"\"\r\n}\r\n\r\nfunc SubmergeDataObjectWithValuesArray(\r\n\tdata *workspaces.JSON,\r\n\tfields []*ProductFields,\r\n) []*ProductSubmissionValues {\r\n\r\n\titems := []*ProductSubmissionValues{}\r\n\r\n if (data == nil ) {\r\n return items\r\n }\r\n\r\n\tvar data3 map[string]interface{}\r\n\t// var json = jsoniter.ConfigCompatibleWithStandardLibrary\r\n\t// json.UnmarshalFromString(data.String(), \u0026data3)\r\n\tjson.Unmarshal([]byte(data.String()), \u0026data3)\r\n\r\n\tfor k, v := range workspaces.FlattenData(data3, \"\") {\r\n\r\n\t\tfieldUniqueId := FindFieldId(fields, k)\r\n\t\tif fieldUniqueId == \"\" {\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\trow := \u0026ProductSubmissionValues{\r\n\t\t\tProductFieldId: \u0026fieldUniqueId,\r\n\t\t}\r\n\t\tComputeValueFromInterface(row, v)\r\n\r\n\t\titems = append(items, row)\r\n\t}\r\n\r\n\treturn items\r\n}\r\n\r\nfunc ProductSubmissionCastFieldsToEavAndValidate(dto *ProductSubmissionEntity, query workspaces.QueryDSL) *workspaces.IError {\r\n if dto == nil || dto.ProductId == nil {\r\n return nil\r\n }\r\n\tid := query.UniqueId\r\n\tquery.UniqueId = *dto.ProductId\r\n\tform, err := ProductActionGetOne(query)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tquery.UniqueId = id\r\n\r\n\tdto.Values = SubmergeDataObjectWithValuesArray(dto.Data, form.Fields)\r\n\r\n\tif err0 := workspaces.ValidateEavSchema(form.JsonSchema, dto.Data); err0 != nil {\r\n\t\treturn err0\r\n\t}\r\n\r\n\treturn nil\r\n}", - "prependCreateScript": "\n\tif fields, err := CastProductFieldsFromJson(dto.JsonSchema); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tdto.Fields = fields\n\t}\n\t", - "prependUpdateScript": "\n\tif fields2, err := CastProductFieldsFromJson(fields.JsonSchema); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfields.Fields = fields2\n\t}\n\t", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "validate": "required", - "computedType": "string", - "gormMap": {} - }, - { - "name": "description", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "uiSchema", - "type": "json", - "computedType": "any", - "gormMap": {} - }, - { - "name": "jsonSchema", - "type": "json", - "computedType": "any", - "gormMap": {} - }, - { - "linkedTo": "ProductEntity", - "name": "fields", - "type": "array", - "computedType": "ProductFields[]", - "gormMap": {}, - "fullName": "ProductFields", - "fields": [ - { - "name": "product", - "type": "one", - "target": "ProductEntity", - "computedType": "ProductEntity", - "gormMap": {} - }, - { - "name": "name", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "type", - "type": "string", - "computedType": "string", - "gormMap": {} - } - ] - } - ] -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', - description: 'description', - uiSchema: 'uiSchema', - jsonSchema: 'jsonSchema', - fields$: 'fields', - fields: { - ...BaseEntity.Fields, - productId: 'productId', - product$: 'product', - name: 'name', - type: 'type', - }, -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductSubmissionEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductSubmissionEntity.ts deleted file mode 100644 index e04b2700..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ProductSubmissionEntity.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -import { - CurrencyEntity, -} from "../currency/CurrencyEntity" -import { - FileEntity, -} from "../workspaces/FileEntity" -import { - BrandEntity, -} from "./BrandEntity" -import { - CategoryEntity, -} from "./CategoryEntity" -import { - ProductEntity, - ProductFields, -} from "./ProductEntity" -import { - TagEntity, -} from "./TagEntity" -// In this section we have sub entities related to this object -export class ProductSubmissionValues extends BaseEntity { - public productField?: ProductFields | null; - productFieldId?: string | null; - public valueInt64?: number | null; - public valueFloat64?: number | null; - public valueString?: string | null; - public valueBoolean?: boolean | null; -} -export class ProductSubmissionPrice extends BaseEntity { - public stringRepresentationValue?: string | null; - public variations?: ProductSubmissionPriceVariations[] | null; -} -export class ProductSubmissionPriceVariations extends BaseEntity { - public currency?: CurrencyEntity | null; - currencyId?: string | null; - public amount?: number | null; -} -// Class body -export type ProductSubmissionEntityKeys = - keyof typeof ProductSubmissionEntity.Fields; -export class ProductSubmissionEntity extends BaseEntity { - public children?: ProductSubmissionEntity[] | null; - public product?: ProductEntity | null; - productId?: string | null; - public data?: any | null; - public values?: ProductSubmissionValues[] | null; - public name?: string | null; - public price?: ProductSubmissionPrice | null; - public image?: FileEntity[] | null; - imageListId?: string[] | null; - public description?: string | null; - public descriptionExcerpt?: string[] | null; - public sku?: string | null; - public brand?: BrandEntity | null; - brandId?: string | null; - public category?: CategoryEntity | null; - categoryId?: string | null; - public tags?: TagEntity[] | null; - tagsListId?: string[] | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submissions`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "product-submission/edit/:uniqueId", - Rcreate: "product-submission/new", - Rsingle: "product-submission/:uniqueId", - Rquery: "product-submissions", - rValuesCreate: "product-submission/:linkerId/values/new", - rValuesEdit: "product-submission/:linkerId/values/edit/:uniqueId", - editValues(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/${linkerId}/values/edit/${uniqueId}`; - }, - createValues(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/${linkerId}/values/new`; - }, - rPriceCreate: "product-submission/:linkerId/price/new", - rPriceEdit: "product-submission/:linkerId/price/edit/:uniqueId", - editPrice(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/${linkerId}/price/edit/${uniqueId}`; - }, - createPrice(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/product-submission/${linkerId}/price/new`; - }, - }; - public static definition = { - "name": "productSubmission", - "prependCreateScript": "ProductSubmissionCastFieldsToEavAndValidate(dto, query)", - "prependUpdateScript": "ProductSubmissionCastFieldsToEavAndValidate(fields, query)", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "product", - "type": "one", - "target": "ProductEntity", - "validate": "required", - "computedType": "ProductEntity", - "gormMap": {} - }, - { - "name": "data", - "type": "json", - "computedType": "any", - "gormMap": {} - }, - { - "linkedTo": "ProductSubmissionEntity", - "name": "values", - "type": "array", - "computedType": "ProductSubmissionValues[]", - "gormMap": {}, - "fullName": "ProductSubmissionValues", - "fields": [ - { - "name": "productField", - "type": "one", - "target": "ProductFields", - "rootClass": "ProductEntity", - "computedType": "ProductFields", - "gormMap": {} - }, - { - "name": "valueInt64", - "type": "int64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "valueFloat64", - "type": "float64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "valueString", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "name": "valueBoolean", - "type": "bool", - "computedType": "boolean", - "gormMap": {} - } - ] - }, - { - "name": "name", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "linkedTo": "ProductSubmissionEntity", - "name": "price", - "type": "object", - "computedType": "ProductSubmissionPrice", - "gormMap": {}, - "fullName": "ProductSubmissionPrice", - "fields": [ - { - "name": "stringRepresentationValue", - "type": "string", - "computedType": "string", - "gormMap": {}, - "sql": "-" - }, - { - "linkedTo": "ProductSubmissionPrice", - "name": "variations", - "type": "array", - "computedType": "ProductSubmissionPriceVariations[]", - "gormMap": {}, - "fullName": "ProductSubmissionPriceVariations", - "fields": [ - { - "name": "currency", - "type": "one", - "target": "CurrencyEntity", - "module": "currency", - "computedType": "CurrencyEntity", - "gormMap": {} - }, - { - "name": "amount", - "type": "float64", - "computedType": "number", - "gormMap": {} - } - ] - } - ] - }, - { - "name": "image", - "type": "many2many", - "target": "FileEntity", - "module": "workspaces", - "computedType": "FileEntity[]", - "gormMap": {} - }, - { - "description": "Detailed description of the product", - "name": "description", - "type": "html", - "computedType": "string", - "gormMap": {} - }, - { - "description": "Stock Keeping Unit code for the product", - "name": "sku", - "type": "string", - "computedType": "string", - "gormMap": {} - }, - { - "description": "Brand of the product", - "name": "brand", - "type": "one", - "target": "BrandEntity", - "computedType": "BrandEntity", - "gormMap": {} - }, - { - "description": "Main category the product belongs to", - "name": "category", - "type": "one", - "target": "CategoryEntity", - "computedType": "CategoryEntity", - "gormMap": {} - }, - { - "description": "Tags", - "name": "tags", - "type": "many2many", - "target": "TagEntity", - "computedType": "TagEntity[]", - "gormMap": {} - } - ] -} -public static Fields = { - ...BaseEntity.Fields, - productId: 'productId', - product$: 'product', - product: ProductEntity.Fields, - data: 'data', - values$: 'values', - values: { - ...BaseEntity.Fields, - productFieldId: 'productFieldId', - productField$: 'productField', - productField: ProductFields.Fields, - valueInt64: 'valueInt64', - valueFloat64: 'valueFloat64', - valueString: 'valueString', - valueBoolean: 'valueBoolean', - }, - name: 'name', - price$: 'price', - price: { - ...BaseEntity.Fields, - stringRepresentationValue: 'stringRepresentationValue', - variations$: 'variations', - variations: { - ...BaseEntity.Fields, - currencyId: 'currencyId', - currency$: 'currency', - currency: CurrencyEntity.Fields, - amount: 'amount', - }, - }, - imageListId: 'imageListId', - image$: 'image', - image: FileEntity.Fields, - description: 'description', - sku: 'sku', - brandId: 'brandId', - brand$: 'brand', - brand: BrandEntity.Fields, - categoryId: 'categoryId', - category$: 'category', - category: CategoryEntity.Fields, - tagsListId: 'tagsListId', - tags$: 'tags', - tags: TagEntity.Fields, -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShopActionsDto.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShopActionsDto.ts deleted file mode 100644 index bd1b26bb..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShopActionsDto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -export class ConfirmPurchaseActionReqDto { - public basketId?: string | null; - public currencyId?: string | null; -public static Fields = { - basketId: 'basketId', - currencyId: 'currencyId', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShoppingCartEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShoppingCartEntity.ts deleted file mode 100644 index 117b4157..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/ShoppingCartEntity.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -import { - ProductSubmissionEntity, -} from "./ProductSubmissionEntity" -// In this section we have sub entities related to this object -export class ShoppingCartItems extends BaseEntity { - public quantity?: number | null; - public product?: ProductSubmissionEntity | null; - productId?: string | null; -} -// Class body -export type ShoppingCartEntityKeys = - keyof typeof ShoppingCartEntity.Fields; -export class ShoppingCartEntity extends BaseEntity { - public children?: ShoppingCartEntity[] | null; - public items?: ShoppingCartItems[] | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-cart/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-cart/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-cart/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-carts`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "shopping-cart/edit/:uniqueId", - Rcreate: "shopping-cart/new", - Rsingle: "shopping-cart/:uniqueId", - Rquery: "shopping-carts", - rItemsCreate: "shopping-cart/:linkerId/items/new", - rItemsEdit: "shopping-cart/:linkerId/items/edit/:uniqueId", - editItems(linkerId: string, uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-cart/${linkerId}/items/edit/${uniqueId}`; - }, - createItems(linkerId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/shopping-cart/${linkerId}/items/new`; - }, - }; - public static definition = { - "name": "shoppingCart", - "http": {}, - "gormMap": {}, - "fields": [ - { - "linkedTo": "ShoppingCartEntity", - "name": "items", - "type": "array", - "computedType": "ShoppingCartItems[]", - "gormMap": {}, - "fullName": "ShoppingCartItems", - "fields": [ - { - "name": "quantity", - "type": "float64", - "computedType": "number", - "gormMap": {} - }, - { - "name": "product", - "type": "one", - "target": "ProductSubmissionEntity", - "computedType": "ProductSubmissionEntity", - "gormMap": {} - } - ] - } - ], - "cliDescription": "Manage the active shopping carts (not ordered yet of the store)" -} -public static Fields = { - ...BaseEntity.Fields, - items$: 'items', - items: { - ...BaseEntity.Fields, - quantity: 'quantity', - productId: 'productId', - product$: 'product', - product: ProductSubmissionEntity.Fields, - }, -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/TagEntity.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/TagEntity.ts deleted file mode 100644 index d5e6c39b..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/TagEntity.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - BaseDto, - BaseEntity, -} from "../../core/definitions" -// In this section we have sub entities related to this object -// Class body -export type TagEntityKeys = - keyof typeof TagEntity.Fields; -export class TagEntity extends BaseEntity { - public children?: TagEntity[] | null; - public name?: string | null; - public static Navigation = { - edit(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/tag/edit/${uniqueId}`; - }, - create(locale?: string) { - return `${locale ? '/' + locale : ''}/tag/new`; - }, - single(uniqueId: string, locale?: string) { - return `${locale ? '/' + locale : ''}/tag/${uniqueId}`; - }, - query(params: any = {}, locale?: string) { - return `${locale ? '/' + locale : ''}/tags`; - }, - /** - * Use R series while building router in CRA or nextjs, or react navigation for react Native - * Might be useful in Angular as well. - **/ - Redit: "tag/edit/:uniqueId", - Rcreate: "tag/new", - Rsingle: "tag/:uniqueId", - Rquery: "tags", - }; - public static definition = { - "name": "tag", - "http": {}, - "gormMap": {}, - "fields": [ - { - "name": "name", - "type": "string", - "validate": "required", - "translate": true, - "computedType": "string", - "gormMap": {} - } - ] -} -public static Fields = { - ...BaseEntity.Fields, - name: 'name', -} -} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteBrand.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteBrand.ts deleted file mode 100644 index 7ed7d9b1..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteBrand.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteBrand(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/brand".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.BrandEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.BrandEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteCategory.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteCategory.ts deleted file mode 100644 index 9fe801be..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteCategory.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteCategory(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/category".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.CategoryEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.CategoryEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountCode.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountCode.ts deleted file mode 100644 index dd24cc0e..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountCode.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteDiscountCode(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-code".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.DiscountCodeEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.DiscountCodeEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountScope.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountScope.ts deleted file mode 100644 index cc3c6e55..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountScope.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteDiscountScope(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-scope".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.DiscountScopeEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.DiscountScopeEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountType.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountType.ts deleted file mode 100644 index dcdf5d6f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteDiscountType.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteDiscountType(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-type".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.DiscountTypeEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.DiscountTypeEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrder.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrder.ts deleted file mode 100644 index 6a1af081..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrder.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteOrder(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.OrderEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.OrderEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrderStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrderStatus.ts deleted file mode 100644 index 9ca07657..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteOrderStatus.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteOrderStatus(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.OrderStatusEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.OrderStatusEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentMethod.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentMethod.ts deleted file mode 100644 index d039eb5f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentMethod.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeletePaymentMethod(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-method".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.PaymentMethodEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.PaymentMethodEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentStatus.ts deleted file mode 100644 index 9089f1f9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeletePaymentStatus.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeletePaymentStatus(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.PaymentStatusEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.PaymentStatusEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProduct.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProduct.ts deleted file mode 100644 index 58dbe4df..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProduct.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteProduct(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.ProductEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.ProductEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProductSubmission.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProductSubmission.ts deleted file mode 100644 index ca758f37..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteProductSubmission.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteProductSubmission(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.ProductSubmissionEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.ProductSubmissionEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteShoppingCart.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteShoppingCart.ts deleted file mode 100644 index dca1c522..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteShoppingCart.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteShoppingCart(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.ShoppingCartEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.ShoppingCartEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteTag.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteTag.ts deleted file mode 100644 index c0261fb3..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useDeleteTag.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IDeleteResponse, - mutationErrorsToFormik, - DeleteRequest -} from "../../core/http-tools"; -import { DeleteProps, RemoteQueryContext, queryBeforeSend } from "../../core/react-tools"; -export function useDeleteTag(props?: DeleteProps) { - const {execFnOverride, queryClient, query} = (props || {}) - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/tag".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("DELETE", computedUrl, body); - const mutation = useMutation< - IDeleteResponse, - IDeleteResponse, - DeleteRequest - >(fn); - const fnUpdater = ( - data: IDeleteResponse | undefined, - item: IDeleteResponse - ) => { - return data; - }; - const submit = ( - values: DeleteRequest, - formikProps?: FormikHelpers - ): Promise => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IDeleteResponse) { - /* - * Here we need an improvement here. We are cleanning the data, but - * We may not have to actually - */ - queryClient?.setQueryData( - "*shop.TagEntity", - (data) => fnUpdater(data, response) as any - ); - queryClient?.invalidateQueries("*shop.TagEntity"); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandByUniqueId.ts deleted file mode 100644 index a117a7da..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetBrandByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/brand/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.BrandEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrands.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrands.ts deleted file mode 100644 index 06fd2725..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrands.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - BrandEntity, -} from "../shop/BrandEntity" -export function useGetBrands({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/brands".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.BrandEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetBrands.UKEY = "*shop.BrandEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandsExport.ts deleted file mode 100644 index f2140952..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetBrandsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - BrandEntity, -} from "../shop/BrandEntity" -export function useGetBrandsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/brands/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.BrandEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetBrandsExport.UKEY = "*shop.BrandEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategories.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategories.ts deleted file mode 100644 index a59e7525..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategories.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - CategoryEntity, -} from "../shop/CategoryEntity" -export function useGetCategories({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/categories".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.CategoryEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetCategories.UKEY = "*shop.CategoryEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoriesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoriesExport.ts deleted file mode 100644 index 9526a58d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoriesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - CategoryEntity, -} from "../shop/CategoryEntity" -export function useGetCategoriesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/categories/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.CategoryEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetCategoriesExport.UKEY = "*shop.CategoryEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoryByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoryByUniqueId.ts deleted file mode 100644 index 09beb1d9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetCategoryByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetCategoryByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/category/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.CategoryEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodeByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodeByUniqueId.ts deleted file mode 100644 index 8b3ebeae..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodeByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetDiscountCodeByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-code/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.DiscountCodeEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodes.ts deleted file mode 100644 index 2e610bbf..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodes.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountCodeEntity, -} from "../shop/DiscountCodeEntity" -export function useGetDiscountCodes({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-codes".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountCodeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountCodes.UKEY = "*shop.DiscountCodeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodesExport.ts deleted file mode 100644 index cdc3664f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountCodesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountCodeEntity, -} from "../shop/DiscountCodeEntity" -export function useGetDiscountCodesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-codes/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountCodeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountCodesExport.UKEY = "*shop.DiscountCodeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopeByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopeByUniqueId.ts deleted file mode 100644 index a0a1fddb..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopeByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetDiscountScopeByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-scope/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.DiscountScopeEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopes.ts deleted file mode 100644 index 72564363..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopes.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountScopeEntity, -} from "../shop/DiscountScopeEntity" -export function useGetDiscountScopes({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-scopes".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountScopeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountScopes.UKEY = "*shop.DiscountScopeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopesExport.ts deleted file mode 100644 index ccde3c60..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountScopesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountScopeEntity, -} from "../shop/DiscountScopeEntity" -export function useGetDiscountScopesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-scopes/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountScopeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountScopesExport.UKEY = "*shop.DiscountScopeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypeByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypeByUniqueId.ts deleted file mode 100644 index 85a5270f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypeByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetDiscountTypeByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-type/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.DiscountTypeEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypes.ts deleted file mode 100644 index 46952bda..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypes.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountTypeEntity, -} from "../shop/DiscountTypeEntity" -export function useGetDiscountTypes({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-types".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountTypeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountTypes.UKEY = "*shop.DiscountTypeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypesExport.ts deleted file mode 100644 index d0425f7f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetDiscountTypesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - DiscountTypeEntity, -} from "../shop/DiscountTypeEntity" -export function useGetDiscountTypesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/discount-types/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.DiscountTypeEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetDiscountTypesExport.UKEY = "*shop.DiscountTypeEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderByUniqueId.ts deleted file mode 100644 index 6eff301b..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetOrderByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.OrderEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderItemsByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderItemsByLinkerIdAndUniqueId.ts deleted file mode 100644 index 8d88893a..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderItemsByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetOrderItemsByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/items/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.OrderItems"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusByUniqueId.ts deleted file mode 100644 index 33a16de5..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetOrderStatusByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order-status/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.OrderStatusEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatuses.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatuses.ts deleted file mode 100644 index 0d4888ef..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatuses.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - OrderStatusEntity, -} from "../shop/OrderStatusEntity" -export function useGetOrderStatuses({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/order-statuses".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.OrderStatusEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetOrderStatuses.UKEY = "*shop.OrderStatusEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusesExport.ts deleted file mode 100644 index aec44b20..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderStatusesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - OrderStatusEntity, -} from "../shop/OrderStatusEntity" -export function useGetOrderStatusesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/order-statuses/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.OrderStatusEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetOrderStatusesExport.UKEY = "*shop.OrderStatusEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderTotalPriceByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderTotalPriceByLinkerIdAndUniqueId.ts deleted file mode 100644 index feea3705..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrderTotalPriceByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetOrderTotalPriceByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/total_price/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.OrderTotalPrice"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrders.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrders.ts deleted file mode 100644 index 88aa08e5..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrders.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - OrderEntity, -} from "../shop/OrderEntity" -export function useGetOrders({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/orders".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.OrderEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetOrders.UKEY = "*shop.OrderEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrdersExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrdersExport.ts deleted file mode 100644 index 9b2a91a9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetOrdersExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - OrderEntity, -} from "../shop/OrderEntity" -export function useGetOrdersExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/orders/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.OrderEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetOrdersExport.UKEY = "*shop.OrderEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodByUniqueId.ts deleted file mode 100644 index 1528a80e..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetPaymentMethodByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-method/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.PaymentMethodEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethods.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethods.ts deleted file mode 100644 index f465977c..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethods.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - PaymentMethodEntity, -} from "../shop/PaymentMethodEntity" -export function useGetPaymentMethods({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/payment-methods".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.PaymentMethodEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetPaymentMethods.UKEY = "*shop.PaymentMethodEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodsExport.ts deleted file mode 100644 index 7b051a3d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentMethodsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - PaymentMethodEntity, -} from "../shop/PaymentMethodEntity" -export function useGetPaymentMethodsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/payment-methods/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.PaymentMethodEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetPaymentMethodsExport.UKEY = "*shop.PaymentMethodEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusByUniqueId.ts deleted file mode 100644 index f5dccb9d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetPaymentStatusByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-status/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.PaymentStatusEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatuses.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatuses.ts deleted file mode 100644 index 3e72aaab..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatuses.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - PaymentStatusEntity, -} from "../shop/PaymentStatusEntity" -export function useGetPaymentStatuses({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/payment-statuses".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.PaymentStatusEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetPaymentStatuses.UKEY = "*shop.PaymentStatusEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusesExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusesExport.ts deleted file mode 100644 index c27ecb0e..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetPaymentStatusesExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - PaymentStatusEntity, -} from "../shop/PaymentStatusEntity" -export function useGetPaymentStatusesExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/payment-statuses/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.PaymentStatusEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetPaymentStatusesExport.UKEY = "*shop.PaymentStatusEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductByUniqueId.ts deleted file mode 100644 index 9aec2241..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetProductByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ProductEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductFieldsByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductFieldsByLinkerIdAndUniqueId.ts deleted file mode 100644 index 5d92127c..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductFieldsByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetProductFieldsByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product/fields/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ProductFields"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionByUniqueId.ts deleted file mode 100644 index 82777100..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetProductSubmissionByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ProductSubmissionEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionPriceByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionPriceByLinkerIdAndUniqueId.ts deleted file mode 100644 index 38eef3e1..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionPriceByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetProductSubmissionPriceByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/price/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ProductSubmissionPrice"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionValuesByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionValuesByLinkerIdAndUniqueId.ts deleted file mode 100644 index 7b911cdf..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionValuesByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetProductSubmissionValuesByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/values/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ProductSubmissionValues"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissions.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissions.ts deleted file mode 100644 index 2384ec35..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissions.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ProductSubmissionEntity, -} from "../shop/ProductSubmissionEntity" -export function useGetProductSubmissions({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/product-submissions".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ProductSubmissionEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetProductSubmissions.UKEY = "*shop.ProductSubmissionEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionsExport.ts deleted file mode 100644 index ecb2400e..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductSubmissionsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ProductSubmissionEntity, -} from "../shop/ProductSubmissionEntity" -export function useGetProductSubmissionsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/product-submissions/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ProductSubmissionEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetProductSubmissionsExport.UKEY = "*shop.ProductSubmissionEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProducts.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProducts.ts deleted file mode 100644 index cf8ae180..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProducts.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ProductEntity, -} from "../shop/ProductEntity" -export function useGetProducts({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/products".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ProductEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetProducts.UKEY = "*shop.ProductEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductsExport.ts deleted file mode 100644 index fe9726a0..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetProductsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ProductEntity, -} from "../shop/ProductEntity" -export function useGetProductsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/products/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ProductEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetProductsExport.UKEY = "*shop.ProductEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartByUniqueId.ts deleted file mode 100644 index 7386063d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetShoppingCartByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ShoppingCartEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartItemsByLinkerIdAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartItemsByLinkerIdAndUniqueId.ts deleted file mode 100644 index 9b135727..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartItemsByLinkerIdAndUniqueId.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetShoppingCartItemsByLinkerIdAndUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart/items/:linkerId/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.ShoppingCartItems"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCarts.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCarts.ts deleted file mode 100644 index 0f1d7bab..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCarts.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ShoppingCartEntity, -} from "../shop/ShoppingCartEntity" -export function useGetShoppingCarts({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/shopping-carts".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ShoppingCartEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetShoppingCarts.UKEY = "*shop.ShoppingCartEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartsExport.ts deleted file mode 100644 index 50b9b9c6..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetShoppingCartsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - ShoppingCartEntity, -} from "../shop/ShoppingCartEntity" -export function useGetShoppingCartsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/shopping-carts/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.ShoppingCartEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetShoppingCartsExport.UKEY = "*shop.ShoppingCartEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagByUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagByUniqueId.ts deleted file mode 100644 index 4f4c8de6..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagByUniqueId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { FormikHelpers } from "formik"; -import React, { useCallback, useContext } from "react"; -import { useMutation, useQuery, useQueryClient, QueryClient , UseQueryOptions} from "react-query"; -import { - execApiFn, - RemoteRequestOption, - IDeleteResponse, - IResponse, - ExecApi, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - queryBeforeSend, - UseRemoteQuery -} from "../../core/react-tools"; -export function useGetTagByUniqueId({ - queryOptions, - execFnOverride, - query, - queryClient, - unauthorized -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/tag/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = options?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery([options, query, "*shop.TagEntity"], fn, { - cacheTime: 1001, - retry: false, - keepPreviousData: true, - enabled: (hasKey || unauthorized ) && !!query?.uniqueId, - ...(queryOptions || {}) - }); - return { query: query$ }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTags.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTags.ts deleted file mode 100644 index b4f9ee74..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTags.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - TagEntity, -} from "../shop/TagEntity" -export function useGetTags({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/tags".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.TagEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetTags.UKEY = "*shop.TagEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagsExport.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagsExport.ts deleted file mode 100644 index 79216573..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/useGetTagsExport.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useContext } from "react"; -import { useQuery } from "react-query"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend, -} from "../../core/react-tools"; -import { execApiFn, IResponseList } from "../../core/http-tools"; -import { - TagEntity, -} from "../shop/TagEntity" -export function useGetTagsExport({ - queryOptions, - query, - queryClient, - execFnOverride, - unauthorized, - optionFn -}: UseRemoteQuery) { - const { options, execFn } = useContext(RemoteQueryContext); - const computedOptions = optionFn ? optionFn(options) : options; - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(computedOptions) - : execFn - ? execFn(computedOptions) - : execApiFn(computedOptions); - // Url of the remote affix. - const url = "/tags/export".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = () => rpcFn("GET", computedUrl); - const auth = computedOptions?.headers?.authorization - const hasKey = auth != "undefined" && auth != undefined && auth !=null && auth != "null" && !!auth - const query$ = useQuery, any>(["*shop.TagEntity", computedOptions, query], fn, { - cacheTime: 1000, - retry: false, - keepPreviousData: true, - enabled: hasKey || unauthorized || false, - ...(queryOptions || {}) - } as any); - const items: Array = query$.data?.data?.items || []; - return { query: query$, items}; -} -useGetTagsExport.UKEY = "*shop.TagEntity" \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrand.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrand.ts deleted file mode 100644 index d152594d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrand.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - BrandEntity, -} from "../shop/BrandEntity" -export function usePatchBrand(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/brand".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.BrandEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrands.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrands.ts deleted file mode 100644 index 9f49c943..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchBrands.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - BrandEntity, -} from "../shop/BrandEntity" -export function usePatchBrands(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/brands".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.BrandEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategories.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategories.ts deleted file mode 100644 index 7db72f8f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategories.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - CategoryEntity, -} from "../shop/CategoryEntity" -export function usePatchCategories(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/categories".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.CategoryEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategory.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategory.ts deleted file mode 100644 index 6ad12b8b..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchCategory.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - CategoryEntity, -} from "../shop/CategoryEntity" -export function usePatchCategory(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/category".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.CategoryEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCode.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCode.ts deleted file mode 100644 index 15df0a5c..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCode.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountCodeEntity, -} from "../shop/DiscountCodeEntity" -export function usePatchDiscountCode(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-code".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.DiscountCodeEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCodes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCodes.ts deleted file mode 100644 index b7fc2605..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountCodes.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountCodeEntity, -} from "../shop/DiscountCodeEntity" -export function usePatchDiscountCodes(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-codes".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.DiscountCodeEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScope.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScope.ts deleted file mode 100644 index 214d0834..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScope.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountScopeEntity, -} from "../shop/DiscountScopeEntity" -export function usePatchDiscountScope(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-scope".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.DiscountScopeEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScopes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScopes.ts deleted file mode 100644 index 1b2d1d74..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountScopes.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountScopeEntity, -} from "../shop/DiscountScopeEntity" -export function usePatchDiscountScopes(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-scopes".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.DiscountScopeEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountType.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountType.ts deleted file mode 100644 index 192bc01d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountType.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountTypeEntity, -} from "../shop/DiscountTypeEntity" -export function usePatchDiscountType(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-type".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.DiscountTypeEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountTypes.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountTypes.ts deleted file mode 100644 index c9d867c9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchDiscountTypes.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - DiscountTypeEntity, -} from "../shop/DiscountTypeEntity" -export function usePatchDiscountTypes(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-types".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.DiscountTypeEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrder.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrder.ts deleted file mode 100644 index b1b5477f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrder.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderEntity, -} from "../shop/OrderEntity" -export function usePatchOrder(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.OrderEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdItemsAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdItemsAndUniqueId.ts deleted file mode 100644 index d334f56b..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdItemsAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderItems, -} from "../shop/OrderEntity" -export function usePatchOrderByLinkerIdItemsAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/:linkerId/items/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.OrderItems", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdTotalPriceAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdTotalPriceAndUniqueId.ts deleted file mode 100644 index d18341e8..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderByLinkerIdTotalPriceAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderTotalPrice, -} from "../shop/OrderEntity" -export function usePatchOrderByLinkerIdTotalPriceAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/:linkerId/total_price/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.OrderTotalPrice", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatus.ts deleted file mode 100644 index ffbab753..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatus.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderStatusEntity, -} from "../shop/OrderStatusEntity" -export function usePatchOrderStatus(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.OrderStatusEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatuses.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatuses.ts deleted file mode 100644 index 06464ded..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrderStatuses.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderStatusEntity, -} from "../shop/OrderStatusEntity" -export function usePatchOrderStatuses(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order-statuses".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.OrderStatusEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrders.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrders.ts deleted file mode 100644 index 0a4fb704..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchOrders.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - OrderEntity, -} from "../shop/OrderEntity" -export function usePatchOrders(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/orders".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.OrderEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethod.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethod.ts deleted file mode 100644 index 37b582bb..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethod.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - PaymentMethodEntity, -} from "../shop/PaymentMethodEntity" -export function usePatchPaymentMethod(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-method".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.PaymentMethodEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethods.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethods.ts deleted file mode 100644 index c4dd8157..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentMethods.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - PaymentMethodEntity, -} from "../shop/PaymentMethodEntity" -export function usePatchPaymentMethods(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-methods".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.PaymentMethodEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatus.ts deleted file mode 100644 index e9558976..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatus.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - PaymentStatusEntity, -} from "../shop/PaymentStatusEntity" -export function usePatchPaymentStatus(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.PaymentStatusEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatuses.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatuses.ts deleted file mode 100644 index 7f0d7b13..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchPaymentStatuses.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - PaymentStatusEntity, -} from "../shop/PaymentStatusEntity" -export function usePatchPaymentStatuses(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-statuses".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.PaymentStatusEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProduct.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProduct.ts deleted file mode 100644 index 1ba00924..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProduct.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductEntity, -} from "../shop/ProductEntity" -export function usePatchProduct(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ProductEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductByLinkerIdFieldsAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductByLinkerIdFieldsAndUniqueId.ts deleted file mode 100644 index 3f4f993a..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductByLinkerIdFieldsAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductFields, -} from "../shop/ProductEntity" -export function usePatchProductByLinkerIdFieldsAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product/:linkerId/fields/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ProductFields", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmission.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmission.ts deleted file mode 100644 index 5c9fd35c..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmission.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductSubmissionEntity, -} from "../shop/ProductSubmissionEntity" -export function usePatchProductSubmission(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ProductSubmissionEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdPriceAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdPriceAndUniqueId.ts deleted file mode 100644 index 2875ce0c..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdPriceAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductSubmissionPrice, -} from "../shop/ProductSubmissionEntity" -export function usePatchProductSubmissionByLinkerIdPriceAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/:linkerId/price/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ProductSubmissionPrice", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdValuesAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdValuesAndUniqueId.ts deleted file mode 100644 index 814d17f7..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissionByLinkerIdValuesAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductSubmissionValues, -} from "../shop/ProductSubmissionEntity" -export function usePatchProductSubmissionByLinkerIdValuesAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/:linkerId/values/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ProductSubmissionValues", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissions.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissions.ts deleted file mode 100644 index 08dd7af9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProductSubmissions.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductSubmissionEntity, -} from "../shop/ProductSubmissionEntity" -export function usePatchProductSubmissions(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submissions".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.ProductSubmissionEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProducts.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProducts.ts deleted file mode 100644 index 8842979f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchProducts.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ProductEntity, -} from "../shop/ProductEntity" -export function usePatchProducts(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/products".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.ProductEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCart.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCart.ts deleted file mode 100644 index 513a8151..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCart.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ShoppingCartEntity, -} from "../shop/ShoppingCartEntity" -export function usePatchShoppingCart(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ShoppingCartEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCartByLinkerIdItemsAndUniqueId.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCartByLinkerIdItemsAndUniqueId.ts deleted file mode 100644 index 9c994038..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCartByLinkerIdItemsAndUniqueId.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ShoppingCartItems, -} from "../shop/ShoppingCartEntity" -export function usePatchShoppingCartByLinkerIdItemsAndUniqueId(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart/:linkerId/items/:uniqueId".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - computedUrl = computedUrl.replace(":uniqueId", (query as any)[":uniqueId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.ShoppingCartItems", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCarts.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCarts.ts deleted file mode 100644 index c4db68e9..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchShoppingCarts.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - ShoppingCartEntity, -} from "../shop/ShoppingCartEntity" -export function usePatchShoppingCarts(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-carts".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.ShoppingCartEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTag.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTag.ts deleted file mode 100644 index 24157e63..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTag.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - TagEntity, -} from "../shop/TagEntity" -export function usePatchTag(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/tag".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*shop.TagEntity", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTags.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTags.ts deleted file mode 100644 index 3e90e7d8..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePatchTags.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation, QueryClient } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { RemoteQueryContext, queryBeforeSend, PatchProps } from "../../core/react-tools"; -import { - TagEntity, -} from "../shop/TagEntity" -export function usePatchTags(props?: PatchProps) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/tags".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("PATCH", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueriesData("*workspaces.BulkRecordRequest[shop.TagEntity]", (data: any) => - fnUpdater(data, response) - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostBrand.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostBrand.ts deleted file mode 100644 index cb9f1241..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostBrand.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - BrandEntity, -} from "../shop/BrandEntity" -export function usePostBrand(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/brand".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.BrandEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostCategory.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostCategory.ts deleted file mode 100644 index 11842f14..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostCategory.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - CategoryEntity, -} from "../shop/CategoryEntity" -export function usePostCategory(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/category".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.CategoryEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountCode.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountCode.ts deleted file mode 100644 index 5b8c2e7f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountCode.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - DiscountCodeEntity, -} from "../shop/DiscountCodeEntity" -export function usePostDiscountCode(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-code".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.DiscountCodeEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountScope.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountScope.ts deleted file mode 100644 index 971b1d6f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountScope.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - DiscountScopeEntity, -} from "../shop/DiscountScopeEntity" -export function usePostDiscountScope(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-scope".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.DiscountScopeEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountType.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountType.ts deleted file mode 100644 index 019e823d..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostDiscountType.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - DiscountTypeEntity, -} from "../shop/DiscountTypeEntity" -export function usePostDiscountType(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/discount-type".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.DiscountTypeEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrder.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrder.ts deleted file mode 100644 index 7e1d19e5..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrder.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - OrderEntity, -} from "../shop/OrderEntity" -export function usePostOrder(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.OrderEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdItems.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdItems.ts deleted file mode 100644 index 9dfd7743..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdItems.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - OrderItems, -} from "../shop/OrderEntity" -export function usePostOrderByLinkerIdItems(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/:linkerId/items".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.OrderItems", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdTotalPrice.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdTotalPrice.ts deleted file mode 100644 index 2f5f0cff..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderByLinkerIdTotalPrice.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - OrderTotalPrice, -} from "../shop/OrderEntity" -export function usePostOrderByLinkerIdTotalPrice(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order/:linkerId/total_price".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.OrderTotalPrice", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderStatus.ts deleted file mode 100644 index 029a5a82..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostOrderStatus.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - OrderStatusEntity, -} from "../shop/OrderStatusEntity" -export function usePostOrderStatus(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/order-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.OrderStatusEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentMethod.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentMethod.ts deleted file mode 100644 index dbd6ebcd..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentMethod.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - PaymentMethodEntity, -} from "../shop/PaymentMethodEntity" -export function usePostPaymentMethod(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-method".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.PaymentMethodEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentStatus.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentStatus.ts deleted file mode 100644 index bc15b106..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostPaymentStatus.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - PaymentStatusEntity, -} from "../shop/PaymentStatusEntity" -export function usePostPaymentStatus(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/payment-status".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.PaymentStatusEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProduct.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProduct.ts deleted file mode 100644 index 35520a87..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProduct.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ProductEntity, -} from "../shop/ProductEntity" -export function usePostProduct(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ProductEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductByLinkerIdFields.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductByLinkerIdFields.ts deleted file mode 100644 index 1d645d9f..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductByLinkerIdFields.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ProductFields, -} from "../shop/ProductEntity" -export function usePostProductByLinkerIdFields(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product/:linkerId/fields".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ProductFields", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmission.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmission.ts deleted file mode 100644 index 8b6f51ed..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmission.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ProductSubmissionEntity, -} from "../shop/ProductSubmissionEntity" -export function usePostProductSubmission(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ProductSubmissionEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdPrice.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdPrice.ts deleted file mode 100644 index 2e5b8076..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdPrice.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ProductSubmissionPrice, -} from "../shop/ProductSubmissionEntity" -export function usePostProductSubmissionByLinkerIdPrice(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/:linkerId/price".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ProductSubmissionPrice", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdValues.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdValues.ts deleted file mode 100644 index 8b5bbf64..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostProductSubmissionByLinkerIdValues.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ProductSubmissionValues, -} from "../shop/ProductSubmissionEntity" -export function usePostProductSubmissionByLinkerIdValues(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/product-submission/:linkerId/values".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ProductSubmissionValues", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCart.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCart.ts deleted file mode 100644 index 2865e145..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCart.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ShoppingCartEntity, -} from "../shop/ShoppingCartEntity" -export function usePostShoppingCart(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ShoppingCartEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCartByLinkerIdItems.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCartByLinkerIdItems.ts deleted file mode 100644 index 314d8bdd..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostShoppingCartByLinkerIdItems.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - ShoppingCartItems, -} from "../shop/ShoppingCartEntity" -export function usePostShoppingCartByLinkerIdItems(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/shopping-cart/:linkerId/items".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - computedUrl = computedUrl.replace(":linkerId", (query as any)[":linkerId".replace(":", "")]) - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.ShoppingCartItems", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostTag.ts b/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostTag.ts deleted file mode 100644 index ff653bb4..00000000 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/sdk/modules/shop/usePostTag.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { FormikHelpers } from "formik"; -import { useContext } from "react"; -import { useMutation } from "react-query"; -import { - execApiFn, - IResponse, - mutationErrorsToFormik, - IResponseList -} from "../../core/http-tools"; -import { - RemoteQueryContext, - UseRemoteQuery, - queryBeforeSend -} from "../../core/react-tools"; -import { - TagEntity, -} from "../shop/TagEntity" -export function usePostTag(props?: UseRemoteQuery) { - let {queryClient, query, execFnOverride} = props || {}; - query = query || {} - const { options, execFn } = useContext(RemoteQueryContext); - // Calculare the function which will do the remote calls. - // We consider to use global override, this specific override, or default which - // comes with the sdk. - const rpcFn = execFnOverride - ? execFnOverride(options) - : execFn - ? execFn(options) - : execApiFn(options); - // Url of the remote affix. - const url = "/tag".substr(1); - let computedUrl = `${url}?${new URLSearchParams( - queryBeforeSend(query) - ).toString()}`; - // Attach the details of the request to the fn - const fn = (body: any) => rpcFn("POST", computedUrl, body); - const mutation = useMutation< - IResponse, - IResponse, - Partial - >(fn); - // Only entities are having a store in front-end - const fnUpdater = ( - data: IResponseList | undefined, - item: IResponse - ) => { - if (!data) { - return { - data: { items: [] }, - }; - } - // To me it seems this is not a good or any correct strategy to update the store. - // When we are posting, we want to add it there, that's it. Not updating it. - // We have patch, but also posting with ID is possible. - if (data.data && item?.data) { - data.data.items = [item.data, ...(data?.data?.items || [])]; - } - return data; - }; - const submit = ( - values: Partial, - formikProps?: FormikHelpers> - ): Promise> => { - return new Promise((resolve, reject) => { - mutation.mutate(values, { - onSuccess(response: IResponse) { - queryClient?.setQueryData>( - "*shop.TagEntity", - (data) => fnUpdater(data, response) as any - ); - resolve(response); - }, - onError(error: any) { - formikProps?.setErrors(mutationErrorsToFormik(error)); - reject(error); - }, - }); - }); - }; - return { mutation, submit, fnUpdater }; -} diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/sidebar.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/sidebar.scss index 7d26ef74..fe9b6b59 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/sidebar.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/sidebar.scss @@ -1,8 +1,8 @@ .sidebar { - position: fixed; - top: 0; - bottom: 0; - left: 0; + // position: fixed; + // top: 0; + // bottom: 0; + // left: 0; .current-user > a { padding: 0 5px; } @@ -38,7 +38,7 @@ animation: opensubmenu 0.3s forwards; } - width: $sidebarExpandedSize; + // width: $sidebarExpandedSize; // height: 100vh; background-color: rgba(224, 222, 227); overflow: auto; @@ -81,8 +81,8 @@ display: flex; } .nav-link-text { - width: 95px; - display: inline-block !important; + // width: 95px; + display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -121,3 +121,12 @@ right: 2px; } } + +.sidebar-extra-small .sidebar .nav-link-text { + display: none !important; +} + +.sidebar-extra-small { + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-core.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-core.scss index 0d13e01e..a9d99a23 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-core.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-core.scss @@ -50,6 +50,16 @@ overflow: hidden; + .panel-resize-handle { + width: 8px; + align-self: flex-end; + height: 100%; + position: absolute; + right: 0; + top: 0; + background: linear-gradient(90deg, rgb(224, 222, 227), rgb(207, 207, 206)); + } + .navbar-search-box { display: flex; input { @@ -162,7 +172,7 @@ .content-section { margin-top: 0; - margin-left: $sidebarExpandedSize; + // margin-left: $sidebarExpandedSize; // min-height: 100vh; background-color: white; @@ -211,10 +221,7 @@ min-height: 55px; height: auto; user-select: none; - position: fixed; - - right: 0; - left: $sidebarExpandedSize; + position: initial; z-index: 9; @supports (-webkit-touch-callout: none) { padding-top: 0; @@ -257,13 +264,15 @@ height: calc(100vh - $navHeight + constant(safe-area-inset-top)); height: calc(100vh - $navHeight + env(safe-area-inset-top)); overflow: auto; - margin-top: $navHeight; - margin-top: calc($navHeight + constant(safe-area-inset-top)); - margin-top: calc($navHeight + env(safe-area-inset-top)); + // margin-top: $navHeight; + margin-top: 0; + // margin-top: calc($navHeight + constant(safe-area-inset-top)); + // margin-top: calc($navHeight + env(safe-area-inset-top)); min-height: calc(100vh - $navHeight - constant(safe-area-inset-top)); min-height: calc(100vh - $navHeight - env(safe-area-inset-top)); overflow-y: auto; max-width: calc(100vw - 185px); + max-width: 100%; } @media only screen and (max-width: 500px) { @@ -273,7 +282,6 @@ } .sidebar-overlay { - left: $sidebarExpandedSize; } @import "./sidebar.scss"; @@ -389,3 +397,7 @@ html[dir="rtl"] { } } } + +a { + text-decoration: none; +} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-dark-override.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-dark-override.scss index 019805c5..fc1c1076 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-dark-override.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/apple-family/theme-osx-dark-override.scss @@ -1,5 +1,10 @@ @mixin osx-dark() { + + .panel-resize-handle { + background: linear-gradient(90deg, #5a565e, rgb(70, 70, 70)); + } + .Toastify__toast-theme--light { background-color: #46414f !important; } diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/drive.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/drive.scss index 8f5181b6..5f870a30 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/drive.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/drive.scss @@ -3,6 +3,8 @@ bottom: 0; right: 30px; width: 370px; + + height: 180px; background-color: white; z-index: 99999; diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/layout.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/layout.scss index 955d7e5b..5c6db6dd 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/layout.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/layout.scss @@ -34,15 +34,15 @@ h2 { .content-section { margin-top: 30px; - margin-left: 10px; flex: 1; @media only screen and (max-width: 500px) { // margin-left: 0; } .content-container { + // background: white; // box-shadow: 3px -4px 7px 0px #4a4a4a1a; - padding: 20px; + padding: 20px 25px; // overflow: auto; position: relative; max-width: calc(100vw - 155px); diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/navbar.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/navbar.scss index b0e168cf..d3c1f5b8 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/navbar.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/navbar.scss @@ -39,13 +39,13 @@ html[dir="rtl"] { } } -.navbar-menu-icon { - display: none; +// .navbar-menu-icon { +// display: none; - @media only screen and (max-width: 500px) { - display: inline-block; - } -} +// @media only screen and (max-width: 500px) { +// display: inline-block; +// } +// } html[dir="rtl"] { .navigator-back-button { diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/sidebar.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/sidebar.scss index ffc1094e..9e6f7a5d 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/sidebar.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/sidebar.scss @@ -1,10 +1,10 @@ .sidebar-overlay { - position: fixed; + position: absolute; transition: 0.1s all cubic-bezier(0.075, 0.82, 0.165, 1); top: 0; right: 0; bottom: 0; - left: $sidebarExpandedSize; + left: 0; background: #000000a6; z-index: 99999; @@ -52,7 +52,7 @@ } transition: 0.1s all cubic-bezier(0.075, 0.82, 0.165, 1); - width: $sidebarExpandedSize; + // width: $sidebarExpandedSize; // position: fixed; // top: 0; // bottom: 0; @@ -122,13 +122,13 @@ display: flex; - @media only screen and (max-width: 500px) { - transform: translateX(-$sidebarExpandedSize); + // @media only screen and (max-width: 500px) { + // transform: translateX(-$sidebarExpandedSize); - &.open { - transform: translateX(0); - } - } + // &.open { + // transform: translateX(0); + // } + // } ul ul { margin-top: 5px; diff --git a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/theme-basic.scss b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/theme-basic.scss index c140f58c..973948d2 100644 --- a/modules/workspaces/codegen/react-new/src/modules/fireback/styles/theme-basic.scss +++ b/modules/workspaces/codegen/react-new/src/modules/fireback/styles/theme-basic.scss @@ -441,16 +441,17 @@ html[dir="rtl"] { } -@media screen { - .no-screen, - .no-screen * { - display: none !important; - } -} - -@media print { - .no-print, - .no-print * { - display: none !important; - } -} +.table-copy-btn { + font-size: 9px; + display: inline; + right: 0; + position: absolute; + cursor: pointer; + opacity: 0; + margin-top: 2px; + transition: 0.3s opacity ease-in-out; +} + +.dx-g-bs4-table tbody tr:hover .table-copy-btn { + opacity: 1; +} \ No newline at end of file diff --git a/modules/workspaces/codegen/react-new/src/modules/sdk/projectname/core/react-tools.tsx b/modules/workspaces/codegen/react-new/src/modules/sdk/projectname/core/react-tools.tsx index 3e1f3811..7b3547c8 100644 --- a/modules/workspaces/codegen/react-new/src/modules/sdk/projectname/core/react-tools.tsx +++ b/modules/workspaces/codegen/react-new/src/modules/sdk/projectname/core/react-tools.tsx @@ -314,6 +314,7 @@ export function RemoteQueryProvider({ defaultExecFn, socket, credentialStorage, + prefix, }: { children: React.ReactNode; remote?: string; @@ -325,6 +326,7 @@ export function RemoteQueryProvider({ defaultExecFn?: any; socket?: boolean; credentialStorage?: CredentialStorage; + prefix?: string; }) { const [checked, setChecked] = useState(false); const [session, setSession$] = useState(); @@ -369,7 +371,7 @@ export function RemoteQueryProvider({ headers: { authorization: token || session?.token, }, - prefix: remote, + prefix: remote + prefix, }; if (selectedWorkspaceInternal) { diff --git a/modules/workspaces/codegen/react-new/yarn.lock b/modules/workspaces/codegen/react-new/yarn.lock index d0810e30..13f05a04 100644 --- a/modules/workspaces/codegen/react-new/yarn.lock +++ b/modules/workspaces/codegen/react-new/yarn.lock @@ -1847,46 +1847,6 @@ resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.6.tgz" integrity sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA== -"@next/swc-darwin-x64@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.6.tgz" - integrity sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA== - -"@next/swc-linux-arm64-gnu@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.6.tgz" - integrity sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg== - -"@next/swc-linux-arm64-musl@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.6.tgz" - integrity sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q== - -"@next/swc-linux-x64-gnu@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.6.tgz" - integrity sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw== - -"@next/swc-linux-x64-musl@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.6.tgz" - integrity sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ== - -"@next/swc-win32-arm64-msvc@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.6.tgz" - integrity sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg== - -"@next/swc-win32-ia32-msvc@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.6.tgz" - integrity sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg== - -"@next/swc-win32-x64-msvc@13.5.6": - version "13.5.6" - resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.6.tgz" - integrity sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ== - "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": version "5.1.1-v1" resolved "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz" @@ -9248,7 +9208,7 @@ react-dnd@^11.1.3: dnd-core "^11.1.3" hoist-non-react-statics "^3.3.0" -"react-dom@^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", "react-dom@^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0", "react-dom@^16.14 || ^17.0 || ^18.0", "react-dom@^16.8 || ^17.0 || ^18.0", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8.5 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, "react-dom@^18.0.0 || ^17.0.1 || ^16.7.0", react-dom@^18.2.0, "react-dom@>= 16.9.0", react-dom@>=16, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=16.8.0, react-dom@>=17.0.2, react-dom@18.2.0: +"react-dom@^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", "react-dom@^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0", "react-dom@^16.14 || ^17.0 || ^18.0", "react-dom@^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom@^16.8 || ^17.0 || ^18.0", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8.5 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, "react-dom@^18.0.0 || ^17.0.1 || ^16.7.0", react-dom@^18.2.0, "react-dom@>= 16.9.0", react-dom@>=16, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=16.8.0, react-dom@>=17.0.2, react-dom@18.2.0: version "18.2.0" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -9391,6 +9351,11 @@ react-refresh@0.11.0: resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz" integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A== +react-resizable-panels@^2.1.7: + version "2.1.7" + resolved "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.1.7.tgz" + integrity sha512-JtT6gI+nURzhMYQYsx8DKkx6bSoOGFp7A3CwMrOb8y5jFHFyqwo9m68UhmXRw57fRVJksFn1TSlm3ywEQ9vMgA== + react-router-dom@^6.9.0: version "6.22.2" resolved "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.2.tgz" @@ -9516,7 +9481,7 @@ react-window@^1.8.9: "@babel/runtime" "^7.0.0" memoize-one ">=3.1.1 <6" -"react@^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", "react@^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0", "react@^16.14 || ^17.0 || ^18.0", "react@^16.14.0 || >=17", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^16.8.3 || ^17 || ^18", "react@^16.8.5 || ^17.0.0 || ^18.0.0", "react@^16.9.0 || ^17.0.0 || ^18.0.0", "react@^16.x || ^17.x || ^18.x", react@^18.0.0, "react@^18.0.0 || ^17.0.1 || ^16.7.0", react@^18.2.0, "react@>= 0.14.0", "react@>= 16", "react@>= 16.0.0", "react@>= 16.3.0", "react@>= 16.8", "react@>= 16.8 || 18.0.0", "react@>= 16.8.0", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", "react@>= 16.9.0", react@>=16, react@>=16.13.1, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=16.8.6, react@>=17.0.2: +"react@^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", "react@^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0", "react@^16.14 || ^17.0 || ^18.0", "react@^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react@^16.14.0 || >=17", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^16.8.3 || ^17 || ^18", "react@^16.8.5 || ^17.0.0 || ^18.0.0", "react@^16.9.0 || ^17.0.0 || ^18.0.0", "react@^16.x || ^17.x || ^18.x", react@^18.0.0, "react@^18.0.0 || ^17.0.1 || ^16.7.0", react@^18.2.0, "react@>= 0.14.0", "react@>= 16", "react@>= 16.0.0", "react@>= 16.3.0", "react@>= 16.8", "react@>= 16.8 || 18.0.0", "react@>= 16.8.0", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", "react@>= 16.9.0", react@>=16, react@>=16.13.1, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=16.8.6, react@>=17.0.2: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== diff --git a/modules/workspaces/codegen/typescript/SharedSnippets.tpl b/modules/workspaces/codegen/typescript/SharedSnippets.tpl index e5acef5b..e3d24382 100644 --- a/modules/workspaces/codegen/typescript/SharedSnippets.tpl +++ b/modules/workspaces/codegen/typescript/SharedSnippets.tpl @@ -70,43 +70,53 @@ import { {{ define "stringfield" }} {{ $row := index . 0 }} {{ $root := index . 1 }} + {{ $prefix := index . 2 }} ...BaseEntity.Fields, {{ range $row.CompleteFields }} - + {{ $newPrefix := print $prefix .PrivateName "." }} {{ if or (eq .Type "daterange") }} - {{ .PrivateName }}Start: '{{ .PrivateName }}Start', - {{ .PrivateName }}End: '{{ .PrivateName }}End', + {{ .PrivateName }}Start: `{{ $prefix}}{{ .PrivateName }}Start`, + {{ .PrivateName }}End: `{{ $prefix}}{{ .PrivateName }}End`, {{ end }} - {{ if or (eq .Type "array") (eq .Type "object") (eq .Type "embed") }} - {{ .PrivateName }}$: '{{ .PrivateName }}', + {{ if or (eq .Type "array") }} + {{ .PrivateName }}$: `{{ $prefix}}{{ .PrivateName }}`, + {{ .PrivateName }}At: (index: number) => { + return { + $: `{{ $prefix}}{{ .PrivateName }}[${index}]`, + + {{ $newPrefix := print $prefix .PrivateName "[${index}]." }} + {{ template "stringfield" (arr . $root $newPrefix) }} + }; + }, + {{ else if or (eq .Type "object") (eq .Type "embed") }} + {{ .PrivateName }}$: '{{ $prefix}}{{ .PrivateName }}', {{ .PrivateName }}: { - {{ template "stringfield" (arr . $root) }} + {{ template "stringfield" (arr . $root $newPrefix) }} }, {{ else if or (eq .Type "one") (eq .Type "many2many") }} {{ if eq .Type "one" }} {{ if and (ne .PrivateName "user") (ne .PrivateName "workspace") }} - {{ .PrivateName }}Id: '{{ .PrivateName }}Id', + {{ .PrivateName }}Id: `{{ $prefix}}{{ .PrivateName }}Id`, {{ end }} {{ end }} {{ if eq .Type "many2many" }} - {{ .PrivateName }}ListId: '{{ .PrivateName }}ListId', + {{ .PrivateName }}ListId: `{{ $prefix}}{{ .PrivateName }}ListId`, {{ end }} {{ if or (eq .Type "html") (eq .Type "text") }} - {{ .PrivateName }}Excerpt: '{{ .PrivateName }}Excerpt', + {{ .PrivateName }}Excerpt: `{{ $prefix}}{{ .PrivateName }}Excerpt`, {{ end }} - {{ .PrivateName }}$: '{{ .PrivateName }}', + {{ .PrivateName }}$: `{{ $prefix}}{{ .PrivateName }}`, - {{ if ne $root.ObjectName - .Target}} + {{ if ne $root.ObjectName .Target }} {{ .PrivateName }}: {{ .Target }}.Fields, {{ end }} {{ else }} - {{ .PrivateName }}: '{{ .PrivateName }}', + {{ .PrivateName }}: `{{ $prefix}}{{ .PrivateName }}`, {{ end }} {{ end }} @@ -168,7 +178,7 @@ import { {{ define "staticfield" }} public static Fields = { - {{ template "stringfield" (arr .e .e) }} + {{ template "stringfield" (arr .e .e "") }} } diff --git a/modules/workspaces/codegen/typescript/include/core/react-tools.tsx b/modules/workspaces/codegen/typescript/include/core/react-tools.tsx index 3e1f3811..7b3547c8 100644 --- a/modules/workspaces/codegen/typescript/include/core/react-tools.tsx +++ b/modules/workspaces/codegen/typescript/include/core/react-tools.tsx @@ -314,6 +314,7 @@ export function RemoteQueryProvider({ defaultExecFn, socket, credentialStorage, + prefix, }: { children: React.ReactNode; remote?: string; @@ -325,6 +326,7 @@ export function RemoteQueryProvider({ defaultExecFn?: any; socket?: boolean; credentialStorage?: CredentialStorage; + prefix?: string; }) { const [checked, setChecked] = useState(false); const [session, setSession$] = useState(); @@ -369,7 +371,7 @@ export function RemoteQueryProvider({ headers: { authorization: token || session?.token, }, - prefix: remote, + prefix: remote + prefix, }; if (selectedWorkspaceInternal) {