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: KnoraUserGroup and KnoraUserGroupRepo (DEV-3288) #3059

Merged
merged 8 commits into from
Mar 4, 2024

Conversation

siers
Copy link
Contributor

@siers siers commented Feb 23, 2024

This feature is somewhere between a chore and a refactor.

  1. KnoraUserGroup was expanded with the rest
    1.1. GroupDefinitions head
    1.2. KnoraUserGroupRepoLive created with find/save method
    1.3. getObjectIrisConvert used from KnoraUserRepoLive and reused
  2. KnoraUserRepoLive refactored slightly, somewhat generic code copied to KnoraUserGroupRepoLive
  3. AuthorizationRestService
    3.1. Methods in AuthorizationRestService sorted according to call order
    3.2. Missing belongsToGroup handled (its absence is valid according to the ontology)
  4. datasetStatements in TriplestoreServiceInMemory for debugging

Pull Request Checklist

Task Description/Number

Issue Number: DEV-3288

PR Type

  • build/chore: maintenance tasks (no production code change)
  • docs: documentation changes (no production code change)
  • feat: represents new features
  • fix: represents bug fixes
  • perf: performance improvements
  • refactor: represents production code refactoring
  • test: adding or refactoring tests (no production code change)

Basic requirements for bug fixes and features

  • Tests for the changes have been added
  • Docs have been added / updated

Does this PR introduce a breaking change?

  • Yes

Does this PR change client-test-data?

  • Yes

Copy link

linear bot commented Feb 23, 2024

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 97.41379% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 88.67%. Comparing base (eac5751) to head (4f6ec50).
Report is 97 commits behind head on main.

Files Patch % Lines
...ce/admin/repo/service/KnoraUserGroupRepoLive.scala 94.44% 2 Missing ⚠️
...bapi/slice/admin/domain/model/KnoraUserGroup.scala 96.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3059       +/-   ##
===========================================
+ Coverage   11.74%   88.67%   +76.92%     
===========================================
  Files         246      263       +17     
  Lines       22907    22430      -477     
===========================================
+ Hits         2690    19889    +17199     
+ Misses      20217     2541    -17676     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@siers siers force-pushed the chore/DEV-3288-knora-user-group-repository branch 3 times, most recently from 47b5a42 to 0b8e9d4 Compare February 29, 2024 10:48
@siers siers self-assigned this Feb 29, 2024
@siers siers changed the title feat: Expand KnoraUserGroup's RdfModel implementation (DEV-3288) refactor: KnoraUserGroup and KnoraUserGroupRepo (DEV-3288) Feb 29, 2024
@siers siers force-pushed the chore/DEV-3288-knora-user-group-repository branch 2 times, most recently from cb61b25 to 7fc89fd Compare February 29, 2024 11:28
@siers siers force-pushed the chore/DEV-3288-knora-user-group-repository branch from 7fc89fd to ffce932 Compare February 29, 2024 12:23
@siers siers requested review from BalduinLandolt, mpro7 and seakayone and removed request for BalduinLandolt, mpro7 and seakayone February 29, 2024 12:44
Copy link
Contributor

@BalduinLandolt BalduinLandolt left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

There is one change that looks lika bad marge and needs to be reverted. Apart of that I have also few suggestions, and questions related to value objects, please se below comments:

@siers siers force-pushed the chore/DEV-3288-knora-user-group-repository branch from 5223382 to ea34116 Compare February 29, 2024 15:25
def save(userGroup: KnoraUserGroup): Task[KnoraUserGroup] =
for {
query <- findById(userGroup.id).map {
case Some(_) => throw new TriplestoreUnsupportedFeatureException("Updating users is not supported.")
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: The save method suggests it could persisted a new or existing group but fails on update

I would suggest you implement this similar to the save query in the user repo. This query is able to create a new user or update an existing. There is also no need for findById pre-query as the save query does is in one go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take a look, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Morning!

@siers siers requested review from seakayone and mpro7 March 4, 2024 08:51
@siers siers merged commit 8a79e93 into main Mar 4, 2024
13 checks passed
@siers siers deleted the chore/DEV-3288-knora-user-group-repository branch March 4, 2024 10:06
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