Commit ac4c7a0
Chore/891 eliminate any usage (#994)
* fix(auth): eliminate any type usage in auth.service.ts
Replace 8 any annotations with Prisma-derived and explicit types:
- transactionsToActivityItems: TransactionWithPropertyTitle[]
- handleTokenReuse: Prisma.BlacklistedToken
- document/apiKey/passwordHistory map callbacks: Prisma model types
- recaptcha response: new RecaptchaVerifyResponse interface
Part of #891
* fix(transactions): eliminate any type usage in transactions.service.ts
Replace 24 any annotations with Prisma-derived and explicit types:
- create/update DTO fields: Prisma.TransactionType, Prisma.TransactionStatus
- where clauses: Prisma.TransactionWhereInput
- update data: Prisma.TransactionUpdateInput
- blockchain methods: BlockchainTransactionDto, BlockchainVerificationResultDto
- new TransactionWithFullRelations type for createTransaction return
- new UpdateEscrowDto interface
- toResponseDto param: Prisma.Transaction
- removed unnecessary any casts, let TS infer map/filter/reduce callbacks
- tax strategy methods: Prisma.TransactionTaxStrategy
Verified clean with npx tsc --noEmit --skipLibCheck
Part of #891
* fix(dashboard): eliminate any type usage in dashboard.service.ts
Remove 4 any annotations from map/filter callbacks over Prisma query
results, letting TS infer the correct type from the source array
instead. admin.service.ts already had zero any usages — no change
needed there.
This completes the 4 files named directly in the issue. Verified
clean with npx tsc --noEmit --skipLibCheck.
Part of #891
* fix(search): eliminate any type usage in search-filters.service.ts
Replace 19 any annotations:
- whereClause params and return types: Prisma.PropertyWhereInput
- individual filter values (price/bedrooms/city/etc): unknown, since
they're genuinely polymorphic and already narrowed via typeof/
property checks in each method body
- Record<string, any> in SavedFilter/FilterCombination: Record<string, unknown>
- new SaveFilterDto interface for saveFilter's input shape
Verified clean with npx tsc --noEmit --skipLibCheck
Part of #891
* fix: eliminate any type usage across 34 small/simple files
Batch of straightforward any removals across interceptors, controllers,
and small services:
- 6 NestJS interceptors: Observable<any> -> Observable<unknown>
- Express Request augmentation for custom properties (apiVersion,
openAPIDocument) via local extended interfaces instead of casts to any
- Prisma-derived where/update input types (User, TransactionMilestone,
TransactionNote, VerificationDocument)
- New interfaces for previously-untyped payloads (EmailBouncePayload,
EmailJobData, CreateDocumentDto wiring)
- redisStore cast in cache.config.ts documented as unavoidable
third-party interop rather than silently any
- Fixed 2 downstream type errors surfaced by these changes:
activity-log metadata (object, not string, despite @IsJSON decorator)
and a spec.ts mock missing required CreateDocumentDto fields
Note: activity-log.controller.ts now correctly types user as
AuthUserPayload, which exposes (but does not fix) a pre-existing bug
where the code reads user.id but the payload only has .sub -- flagging
for a separate issue, out of scope here.
Verified clean with npx tsc --noEmit --skipLibCheck
Part of #891
* test: eliminate remaining any usage across 18 spec files (#891)
* fix: move EmailBouncePayload interface above decorators to fix ESLint parse error (#891)
The interface was inserted directly between @apitags and @controller,
which is invalid -- a decorator must be immediately followed by the
declaration it decorates. This passed tsc --noEmit (suppressed by
// @ts-nocheck in this file) but failed ESLint parsing with
Decorators are not valid here.
* test: fix stale specs exposed by main merge (unrelated to #891)
PR #994's test check failed after merging upstream main, but not from
the any-removal work -- two pre-existing test/implementation gaps got
exposed:
- webhooks.service.spec.ts: create() test still expected a 'not yet
implemented' throw, but the service has a real implementation
(generates a secret, writes to DB) merged in from upstream. Rewrote
the test to assert the real behavior.
- trust-score.service.spec.ts: mockPrismaService was missing a
verificationDocument mock that calculateBreakdown's new ID-verification
check (also from an upstream merge) calls. Added the missing mock.
Verified locally: npx jest src/trust-score/trust-score.service.spec.ts
src/webhooks/webhooks.service.spec.ts -> 2 suites, 15 tests, all passing.
* test: pass missing I18nService mock to EmailService constructor
EmailService's constructor gained an I18nService parameter (from a
merged i18n feature) but this spec still called it with only 4
positional args, misassigning the queue mock into the i18nService
slot and leaving mailQueue undefined -- caught by nest build's
TS2554 'Expected 5 arguments, but got 4'.
Verified: npx jest src/email/email.service.spec.ts and npx nest build
both pass clean.
Follow-up to the earlier trust-score/webhooks stale-test fix -- same
root cause pattern (upstream merge outpacing tests), unrelated to #891.
* fix: resolve merge regressions and Prisma type gaps in transactions/auth services (#891)
- Restore two try blocks left without catch handlers after merging main
(transactions.service.ts: recordOnBlockchain, verifyOnBlockchain)
- Remove duplicate/conflicting 'updated' declaration in update()
- Restore transaction-not-found check dropped from update() during the merge
- Restore nextCursor/previousCursor pagination fields dropped from findAll()
during the merge
- Fix TypeScript errors from Prisma client not re-exporting model types
and enums under the Prisma namespace in this generator version
(Transaction, TransactionTaxStrategy, TransactionType, TransactionStatus
in transactions.service.ts; BlacklistedToken, Document, ApiKey,
PasswordHistory in auth.service.ts)
- Add explicit guard rejecting TransactionStatusDto.FAILED, which has no
corresponding value in the Prisma schema's TransactionStatus enum
- Use existing this.toNumber() helper for Decimal conversion instead of
calling .toNumber() directly, matching the pattern already used in
getAnalytics()
- Normalize nullable Prisma fields (blockchainHash, contractAddress,
notes) to undefined to match TransactionResponseDto's optional fields
- Remove remaining 'as any' cast in findAll()'s cursor construction
- Fix misplaced docstring on updateEscrow() and restore its unused-param
lint suppression
* fix: complete Keyv/redis cache migration and rbac.spec AuthUserPayload fixture (#891)
- Finish migrating REDIS_CONFIG from the old cache-manager-redis-store
store-based API (incompatible with cache-manager v7 / @nestjs/cache-manager
v3) to the Keyv-based stores API using @keyv/redis
- Add missing UserTier import and tier field to rbac.spec.ts's mock
AuthUserPayload, which became a required field on the type
* fix: remove unused imports/vars flagged by CI lint (zero-warnings gate)
- rate-limit-headers.interceptor.ts: remove unused 'request' const
- api-docs.controller.ts: remove unused ApiVersionEnum import
- notifications.gateway.ts: remove unused SubscribeMessage, ConnectedSocket,
MessageBody imports
- webhooks.service.spec.ts: remove unused NotFoundException import and
unused mockPrisma declaration
* fix: remove duplicate/orphaned code left by merge conflict resolution in getQuickStats
The conflict resolution for #994 merged in both the old per-role query
code and the new #911 single-query optimization instead of cleanly
replacing one with the other, leaving an unused buyerTransactions
variable and a duplicate totalProperties/activeListings declaration.
* test: add coverage for NotificationsGateway to clear src/notifications/ coverage threshold
Was at 19.77% lines (threshold: 20%), driven almost entirely by
notifications.gateway.ts sitting at 9.61%. Covers connection tracking
and all emit helper methods.
---------
Co-authored-by: nanaf6203-bit <nanaf6203@gmail.com>1 parent 28bf4f3 commit ac4c7a0
56 files changed
Lines changed: 1458 additions & 360 deletions
File tree
- src
- admin
- interceptors
- analytics
- auth
- guards
- interceptors
- blockchain
- cache
- commissions
- config
- dashboard
- documents
- signed-url
- email
- fraud
- notifications
- properties
- search
- transactions
- trust-score
- users
- dto
- versioning
- webhooks
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
6 | 13 | | |
7 | | - | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
15 | | - | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | | - | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 259 | + | |
264 | 260 | | |
265 | 261 | | |
266 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
66 | 83 | | |
67 | 84 | | |
68 | 85 | | |
| |||
123 | 140 | | |
124 | 141 | | |
125 | 142 | | |
126 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
127 | 147 | | |
128 | 148 | | |
129 | 149 | | |
| |||
495 | 515 | | |
496 | 516 | | |
497 | 517 | | |
498 | | - | |
| 518 | + | |
499 | 519 | | |
500 | 520 | | |
501 | 521 | | |
| |||
776 | 796 | | |
777 | 797 | | |
778 | 798 | | |
779 | | - | |
| 799 | + | |
780 | 800 | | |
781 | 801 | | |
782 | 802 | | |
| |||
800 | 820 | | |
801 | 821 | | |
802 | 822 | | |
803 | | - | |
| 823 | + | |
804 | 824 | | |
805 | 825 | | |
806 | 826 | | |
| |||
1061 | 1081 | | |
1062 | 1082 | | |
1063 | 1083 | | |
1064 | | - | |
| 1084 | + | |
1065 | 1085 | | |
1066 | 1086 | | |
1067 | 1087 | | |
| |||
1431 | 1451 | | |
1432 | 1452 | | |
1433 | 1453 | | |
1434 | | - | |
| 1454 | + | |
1435 | 1455 | | |
1436 | 1456 | | |
1437 | 1457 | | |
| |||
1575 | 1595 | | |
1576 | 1596 | | |
1577 | 1597 | | |
1578 | | - | |
| 1598 | + | |
1579 | 1599 | | |
1580 | 1600 | | |
1581 | 1601 | | |
| |||
1652 | 1672 | | |
1653 | 1673 | | |
1654 | 1674 | | |
1655 | | - | |
| 1675 | + | |
1656 | 1676 | | |
1657 | 1677 | | |
1658 | 1678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | | - | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
2 | 12 | | |
3 | 13 | | |
4 | 14 | | |
5 | | - | |
| 15 | + | |
6 | 16 | | |
7 | 17 | | |
8 | 18 | | |
| |||
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
19 | | - | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
| |||
0 commit comments