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

[IP-387] Upgrade fp-ts #165

Merged
merged 74 commits into from
Sep 21, 2021
Merged

[IP-387] Upgrade fp-ts #165

merged 74 commits into from
Sep 21, 2021

Conversation

balanza
Copy link
Contributor

@balanza balanza commented Sep 15, 2021

List of Changes

  • Update fp-ts and all related dependencies in 1e775ae
  • Implement new API into all files (see commit list)

Motivation and Context

We can now move away from legacy, unmaintained fp-ts@1

How Has This Been Tested?

Unit tests

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

GetUser/handler.ts Show resolved Hide resolved
GetUser/handler.ts Show resolved Hide resolved
UpdateUser/handler.ts Outdated Show resolved Hide resolved
UploadOrganizationLogo/handler.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@gquadrati gquadrati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked half of the files for now, I just left 3 comments for now

UserDataProcessingCheckLastStatusActivity/handler.ts Outdated Show resolved Hide resolved
UploadServiceLogo/handler.ts Outdated Show resolved Hide resolved
CreateService/__tests__/handler.test.ts Outdated Show resolved Hide resolved
CreateService/__tests__/handler.test.ts Outdated Show resolved Hide resolved
DeleteUserDataActivity/backupAndDelete.ts Show resolved Hide resolved
DeleteUserDataActivity/backupAndDelete.ts Show resolved Hide resolved
ExtractUserDataActivity/handler.ts Show resolved Hide resolved
ExtractUserDataActivity/handler.ts Show resolved Hide resolved
ExtractUserDataActivity/handler.ts Outdated Show resolved Hide resolved
ExtractUserDataActivity/handler.ts Outdated Show resolved Hide resolved
ExtractUserDataActivity/handler.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@gquadrati gquadrati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just few other comments

UpdateUser/handler.ts Outdated Show resolved Hide resolved
UpdateService/__tests__/handler.test.ts Outdated Show resolved Hide resolved
RegenerateSubscriptionKeys/handler.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@michaeldisaro michaeldisaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found a lot of old _s that could be renamed because they are used and we have to check them.
Some code is not functional, but I understand that it could have been a huge refactoring of old legacy code that's working.
I suggested a refactoring, but my opinion remains that we should just wrap old code since it's working, a refactoring could be a waste of time at this time.
I think that the overall code refactoring should not be so invasive to cause logical problems.
Nice (...and loooong...) job!

const handler = InfoHandler(checkApplicationHealth());

return wrapRequestHandler(handler);
return pipe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite amazing. Thanks @gquadrati!

.findOneByServiceId(serviceId)
.run();
if (isLeft(errorOrMaybeRetrievedService)) {
const errorOrMaybeRetrievedService = await serviceModel.findOneByServiceId(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not improving it with a pipe like the proposed "GetServiceHandler"?

};
return pipe(
Object.entries(existingGroups),
_ => new Map(_),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) I care about _

package.json Outdated Show resolved Hide resolved
() => this.container.item(messageId, fiscalCode).delete(),
toCosmosErrorResponse
),
TE.map(_ => _.item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

() => this.container.item(documentId, notificationId).delete(),
toCosmosErrorResponse
),
TE.map(_ => _.item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

() => this.container.item(documentId, fiscalCode).delete(),
toCosmosErrorResponse
),
TE.map(_ => _.item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

)
.map(_ => _.item.id);
),
TE.map(_ => _.item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

return true;
}

if (
deleteResults.some(
_ => _.maybeError.isSome() && _.uResponse.statusCode !== 404
_ => O.isSome(_.maybeError) && _.uResponse.statusCode !== 404
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

)
) {
// retry
const errors = new Error(
deleteResults
.map(_ => _.maybeError)
.filter(isSome)
.filter(O.isSome)
.map(_ => _.value.message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@balanza
Copy link
Contributor Author

balanza commented Sep 20, 2021

Thanks everybody for the huge effort of reviewing this PR, I really appreciate the care you put in refining code so that changes could be as smooth as possible.

Basically every review focused on having more clear implementations, and I think code has improved a lot from my first proposal. Furthermore, no behavioral issue emerged, and that makes me way more confident on this refactor.

If you agree, I'd stop here with refinements so that we can have a closure on this activity; further improvements can be applied in future as the application evolves.

Copy link
Contributor

@gquadrati gquadrati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@balanza balanza requested a review from a team as a code owner September 21, 2021 14:30
@balanza balanza enabled auto-merge (squash) September 21, 2021 14:30
@balanza balanza merged commit 0a2d30d into master Sep 21, 2021
@balanza balanza deleted the ip-387--upgrade-fp-ts branch September 21, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants