diff --git a/src/app/deals/components/shared/PageBody/PageBody.tsx b/src/app/deals/components/shared/PageBody/PageBody.tsx index fa12af1..4ebbe9c 100644 --- a/src/app/deals/components/shared/PageBody/PageBody.tsx +++ b/src/app/deals/components/shared/PageBody/PageBody.tsx @@ -34,7 +34,7 @@ const PageBody = () => { if (view === "table") { return { withPagination: true, projectId: selectedProject?.id }; } - return { boardId: selectedBoard?.id }; + return { boardId: selectedBoard?.id, projectId: selectedProject?.id }; }; return ( diff --git a/src/app/deals/contexts/DealsContext.tsx b/src/app/deals/contexts/DealsContext.tsx index 7ad04c9..7f6484d 100644 --- a/src/app/deals/contexts/DealsContext.tsx +++ b/src/app/deals/contexts/DealsContext.tsx @@ -54,6 +54,7 @@ const useDealsContextState = ({ const dealsCrud = useDealsCrud({ ...dealsListObjects, + projectId, boardId, statuses, }); diff --git a/src/hooks/cruds/useDealsCrud.tsx b/src/hooks/cruds/useDealsCrud.tsx index f1f1a7e..9d74a0c 100644 --- a/src/hooks/cruds/useDealsCrud.tsx +++ b/src/hooks/cruds/useDealsCrud.tsx @@ -16,6 +16,7 @@ import { getNewLexorank } from "@/utils/lexorank/generation"; type UseDealsOperationsProps = { deals: DealSchema[]; boardId?: number; + projectId?: number; statuses: StatusSchema[]; queryKey: any[]; }; @@ -28,6 +29,7 @@ export type DealsCrud = { export const useDealsCrud = ({ deals, + projectId, boardId, statuses, queryKey, @@ -41,7 +43,7 @@ export const useDealsCrud = ({ delete: deleteDealMutation(), }, getCreateEntity: data => { - if (!boardId || statuses.length === 0) return null; + if (!boardId || !projectId || statuses.length === 0) return null; const firstStatus = statuses[0]; const filteredDeals = deals.filter( d => d.status.id === firstStatus.id @@ -58,6 +60,7 @@ export const useDealsCrud = ({ ...data, name: data.name!, boardId, + projectId, statusId: firstStatus.id, lexorank: newLexorank.toString(), }; diff --git a/src/lib/client/types.gen.ts b/src/lib/client/types.gen.ts index b7d5918..53d0087 100644 --- a/src/lib/client/types.gen.ts +++ b/src/lib/client/types.gen.ts @@ -510,6 +510,10 @@ export type CreateDealSchema = { * Name */ name: string; + /** + * Projectid + */ + projectId: number; /** * Boardid */ diff --git a/src/lib/client/zod.gen.ts b/src/lib/client/zod.gen.ts index 4aa0e73..ce8e482 100644 --- a/src/lib/client/zod.gen.ts +++ b/src/lib/client/zod.gen.ts @@ -102,14 +102,14 @@ export const zBoardSchema = z.object({ * Body_upload_product_barcode_image */ export const zBodyUploadProductBarcodeImage = z.object({ - upload_file: z.any(), + upload_file: z.string(), }); /** * Body_upload_product_image */ export const zBodyUploadProductImage = z.object({ - upload_file: z.any(), + upload_file: z.string(), }); /** @@ -386,6 +386,7 @@ export const zCreateDealProductResponse = z.object({ */ export const zCreateDealSchema = z.object({ name: z.string(), + projectId: z.int(), boardId: z.int(), lexorank: z.string(), statusId: z.int(),