fairdataihub / codefair-app

Your coding assistant to make research software reusable without breaking a sweat!
https://codefair.io
MIT License
7 stars 2 forks source link

feat: ✨ Zenodo arhival workflow #75

Closed slugb0t closed 1 month ago

slugb0t commented 1 month ago

Implement a Zenodo archival workflow to automate software release archiving, including metadata validation and DOI assignment. Enhance the user interface for managing releases and metadata, and introduce a feature to purge user tokens for improved security. Update the database schema to support new features.

New Features:

Enhancements:

Build:

Summary by Sourcery

Implement a Zenodo archival workflow to automate software release archiving, including metadata validation and DOI assignment. Enhance the user interface for managing releases and metadata, and introduce a feature to purge user tokens for improved security. Update the database schema to support new features.

New Features:

Enhancements:

Build:

fairdataihub-bot[bot] commented 1 month ago

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements a Zenodo archival workflow to automate software release archiving, including metadata validation and DOI assignment. It enhances the user interface for managing releases and metadata, introduces a feature to purge user tokens, and updates the database schema to support new features. The changes span across both the bot and UI components of the application, introducing new API endpoints, database migrations, and UI components to support the Zenodo integration and release management process.

Sequence diagram for Zenodo archival workflow

sequenceDiagram
    actor User
    participant UI
    participant Server
    participant Zenodo
    participant GitHub
    participant Database

    User->>UI: Initiate Zenodo archival
    UI->>Server: Send archival request
    Server->>Database: Check Zenodo token
    Database-->>Server: Return token
    Server->>Zenodo: Validate token
    Zenodo-->>Server: Token valid
    Server->>GitHub: Create draft release
    GitHub-->>Server: Draft release created
    Server->>Zenodo: Create or update deposition
    Zenodo-->>Server: Deposition info
    Server->>GitHub: Update release with DOI
    GitHub-->>Server: Release updated
    Server->>Database: Update deposition info
    Database-->>Server: Info updated
    Server->>UI: Archival process complete
    UI-->>User: Display success message

User journey diagram for managing Zenodo releases

journey
    title User journey for managing Zenodo releases
    section Initiate Release
      User: 5: Navigate to release page
      User: 4: Review metadata
      User: 3: Confirm release details
    section Zenodo Archival
      System: 5: Validate metadata
      System: 4: Create draft release on GitHub
      System: 3: Create or update Zenodo deposition
      System: 2: Assign DOI
    section Completion
      User: 5: Receive confirmation
      User: 4: View DOI and release details

ER diagram for updated database schema

erDiagram
    User {
      string id
      string username
      string access_token
      int github_id
    }
    Installation {
      int id
      string owner
      string repo
      int installation_id
    }
    ZenodoToken {
      string user_id
      string token
      date expires_at
    }
    ZenodoDeposition {
      int repository_id
      int zenodo_id
      string zenodo_metadata
    }
    User ||--o{ ZenodoToken : has
    Installation ||--o{ ZenodoDeposition : manages
    ZenodoDeposition }o--|| ZenodoToken : uses

File-Level Changes

Change Details Files
Implement Zenodo archival workflow
  • Add functions to create, fetch, and update Zenodo depositions
  • Implement metadata validation for Zenodo submissions
  • Add functionality to upload release assets to Zenodo
  • Create new API endpoints for Zenodo-related operations
bot/archival/index.js
bot/index.js
ui/server/api/[owner]/[repo]/release/zenodo/index.post.ts
ui/server/api/[owner]/[repo]/release/zenodo/index.get.ts
Enhance user interface for managing releases and metadata
  • Add new components for release management
  • Implement UI for Zenodo metadata input and validation
  • Create a new page for Zenodo release creation
  • Update dashboard to include FAIR Software Release section
ui/pages/dashboard/[owner]/[repo]/index.vue
ui/pages/dashboard/[owner]/[repo]/release/zenodo.vue
ui/components/card/CardDashboard.vue
ui/components/card/CardIcon.vue
ui/components/card/CardPlaceholder.vue
Introduce feature to purge user tokens
  • Add API endpoint to delete user tokens
  • Update profile page to include token purge functionality
ui/server/api/user/tokens.delete.ts
ui/pages/profile.vue
Update database schema and add migrations
  • Create new tables for Zenodo tokens and depositions
  • Add migration files for schema changes
  • Update Prisma schema to include new models
bot/prisma/migrations/20241010220426_zenodo/migration.sql
ui/prisma/migrations/20241009182523_zenodo/migration.sql
ui/prisma/migrations/0_init/migration.sql
bot/prisma/migrations/0_init/migration.sql
Refactor and improve existing functionality
  • Update metadata handling to support asynchronous operations
  • Improve error handling for metadata validation and updates
  • Refactor GitHub API calls and repository information retrieval
bot/metadata/index.js
bot/utils/tools/index.js
ui/server/utils/auth/repoWritePermissions.ts

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
fairdataihub-bot[bot] commented 1 month ago

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!

fairdataihub-bot[bot] commented 1 month ago

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!