-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Nv 2460 - Update Tenant Endpoint #3638
Nv 2460 - Update Tenant Endpoint #3638
Conversation
); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
return (await this.tenantRepository.findOne({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can not be null because we fetched it in the beginning.
…V-2460-update-tenant-endpoint # Conflicts: # apps/api/src/app/tenant/tenant.controller.ts
apps/api/src/app/tenant/usecases/update-tenant/update-tenant.usecase.ts
Outdated
Show resolved
Hide resolved
apps/api/src/app/tenant/usecases/update-tenant/update-tenant.usecase.ts
Outdated
Show resolved
Hide resolved
updatePayload.data = command.data; | ||
} | ||
|
||
if (command.newIdentifier != null && command.newIdentifier !== command.identifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (command.newIdentifier != null && command.newIdentifier !== command.identifier) { | |
if (command?.newIdentifier !== command.identifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we need to make sure that command.newIdentifier
is not undefined as well, and then check if they are not equal, because of the following case:
command?.newIdentifier !== command.identifier
could be undefine !== 'current_identifier'
and the if will the true but i am not sure we will want to update it with undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TS statement command?.newIdentifier !== command.identifier
is compiled to JS like (command === null || command === void 0 ? void 0 : command.newIdentifier) !== command.identifier
in short it's like command.newIdentifier && command.newIdentifier !== command.identifier
.
So for the undefined
case it will be like undefined && command.newIdentifier !== command.identifier
, in the result false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a dedicated test to check the null/undefined updates just in case.
db00449
into
nv-2402-tenancy-crud-api
What change does this PR introduce?
Adds updated tenant metadata.
Why was this change needed?
So the user's tenants will be updated.
Other information (Screenshots)