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

Expand cache services #106

Open
kilchenmann opened this issue Nov 12, 2019 · 10 comments
Open

Expand cache services #106

kilchenmann opened this issue Nov 12, 2019 · 10 comments
Assignees
Labels
enhancement Improve existing code or new feature
Milestone

Comments

@kilchenmann
Copy link
Contributor

Can you expand the cache service with the following methods:

  • get project by shortcode
  • get project members by shortcode
  • get project groups by shortcode
  • get all users
  • get user by username
  • get ontology by iri
@kilchenmann kilchenmann added the enhancement Improve existing code or new feature label Nov 12, 2019
@tobiasschweizer
Copy link
Contributor

  • get ontology by iri -> use OntologyCache.getOntology(ontologyIri: string)
  • get project by shortcode -> ProjectsEndpoint.getProjectByShortname(shortname: string) -> I can add a cache for this
  • get project members by shortcode (ProjectsEndpoint.getProjectMembersByShortcode(shortcode: string)) -> I can add a cache for this
  • get user by username -> I could adapt the UserCache which gets users by IRI
  • get project groups by shortcode: Which endpoint and which method would have to be called?
  • get all users (UsersEndpoint.getUsersthe) -> if we call that method, we don't need a cache for users at all. Could you make an Angular service that just calls this method once?

@tobiasschweizer
Copy link
Contributor

get project groups by shortcode: Which endpoint and which method would have to be called?

@kilchenmann Does the endpoint already exist or does it have to be added?

@kilchenmann
Copy link
Contributor Author

kilchenmann commented Nov 20, 2019

I'm sorry, didn't saw your previous answer.

get project groups by shortcode: Which endpoint and which method would have to be called?

Hm, it's a mistake from my side. there is no route or endpoint to get project specific groups. We have to use the groupsEndpoint.getGroups and filter by project.id. In this case the cache contains all groups. So, it should be a getGroups cache.

@tobiasschweizer
Copy link
Contributor

get all users (UsersEndpoint.getUsersthe) -> if we call that method, we don't need a cache for users at all. Could you make an Angular service that just calls this method once?

@kilchenmann Do we still need a user cache then?

@kilchenmann
Copy link
Contributor Author

get all users (UsersEndpoint.getUsersthe) -> if we call that method, we don't need a cache for users at all. Could you make an Angular service that just calls this method once?

Not sure. I have to run this request many times — not only to list all users. I need a list of all users also in the user-form to keep email and username unique. I compare new entries with the existing ones. But I can make my one cache for this.

@tobiasschweizer
Copy link
Contributor

I think I could make a simple cache in the admin endpoint that requests all users when the endpoint is created and stores them all so you can ask for specific users without any further request to Knora. Of course, when user data changes or new users are added, the entries have to be updated.

I think this use case is simpler than the ones I have implemented so far so I will make a separate class for this.

@kilchenmann
Copy link
Contributor Author

Keep in mind, that only system admin or project admin get an answer from usersEndpoint.getUsers.

@tobiasschweizer
Copy link
Contributor

good point, so you need to log in. I will think of a good way to do this.

@kilchenmann
Copy link
Contributor Author

Hm, but I don't think we'll need the list of all users outside of the admin interface. So, your solution should be fine.

@tobiasschweizer
Copy link
Contributor

So we would have a UserCache by Iri so we could resolve attachedToUser props and use getUsers() only within the admin area?

@tobiasschweizer tobiasschweizer mentioned this issue Dec 2, 2019
5 tasks
@kilchenmann kilchenmann added this to the 2019-12 milestone Dec 2, 2019
@subotic subotic modified the milestones: 2019-12, 2020.1 Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing code or new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants