You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #23 from ThePiratePhone/add-data-source
## Pull Request Overview
This PR adds data source functionality by extending the client model with new fields for tracking integration details and enhancing search capabilities. The changes focus on adding `firstIntegration` date and `integrationReason` fields to the Client model while improving search functionality to include firstname searches.
- Enhanced client model with integration tracking fields (`firstIntegration`, `integrationReason`)
- Extended parameter validation to support Date type checking
- Improved search functionality to include firstname and priority information
### Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
<details>
<summary>Show a summary per file</summary>
| File | Description |
| ---- | ----------- |
| Models/Client.ts | Added firstIntegration and integrationReason fields to Client schema |
| tools/utils.ts | Extended checkParameters function to support Date type validation |
| router/admin/client/createClient.ts | Updated client creation to handle new integration fields |
| router/admin/client/createClients.ts | Enhanced bulk client creation with integration data support |
| router/admin/client/searchByName.ts | Extended search to include firstname matching |
| router/admin/client/searchByPhone.ts | Added firstname to search results |
| router/caller/getPhoneNumber.ts | Added priority information and improved client data handling |
| router/admin/login.ts | Removed await from synchronous function call |
| tests/admin/client/createClients.test.ts | Updated test to reflect new error message format |
</details>
res.status(400).send({message: 'Each data entry must be an object with valid properties',OK: false});
72
+
res.status(400).send({
73
+
message:
74
+
'Each data entry must be an object with valid properties: {phone:string, name?:string, firstname?:string, institution?:string, priority?:string, firstIntegration?:date, integrationReason?:string}',
75
+
OK: false
76
+
});
69
77
log(`[!${req.body.area}, ${ip}] Invalid data format`,'WARNING',__filename);
Copy file name to clipboardExpand all lines: tests/admin/client/createClients.test.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,8 @@ describe('post on /admin/client/createClients', () => {
99
99
.send({adminCode: 'password',area: areaId,data: ['not an object']});
100
100
expect(res.status).toEqual(400);
101
101
expect(res.body).toEqual({
102
-
message: 'Each data entry must be an object with valid properties',
102
+
message:
103
+
'Each data entry must be an object with valid properties: {phone:string, name?:string, firstname?:string, institution?:string, priority?:string, firstIntegration?:date, integrationReason?:string}',
0 commit comments