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

Create endpoints for bb-digital-registries #6

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

Conversation

lruzicki
Copy link
Collaborator

@lruzicki lruzicki commented Jul 10, 2023

With this Pull Request, we introduce a new module for openIMIS. The newly created openIMIS backend module provides routing for the Building Block API in conjunction with the GovStack test suite. This addition enhances the functionality and interoperability of openIMIS, facilitating better testing mechanisms.

@lruzicki lruzicki force-pushed the develop branch 2 times, most recently from 163076b to e46fc08 Compare July 10, 2023 11:10
@lruzicki lruzicki changed the title Develop Create endpoints for bb-digital-registries Jul 10, 2023
@lruzicki lruzicki requested a review from dborowiecki July 10, 2023 11:21
@lruzicki lruzicki force-pushed the main branch 3 times, most recently from 8471058 to 5607c00 Compare July 10, 2023 11:58
Copy link

@dborowiecki dborowiecki left a comment

Choose a reason for hiding this comment

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

I left several comments. Views.py requires some rework, same for the services that are hardcoded for the openAPI compliance payloads. This should be refactored in order to handle more unstructured data.

# from contribution_plan import schema as contribution_plan_schema


class QueryTest(TestCase):

Choose a reason for hiding this comment

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

Does this class test any logic? If it's just helper for GraphQL tests then you could make it a Mixin. Django TestCase is already a subclass of unittest TestCase, I don't think we should add another level of inheritance. Also it doesn't provide any logic that would be executed during setup. As it's only providing one function we could drop this class as a whole and just keep set_up_env function that would be used by tests independently.


response_data = {"status": 200}
response = HttpResponse(json.dumps(response_data))
response['Content-Type'] = "application/json; charset=utf-8"

Choose a reason for hiding this comment

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

Shouldn't this header be defined somewhere on DRF level?

Comment on lines 222 to 229
if 'errors' in result:
print(result['errors'][0])
response_data = {
"answer": {
"status": 401,
"message": result['errors'][0]
}
}

Choose a reason for hiding this comment

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

In the separate client for GQL you can add separate method for handling errors.

Comment on lines 368 to 375
context = login_with_env_variables(request)
client = get_client(Schema, Query, Mutation)

query = get_insurees_query(f'chfId: "{uuid}"', f"{field}")
result = client.execute(query, context=context)

insuree_data = result['data']['insurees']['edges'][0]['node']

Choose a reason for hiding this comment

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

This part is very similar to one in previous view. Please make it more generic.

@lruzicki lruzicki marked this pull request as draft July 25, 2023 07:46
lruzicki and others added 3 commits August 17, 2023 20:00
* TECH-717: draft endpoint that always return true added

* TECH-717: module renamed to govstack_api

* TECH-717: empty module created

* TECH-779: changed function views to class views

* TECH-779: added factory and apiviews class

* TECH-779: added draft client api graphql

* TECH-718: added middleware for info mediator client

* TECH-718: added middleware for jwt token auth and login decorator

* TECH-718: auth with token authorization

* TECH-779: added graphql api client common for all building blocks

* TECH-779: added insuree registry for api test scheme

* TECH-779: get insuree endpoint completed

* TECH-779: deleted insuree serializer to keep only those genric one

* TECH-779: insuree registry methods for single registry

* TECH-779: multiple serializer added

* TECH-779: working version

* TECH-779: default version

* TECH-779: revert adding json file

* TECH-718: added authentication (#11)

Co-authored-by: lruzicki <[email protected]>

* TECH-783: added class configuration (#10)

* TECH-783: added class configuration

* TECH-783: fixed missing argument for update function

* TECH-783: refactorem insuree registry and exported most functions into base class

* TECH-783: added views and controllers for multiple records

* TECH-783: added registry creation to the admin panel

* TECH-783: moved functions from insuree registry to base registry

* TECH-783: moved functions from insuree registry to base registry

* Feature/tech 794 (#12)

* TECH-794: added tests for presence, update and reading single fields

* TEHC-794: added test for single endpoints

* TECH-794: added list multiple records endpoint

* TECH-794: sorting for queries added

* TECH-794: code refactor for sonar cloud

* TECH-794: refactor for code smells in tests

* test dummy validator

* test dummy validator

---------

Co-authored-by: lruzicki <[email protected]>

---------

Co-authored-by: lruzicki <[email protected]>
Co-authored-by: Damian Borowiecki <[email protected]>

* Refactor checkpoint

* Refactor 2

* Refactor 3

* Refactor 4

* Refactor 5

* Refactor 6

* Refactor 6

* Refactor 7

* Refactor 8

* Added middleware for header fix

* Removed old files

---------

Co-authored-by: lruzicki <[email protected]>
Co-authored-by: Patrick Delcroix <[email protected]>
Co-authored-by: Damian Borowiecki <[email protected]>
Co-authored-by: Damian Borowiecki <[email protected]>
…n the registry. It includes a predefined set of fields, default values, mutations, and queries, providing a starting point for the registry. Commit improves onboarding OpenIMIS into USCT use case https://github.com/GovStackWorkingGroup/sandbox-usecase-usct-backend/blob/main/docs/packages.md#packages
Snd 578 Add Initial Sample Record for 'InsureeRegistry' in the Registry
Copy link

sonarqubecloud bot commented Nov 7, 2023

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 15 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

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