Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings related to nullability in Devices module #495

Merged
merged 276 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
276 commits
Select commit Hold shift + click to select a range
3a0d553
chore: fix nullability in IDbContext
tnotheis Jan 19, 2024
3e128e9
fix: get rid of infinite recursion
tnotheis Jan 19, 2024
a909942
chore: remove unused method
tnotheis Jan 19, 2024
7c857a6
refactor: fix nullability of PnsRegistrationsRepository.FindByDeviceId
tnotheis Jan 19, 2024
4722dd1
refactor: make properties required
NikolaVetnic Jan 19, 2024
a4e4d68
chore: add comment clarifying the usage of the empty ctor
NikolaVetnic Jan 19, 2024
6f438a3
chore: remove unused directive
NikolaVetnic Jan 19, 2024
7b3909c
chore: remove unused directive
NikolaVetnic Jan 19, 2024
a1d726c
refactor: set properties as nullable since any of two options could b…
NikolaVetnic Jan 19, 2024
7d39599
refactor: mark return type as nullable since it can indeed return null
NikolaVetnic Jan 19, 2024
129a4b6
refactor: mark return type as nullable since it can return null and t…
NikolaVetnic Jan 19, 2024
557c0bd
refactor: make property required as it is the single property of the …
NikolaVetnic Jan 19, 2024
81ba0d4
refactor: put the nullability suffix back
NikolaVetnic Jan 19, 2024
3792095
refactor: mark the parameter as nullable as it can clearly be null
NikolaVetnic Jan 19, 2024
b05f03b
chore: remove unused directive
NikolaVetnic Jan 19, 2024
042e51d
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
tnotheis Jan 19, 2024
0376831
refactor: add nullable suppression and '?' suffix
NikolaVetnic Jan 19, 2024
d225132
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
NikolaVetnic Jan 19, 2024
20670f8
chore: change parameter order to match the class
NikolaVetnic Jan 19, 2024
b743cb0
refactor: remove '?' suffix as options is never null
NikolaVetnic Jan 19, 2024
bc1d419
refactor: suppress null warnings as the object is instantiated as emp…
NikolaVetnic Jan 19, 2024
f5c73c8
refactor: avoid possible multiple enumeration
NikolaVetnic Jan 19, 2024
cfe0f09
refactor: remove null suppression as AppId is never null
NikolaVetnic Jan 19, 2024
c172a4c
refactor: suppress null warning as it presumably can never be null
NikolaVetnic Jan 19, 2024
878f1b6
refactor: make the return type not nullable
NikolaVetnic Jan 19, 2024
87790ac
refactor: throw exception in case of bundle being null
NikolaVetnic Jan 19, 2024
9399822
refactor: make the property nullable
NikolaVetnic Jan 19, 2024
2a0757e
chore: revert change
NikolaVetnic Jan 19, 2024
04d1be6
refactor: make the method signature match the one it is calling
NikolaVetnic Jan 19, 2024
8fd29da
refactor: avoid possible multiple enumeration
NikolaVetnic Jan 19, 2024
9df18b9
refactor: make the method signature match the one it is calling
NikolaVetnic Jan 19, 2024
7e53a3a
refactor: add '?' suffix where required
NikolaVetnic Jan 19, 2024
ceedfea
refactor: remove meaningless '?' suffix
NikolaVetnic Jan 19, 2024
3a2f7b9
refactor: remove unnecessary async keyword
NikolaVetnic Jan 19, 2024
4da5505
refactor: add '?' suffix where needed
NikolaVetnic Jan 19, 2024
b310d4a
refactor: throw exception in case that public key cannot be deserialized
NikolaVetnic Jan 19, 2024
6430a48
refactor: throw exception in case that signature cannot be deserialized
NikolaVetnic Jan 19, 2024
7741fea
chore: fix formatting issues
NikolaVetnic Jan 19, 2024
6ba33e9
refactor: remove unnecessary null check
NikolaVetnic Jan 19, 2024
6ee26a5
refactor: suppress null warning as ToModel never returns null
NikolaVetnic Jan 19, 2024
ecac86d
refactor: make input parameter nullable as it is checked for null val…
NikolaVetnic Jan 19, 2024
4f2a35c
refactor: suppress nullable warning as the class is never instantiate…
NikolaVetnic Jan 19, 2024
c1c93d2
refactor: suppress warning with 'null!' initializers as ClientDTO is …
NikolaVetnic Jan 19, 2024
f4f2349
refactor: make properties required
NikolaVetnic Jan 19, 2024
baadd89
fix: remove required keyword as it seems to break some tests
NikolaVetnic Jan 19, 2024
b1ca5a2
refactor: remove 'null!' initializers as they seem to break some tests
NikolaVetnic Jan 19, 2024
955a541
fix: remove 'null!' initializers as they seem to break some tests
NikolaVetnic Jan 19, 2024
84a0bcf
fix: remove 'null!' initializers as they seem to break some tests
NikolaVetnic Jan 19, 2024
3154e0e
fix: revert changes that seem to break some tests
NikolaVetnic Jan 19, 2024
e3d4a1a
refactor: revert to changes previously suspected to crash the tests
NikolaVetnic Jan 19, 2024
e6d96a7
fix: wip
NikolaVetnic Jan 19, 2024
6d358c2
Revert "fix: wip"
NikolaVetnic Jan 19, 2024
cdea482
Revert "refactor: revert to changes previously suspected to crash the…
NikolaVetnic Jan 19, 2024
20b84f6
Merge main into fix-devices-code-issues
github-actions[bot] Jan 22, 2024
5f8705e
chore: remove redundant nullable directive
NikolaVetnic Jan 22, 2024
c5a1f51
refactor: make properties required
NikolaVetnic Jan 22, 2024
124d316
chore: comment out the tests which are to be ignored at the moment
NikolaVetnic Jan 22, 2024
3f6fce6
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
NikolaVetnic Jan 22, 2024
08333ea
refactor: make property required
NikolaVetnic Jan 22, 2024
2851b0e
refactor: check expression for null
NikolaVetnic Jan 22, 2024
8be174e
refactor: suppress null value as UserName is never null
NikolaVetnic Jan 22, 2024
0069918
refactor: throw exceptions where appropriate
NikolaVetnic Jan 22, 2024
466e29b
refactor: suppress null value on instantiation
NikolaVetnic Jan 22, 2024
6de40a4
refactor: throw exception if basic tier not found
NikolaVetnic Jan 22, 2024
12eced1
Revert "refactor: throw exception if basic tier not found"
NikolaVetnic Jan 22, 2024
bb6a9e8
Revert "refactor: suppress null value on instantiation"
NikolaVetnic Jan 22, 2024
4b1313b
Revert "refactor: throw exceptions where appropriate"
NikolaVetnic Jan 22, 2024
bb92014
Revert "refactor: suppress null value as UserName is never null"
NikolaVetnic Jan 22, 2024
7859562
Revert "refactor: check expression for null"
NikolaVetnic Jan 22, 2024
83bce3e
Revert "refactor: make property required"
NikolaVetnic Jan 22, 2024
ac51997
refactor: make Provider property nullable
NikolaVetnic Jan 22, 2024
9496c56
refactor: check expression for null
NikolaVetnic Jan 22, 2024
f01c643
refactor: check expression for null
NikolaVetnic Jan 22, 2024
f094e55
refactor: suppress null value as UserName is never null
NikolaVetnic Jan 22, 2024
b0e6c16
chore: suppress null value for Read, ReadValue and ReadList
NikolaVetnic Jan 22, 2024
3566db1
refactor: suppress null value on instantiation
NikolaVetnic Jan 22, 2024
3fe78da
refactor: throw exception if basic tier not found
NikolaVetnic Jan 22, 2024
b930f35
Helm Chart: Update Consumer API, Admin UI and Admin CLI (#501)
tnotheis Jan 22, 2024
b095e73
Merge main into fix-devices-code-issues
github-actions[bot] Jan 22, 2024
dcd55aa
Helm Chart: Update Consumer API, Admin UI and Admin CLI (#501)
tnotheis Jan 22, 2024
8000eb5
Merge main into fix-devices-code-issues
github-actions[bot] Jan 22, 2024
73ded30
Merge main into fix-devices-code-issues
github-actions[bot] Jan 22, 2024
c96cde8
refactor: suppress null warning since basic tier always exists
NikolaVetnic Jan 22, 2024
efdd4d8
chore: fix formatting issues
NikolaVetnic Jan 22, 2024
39b1487
refactor: suppress null warnings as values can never be null
NikolaVetnic Jan 22, 2024
178bade
refactor: suppress null warning since basic tier always exists
NikolaVetnic Jan 22, 2024
10214a0
refactor: suppress the null warning since default value of identity i…
NikolaVetnic Jan 22, 2024
4ad2ce5
refactor: add '?' suffix to match the signature of base method
NikolaVetnic Jan 22, 2024
2444ae5
refactor: cast ids to list
NikolaVetnic Jan 22, 2024
6079fc0
refactor: remove unused field
NikolaVetnic Jan 22, 2024
8eefbc7
refactor: suppress null value as UserName is never null
NikolaVetnic Jan 22, 2024
4605187
refactor: cast devices to list
NikolaVetnic Jan 22, 2024
90d8081
refactor: add null checks for nullable parameters
NikolaVetnic Jan 22, 2024
3688af8
chore: fix formatting issues
NikolaVetnic Jan 22, 2024
00b863a
refactor: suppress null value as UserName is never null
NikolaVetnic Jan 22, 2024
f4d145d
chore: fix typo
NikolaVetnic Jan 22, 2024
a9c00eb
refactor: make property nullable to match the nullability of non-dto …
NikolaVetnic Jan 22, 2024
d2e769f
refactor: fix formatting
NikolaVetnic Jan 22, 2024
6c97877
refactor: add null checks due to properties being nullable
NikolaVetnic Jan 22, 2024
aa083d0
chore: fix formatting
NikolaVetnic Jan 22, 2024
e100301
refactor: match nullability of the base class return type
NikolaVetnic Jan 22, 2024
47f2790
refactor: match nullability of the base class return type
NikolaVetnic Jan 22, 2024
80c940a
refactor: initialize properties of SendResult with null! (not possibl…
NikolaVetnic Jan 22, 2024
21dc05e
refactor: make properties of ApnsMessageBuilder nullable
NikolaVetnic Jan 22, 2024
27d3a12
refactor: disable 'property unused' warnings (reluctant to remove unu…
NikolaVetnic Jan 22, 2024
72fec33
refactor: make property nullable
NikolaVetnic Jan 22, 2024
be7e690
refactor: suppress nullability warning (class is never instanced in c…
NikolaVetnic Jan 22, 2024
5ff8caa
refactor: remove null check as the value should never be null
NikolaVetnic Jan 22, 2024
d12809b
refactor: mark Property as nullable (insantiated manually once where …
NikolaVetnic Jan 22, 2024
d1cf4b2
refactor: mark property as nullable
NikolaVetnic Jan 22, 2024
651a22c
refactor: mark properties as nullable
NikolaVetnic Jan 22, 2024
6894bbe
refactor: mark properties as nullable
NikolaVetnic Jan 22, 2024
ed6f19d
refactor: mark properties as nullable (insantiated manually once wher…
NikolaVetnic Jan 22, 2024
f4df323
refactor: mark properties as nullable
NikolaVetnic Jan 22, 2024
e0d341d
refactor: mark properties as nullable (insantiated manually once wher…
NikolaVetnic Jan 22, 2024
ca67638
refactor: make property nullable
NikolaVetnic Jan 22, 2024
451a1b4
refactor: make properties nullable
NikolaVetnic Jan 22, 2024
ed0eefb
refactor: make properties nullable
NikolaVetnic Jan 22, 2024
2dbd4ac
refactor: make properties nullable
NikolaVetnic Jan 22, 2024
483ac5a
chore: remove unused directive
NikolaVetnic Jan 22, 2024
9d9a90f
refactor: make property nullable (instantiated manually with empty ctor)
NikolaVetnic Jan 22, 2024
74cb887
fix: return null check and disable the warning with comment
NikolaVetnic Jan 22, 2024
ec8808e
refactor: suppress null warnings in case of all properties previously…
NikolaVetnic Jan 22, 2024
fb29630
refactor: cast tiers to list
NikolaVetnic Jan 22, 2024
5fde25e
refactor: suppress nullable warnings
NikolaVetnic Jan 22, 2024
93e7fac
refactor: match signature of FindByAddress in IIdentitiesRepository t…
NikolaVetnic Jan 22, 2024
0512720
refactor: suppress nullability warnings as JsonElement.Deserialize is…
NikolaVetnic Jan 22, 2024
7153199
refactor: suppress null warnings as the instanced objects cannot be null
NikolaVetnic Jan 22, 2024
feb45fe
refactor: suppress null warnings in tests
NikolaVetnic Jan 22, 2024
833e138
refactor: fix nullability of CreateClientCommand
tnotheis Jan 23, 2024
ff2a184
refactor: add invalid default values to ApplicationOptions to be able…
tnotheis Jan 23, 2024
c3a668b
refactor: mkae RegisterDeviceCommand properties required (recursively)
tnotheis Jan 23, 2024
389c502
refactor: fix nullability warnings in TiersRepository
tnotheis Jan 23, 2024
ed6b101
refactor: make DeleteDeviceCommand.Id required
tnotheis Jan 23, 2024
2dbe129
refactor: make ClientDTO.CreatedAt required
tnotheis Jan 23, 2024
3a40cb7
refactor: make ChallengeDTO.Id required
tnotheis Jan 23, 2024
597c7d9
refactor: simplify IdentitySummaryDTO
tnotheis Jan 23, 2024
e94bb43
refactor: fix nullability issues in DynamicJsonConverter
tnotheis Jan 23, 2024
3626af4
refactor: add some required modifiers
tnotheis Jan 23, 2024
608e3ab
chore: formatting
tnotheis Jan 23, 2024
b674f32
refactor: make all properties except ClientId required - ClientId is …
NikolaVetnic Jan 23, 2024
4ff9af6
refactor: make Properties required
NikolaVetnic Jan 23, 2024
d385c09
refactor: make Property required
NikolaVetnic Jan 23, 2024
ab49d41
refactor: mark property as nullable
NikolaVetnic Jan 23, 2024
6363d66
refactor: make property required to avoid compiler error
NikolaVetnic Jan 24, 2024
f2b917a
refactor: rearrange properties to match domain class
NikolaVetnic Jan 24, 2024
622e82e
refactor: pass the entire identity to base ctor
NikolaVetnic Jan 24, 2024
93b8b1c
refactor: pass identity to ctor
NikolaVetnic Jan 24, 2024
2676f85
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
f2773cf
refactor: remove redundant nullability suppression
NikolaVetnic Jan 25, 2024
2a07903
refactor: remove redundant nullability suppression
NikolaVetnic Jan 25, 2024
72229b6
refactor: make properties of DatawalletModifiedIntegrationEvent required
NikolaVetnic Jan 25, 2024
8b0eba1
refactor: remove null warning suppression for usage of DatawalletModi…
NikolaVetnic Jan 25, 2024
f473160
chore: fix formatting
NikolaVetnic Jan 25, 2024
5cb2e16
refactor: make property of ExternalEventCreatedIntegrationEvent requi…
NikolaVetnic Jan 25, 2024
529e6ad
refactor: remove null warning suppression
NikolaVetnic Jan 25, 2024
84619a7
refactor: revert changes as they are to be done later
NikolaVetnic Jan 25, 2024
65ea980
chore: remove pointless line breaks
NikolaVetnic Jan 25, 2024
c706e70
chore: enhance formatting
NikolaVetnic Jan 25, 2024
7c51941
chore: enhance formatting
NikolaVetnic Jan 25, 2024
16723da
chore: remove pointless line break
NikolaVetnic Jan 25, 2024
f089307
refactor: make properties of CreateIdentityResponse and CreateIdentit…
NikolaVetnic Jan 25, 2024
037d57a
refactor: remove the '?' suffix as it makes no sense, though the clas…
NikolaVetnic Jan 25, 2024
a9eb901
refactor: make properties of NotificationTextAttribute required inste…
NikolaVetnic Jan 25, 2024
4baccab
chore: disable meaningless warnings with comments
NikolaVetnic Jan 25, 2024
326f38f
refactor: use collection expression to initialize list
NikolaVetnic Jan 25, 2024
09e0f66
refactor: make properties of CustomOpenIddictEntityFrameworkCoreAppli…
NikolaVetnic Jan 25, 2024
43d5347
refactor: initialize field with null in EF Core required ctor
NikolaVetnic Jan 25, 2024
24af5a6
refactor: initialize DbSets with 'null!' as discussed
NikolaVetnic Jan 25, 2024
f531ff4
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
a3677a7
refactor: mark return type as nullable
NikolaVetnic Jan 25, 2024
e54207c
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
768d06d
refactor: update return type
NikolaVetnic Jan 25, 2024
ce9d58f
refactor: update return type and remove redundant null warning suppre…
NikolaVetnic Jan 25, 2024
1ef9d84
refactor: update return type
NikolaVetnic Jan 25, 2024
cd72180
refactor: update return type and remove redundant null warning suppre…
NikolaVetnic Jan 25, 2024
530fa66
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
bad0008
chore: add line break
NikolaVetnic Jan 25, 2024
024fb6a
refactor: revert changes as they are to be done later
NikolaVetnic Jan 25, 2024
ca82384
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
6ddda4d
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
de929a0
refactor: match return type of the interface
NikolaVetnic Jan 25, 2024
2bfe257
refactor: add null warning suppression as _identity is not null
NikolaVetnic Jan 25, 2024
eddcc9e
refactor: match return type of the interface
NikolaVetnic Jan 25, 2024
9a3ce89
refactor: remove redundant null warning suppression
NikolaVetnic Jan 25, 2024
f82fdb5
chore: fix formatting
NikolaVetnic Jan 25, 2024
166c3f3
refactor: remove redundant nullability suffix
NikolaVetnic Jan 25, 2024
46adba9
Revert "refactor: remove redundant nullability suffix"
NikolaVetnic Jan 25, 2024
ab92786
refactor: revert changes to match the possible state of same property…
NikolaVetnic Jan 25, 2024
27cb516
refactor: replace null warning suppression with an exception throw
NikolaVetnic Jan 25, 2024
3cbb163
refactor: revert changes as they are to be done later
NikolaVetnic Jan 25, 2024
9cfdcc8
refactor: replace null warning suppression with an exception throw
NikolaVetnic Jan 25, 2024
c52bbce
refactor: revert changes to match the possible state of same property…
NikolaVetnic Jan 25, 2024
109a870
refactor: make return type nullable
NikolaVetnic Jan 26, 2024
6f70035
refactor: throw exception if OAuthClient not found
NikolaVetnic Jan 26, 2024
e4b7bda
refactor: remove redundant null warning suppression
NikolaVetnic Jan 26, 2024
95d72e7
fix: make return type nullable instead of throwing an exception
NikolaVetnic Jan 26, 2024
963a49a
refactor: update default values
NikolaVetnic Jan 26, 2024
7785c8f
refactor: change to FirstAsync call as basic tier always exists since…
NikolaVetnic Jan 26, 2024
4dfd6b7
refactor: make return type not nullable
NikolaVetnic Jan 26, 2024
8fafc75
fix: revert to previous state
NikolaVetnic Jan 26, 2024
fd4fe0f
fix: revert changes done earlier
NikolaVetnic Jan 26, 2024
10acd51
Merge main into fix-devices-code-issues
github-actions[bot] Jan 26, 2024
e104496
ci: trigger pipelines
NikolaVetnic Jan 26, 2024
320d4d0
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
NikolaVetnic Jan 26, 2024
68272cd
refactor: make return type nullable and possibly return null
NikolaVetnic Jan 26, 2024
058c9b4
refactor: remove null warning suppression and return nullable type
NikolaVetnic Jan 26, 2024
a968a74
refactor: change to FirstAsync call as basic tier always exists since…
NikolaVetnic Jan 26, 2024
f4a6ab3
Merge main into fix-devices-code-issues
github-actions[bot] Jan 29, 2024
107ef6a
refactor: make return type nullable
NikolaVetnic Jan 29, 2024
68c9ed6
refactor: change FirstAsync into FirstOrDefaultAsync
NikolaVetnic Jan 29, 2024
8a2b56b
Revert "refactor: change FirstAsync into FirstOrDefaultAsync"
NikolaVetnic Jan 29, 2024
2f5e9b8
refactor: change FirstAsync into FirstOrDefaultAsync
NikolaVetnic Jan 29, 2024
8f6aa68
chore: disable warning temporarily
NikolaVetnic Jan 29, 2024
661ea50
refactor: remove null check
NikolaVetnic Jan 29, 2024
5e34df6
chore: formatting
NikolaVetnic Jan 29, 2024
e5c361d
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
NikolaVetnic Jan 29, 2024
d441ca0
Merge main into fix-devices-code-issues
github-actions[bot] Jan 29, 2024
984cd7e
Merge main into fix-devices-code-issues
github-actions[bot] Jan 30, 2024
d416309
Merge remote-tracking branch 'origin/main' into fix-devices-code-issues
NikolaVetnic Jan 30, 2024
d8ec2d2
Merge branch 'fix-devices-code-issues' of github.com:nmshd/backbone i…
NikolaVetnic Jan 30, 2024
297a0a9
Merge main into fix-devices-code-issues
github-actions[bot] Feb 5, 2024
c8e7899
Merge main into fix-devices-code-issues
github-actions[bot] Feb 5, 2024
0c0d02d
Merge main into fix-devices-code-issues
github-actions[bot] Feb 6, 2024
51d82ae
Merge main into fix-devices-code-issues
github-actions[bot] Feb 9, 2024
5d910d3
Merge main into fix-devices-code-issues
github-actions[bot] Feb 9, 2024
9abec29
Merge main into fix-devices-code-issues
github-actions[bot] Feb 9, 2024
0321a88
Merge main into fix-devices-code-issues
github-actions[bot] Feb 9, 2024
be116b4
Merge main into fix-devices-code-issues
github-actions[bot] Feb 9, 2024
11a03e7
Merge branch 'main' into fix-devices-code-issues
mergify[bot] Feb 9, 2024
f5d0d98
Merge branch 'main' into fix-devices-code-issues
mergify[bot] Feb 12, 2024
281dc62
chore: remove null suppression operator
tnotheis Feb 16, 2024
ba452e0
chore: remove default values from PaginationOptions properties
tnotheis Feb 16, 2024
b332ed7
feat: fix nullability in SendResult
tnotheis Feb 16, 2024
467be99
Merge branch 'main' into fix-devices-code-issues
tnotheis Feb 16, 2024
0da9fce
chore: resolve nullability problems
tnotheis Feb 16, 2024
ef46d30
chore: extract variable
tnotheis Feb 19, 2024
0a510d9
chore: fix nullability issues for entity constructors
tnotheis Feb 19, 2024
90c2ded
Merge branch 'main' into fix-devices-code-issues
tnotheis Feb 19, 2024
1465ef0
chore: remove redundant using directives
tnotheis Feb 19, 2024
5403230
chore: add words to resharper dictionary
tnotheis Feb 19, 2024
3c353fe
chore: remove unused setters from Identity
tnotheis Feb 19, 2024
b605705
chore: fix some compiler warnings
tnotheis Feb 19, 2024
c4a55b9
chore: remove redundant assignment of null
tnotheis Feb 19, 2024
8a45812
refactor: rename GetBasicTierAsync to FindBasicTier to match naming c…
tnotheis Feb 19, 2024
82b9e3c
chore: fix some nullability issues
tnotheis Feb 19, 2024
6516991
chore: formatting
tnotheis Feb 19, 2024
fdd86fa
test: fix DeletedAt comparison
tnotheis Feb 19, 2024
229190b
fix: add CreatedAt and PublicKey to IdentityEntityTypeConfiguration
tnotheis Feb 19, 2024
ff3a255
chore: formatting
tnotheis Feb 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Task RunInTransaction(Func<Task> action, List<int> errorNumbersToRetry,

Task RunInTransaction(Func<Task> action, IsolationLevel isolationLevel);

Task<T?> RunInTransaction<T>(Func<Task<T?>> action, List<int> errorNumbersToRetry,
Task<T?> RunInTransaction<T>(Func<Task<T?>> action, List<int>? errorNumbersToRetry,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted);

Task<T?> RunInTransaction<T>(Func<Task<T?>> func, IsolationLevel isolationLevel);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.8.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ public class UpdateDeviceRegistrationCommand : IRequest<UpdateDeviceRegistration
public string Platform { get; set; }
public string Handle { get; set; }
public string AppId { get; set; }
public string Environment { get; set; }
public string? Environment { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CreateIdentityRequest
public required string ClientSecret { get; set; }
public required byte[] IdentityPublicKey { get; set; }
public required string DevicePassword { get; set; }
public byte IdentityVersion { get; set; }
public required byte IdentityVersion { get; set; }
public required CreateIdentityRequestSignedChallenge SignedChallenge { get; set; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ namespace Backbone.Modules.Devices.Domain.Aggregates.PushNotifications;
public class PnsRegistration
{
// ReSharper disable once UnusedMember.Local
private PnsRegistration() { }
private PnsRegistration()
{
IdentityAddress = null!;
DeviceId = null!;
DevicePushIdentifier = null!;
Handle = null!;
UpdatedAt = SystemTime.UtcNow;
AppId = null!;
Environment = PushEnvironment.Development;
}

public PnsRegistration(IdentityAddress identityAddress, DeviceId deviceId, PnsHandle handle, string appId, PushEnvironment environment)
{
Expand All @@ -21,11 +30,11 @@ public PnsRegistration(IdentityAddress identityAddress, DeviceId deviceId, PnsHa
Environment = environment;
}

public IdentityAddress IdentityAddress { get; } = null!;
public DeviceId DeviceId { get; } = null!;
public DevicePushIdentifier DevicePushIdentifier { get; private set; } = null!;
public PnsHandle Handle { get; private set; } = null!;
public string AppId { get; private set; } = null!;
public IdentityAddress IdentityAddress { get; }
public DeviceId DeviceId { get; }
public DevicePushIdentifier DevicePushIdentifier { get; private set; }
public PnsHandle Handle { get; private set; }
public string AppId { get; private set; }
public DateTime UpdatedAt { get; private set; }
public PushEnvironment Environment { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
using Microsoft.Extensions.DependencyInjection;
using Npgsql.EntityFrameworkCore.PostgreSQL;

#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

namespace Backbone.Modules.Devices.Infrastructure.Persistence.Database;

public class DevicesDbContext : IdentityDbContext<ApplicationUser>, IDevicesDbContext
{
private readonly IServiceProvider _serviceProvider;
private readonly IServiceProvider? _serviceProvider;
private const int MAX_RETRY_COUNT = 50000;
private static readonly TimeSpan MAX_RETRY_DELAY = TimeSpan.FromSeconds(1);
private const string SQLSERVER = "Microsoft.EntityFrameworkCore.SqlServer";
private const string POSTGRES = "Npgsql.EntityFrameworkCore.PostgreSQL";

public DevicesDbContext(DbContextOptions<DevicesDbContext> options)
: base(options)
{
}
{ }

public DevicesDbContext(DbContextOptions<DevicesDbContext> options, IServiceProvider serviceProvider)
: base(options)
Expand Down Expand Up @@ -60,7 +61,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
optionsBuilder.AddInterceptors(_serviceProvider.GetRequiredService<SaveChangesTimeInterceptor>());
}

public async Task RunInTransaction(Func<Task> action, List<int> errorNumbersToRetry,
public async Task RunInTransaction(Func<Task> action, List<int>? errorNumbersToRetry,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
{
ExecutionStrategy executionStrategy;
Expand All @@ -70,7 +71,6 @@ public async Task RunInTransaction(Func<Task> action, List<int> errorNumbersToRe
executionStrategy = new SqlServerRetryingExecutionStrategy(this, MAX_RETRY_COUNT, MAX_RETRY_DELAY, errorNumbersToRetry);
break;
case POSTGRES:
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
var errorCodesToRetry = errorNumbersToRetry != null ? errorNumbersToRetry.ConvertAll(x => x.ToString()) : new List<string>();
executionStrategy = new NpgsqlRetryingExecutionStrategy(this, MAX_RETRY_COUNT, MAX_RETRY_DELAY, errorCodesToRetry);
break;
Expand All @@ -88,10 +88,10 @@ await executionStrategy.ExecuteAsync(async () =>

public async Task RunInTransaction(Func<Task> action, IsolationLevel isolationLevel)
{
await RunInTransaction(action, null!, isolationLevel);
await RunInTransaction(action, null, isolationLevel);
}

public async Task<T> RunInTransaction<T>(Func<Task<T>> action, List<int> errorNumbersToRetry,
public async Task<T?> RunInTransaction<T>(Func<Task<T?>> action, List<int>? errorNumbersToRetry,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
{
var response = default(T);
Expand All @@ -101,9 +101,9 @@ public async Task<T> RunInTransaction<T>(Func<Task<T>> action, List<int> errorNu
return response;
}

public async Task<T> RunInTransaction<T>(Func<Task<T>> func, IsolationLevel isolationLevel)
public async Task<T?> RunInTransaction<T>(Func<Task<T?>> func, IsolationLevel isolationLevel)
{
return await RunInTransaction(func, null!, isolationLevel);
return await RunInTransaction(func, null, isolationLevel);
}

public List<string> GetFcmAppIdsForWhichNoConfigurationExists(ICollection<string> supportedAppIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal class DevicePushIdentifierEntityFrameworkValueConverter : ValueConverte
{
public DevicePushIdentifierEntityFrameworkValueConverter() : this(null) { }

public DevicePushIdentifierEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
public DevicePushIdentifierEntityFrameworkValueConverter(ConverterMappingHints? mappingHints)
: base(
dpi => dpi.StringValue,
value => DevicePushIdentifier.Parse(value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public PnsHandleEntityFrameworkValueConverter() : this(null)
{
}

public PnsHandleEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
public PnsHandleEntityFrameworkValueConverter(ConverterMappingHints? mappingHints)
: base(
pnsHandle => SerializeHandle(pnsHandle),
value => DeserializeHandle(value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public TierIdEntityFrameworkValueConverter() : this(null)
{
}

public TierIdEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
public TierIdEntityFrameworkValueConverter(ConverterMappingHints? mappingHints)
: base(
id => id.Value,
value => TierId.Create(value).Value,
Expand All @@ -19,13 +19,13 @@ public TierIdEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
}
}

public class NullableTierIdValueConverter : ValueConverter<TierId, string>
public class NullableTierIdValueConverter : ValueConverter<TierId?, string?>
{
public NullableTierIdValueConverter() : this(null)
{
}

public NullableTierIdValueConverter(ConverterMappingHints mappingHints)
public NullableTierIdValueConverter(ConverterMappingHints? mappingHints)
: base(
id => id == null ? null : id.Value,
value => value == null ? null : TierId.Create(value).Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public TierNameEntityFrameworkValueConverter() : this(null)
{
}

public TierNameEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
public TierNameEntityFrameworkValueConverter(ConverterMappingHints? mappingHints)
: base(
id => id.Value,
value => TierName.Create(value).Value,
Expand All @@ -18,13 +18,13 @@ public TierNameEntityFrameworkValueConverter(ConverterMappingHints mappingHints)
}
}

public class NullableTierNameValueConverter : ValueConverter<TierName, string>
public class NullableTierNameValueConverter : ValueConverter<TierName?, string?>
{
public NullableTierNameValueConverter() : this(null)
{
}

public NullableTierNameValueConverter(ConverterMappingHints mappingHints)
public NullableTierNameValueConverter(ConverterMappingHints? mappingHints)
: base(
id => id == null ? null : id.Value,
value => value == null ? null : TierName.Create(value).Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public bool HasConfigForAppId(string appId)
return serviceAccountForServiceAccountNameExists;
}

public string GetServiceAccountForAppId(string appId)
public string GetServiceAccountForAppId(string? appId)
{
var app = Apps.GetValueOrDefault(appId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public async void Update_of_a_registration_that_does_not_exist_yet()

var mockPnsRegistrationsRepository = A.Fake<IPnsRegistrationsRepository>();

A.CallTo(() => mockPnsRegistrationsRepository.FindByDeviceId(deviceId, A<CancellationToken>._, A<bool>._))
.Returns((PnsRegistration)null!).Once();
A.CallTo(() => mockPnsRegistrationsRepository.FindByDeviceId(deviceId, A<CancellationToken>._, A<bool>._))!
.Returns((PnsRegistration?)null).Once();

var directPushService = CreateDirectPushService(mockPnsRegistrationsRepository);

Expand Down Expand Up @@ -97,8 +97,8 @@ public async void Trying_to_delete_non_existing_PnsRegistration_does_nothing()

var mockPnsRegistrationsRepository = A.Fake<IPnsRegistrationsRepository>();

A.CallTo(() => mockPnsRegistrationsRepository.FindByDeviceId(deviceId, A<CancellationToken>._, A<bool>._))
.Returns((PnsRegistration)null!);
A.CallTo(() => mockPnsRegistrationsRepository.FindByDeviceId(deviceId, A<CancellationToken>._, A<bool>._))!
.Returns((PnsRegistration?)null);

var directPushService = CreateDirectPushService(mockPnsRegistrationsRepository);

Expand Down