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 projects decorator #1547

Merged
merged 9 commits into from
Sep 4, 2024
Merged

Conversation

MarcAstr0
Copy link
Collaborator

@MarcAstr0 MarcAstr0 commented Sep 4, 2024

Description

After the changes introduced in #1469, it was found that read model projections where the join key was a nullable array gave a "TS1241: Unable to resolve signature of method decorator when called as an expression" compilation error. This happened in read models and entities like the following:

@Entity
export class MyEntity {
  public constructor(
    readonly id: UUID,
    readonly someListOfIds?: Array<string>
    // other properties
  ) {}
  // rest of the entity code
}
@ReadModel
export class SomeReadModel {
  @Projects(MyEntity, 'someListOfIds')
  public static projectMyEntity(
    entity: MyEntity,
    readModelId: UUID,
    currentReadModel?: SomeReadModel
  ): ProjectionResult<SomeReadModel> {
    // projection logic
  }
  
  // rest of the read model code
}

Changes

  • Modified ProjectionMethod type to appropriately handle this edge case.

Checks

  • Project Builds
  • Project passes tests and checks
  • Updated documentation accordingly

Copy link

what-the-diff bot commented Sep 4, 2024

PR Summary

  • Introduction of a New File
    A new file named fix_projects_decorator_2024-09-04-11-50.json has been placed in the common/changes/@boostercloud/framework-core directory. This file contains updates about necessary tweaks made to the @boostercloud/framework-core to rectify issues with the Projects decorator.

  • Adjustment to ProjectionMethod Type
    Changes were applied to the ProjectionMethod type in the projects.ts file located in packages/framework-core/src/decorators. The adjustment pertains to the condition for PropertyType<TEntity, TJoinKeyType>. Earlier, it specifically looked for an extension of UUID, but after the revision, it checks if it extends an array of any type. This allows for greater flexibility and adaptability in the system.

@MarcAstr0
Copy link
Collaborator Author

/integration sha=ca27e4da9511f9daa8166e66be4319c2b5bf415d

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=9332c5c99ccfbdadbf8601011b2837419ec4c07e

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

2 similar comments
Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=ca27e4d

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

1 similar comment
Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=f682cc0

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=9daf86b

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=7b45ee1

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

@MarcAstr0
Copy link
Collaborator Author

/integration sha=ca27e4d

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=ca27e4da9511f9daa8166e66be4319c2b5bf415d

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

❌ Oh no! Integration tests have failed

@MarcAstr0
Copy link
Collaborator Author

/integration sha=fbc2067ba64e8f0d10151954886e618d891aa9b8

Copy link
Contributor

github-actions bot commented Sep 4, 2024

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

github-actions bot commented Sep 4, 2024

✅ Integration tests have finished successfully!

@MarcAstr0 MarcAstr0 marked this pull request as ready for review September 4, 2024 16:13
Copy link
Collaborator

@davidverdu davidverdu left a comment

Choose a reason for hiding this comment

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

LGTM. I guess that you don't need other types different from string and UUID in the union, do you?

@MarcAstr0 MarcAstr0 merged commit adf2902 into boostercloud:main Sep 4, 2024
6 checks passed
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.

2 participants