8000 feat: add import and export buttons/functions by simplicityf · Pull Request #205 · joaovitoriasilva/endurain · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add import and export buttons/functions #205

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

Merged

Conversation

simplicityf
Copy link
Contributor

Description

This PR introduces the “Import and Export Data” button to the user settings page, allowing users to export their data in a compressed file and also select and upload a .zip backup file they previously exported.

  • Added new endpoints for import and export in the profile page
  • Added new buttons in the frontend
  • Created an API connection from frontend to backend
  • Update settingsUserProfileZoneComponent.json for the import and export, both in English and French

Related issues: closes #175

Screenshot 2025-06-10 at 1 27 28 AM

@simplicityf
Copy link
Contributor Author

@joaovitoriasilva, review before merging any changes to your branch again, to avoid causing another big conflicts.

@joaovitoriasilva joaovitoriasilva requested a review from Copilot June 23, 2025 15:46
@joaovitoriasilva joaovitoriasilva self-assigned this Jun 23, 2025
@joaovitoriasilva joaovitoriasilva added the enhancement New feature or request label Jun 23, 2025
@joaovitoriasilva joaovitoriasilva moved this to In Progress in Endurain project Jun 23, 2025
@joaovitoriasilva joaovitoriasilva added this to the v0.12.X milestone Jun 23, 2025
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds import/export functionality for user data by extending backend APIs, updating frontend service utilities, and adding corresponding UI elements with localization entries.

  • Refactor serviceUtils to support blob responses and file uploads
  • Add exportData / importData methods in profileService and update UI localization
  • Implement /profile/export and /profile/import endpoints in backend

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/app/src/utils/serviceUtils.js Refactored HTTP helper functions; added blob support and file upload methods
frontend/app/src/services/profileService.js Added exportData and importData methods
frontend/app/src/i18n/us/components/settings/*.json Added import/export button labels and messages
frontend/app/src/i18n/pt/generalItems.json Added new keys (note: translations may be incorrect)
frontend/app/src/i18n/fr/components/settings/*.json Added new keys (note: one English string remains untranslated)
frontend/app/.env Changed VITE_ENDURAIN_HOST to localhost
backend/app/profile/router.py Added ZIP export/import endpoints but missing import for StreamingResponse
Comments suppressed due to low confidence (8)

frontend/app/src/utils/serviceUtils.js:129

  • It looks like the closing brace at line 129 ends fetchPostFileRequest prematurely, causing the return fetchWithRetry(url, options) to be outside the function body. Please fix the brace placement so that the return is inside the function.
  }

frontend/app/src/utils/serviceUtils.js:143

  • Similarly, this brace ends fetchPostFormUrlEncoded too early, so the subsequent return fetchWithRetry is outside the function. Adjust braces to include the return in the function body.
  }

frontend/app/src/utils/serviceUtils.js:156

  • This closing brace ends fetchPostRequest before its return statement. Ensure the return is inside the function by moving or removing this extra brace.
  }

frontend/app/src/utils/serviceUtils.js:169

  • The brace here prematurely closes fetchPutRequest, placing the return fetchWithRetry outside the function. Please correct the function structure.
  }

frontend/app/src/utils/serviceUtils.js:181

  • This closing brace ends fetchDeleteRequest too early, causing a syntax error for the return statement. Re-align braces to keep the return inside the function.
  }

backend/app/profile/router.py:271

  • The code uses StreamingResponse but it's not imported. Add from fastapi.responses import StreamingResponse (or equivalent) at the top of the file to avoid a NameError.
    return StreamingResponse(

frontend/app/src/i18n/pt/generalItems.json:55

  • The Portuguese locale file contains French strings (Annuler, Chargement). Please correct these entries to their Portuguese equivalents.
    "cancel": "Annuler",

frontend/app/src/i18n/fr/components/settings/settingsUserProfileZoneComponent.json:72

  • This French locale entry is still in English. Please provide the proper French translation.
    "successUpdateUserPrivacySettings": "User privacy settings updated successfully",

joaovitoriasilva and others added 3 commits June 23, 2025 16:48
[backend] fix for export_profile_data exporting data as objects and not as a dict
[backend] added additional user data to export logic
[backend] export should now only include .fit files related to the user
[frontend] re added .env file
[backend] added missing user info to export logic
[frontend] moved to composition API in some files
[frontend] added new ModalComponentUploadFile
[frontend] moved modal logic to upload activity on HomeView to new modal
[frontend] added new section on settingsUserProfileZoneComponent for import and export to be aligned with rest of the code
[frontend] moved modal logic to upload activity on settingsUserProfileZoneComponent to new modal
@joaovitoriasilva joaovitoriasilva modified the milestones: v0.12.X, v0.13.X Jun 25, 2025
[frontend] change button icons and spacing
[frontend] change download file name
[frontend] added notification promise logic to import to be aligned with rest of the code
@joaovitoriasilva
Copy link
Owner

Hi, export logic reviewed. Import is next

[backend] replaced hardcoded file and directory paths throughout the backend with constants defined in core.config for better maintainability and configurability. Updated all relevant modules, including activity, profile, server settings, and user utilities
[backend] improved the export profile data logic
[backend] add user image if available to export logic
[frontend] added a beta tag to the export data section in the frontend.
[backend] gear and user tables working on import
[backend] added new methods to laps, sets, streams, sets to get all entries based on array of activity ids to make DB calls more efficient
[backend] added edit_health_target function to health_targets crud for import feature
[backend] added edit_user_integrations function to user_integrations crud for import feature
[frontend] moved to composition API in some files
[frontend] added spinner to import and export buttons and proper disabled on the buttons
[frontend] improve, simplified uploadImportFile with notivue notifications and removed unused functions
[frontend] fixed US translations
[frontend] made API calls with files uniform
[backend] added support for user_default_gear to import feature
[frontend] fix issue joaovitoriasilva#218
[backend] added support for user_privacy_settings and user_integrations to import feature
[backend] added support for activities, health_data, user image and user activity files to import feature
[backend] fixed issue on health_data where date on health_data table was set has unique, not allowing two or more users have an entry for the same day
[docs] fixed volumes on docker examples and docs based on change made on v0.12.4
[docs] added volume server_images on getting started
@joaovitoriasilva joaovitoriasilva modified the milestones: v0.13.X, v0.12.X Jun 27, 2025
@joaovitoriasilva
Copy link
Owner

Merged on pre-release

@joaovitoriasilva joaovitoriasilva linked an issue Jun 27, 2025 that may be closed by this pull request
2 tasks
@joaovitoriasilva joaovitoriasilva merged commit 9afadc3 into joaovitoriasilva:master Jun 27, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Endurain project Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG]: Incorrect Avg speed. Exchanged values km/h mph [FEATURE]: Export all my data to a compressed file
2 participants
0