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

graph:Add stubs for education/classes endpoints #5360

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

rhafer
Copy link
Contributor

@rhafer rhafer commented Jan 9, 2023

Description

This adds an implementation of the /graph/v1.0/education/classes/ endpoints. It borrows heavily from
the /groups/ endpoints. The actual backend implementation for LDAP will follow in a separate PR.

@rhafer rhafer changed the title graph:Add stubs for educat:wion/classes endpoints graph:Add stubs for education/classes endpoints Jan 9, 2023
@rhafer rhafer marked this pull request as draft January 9, 2023 16:14
@update-docs
Copy link

update-docs bot commented Jan 9, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@rhafer rhafer force-pushed the education-classes branch from 2ed4d04 to 420d4fa Compare January 9, 2023 16:17
@ownclouders
Copy link
Contributor

ownclouders commented Jan 9, 2023

💥 Acceptance test wopiValidatorTests-ocis failed. Further test are cancelled...

@ownclouders
Copy link
Contributor

💥 Acceptance test localApiTests-apiCors-ocis failed. Further test are cancelled...

@ownclouders
Copy link
Contributor

💥 Acceptance test Core-API-Tests-ocis-storage-5 failed. Further test are cancelled...

@rhafer rhafer force-pushed the education-classes branch 3 times, most recently from c84aaae to a8105c9 Compare January 10, 2023 08:32
@rhafer rhafer marked this pull request as ready for review January 10, 2023 08:32
@rhafer rhafer requested review from butonic, ainmosni and Excds January 10, 2023 08:32
Excds
Excds previously requested changes Jan 11, 2023
Copy link

@Excds Excds left a comment

Choose a reason for hiding this comment

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

Some typos, but most importantly one service endpoint it seems is not matching the API spec (if I'm reading that correctly).

services/graph/pkg/service/v0/educationclasses.go Outdated Show resolved Hide resolved
services/graph/pkg/service/v0/educationclasses.go Outdated Show resolved Hide resolved
}

// PatchEducationClass implements the Service interface.
func (g Graph) PatchEducationClass(w http.ResponseWriter, r *http.Request) {
Copy link

Choose a reason for hiding this comment

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

If I'm reading the API definition correctly, then this should only update the properties of the class object. Not adding members to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I identended it to support both (the update of single properties is still missing, I'd prefer to add that in a subsequent PR). Similar to what is possible for groups, PATCH can be used to add multiple group members at once. I guess we need to add an example to the Swagger spec to make that clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

services/graph/pkg/service/v0/educationclasses.go Outdated Show resolved Hide resolved
services/graph/pkg/service/v0/educationclasses_test.go Outdated Show resolved Hide resolved
identityEducationBackend.On("GetEducationClasses", ctx, mock.Anything).Return([]*libregraph.EducationClass{}, nil)

r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/education/classe", nil)
svc.GetEducationClasses(rr, r)
Copy link

Choose a reason for hiding this comment

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

General question: When running the service methods like this, we're not actually running through the chi router. Why are we not doing that? It would have caught the problem in the comment above.

Copy link
Member

Choose a reason for hiding this comment

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

because the plumbing of handlers and middlewares originally was agnostic to http and grpc, see #5209 This brings us back to rewriting the graph service. The webfinger PR uses the correct plumbing if you are interested: #5373 and specifically the service interface in https://github.com/owncloud/ocis/pull/5373/files#diff-ae7a50755d96a63adb77b0843780b8e849d31dabe326d9db3b0593c222aa8d8dR17-R19

@rhafer rhafer force-pushed the education-classes branch 2 times, most recently from dea6ec7 to adb0dab Compare January 11, 2023 12:06
err_school.go implements the full education interface not just schools.
ldap_school.go renamed to ldap_education_school.go for making it
consistent with ldap_education_user.go
The acutal backend implementations are still empty.
@rhafer rhafer force-pushed the education-classes branch from adb0dab to 6a9108b Compare January 11, 2023 15:23
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 23 Code Smells

64.0% 64.0% Coverage
8.0% 8.0% Duplication

@rhafer rhafer requested a review from Excds January 11, 2023 16:18
@butonic butonic dismissed Excds’s stale review January 11, 2023 19:38

All adressed

@butonic butonic merged commit 709ef1f into owncloud:master Jan 11, 2023
ownclouders pushed a commit that referenced this pull request Jan 11, 2023
Author: Ralf Haferkamp <[email protected]>
Date:   Wed Jan 11 20:38:18 2023 +0100

    graph:Add stubs for education/classes endpoints (#5360)

    * Renamed files for consistency reasons

    err_school.go implements the full education interface not just schools.
    ldap_school.go renamed to ldap_education_school.go for making it
    consistent with ldap_education_user.go

    * graph: Add stubs for education/classes endpoints

    The acutal backend implementations are still empty.
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