@colior115/all-connected-be-sdk 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "type": "git",
8
8
  "url": "https://github.com/colior115/allConnectedBE.git"
9
9
  },
10
- "version": "1.0.35",
10
+ "version": "1.0.37",
11
11
  "type": "module",
12
12
  "main": "src/index.ts",
13
13
  "types": "src/index.ts",
@@ -1,5 +1,5 @@
1
1
  import { request, SdkConfig } from "../http";
2
- import { ProjectDTO, ProjectListResponseDTO, CreateProjectInputDTO, UpdateProjectInputDTO } from "../types";
2
+ import { ProjectListResponseDTO, ProjectDetailDTO, ProjectDetailListResponseDTO, CreateProjectInputDTO, UpdateProjectInputDTO } from "../types";
3
3
 
4
4
  export type GetProjectsParams = {
5
5
  page?: number;
@@ -19,17 +19,17 @@ export const createProjectClient = (config: SdkConfig) => ({
19
19
  request<ProjectListResponseDTO>(config, `/api/project/${businessId}/all${buildQs(params)}`, { withBusinessToken: true }),
20
20
 
21
21
  getAllByCustomer: (customerId: string, params: GetProjectsParams = {}) =>
22
- request<ProjectListResponseDTO>(config, `/api/project/customer/${customerId}${buildQs(params)}`, { withBusinessToken: true }),
22
+ request<ProjectDetailListResponseDTO>(config, `/api/project/customer/${customerId}${buildQs(params)}`, { withBusinessToken: true }),
23
23
 
24
24
  get: (id: string) =>
25
- request<ProjectDTO>(config, `/api/project/${id}`, { withBusinessToken: true }),
25
+ request<ProjectDetailDTO>(config, `/api/project/${id}`, { withBusinessToken: true }),
26
26
 
27
27
  create: (input: CreateProjectInputDTO) =>
28
- request<ProjectDTO>(config, "/api/project", { method: "POST", body: input, withBusinessToken: true }),
28
+ request<ProjectDetailDTO>(config, "/api/project", { method: "POST", body: input, withBusinessToken: true }),
29
29
 
30
30
  update: (id: string, input: UpdateProjectInputDTO) =>
31
- request<ProjectDTO>(config, `/api/project/${id}`, { method: "PUT", body: input, withBusinessToken: true }),
31
+ request<ProjectDetailDTO>(config, `/api/project/${id}`, { method: "PUT", body: input, withBusinessToken: true }),
32
32
 
33
33
  delete: (id: string) =>
34
- request<ProjectDTO>(config, `/api/project/${id}`, { method: "DELETE", withBusinessToken: true }),
34
+ request<ProjectDetailDTO>(config, `/api/project/${id}`, { method: "DELETE", withBusinessToken: true }),
35
35
  });
package/src/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // ── Shared primitives ─────────────────────────────────────────────────────────
2
2
 
3
3
  export type UserSystemRole = "admin" | "user";
4
- export type AppArea = "employees" | "accounts" | "customers";
4
+ export type AppArea = "employees" | "accounts" | "customers" | "business" | "business_roles" | "projects";
5
5
  export type PermissionLevel = "EDIT" | "VIEW" | "NONE";
6
6
  export type Permissions = { [K in AppArea]: PermissionLevel };
7
7
  export type EmploymentStatus = "active" | "terminated" | "on_leave";
@@ -135,10 +135,20 @@ export type NextPaymentDTO = {
135
135
  milestone?: string;
136
136
  };
137
137
 
138
+ export type ProjectCustomerDTO = {
139
+ id: string;
140
+ name: string;
141
+ individual: boolean;
142
+ address?: string;
143
+ phone?: string;
144
+ email?: string;
145
+ };
146
+
147
+ // Returned by getAllByBusiness — includes joined customer object
138
148
  export type ProjectDTO = {
139
149
  id: string;
140
150
  businessId: string;
141
- customerId: string;
151
+ customer: ProjectCustomerDTO;
142
152
  totalContractAmount: number;
143
153
  totalPaidAmount?: number;
144
154
  currency: string;
@@ -153,5 +163,32 @@ export type ProjectListResponseDTO = {
153
163
  limit: number;
154
164
  };
155
165
 
156
- export type CreateProjectInputDTO = Omit<ProjectDTO, "id">;
157
- export type UpdateProjectInputDTO = Partial<Omit<ProjectDTO, "id">>;
166
+ // Returned by getAllByCustomer and get — plain project with customerId
167
+ export type ProjectDetailDTO = {
168
+ id: string;
169
+ businessId: string;
170
+ customerId: string;
171
+ totalContractAmount: number;
172
+ totalPaidAmount?: number;
173
+ currency: string;
174
+ toBePaidAmount?: number;
175
+ nextPayment?: NextPaymentDTO;
176
+ };
177
+
178
+ export type ProjectDetailListResponseDTO = {
179
+ data: ProjectDetailDTO[];
180
+ total: number;
181
+ page: number;
182
+ limit: number;
183
+ };
184
+
185
+ export type CreateProjectInputDTO = {
186
+ businessId: string;
187
+ customerId: string;
188
+ totalContractAmount: number;
189
+ currency: string;
190
+ totalPaidAmount?: number;
191
+ toBePaidAmount?: number;
192
+ nextPayment?: NextPaymentDTO;
193
+ };
194
+ export type UpdateProjectInputDTO = Partial<CreateProjectInputDTO>;