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

feat: Connect API endpoints for dynamic dimensions between BE and FE #95

Open
wants to merge 2 commits into
base: feature/DynamicAnnotationProject
Choose a base branch
from

Conversation

teddy-f-47
Copy link

This PR aims to connect the new API endpoints for dynamic dimensions added in PR #94 to the front-end. In addition, it also adds the API endpoint for listing all dimensions and their metadata for a given project. Ideally, this PR should not be merged before PR #94 is merged, as it is dependant on the BE implementation.

What's new/changed:

  • backend/projects/views/project.py : Add view for listing dimensions and their metadata for a given project
  • backend/projects/urls.py : Add api endpoint for listing dimensions and their metadata for a given project
  • frontend/domain/models/dimension/dimension.ts : Add classes for dimension and dimension list
  • frontend/domain/models/dimension/dimensionRepository.ts : Add dimension repository
  • frontend/repositories/dimension/apiDimensionRepository.ts : Add new api endpoints
  • frontend/services/application/dimension/dimensionApplicationServices.ts : Add dimension application service containing new api endpoints related with dynamic dimensions
  • frontend/plugins/services.ts : Register the new dimension application service
  • frontend/store/projects.js : Add getter and setter to store dimensions data of currently opened project
  • frontend/middleware/check-admin.js : Call the dimension setter after setting current project
  • frontend/middleware/set-project.js : Call the dimension setter after setting current project

Notes:

  1. The api endpoint for creating new project hasn't been modified to include the new dynamic dimension project type, as I'm not sure if it's been done in the FE implementation or not. It can be done in this PR if needed.
  2. For creating new dimensions (the api endpoint /v1/projects/<int:project_id>/dimensions), it can be done from FE via this.$services.dimension.create(projectId: string, name: string, type: string, dimension_meta_data: string).
  3. For getting metadata of a given dimension (the api endpoint /v1/projects/dimensions/<int:dimension_id>/metadata), it can be done from FE via this.$services.dimension.getDimensionMetaData(dimensionId: number).
  4. For getting all dimensions (the api endpoint /v1/projects/dimensions, it can be done from FE via this.$services.dimension.listAllDimensions().
  5. For assigning additional dimensions to a project (the api endpoint /v1/projects/<int:project_id>/assign_dimensions), it can be done from FE via this.$services.dimension.assignDimensions(projectId: string, dimensionIds: number[]).
  6. For getting a list of dimensions and their metadata for a project, it can be retrieved from the project store with currentDimensions getter. The store is populated and updated by middleware, which calls the api endpoint with this.$services.dimension.list(projectId).

For testing, the branch feature/DynamicAnnotationProject-api-integrationTest can be used, which contains the code for the BE implementation and the code from this PR.

Copy link

@haanh764 haanh764 left a comment

Choose a reason for hiding this comment

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

Hello, thank you for the great work. I have tested your endpoint to list project's assigned dimensions (+ metadata) and it works as intended. The code for connecting APIs looks fine for me also but let's wait for Argi's comment XD Approved!

@artikandri
Copy link

artikandri commented Mar 16, 2023

Hello, thank you for the good work. Unfortunately I have worked on some of these myself as well when I'm testing Anh's branch (only rebased to your branch until before the latest adjustment), but I will rebase my branch and add my own adjustment later. Approved.

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.

3 participants