-
Notifications
You must be signed in to change notification settings - Fork 334
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
chore(rethinkdb): TemplateScale: One-shot #10021
Conversation
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
Signed-off-by: Matt Krick <[email protected]>
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
WalkthroughThe recent changes focus on enhancing data handling and integration mechanisms within a PostgreSQL context, transitioning from RethinkDB. Key modifications include the introduction of new data loaders, refined GraphQL resolvers for template scales, improved sorting and retrieval functionalities, and a shift towards implicit typing in TypeScript. These updates streamline various components, optimise performance, and enhance code clarity, ensuring a more robust and efficient application architecture. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GraphQL
participant DataLoader
participant PostgreSQL
Client->>GraphQL: Query for TemplateScale
GraphQL->>DataLoader: Load TemplateScale data
DataLoader->>PostgreSQL: Query TemplateScale
PostgreSQL-->>DataLoader: Return TemplateScale data
DataLoader-->>GraphQL: Provide loaded data
GraphQL-->>Client: Respond with TemplateScale data
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review due to trivial changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
Outside diff range, codebase verification and nitpick comments (2)
packages/server/graphql/public/types/TemplateScale.ts (1)
11-20
: Resolverdimensions
looks good but consider error handling.The resolver correctly fetches dimensions from RethinkDB, but it lacks error handling.
Consider adding error handling to manage potential issues with the database query.
+ try { + const r = await getRethink() + return r + .table('TemplateDimension') + .getAll(teamId, {index: 'teamId'}) + .filter((row: RDatum) => + row('removedAt').default(null).eq(null).and(row('scaleId').eq(scaleId)) + ) + .run() + } catch (error) { + console.error('Error fetching dimensions:', error) + throw new Error('Failed to fetch dimensions') + }packages/server/database/rethinkDriver.ts (1)
Verify the impact of removing
TemplateScale
.The removal of the
TemplateScale
type from theRethinkSchema
affects multiple parts of the codebase. The following files contain references toTemplateScale
and need to be updated or have the references removed accordingly:
packages/server/utils/analytics/analytics.ts
packages/server/postgres/select.ts
packages/server/postgres/types/index.d.ts
packages/server/postgres/migrations/1721405703862_TemplateScale.ts
packages/server/postgres/migrations/1614030642692_refs-for-meetings.ts
packages/server/postgres/queries/getTemplateScaleRefsByIds.ts
packages/server/postgres/migrations/1698265600000_addPrioritizationTemplates.ts
packages/server/postgres/migrations/1613005669863_template-refs.ts
packages/server/postgres/generatedMigrationHelpers.ts
packages/server/graphql/types/AddTemplateScaleInput.ts
packages/server/graphql/types/TemplateScaleRef.ts
packages/server/graphql/types/TemplateScale.ts
packages/server/graphql/types/Team.ts
packages/server/graphql/types/UpdatePokerTemplateScaleValuePayload.ts
packages/server/graphql/types/TemplateScaleInput.ts
packages/server/graphql/types/TemplateDimensionRef.ts
packages/server/graphql/types/TemplateDimension.ts
packages/server/graphql/types/RenamePokerTemplateScalePayload.ts
packages/server/graphql/types/RemovePokerTemplateScaleValuePayload.ts
packages/server/graphql/types/RemovePokerTemplateScalePayload.ts
packages/server/graphql/types/MovePokerTemplateScaleValuePayload.ts
packages/server/graphql/types/AddPokerTemplateScaleValuePayload.ts
packages/server/graphql/types/AddPokerTemplateScalePayload.ts
packages/server/graphql/rootMutation.ts
packages/server/graphql/public/types/TemplateScaleValue.ts
packages/server/graphql/public/types/TemplateScaleRef.ts
packages/server/graphql/public/types/TemplateScale.ts
packages/server/graphql/mutations/updatePokerTemplateScaleValue.ts
packages/server/graphql/mutations/startSprintPoker.ts
packages/server/graphql/mutations/removePokerTemplateScaleValue.ts
packages/server/graphql/mutations/renamePokerTemplateScale.ts
packages/server/graphql/mutations/removePokerTemplateScale.ts
packages/server/graphql/mutations/addPokerTemplateScaleValue.ts
packages/server/graphql/mutations/addPokerTemplateScale.ts
packages/server/dataloader/primaryKeyLoaderMakers.ts
packages/server/dataloader/foreignKeyLoaderMakers.ts
packages/server/database/migrations/20201214104322-noPokerSpecial.ts
packages/server/database/migrations/20210330163028-addPriorityScale.ts
packages/server/database/types/EstimateUserScore.ts
packages/server/database/migrations/20201118132835-removeValueFieldInScaleValue.ts
packages/server/database/migrations/20201014110000-templateScale.ts
packages/server/database/migrations/20200824105351-pokerTemplate.ts
packages/server/database/migrations/20200803123551-addTemplateScale.ts
packages/client/subscriptions/TeamSubscription.ts
packages/client/mutations/RenamePokerTemplateScaleMutation.ts
packages/client/mutations/RemovePokerTemplateScaleMutation.ts
packages/client/mutations/AddPokerTemplateScaleMutation.ts
packages/client/mutations/UpdatePokerTemplateScaleValueMutation.ts
packages/client/mutations/UpdatePokerScopeMutation.ts
packages/client/mutations/RemovePokerTemplateScaleValueMutation.ts
packages/client/mutations/MovePokerTemplateScaleValueMutation.ts
packages/client/modules/meeting/components/PokerTemplateScalePicker.tsx
packages/client/modules/meeting/components/ScaleActions.tsx
packages/client/modules/meeting/components/SelectScaleDropdown.tsx
packages/client/modules/meeting/components/TemplateScaleValueList.tsx
packages/client/modules/meeting/components/EditableTemplateScaleValueLabel.tsx
packages/client/modules/meeting/components/TemplateScaleValueItem.tsx
packages/client/modules/meeting/components/EditableTemplateScaleName.tsx
packages/client/modules/meeting/components/EditableTemplateScaleValueColor.tsx
packages/client/modules/meeting/components/AddPokerTemplateScaleValue.tsx
packages/client/modules/meeting/components/AddScaleValueButtonInput.tsx
packages/client/modules/meeting/components/TemplateDimensionItem.tsx
packages/client/modules/meeting/components/ScaleValuePalettePicker.tsx
packages/client/modules/meeting/components/ScaleDropdownMenuItem.tsx
packages/client/modules/meeting/components/PokerTemplateScaleDetails.tsx
packages/client/hooks/usePortal.tsx
packages/client/modules/meeting/components/NewTemplateScaleValueLabelInput.tsx
packages/client/components/PokerVotingRow.tsx
packages/client/components/PokerCard.tsx
packages/client/components/ActivityLibrary/ActivityDetails/TemplateDetails.tsx
Please ensure that all references to
TemplateScale
are updated or removed accordingly.Analysis chain
Line range hint
64-64
:
Verify the impact of removingTemplateScale
.The removal of the
TemplateScale
type from theRethinkSchema
might affect components or services relying on this type. Ensure that all references toTemplateScale
are updated or removed accordingly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing `TemplateScale`. # Test: Search for references to `TemplateScale`. Expect: No references to `TemplateScale`. rg --type python -A 5 $'TemplateScale'Length of output: 68
Script:
#!/bin/bash # Description: Verify the impact of removing `TemplateScale`. # Test: Search for references to `TemplateScale`. Expect: No references to `TemplateScale`. rg --type ts -A 5 $'TemplateScale'Length of output: 170626
}[] | ||
|
||
const uniqueScaleIdSet = new Set<string>() | ||
const uniqueScales = [] as TemplateScale[] | ||
const uniqueScales = [] as any[] |
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.
Potential issue with changing the type of uniqueScales
to any
.
Changing the type of uniqueScales
from TemplateScale
to any
sacrifices type safety and may lead to unexpected behaviour. Consider maintaining type safety by using a more specific type.
- const uniqueScales = [] as any[]
+ const uniqueScales = [] as TemplateScale[]
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const uniqueScales = [] as any[] | |
const uniqueScales = [] as TemplateScale[] |
@@ -58,11 +57,11 @@ | |||
.run()) as { | |||
id: string | |||
name: string | |||
dimensions: (TemplateDimension & {scale: TemplateScale})[] | |||
dimensions: (TemplateDimension & {scale: any})[] |
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.
Potential issue with changing the type to any
.
Changing the type of the scale
property from TemplateScale
to any
sacrifices type safety and may lead to unexpected behaviour. Consider maintaining type safety by using a more specific type.
- dimensions: (TemplateDimension & {scale: any})[]
+ dimensions: (TemplateDimension & {scale: TemplateScale})[]
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
dimensions: (TemplateDimension & {scale: any})[] | |
dimensions: (TemplateDimension & {scale: TemplateScale})[] |
Signed-off-by: Matt Krick <[email protected]>
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
Description
moves TemplateScale to PG in one shot (it's such a small, rarely used table that 1 shot is OK)
Summary by CodeRabbit
New Features
TemplateScale
,TemplateScaleRef
, andTemplateScaleValue
to enhance data handling in queries.Bug Fixes
Improvements