@colior115/all-connected-be-sdk 1.0.36 → 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.36",
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";
@@ -144,6 +144,7 @@ export type ProjectCustomerDTO = {
144
144
  email?: string;
145
145
  };
146
146
 
147
+ // Returned by getAllByBusiness — includes joined customer object
147
148
  export type ProjectDTO = {
148
149
  id: string;
149
150
  businessId: string;
@@ -162,6 +163,25 @@ export type ProjectListResponseDTO = {
162
163
  limit: number;
163
164
  };
164
165
 
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
+
165
185
  export type CreateProjectInputDTO = {
166
186
  businessId: string;
167
187
  customerId: string;