Commit 05e1ad0
fix: Code Quality improvements to response record endpoint and added unit tests (calcom#22264)
* chore: remove unnecessary logs and fix documentation
* refactor: extract GetSlotsInputWithRouting type and eliminate code duplication
- Move GetSlotsInputWithRouting_2024_09_04 type to platform-types package for reuse
- Refactor slots service to eliminate duplicate error handling logic
- Fix TypeScript errors in slots service tests by adding missing type property
- Update test expectations to match new implementation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: improve type safety in slots service
- Export explicit types from slots-input.service for transformed queries
- Replace 'any' type with proper TransformedSlotsQuery union type
- Re-implement fetchAndFormatSlots abstraction to eliminate code duplication
- Revert unrelated console.log in router.controller.ts
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify slots service implementation
- Remove intermediate variable assignment in getAvailableSlotsWithRouting
- Update test to match simplified routing parameters structure
* test: add comprehensive error handling and edge case tests for slots service
- Add error scenario tests for NotFoundException, invalid time range, and generic errors
- Add edge case tests for null/undefined parameters and empty arrays
- Improve test coverage for getAvailableSlotsWithRouting method
- Mock SlotsInputService properly to enable isolated unit testing
* 📝 CodeRabbit Chat: Rename TransformedGetSlotsQuery types to InternalGetSlotsQuery in slot services
* fix: correct import path for AvailableSlotsService in slots service test
- Fix import path from '@/lib/services/AvailableSlots' to '@/lib/services/available-slots.service'
- Resolves unit test failure due to case sensitivity/naming mismatch
- All API v2 tests now pass (9 test suites, 142 tests)
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent cf39256 commit 05e1ad0
9 files changed
Lines changed: 477 additions & 51 deletions
File tree
- apps/api/v2
- src/modules
- organizations/routing-forms
- outputs
- services
- slots/slots-2024-09-04/services
- swagger
- docs/api-reference/v2
- packages/platform/types/slots/slots-2024-09-04/inputs
apps/api/v2/src/modules/organizations/routing-forms/outputs/create-routing-form-response.output.ts
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
93 | | - | |
| 92 | + | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
104 | | - | |
105 | 102 | | |
106 | 103 | | |
107 | 104 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
| 64 | + | |
64 | 65 | | |
65 | | - | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
Lines changed: 39 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
21 | 42 | | |
22 | 43 | | |
23 | 44 | | |
| |||
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
33 | | - | |
| 54 | + | |
34 | 55 | | |
35 | 56 | | |
36 | 57 | | |
| |||
46 | 67 | | |
47 | 68 | | |
48 | 69 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 70 | | |
54 | 71 | | |
55 | 72 | | |
| |||
62 | 79 | | |
63 | 80 | | |
64 | 81 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
| |||
0 commit comments