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

feat(auth-api): Add column to delegation type indicating if actor discretion is required #16226

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

valurefugl
Copy link
Member

@valurefugl valurefugl commented Oct 1, 2024

https://www.notion.so/Add-opt-out-by-default-property-on-delegation-types-5e6e6b2dd3a94833a053787504feba6f?pvs=4

What

Add a column to delegation type that can be used to specify default behavior for that type.

Why

So we can configure that legal representatives are opted-out of notifications by default.

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced delegation management with new validation checks for delegation types and providers.
    • Introduced a new column for actor_discretion_required in the delegation type database schema.
    • Added optional property actorDiscretionRequired to delegation records.
    • Improved fixture factory with methods to create all delegation types and support for actor discretion.
  • Bug Fixes

    • Improved test cases for delegation indexing and management to ensure accuracy in various scenarios.
  • Documentation

    • Updated type definitions to include new properties related to delegation types.
  • Chores

    • Refactored test suite for clarity and organization, including new methods for creating delegation types.

@valurefugl valurefugl requested review from a team as code owners October 1, 2024 14:58
Copy link
Contributor

coderabbitai bot commented Oct 1, 2024

Walkthrough

The pull request introduces several changes across multiple files, focusing on enhancing delegation management within the application. Key modifications include updates to test cases for delegation indexing, the addition of new database migration scripts for schema modifications, and enhancements to service and model classes to incorporate new delegation types and properties. These changes collectively aim to improve the handling of delegation types, including the introduction of actor discretion requirements.

Changes

File Change Summary
apps/services/auth/delegation-api/src/app/delegations/test/... Updated test cases for delegation indexing, modifying how supported delegation types are defined and enhancing validation scenarios in the DelegationIndexController tests.
libs/auth-api-lib/migrations/... Introduced migration files to add a new column actor_discretion_required to delegation_type, and foreign key constraints to delegation_index. Additionally, a seeder script sets discretion for legal representatives.
libs/auth-api-lib/src/lib/delegations/... Updated DelegationsIndexService to include DelegationTypeModel in queries, and modified the DelegationRecordDTO to include a new optional property actorDiscretionRequired.
libs/auth-api-lib/src/lib/delegations/models/... Enhanced DelegationIndex and DelegationTypeModel to include foreign key relationships and the new actorDiscretionRequired property.
libs/services/auth/testing/src/fixtures/... Modified FixtureFactory to create all delegation types and updated the CreateDelegationType type definition to include actorDiscretionRequired.

Possibly related PRs

Suggested labels

automerge, high priority

Suggested reviewers

  • Herdismaria
  • GunnlaugurG

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (8)
libs/auth-api-lib/migrations/20240927103047-add-discretion-column-to-delegation-type.js (1)

1-1: Remove redundant 'use strict' directive

The 'use strict' directive is unnecessary in this context as JavaScript modules are automatically in strict mode.

Apply this diff to remove the redundant directive:

-'use strict'
🧰 Tools
🪛 Biome

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

libs/auth-api-lib/seeders/20241001144241-set-actor-discretion-for-legal-repr.js (1)

2-11: LGTM: up method correctly implements the required change.

The up method successfully updates the actor_discretion_required field for the 'LegalRepresentative' delegation type. The use of a transaction ensures atomicity.

Consider using parameterized queries in future migrations, especially when dealing with user input, to prevent potential SQL injection vulnerabilities. For example:

return queryInterface.sequelize.query(
  `UPDATE delegation_type SET actor_discretion_required = :value WHERE id = :id`,
  {
    replacements: { value: true, id: 'LegalRepresentative' },
    type: queryInterface.sequelize.QueryTypes.UPDATE,
  }
);
libs/auth-api-lib/migrations/20240927153835-add_fk_constraints_to_delegation_index.js (1)

1-3: Remove redundant 'use strict' directive

The 'use strict' directive on line 1 is redundant in JavaScript modules as they are automatically in strict mode. Consider removing this line to adhere to modern JavaScript practices.

Apply this diff to remove the redundant directive:

-'use strict'

 module.exports = {

The overall structure of the migration file looks good and follows the expected pattern for Sequelize migrations.

🧰 Tools
🪛 Biome

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

libs/auth-api-lib/src/lib/delegations/dto/delegation-index.dto.ts (1)

34-37: LGTM! Consider adding a description to the @ApiProperty decorator.

The new actorDiscretionRequired property is well-implemented and aligns with the PR objectives. The use of TypeScript and appropriate decorators adheres to the coding guidelines for the libs directory.

To improve documentation, consider adding a description to the @ApiProperty decorator:

@ApiProperty({ 
  type: Boolean, 
  nullable: true, 
  description: 'Indicates whether actor discretion is required for this delegation type.' 
})

This addition will enhance the API documentation and provide more context for consumers of this DTO.

libs/auth-api-lib/src/lib/delegations/models/delegation-type.model.ts (1)

68-73: LGTM: New column actorDiscretionRequired added correctly.

The new boolean column actorDiscretionRequired has been added as per the PR objectives. It's correctly defined as non-nullable with a default value of false, which aligns with the goal of enabling legal representatives to be opted-out of notifications by default.

Consider adding a brief comment above the column to explain its purpose:

/**
 * Indicates whether actor discretion is required for this delegation type.
 * When false, legal representatives are opted-out of notifications by default.
 */
@Column({
  type: DataType.BOOLEAN,
  allowNull: false,
  defaultValue: false,
})
actorDiscretionRequired!: boolean
apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index-test-cases.ts (2)

68-70: Approved: Enhanced specificity for personal representative delegation type

The change introduces a more granular specification of delegation rights for personal representatives, which aligns well with the PR objective of adding a new column to the delegation type. This modification enhances the test case's ability to validate the new feature.

Consider adding a brief comment explaining the significance of the prRight1 variable in this context, to improve code readability:

supportedDelegationTypes: [
  // Combine personal representative type with specific right for granular testing
  `${AuthDelegationType.PersonalRepresentative}:${prRight1}`,
],

Line range hint 1-105: Approved: Well-structured test cases adhering to NestJS practices

The test file demonstrates good adherence to NestJS testing practices:

  1. Proper organization within the test directory
  2. Consistent use of imports from shared modules
  3. Standardized approach to defining test cases using the TestCase class
  4. Comprehensive coverage of various delegation scenarios

For improved consistency and maintainability, consider extracting the repeated client creation logic into a separate factory function. This could reduce duplication and make it easier to update common client properties across all test cases:

function createTestClient(options: Partial<ClientOptions> = {}) {
  return createClient({
    clientId,
    ...options,
  });
}

// Usage in test cases:
custom: new TestCase(
  createTestClient({
    supportsCustomDelegation: true,
    supportedDelegationTypes: [AuthDelegationType.Custom],
  }),
  // ... rest of the test case
),
apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts (1)

Line range hint 32-42: Correct the invalid fromNationalId parameter in the test case

In the validation test case for 'should return status 400 if fromNationalId is invalid', the parameter uses 'invalidToNationalId' instead of 'invalidFromNationalId'. This may prevent the test from properly validating the scenario where the fromNationalId is invalid.

Apply this diff to correct the test case:

{
  message: 'should return status 400 if fromNationalId is invalid',
- param: `${AuthDelegationType.ProcurationHolder}_${testNationalId}_invalidToNationalId`,
+ param: `${AuthDelegationType.ProcurationHolder}_${testNationalId}_invalidFromNationalId`,
  responseDetail: 'Invalid national ids',
},
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 148403d and c039332.

📒 Files selected for processing (11)
  • apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index-test-cases.ts (1 hunks)
  • apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts (3 hunks)
  • libs/auth-api-lib/migrations/20240927103047-add-discretion-column-to-delegation-type.js (1 hunks)
  • libs/auth-api-lib/migrations/20240927153835-add_fk_constraints_to_delegation_index.js (1 hunks)
  • libs/auth-api-lib/seeders/20241001144241-set-actor-discretion-for-legal-repr.js (1 hunks)
  • libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts (7 hunks)
  • libs/auth-api-lib/src/lib/delegations/dto/delegation-index.dto.ts (2 hunks)
  • libs/auth-api-lib/src/lib/delegations/models/delegation-index.model.ts (3 hunks)
  • libs/auth-api-lib/src/lib/delegations/models/delegation-type.model.ts (3 hunks)
  • libs/services/auth/testing/src/fixtures/fixture-factory.ts (4 hunks)
  • libs/services/auth/testing/src/fixtures/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index-test-cases.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/auth-api-lib/migrations/20240927103047-add-discretion-column-to-delegation-type.js (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/migrations/20240927153835-add_fk_constraints_to_delegation_index.js (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/seeders/20241001144241-set-actor-discretion-for-legal-repr.js (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/src/lib/delegations/dto/delegation-index.dto.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/src/lib/delegations/models/delegation-index.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/src/lib/delegations/models/delegation-type.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/services/auth/testing/src/fixtures/fixture-factory.ts (2)

Pattern libs/services/**/*: "Confirm that the code adheres to the following:

  • Shared services and modules that can be utilized across NestJS apps.
  • Proper implementation of NestJS providers, including custom providers.
  • Adherence to NestJS module encapsulation and isolation principles."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/services/auth/testing/src/fixtures/types.ts (2)

Pattern libs/services/**/*: "Confirm that the code adheres to the following:

  • Shared services and modules that can be utilized across NestJS apps.
  • Proper implementation of NestJS providers, including custom providers.
  • Adherence to NestJS module encapsulation and isolation principles."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
📓 Learnings (1)
apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts (1)
Learnt from: baering
PR: island-is/island.is#16116
File: apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts:466-490
Timestamp: 2024-09-23T14:32:40.892Z
Learning: You prefer not to include additional error handling in test setup functions if errors would surface elsewhere.
🪛 Biome
libs/auth-api-lib/migrations/20240927103047-add-discretion-column-to-delegation-type.js

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

libs/auth-api-lib/migrations/20240927153835-add_fk_constraints_to_delegation_index.js

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

🔇 Additional comments (21)
libs/auth-api-lib/migrations/20240927103047-add-discretion-column-to-delegation-type.js (3)

4-12: LGTM: up function implementation

The up function correctly implements the addition of the actor_discretion_required column to the delegation_type table. The column definition aligns with the PR objectives, setting it as a non-null boolean with a default value of false.


14-21: LGTM: down function implementation

The down function correctly implements the removal of the actor_discretion_required column from the delegation_type table, effectively reversing the changes made in the up function.


1-22: Overall implementation looks good

The migration file successfully implements the addition of the actor_discretion_required column to the delegation_type table, aligning with the PR objectives. Both up and down functions are correctly implemented, ensuring the change can be applied and reverted as needed.

A minor suggestion was made to remove the redundant 'use strict' directive, but this doesn't affect the functionality of the migration.

🧰 Tools
🪛 Biome

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

libs/auth-api-lib/seeders/20241001144241-set-actor-discretion-for-legal-repr.js (3)

1-23: LGTM: File structure follows Sequelize migration standards.

The file structure and naming convention adhere to the Sequelize migration standards. The exported object with up and down methods is correct for managing database schema changes.


13-22: LGTM: down method correctly reverts the change.

The down method successfully reverts the change made in the up method by setting actor_discretion_required back to false for the 'LegalRepresentative' delegation type. The use of a transaction ensures atomicity.


1-23: Overall assessment: Well-implemented migration for updating delegation type.

This migration file successfully implements the required changes to add a column indicating if actor discretion is required for the 'LegalRepresentative' delegation type. The implementation is concise, focused, and aligns well with the PR objectives. Both up and down methods are correctly implemented, ensuring proper migration and rollback capabilities.

To ensure the migration's correctness, run the following verification script:

This script will help confirm the existence of the delegation_type table and the actor_discretion_required column, as well as identify any other references to the table that might need attention.

✅ Verification successful

Migration Verified: actor_discretion_required column added successfully.

The migration correctly adds the actor_discretion_required column to the delegation_type table. Both up and down methods are properly implemented, ensuring that the migration and rollback processes function as intended. This aligns well with the PR objectives and maintains the integrity of the database schema.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and structure of the delegation_type table

# Test: Check if the delegation_type table exists and has the actor_discretion_required column
rg --type sql -A 10 'CREATE TABLE.*delegation_type'

# Test: Verify other references to the delegation_type table in the codebase
rg --type-add 'code:*.{js,ts,jsx,tsx}' --type code 'delegation_type'

Length of output: 16319


Script:

#!/bin/bash
# Description: Verify the addition of the actor_discretion_required column to the delegation_type table

# Search for the addition of actor_discretion_required in migration files
rg --type js 'addColumn\s*\(\s*[\'"]delegation_type[\'"]\s*,\s*[\'"]actor_discretion_required[\'"]'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify the addition of the actor_discretion_required column to the delegation_type table

# Search for the addition of actor_discretion_required in migration files
rg --type js "addColumn\s*\(\s*['\"]delegation_type['\"]\s*,\s*['\"]actor_discretion_required['\"]"

Length of output: 278

libs/auth-api-lib/migrations/20240927153835-add_fk_constraints_to_delegation_index.js (3)

4-25: LGTM: Well-implemented up method

The up method is correctly implemented:

  • It adds two foreign key constraints to the delegation_index table.
  • The constraints are properly defined, linking type to delegation_type.id and provider to delegation_provider.id.
  • The use of Promise.all is appropriate for handling multiple asynchronous operations.
  • The constraint names are descriptive and follow a consistent naming convention.

The implementation adheres to the Sequelize migration pattern and looks good to me.


27-38: LGTM: Well-implemented down method

The down method is correctly implemented:

  • It removes the two foreign key constraints added in the up method.
  • The constraint names match those used in the up method, ensuring proper rollback.
  • The use of Promise.all is appropriate for handling multiple asynchronous operations.

The implementation provides a proper rollback mechanism and adheres to the Sequelize migration pattern.


1-39: Overall assessment: Well-implemented migration file

This migration file is well-structured and correctly implements the addition of foreign key constraints to the delegation_index table. Both the up and down methods are properly implemented, following Sequelize migration patterns and best practices. The only minor suggestion is to remove the redundant 'use strict' directive.

The implementation aligns with the PR objectives of enhancing the delegation type functionality in the auth API. Good job!

🧰 Tools
🪛 Biome

[error] 1-1: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

libs/auth-api-lib/src/lib/delegations/dto/delegation-index.dto.ts (1)

Line range hint 1-37: Changes align well with PR objectives and coding guidelines.

The addition of the actorDiscretionRequired property to the DelegationRecordDTO class successfully implements the feature described in the PR objectives. This change allows for specifying the default behavior associated with delegation types, particularly for opting out legal representatives from notifications by default.

The implementation adheres to the coding guidelines for the libs directory:

  1. It uses TypeScript for defining props and exporting types.
  2. The DTO remains reusable across different NextJS apps.
  3. The minimal changes support effective tree-shaking and bundling practices.
libs/auth-api-lib/src/lib/delegations/models/delegation-type.model.ts (3)

8-8: LGTM: Import changes are appropriate and well-organized.

The new imports (BelongsToMany, PersonalRepresentativeDelegationTypeModel, and DelegationTypeDto) are relevant to the changes made in the model and are correctly placed within their respective import groups.

Also applies to: 22-22, 25-25


Line range hint 1-105: LGTM: Excellent TypeScript usage and reusability.

The file demonstrates proper use of TypeScript, including:

  1. Effective use of type inference with Sequelize models.
  2. Clear type definitions for model attributes.
  3. Use of a DTO for type-safe data transfer.

The model is defined in a way that promotes reusability across different NextJS apps, adhering to the coding guidelines for the libs directory.


Line range hint 1-105: Summary: Changes successfully implement the PR objectives.

The modifications to DelegationTypeModel effectively introduce the new actorDiscretionRequired column, aligning with the PR's goal of enabling configuration for legal representatives to be opted-out of notifications by default. The implementation adheres to TypeScript best practices and maintains reusability across NextJS apps.

Key points:

  1. New column actorDiscretionRequired added with appropriate constraints.
  2. Necessary imports added to support the changes.
  3. TypeScript usage is robust throughout the file.
  4. The model remains reusable and consistent with existing patterns.

These changes successfully enhance the delegation type functionality as intended.

libs/services/auth/testing/src/fixtures/types.ts (1)

121-125: LGTM: Change aligns with PR objectives and follows best practices

The addition of the actorDiscretionRequired property to the CreateDelegationType type is well-implemented and aligns perfectly with the PR objective of introducing a new column to the delegation type. This change will enable the configuration of legal representatives to be opted-out of notifications by default, as intended.

The use of TypeScript's Pick and Optional utility types maintains code consistency and follows best practices, ensuring type safety and clarity in the codebase.

libs/auth-api-lib/src/lib/delegations/models/delegation-index.model.ts (3)

51-51: ForeignKey decorator correctly applied to 'provider'.

The @ForeignKey(() => DelegationProviderModel) decorator is appropriately added to establish the foreign key relationship for the provider field.


59-59: ForeignKey decorator correctly applied to 'type'.

The @ForeignKey(() => DelegationTypeModel) decorator is correctly added to the type field, ensuring the foreign key relationship is established.


86-88: ⚠️ Potential issue

Ensure 'delegationType' association is loaded when accessing 'actorDiscretionRequired'.

In the toDTO() method, this.delegationType?.actorDiscretionRequired is accessed. To prevent actorDiscretionRequired from being undefined, ensure that the delegationType association is eagerly loaded whenever toDTO() is called.

Run the following script to verify that all instances where DelegationIndex is fetched include the delegationType association:

✅ Verification successful

DelegationType association is properly loaded in all queries

All instances where DelegationIndex is fetched include the delegationType association, ensuring that actorDiscretionRequired is never undefined.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all queries fetching DelegationIndex without including 'delegationType'.

# Search for DelegationIndex queries and check for 'include' parameters.
rg --type typescript 'DelegationIndex\.(findAll|findOne|findByPk|findAndCountAll)\s*\(' -A 10 | grep -B 10 -A 10 -E 'include:\s*\[.*\]'

# Verify that 'delegationType' is included in the 'include' arrays.

Length of output: 172


Script:

#!/bin/bash
# Description: Find all queries fetching DelegationIndex without including 'delegationType'.

# Search for DelegationIndex queries in TypeScript files and check for 'include' parameters.
rg -g '*.ts' -g '*.tsx' 'DelegationIndex\.(findAll|findOne|findByPk|findAndCountAll)\s*\(' -A 10 | grep -B 10 -A 10 -E 'include:\s*\[.*\]'

# Verify that 'delegationType' is included in the 'include' arrays.

Length of output: 140

apps/services/auth/delegation-api/src/app/delegations/test/delegation-index/delegation-index.controller.spec.ts (1)

267-268: Good use of FixtureFactory to initialize test data

The initialization of delegation types using FixtureFactory enhances test reliability and maintainability by ensuring all necessary data is available for the tests.

libs/services/auth/testing/src/fixtures/fixture-factory.ts (1)

Line range hint 706-721: Addition of 'actorDiscretionRequired' parameter appears correct

The introduction of the actorDiscretionRequired parameter with a default value of false in the createDelegationType method, along with its inclusion in the defaults object, aligns with the intended functionality to specify default behaviors for delegation types.

libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts (2)

33-33: Import of DelegationTypeModel is Correct

The addition of DelegationTypeModel to the imports ensures that it can be included in the Sequelize queries below.


382-382: Verify Associations Between Models for Sequelize Includes

Including { model: DelegationTypeModel } in the include array of your Sequelize queries requires that an association is properly defined between the DelegationIndex model and the DelegationTypeModel. This could be a belongsTo, hasOne, or similar association.

Please confirm that these associations are correctly established to ensure that the queries execute without errors and return the expected results.

Also applies to: 652-652, 688-688, 715-715, 744-744

toDTO(): DelegationRecordDTO {
return {
fromNationalId: this.fromNationalId,
toNationalId: this.toNationalId,
subjectId: this.subjectId,
type: this.type as AuthDelegationType,
actorDiscretionRequired: this.delegationType?.actorDiscretionRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle potential undefined 'actorDiscretionRequired' in DTO.

Since delegationType might not be loaded, actorDiscretionRequired could be undefined. Consider providing a default value or handling this case to ensure consistent behavior for consumers of the DTO.

libs/services/auth/testing/src/fixtures/fixture-factory.ts Outdated Show resolved Hide resolved
libs/services/auth/testing/src/fixtures/fixture-factory.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.78%. Comparing base (9ef986b) to head (4a9e5e0).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16226      +/-   ##
==========================================
+ Coverage   36.76%   36.78%   +0.01%     
==========================================
  Files        6785     6785              
  Lines      139900   139955      +55     
  Branches    39772    39786      +14     
==========================================
+ Hits        51435    51476      +41     
- Misses      88465    88479      +14     
Flag Coverage Δ
air-discount-scheme-backend 54.27% <ø> (+0.03%) ⬆️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (-0.03%) ⬇️
api-domains-air-discount-scheme 37.00% <ø> (+0.09%) ⬆️
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.93% <ø> (+0.01%) ⬆️
api-domains-criminal-record 47.93% <ø> (+0.07%) ⬆️
api-domains-driving-license 44.52% <ø> (+0.04%) ⬆️
api-domains-education 31.74% <ø> (+0.06%) ⬆️
api-domains-health-insurance 34.78% <ø> (+0.09%) ⬆️
api-domains-mortgage-certificate 35.76% <ø> (+0.05%) ⬆️
api-domains-payment-schedule 41.29% <ø> (+0.08%) ⬆️
application-api-files 57.91% <ø> (+0.05%) ⬆️
application-core 71.29% <ø> (-0.33%) ⬇️
application-system-api 41.62% <ø> (+<0.01%) ⬆️
application-template-api-modules 23.76% <ø> (+0.02%) ⬆️
application-templates-accident-notification 22.14% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.70% <ø> (ø)
application-templates-estate 12.33% <ø> (-0.01%) ⬇️
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.15% <ø> (ø)
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <ø> (-0.01%) ⬇️
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.73% <ø> (+0.08%) ⬆️
clients-driving-license-book 43.97% <ø> (+0.05%) ⬆️
clients-financial-statements-inao 49.25% <ø> (+0.07%) ⬆️
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.71% <ø> (+0.08%) ⬆️
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.71% <ø> (+0.04%) ⬆️
cms 0.43% <ø> (ø)
cms-translations 39.06% <ø> (+0.01%) ⬆️
dokobit-signing 63.20% <ø> (+0.17%) ⬆️
download-service 44.79% <ø> (+0.04%) ⬆️
email-service 60.97% <ø> (+0.15%) ⬆️
feature-flags 90.97% <ø> (+0.13%) ⬆️
file-storage 53.48% <ø> (+0.23%) ⬆️
financial-aid-backend 56.58% <ø> (+0.03%) ⬆️
financial-aid-shared 19.03% <ø> (ø)
icelandic-names-registry-backend 54.68% <ø> (+0.03%) ⬆️
judicial-system-api 18.30% <ø> (ø)
judicial-system-audit-trail 69.10% <ø> (+0.16%) ⬆️
judicial-system-backend 55.30% <ø> (+<0.01%) ⬆️
judicial-system-message 67.12% <ø> (+0.12%) ⬆️
judicial-system-message-handler 48.17% <ø> (+0.37%) ⬆️
judicial-system-scheduler 69.17% <ø> (+0.05%) ⬆️
license-api 42.72% <ø> (+0.05%) ⬆️
nest-config 78.32% <ø> (+0.12%) ⬆️
nest-feature-flags 52.16% <ø> (+0.12%) ⬆️
nova-sms 62.56% <ø> (+0.18%) ⬆️
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.17% <ø> (ø)
services-auth-admin-api 52.01% <68.18%> (+0.02%) ⬆️
services-auth-delegation-api 57.97% <100.00%> (+0.03%) ⬆️
services-auth-ids-api 51.90% <72.72%> (+0.01%) ⬆️
services-auth-personal-representative 45.58% <63.63%> (+0.06%) ⬆️
services-auth-personal-representative-public 41.67% <63.63%> (+0.08%) ⬆️
services-auth-public-api 49.41% <68.18%> (+0.03%) ⬆️
services-documents 61.29% <ø> (+0.02%) ⬆️
services-endorsements-api 55.27% <ø> (+0.03%) ⬆️
services-sessions 65.88% <ø> (+0.09%) ⬆️
services-university-gateway 48.48% <ø> (+0.05%) ⬆️
services-user-notification 47.06% <ø> (-0.02%) ⬇️
services-user-profile 62.40% <ø> (+0.02%) ⬆️
shared-form-fields 31.63% <ø> (+0.02%) ⬆️
web 1.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...st/delegation-index/delegation-index-test-cases.ts 100.00% <ø> (ø)
...ns-controller/delegations.controller.test-cases.ts 100.00% <100.00%> (ø)
...modules/notifications/notificationsWorker/mocks.ts 97.67% <ø> (ø)
...b/src/lib/delegations/delegations-index.service.ts 87.06% <100.00%> (+0.05%) ⬆️
...ib/src/lib/delegations/dto/delegation-index.dto.ts 100.00% <100.00%> (ø)
...c/lib/delegations/models/delegation-index.model.ts 95.23% <100.00%> (-4.77%) ⬇️
...rc/lib/delegations/models/delegation-type.model.ts 100.00% <100.00%> (ø)
...vices/auth/testing/src/fixtures/fixture-factory.ts 91.54% <100.00%> (+0.19%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ef986b...4a9e5e0. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 1, 2024

Datadog Report

All test runs 779cea6 🔗

74 Total Test Services: 0 Failed, 72 Passed
🔻 Test Sessions change in coverage: 2 decreased, 8 increased, 189 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 28.35s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.74s N/A Link
api 0 0 0 4 0 2.6s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 16.68s N/A Link
api-domains-assets 0 0 0 3 0 10.85s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 13.87s N/A Link
api-domains-communications 0 0 0 5 0 32.08s N/A Link
api-domains-criminal-record 0 0 0 5 0 9.78s 1 no change Link
api-domains-driving-license 0 0 0 23 0 32.68s 1 no change Link
api-domains-education 0 0 0 8 0 21.96s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • application-core - jest 79.36% (-0.21%) - Details
  • services-university-gateway - jest 44.88% (-0.03%) - Details

@valurefugl valurefugl marked this pull request as draft October 1, 2024 15:53
@valurefugl valurefugl marked this pull request as ready for review October 2, 2024 11:44
@valurefugl valurefugl requested a review from a team as a code owner October 2, 2024 11:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (7)
apps/services/user-notification/src/app/modules/notifications/notificationsWorker/mocks.ts (2)

168-168: LGTM! Consider adding a comment for clarity.

The addition of actorDiscretionRequired: false aligns with the PR objective. This mock data will be useful for testing the new feature.

Consider adding a brief comment explaining the purpose of this new property:

actorDiscretionRequired: false, // Indicates whether the actor's discretion is required for this delegation type

Line range hint 168-186: Consider refactoring mock data for better maintainability.

The changes consistently add the actorDiscretionRequired property to mock delegation records, which is good. To improve maintainability and reduce duplication, consider the following suggestions:

  1. Create a helper function to generate delegation records:
function createMockDelegation(
  fromNationalId: string,
  toNationalId: string,
  type: AuthDelegationType,
  subjectId: string | null = null,
  actorDiscretionRequired: boolean = false
): DelegationRecordDTO {
  return {
    fromNationalId,
    toNationalId,
    subjectId,
    type,
    actorDiscretionRequired,
  };
}
  1. Use this helper function to create delegation records:
const delegations: Record<string, DelegationRecordDTO[]> = {
  [userWithDelegations.nationalId]: [
    createMockDelegation(
      userWithDelegations.nationalId,
      userWithNoDelegations.nationalId,
      AuthDelegationType.ProcurationHolder
    ),
  ],
  // ... other delegations
};

This approach would make it easier to maintain and extend the mock data in the future.

Would you like me to provide a full implementation of this refactoring?

apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.test-cases.ts (1)

190-191: LGTM: Type modification enhances test coverage

The change to use a template string for the delegation type (${AuthDelegationType.PersonalRepresentative}:${personalRepresentativeRightTypeCodeFinance}) aligns with the PR objectives and enhances test coverage for the new column in delegation types. This approach maintains type safety and allows for more dynamic testing scenarios.

For improved readability, consider extracting this type definition to a constant:

const personalRepFinanceType = `${AuthDelegationType.PersonalRepresentative}:${personalRepresentativeRightTypeCodeFinance}` as PersonalRepresentativeDelegationType;

// Then use it in the test case
type: personalRepFinanceType,

This would make the test case more concise and easier to understand at a glance.

apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts (3)

248-248: LGTM: New property added to delegation type model.

The addition of actorDiscretionRequired: false aligns with the PR objective. This change ensures that the test cases cover the new feature for opting out legal representatives from notifications by default.

Consider adding a test case that explicitly verifies the behavior when actorDiscretionRequired is set to true to ensure complete coverage of the new feature.


Line range hint 256-257: LGTM: Improved date handling in test case.

The use of addDays to set validFrom and validTo dates improves the test's robustness. This change creates a specific time window for the delegation scope, making the test less susceptible to timing-related failures.

Consider adding a comment explaining the rationale behind setting the dates to yesterday and tomorrow, to improve code readability.


2-2: Overall assessment: Changes improve test coverage and robustness.

The modifications in this file effectively address the PR objectives:

  1. The new import of addDays enhances date manipulation capabilities.
  2. The addition of actorDiscretionRequired to the delegation type model ensures coverage of the new feature.
  3. Improved date handling in test cases increases the robustness of the tests.

These changes collectively strengthen the test suite and provide better coverage for the new delegation type column feature. The implementation adheres to NestJS testing practices and maintains good test structure.

Consider adding more specific test cases to cover edge cases and different scenarios related to the actorDiscretionRequired property to ensure comprehensive test coverage.

Also applies to: 248-248, 256-257

libs/services/auth/testing/src/fixtures/fixture-factory.ts (1)

731-741: New createAllDelegationTypes method looks good, with a minor suggestion

The new createAllDelegationTypes method efficiently creates all necessary delegation types, including those for personal representatives. This aligns well with the PR objectives.

Consider explicitly setting actorDiscretionRequired for each delegation type, especially if different types might require different default values:

  async createAllDelegationTypes() {
    await Promise.all(
      [
        ...Object.values(AuthDelegationType),
        PersonalRepresentativeDelegationType.PersonalRepresentativePostholf,
        `${AuthDelegationType.PersonalRepresentative}:finance`,
      ].map(async (delegationType) => {
-       await this.createDelegationType({ id: delegationType })
+       await this.createDelegationType({
+         id: delegationType,
+         actorDiscretionRequired: delegationType.startsWith(AuthDelegationType.PersonalRepresentative)
+       })
      }),
    )
  }

This change would set actorDiscretionRequired to true for personal representative delegation types and false for others, providing more explicit control over the default behavior.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c039332 and 4a9e5e0.

📒 Files selected for processing (6)
  • apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (1 hunks)
  • apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.test-cases.ts (2 hunks)
  • apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts (2 hunks)
  • apps/services/user-notification/src/app/modules/notifications/notificationsWorker/mocks.ts (3 hunks)
  • libs/auth-api-lib/src/lib/delegations/models/delegation-index.model.ts (3 hunks)
  • libs/services/auth/testing/src/fixtures/fixture-factory.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/auth-api-lib/src/lib/delegations/models/delegation-index.model.ts
🧰 Additional context used
📓 Path-based instructions (5)
apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.test-cases.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/services/user-notification/src/app/modules/notifications/notificationsWorker/mocks.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/services/auth/testing/src/fixtures/fixture-factory.ts (2)

Pattern libs/services/**/*: "Confirm that the code adheres to the following:

  • Shared services and modules that can be utilized across NestJS apps.
  • Proper implementation of NestJS providers, including custom providers.
  • Adherence to NestJS module encapsulation and isolation principles."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (9)
apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.spec.ts (1)

38-38: Approved: Comprehensive test setup enhancement

The addition of await factory.createAllDelegationTypes() improves the test setup by ensuring all delegation types are created before running the tests. This change aligns with the PR objectives and follows NestJS testing best practices.

To ensure that the new column for delegation types is properly tested, consider adding specific test cases. Run the following script to check for existing tests related to the new column:

If no results are found, consider adding new test cases to verify the functionality of the new column.

apps/services/user-notification/src/app/modules/notifications/notificationsWorker/mocks.ts (2)

177-177: LGTM! Consistent implementation.

The addition of actorDiscretionRequired: false to this delegation record is consistent with the previous change and aligns with the PR objective.


186-186: LGTM! Consider verifying the default value.

The addition of actorDiscretionRequired: false is consistent with previous changes and aligns with the PR objective.

To ensure consistency across the codebase, let's verify that false is indeed the intended default value for actorDiscretionRequired:

This will help confirm that the default value is consistently set to false and that there's no conflicting information in comments or documentation.

✅ Verification successful

Verified: The default value of actorDiscretionRequired is consistently set to false across the codebase, aligning with the PR objective.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the default value of actorDiscretionRequired across the codebase

# Search for declarations or usages of actorDiscretionRequired
rg --type typescript --type javascript 'actorDiscretionRequired'

# Search for any comments or documentation related to actorDiscretionRequired
rg --type typescript --type javascript -i 'actor.?discretion.?required'

Length of output: 208


Script:

#!/bin/bash
# Description: Verify the default value of actorDiscretionRequired across the codebase

# Search for declarations or usages of actorDiscretionRequired
rg --type ts --type js 'actorDiscretionRequired'

# Search for any comments or documentation related to actorDiscretionRequired
rg --type ts --type js -i 'actor.?discretion.?required'

Length of output: 3697

apps/services/auth/delegation-api/src/app/delegations/test/delegations-controller/delegations.controller.test-cases.ts (1)

1-5: LGTM: Import changes align with PR objectives

The addition of DelegationDirection and PersonalRepresentativeDelegationType imports from '@island.is/auth-api-lib' aligns with the PR objectives to enhance delegation types. These changes follow the NestJS architecture guidelines and support the new functionality being introduced.

apps/services/auth/ids-api/src/app/delegations/test/delegations.controller.spec.ts (1)

2-2: LGTM: Import statement for date manipulation.

The addition of the addDays import from 'date-fns' is appropriate for the new test scenarios involving date calculations.

libs/services/auth/testing/src/fixtures/fixture-factory.ts (4)

31-31: Import addition looks good

The addition of PersonalRepresentativeDelegationType import aligns with the PR objectives and will be used in the updated code.


472-472: New property addition is correct

The addition of actorDiscretionRequired: false to the defaults object aligns with the PR objectives. Setting it to false by default is appropriate, allowing for explicit opt-in for actor discretion when needed.


573-579: Correct implementation of actorDiscretionRequired

The addition of actorDiscretionRequired: false in the createDelegationType call is consistent with the PR objectives and other changes in the file. This implementation ensures that each delegation type created within the loop has the correct actorDiscretionRequired value set.


708-708: Correct implementation of actorDiscretionRequired in createDelegationType

The addition of the actorDiscretionRequired parameter with a default value of false in the method signature, and its inclusion in the defaults object, aligns with the PR objectives. This implementation ensures that the actorDiscretionRequired value is correctly set and stored in the database when creating delegation types.

Also applies to: 723-723

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