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 Archival Workflow #77

Closed slugb0t closed 1 month ago

slugb0t commented 1 month ago

Summary by Sourcery

Implement a Zenodo archival workflow to automate software release archiving, refactor database interactions to use Prisma, and enhance the UI with Naive UI components. Transition from pnpm to yarn for package management and update CI workflows accordingly.

New Features:

Enhancements:

Build:

CI:

Deployment:

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 for the Codefair project. It includes significant changes to the database structure, API endpoints, and user interface to support creating and managing Zenodo depositions linked to GitHub releases.

Sequence diagram for Zenodo archival workflow

sequenceDiagram
    actor User
    participant GitHub
    participant Codefair
    participant Zenodo
    User->>GitHub: Create a release
    GitHub->>Codefair: Trigger event
    Codefair->>Zenodo: Get deposition info
    Codefair->>Zenodo: Validate metadata
    Codefair->>Zenodo: Update metadata
    Codefair->>Zenodo: Upload assets
    Codefair->>Zenodo: Publish deposition
    Zenodo-->>Codefair: Confirmation
    Codefair-->>GitHub: Update release status
    Codefair-->>User: Notify completion

ER diagram for updated database schema

erDiagram
    REPOSITORY {
        int id PK
        string owner
        string repo
    }
    INSTALLATION {
        int id PK
        int installation_id
        int action_count
        date latest_commit_date
        string latest_commit_message
        string latest_commit_sha
        string latest_commit_url
        int repository_id FK
    }
    LICENSE_REQUEST {
        int id PK
        string license_id
        string license_content
        int repository_id FK
    }
    CODE_METADATA {
        int id PK
        json metadata
        int repository_id FK
    }
    CWL_VALIDATION {
        int id PK
        json files
        int repository_id FK
    }
    ZENODO_DEPOSITION {
        int id PK
        string status
        string zenodo_id
        int repository_id FK
    }
    REPOSITORY ||--o{ INSTALLATION : "has"
    REPOSITORY ||--o{ LICENSE_REQUEST : "has"
    REPOSITORY ||--o{ CODE_METADATA : "has"
    REPOSITORY ||--o{ CWL_VALIDATION : "has"
    REPOSITORY ||--o{ ZENODO_DEPOSITION : "has"

Class diagram for database interaction changes

classDiagram
    class Database {
        +connect()
        +getDb()
    }
    class PrismaClient {
        +installation
        +analytics
        +licenseRequest
        +codeMetadata
        +cwlValidation
        +zenodoDeposition
    }
    class MongoClient {
        -connect()
    }
    Database --> MongoClient : replaced by
    Database --> PrismaClient : replaced by

File-Level Changes

Change Details Files
Implemented Zenodo integration for archiving software releases
  • Added new API endpoints for Zenodo-related operations
  • Created new database tables for storing Zenodo tokens and depositions
  • Implemented UI components for Zenodo release creation and management
  • Added Zenodo authentication flow
bot/archival/index.js
ui/pages/dashboard/[owner]/[repo]/release/zenodo.vue
ui/server/routes/login/zenodo/callback.get.ts
ui/server/api/[owner]/[repo]/release/zenodo/index.post.ts
ui/server/api/[owner]/[repo]/release/zenodo/index.get.ts
Migrated from MongoDB to PostgreSQL using Prisma ORM
  • Created Prisma schema and migration files
  • Updated database queries to use Prisma client
  • Implemented data migration scripts from MongoDB to PostgreSQL
bot/db.js
ui/server/utils/prisma.ts
bot/prisma/migrations/0_init/migration.sql
ui/prisma/migrations/0_init/migration.sql
bot/scripts/prismaM.ts
ui/scripts/prisma-migrate.ts
Refactored authentication system
  • Updated Lucia auth integration to use Prisma adapter
  • Implemented token purging functionality
  • Modified user session handling
ui/server/utils/auth.ts
ui/server/api/user/tokens.delete.ts
ui/pages/profile.vue
Updated GitHub release management
  • Added API endpoints for creating and managing GitHub releases
  • Implemented UI for GitHub release creation linked to Zenodo depositions
ui/server/api/[owner]/[repo]/release/github/index.post.ts
ui/server/api/[owner]/[repo]/release/github/[release].get.ts
Refactored and updated UI components
  • Updated Naive UI integration and configuration
  • Created new card components for dashboard
  • Modified existing components for better UX
ui/plugins/naive.ts
ui/components/card/CardIcon.vue
ui/components/card/CardPlaceholder.vue
ui/pages/dashboard/[owner]/[repo]/index.vue
Updated project configuration and development setup
  • Modified Nuxt configuration
  • Added development scripts for running UI and bot separately
  • Updated GitHub Actions workflows
ui/nuxt.config.ts
dev.ps1
dev.sh
bot.sh
ui.sh
bot.ps1
ui.ps1
.github/workflows/deploy-main.yml
.github/workflows/deploy-staging.yml

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 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!

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!