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

refactor: user and link selector #514

Merged
merged 15 commits into from
Apr 7, 2024
Merged

Conversation

boris-w
Copy link
Contributor

@boris-w boris-w commented Mar 29, 2024

The main purpose is to get only the data necessary for the user and link selectors in the share view, and is an action to protect data security.

Under the Share page:

  • Form View
    • The selector data for the user field comes from the share scope's interface
    • Selector data for linked fields comes from the interface of the shared view and fetches the associated table records from which new rows can be selected, as a simple example, if relationship is oneOne, then the associated table records that have already been selected cannot be selected again, so the returned records should be filtered out of the associated records that have already been selected.
  • Other Views
    Of the other views, only the filter component currently requires a data source.
    • The data for the selector of the user field should be the users that have already been selected by the user field in the currently shared view.
    • The data for the link field selector should be the rows that have been selected for the link field in the currently shared view.

@boris-w boris-w marked this pull request as draft March 29, 2024 09:47
@boris-w boris-w force-pushed the fix/share-user-and-link-select branch from 4d381fb to 9d7bbc6 Compare April 3, 2024 09:51
@boris-w boris-w marked this pull request as ready for review April 3, 2024 09:52
@coveralls
Copy link
Collaborator

coveralls commented Apr 3, 2024

Pull Request Test Coverage Report for Build 8587764926

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 363 of 390 (93.08%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+61.3%) to 82.835%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/nestjs-backend/src/features/share/share.controller.ts 16 25 64.0%
apps/nestjs-backend/src/features/share/share.service.ts 177 186 95.16%
apps/nestjs-backend/src/features/view/open-api/view-open-api.service.ts 105 114 92.11%
Totals Coverage Status
Change from base Build 8505987069: 61.3%
Covered Lines: 26966
Relevant Lines: 32554

💛 - Coveralls

async getFilterLinkRecords(tableId: string, viewId: string) {
const view = await this.viewService.getViewById(viewId);
const linkFields = await this.prismaService.field.findMany({
where: { tableId, deletedTime: null, type: FieldType.Link, options: { not: null } },
Copy link
Contributor

Choose a reason for hiding this comment

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

options: { not: null } is unnecessary


const fields = await this.fieldService.getFieldsByQuery(tableId, {
viewId: view.id,
filterHidden: !view.shareMeta?.includeHiddenField,
Copy link
Contributor

Choose a reason for hiding this comment

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

For the share view of a form, there is no includeHiddenField property, so there's no need to pass in the filterHidden attribute

@boris-w boris-w merged commit 9deafc4 into develop Apr 7, 2024
7 of 8 checks passed
@boris-w boris-w deleted the fix/share-user-and-link-select branch April 7, 2024 09: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.

4 participants