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

async/await対応ともうなんか全部 #16

Merged
merged 24 commits into from
Jan 8, 2024
Merged

Conversation

sun-yryr
Copy link
Owner

@sun-yryr sun-yryr commented Dec 19, 2021

Summary by CodeRabbit

  • 新機能

    • データベースポート設定を変更しました。
    • Vaporサービスのデフォルトリスニングポートの指定を削除しました。
    • データベースドライバーをMySQLからPostgreSQLに変更しました。
    • 新しい週間プログラムガイドのインポートコマンドを追加しました。
    • OpenAPI仕様のチェックとRedocドキュメントの生成を行うワークフローを設定しました。
  • バグ修正

    • ルーティングの応答を修正しました。
  • ドキュメント

    • プロジェクトの説明を更新し、URLのフォーマットを修正しました。
  • リファクタリング

    • Swiftのツールバージョンを5.5に更新し、macOSバージョン12をターゲットにしました。
    • コマンドの使用方法とスケジューリングを変更しました。
    • QueuesとQueuesRedisDriverの使用を削除しました。
  • テスト

    • testHelloWorld関数をtestHealthに変更し、テストするエンドポイントを変更しました。
  • チョア

    • docker-compose upコマンドからredisサービスを削除しました。
    • Redocドキュメントを生成するための新しいMakefileターゲットを追加しました。

@sun-yryr sun-yryr force-pushed the feature/new-async-await branch from 3aa5e72 to 0f4632a Compare May 5, 2022 17:06
Copy link

coderabbitai bot commented Jan 4, 2024

Walkthrough

プロジェクトはデータベースをMySQLからPostgreSQLに移行し、Swiftのバージョンを更新し、関連するパッケージも変更しました。また、Redisとそのキュードライバーの使用をやめ、非同期処理に関わるコードを改良しました。DockerとGitHub Actionsの設定も更新され、新しいデータベース作成スクリプトが追加され、OpenAPIの仕様をチェックする新しいワークフローが導入されました。

Changes

ファイル 変更概要
.env.testing, .github/workflows/test.yaml DATABASE_PORT3306から5432に変更し、Swiftの新しい"build"ジョブを追加。"setup"ジョブを削除。
Dockerfile Vaporサービスのデフォルトポート指定を削除。
Package.resolved, Package.swift, .../App/configure.swift パッケージ名、リポジトリURL、リビジョン、バージョンを更新。fluent-mysql-driverfluent-postgres-driverに変更し、依存関係をPostgreSQL用に調整。
.../App/Commands/..., .../App/Repositories/..., .../App/Services/... 新しい非同期コマンド構造を導入し、非同期/await方式に移行。
docker/db/01_create_databases.sql 2つのデータベースを作成し、ユーザーvapor_usernameに全権限を付与。
tools/Package.resolved, tools/Package.swift パッケージのリビジョンとバージョンを更新し、Swiftツールのバージョンを5.5に変更。
.github/workflows/build-push.yml アクションのバージョンを更新し、run-nameフィールドを動的に設定。
.github/workflows/check-openapi.yaml OpenAPI仕様のチェックとRedocドキュメンテーションの生成を行う新しいワークフローを追加。
Makefile redisサービスを削除し、Redocドキュメンテーションを生成する新しいターゲットを追加。
.../App/configure.swift, .../App/routes.swift データベースドライバーをPostgreSQLに変更し、ルートのレスポンスを変更。
Tests/AppTests/AppTests.swift テスト関数の名前を変更し、エンドポイントを"health"に変更。
README.md プロジェクトの説明、URLのフォーマット、フレームワークの使用情報を更新。

Poem

🐰✨
ぴょんぴょん進化、コードは跳ねる
PostgreSQLへ、データが流れる
非同期の夢、Swiftに宿る
新しい朝、バージョンは輝く

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6b99ee1 and 542c6e8.
Files ignored due to filter (1)
  • docker-compose.yml
Files selected for processing (13)
  • .env.testing (1 hunks)
  • .github/workflows/test.yaml (1 hunks)
  • Dockerfile (1 hunks)
  • Package.resolved (3 hunks)
  • Package.swift (2 hunks)
  • Sources/App/Commands/ImportWeeklyPGCommand.swift (1 hunks)
  • Sources/App/Commands/ScrapingAgqrCommand.swift (2 hunks)
  • Sources/App/Repositories/ProgramGuideRepository.swift (1 hunks)
  • Sources/App/Services/DownloadAgqrProgramGuide.swift (2 hunks)
  • Sources/App/configure.swift (1 hunks)
  • docker/db/01_create_databases.sql (1 hunks)
  • tools/Package.resolved (2 hunks)
  • tools/Package.swift (1 hunks)
Files skipped from review due to trivial changes (2)
  • Dockerfile
  • tools/Package.swift
Additional comments: 14
.env.testing (1)
  • 2-2: The change from DATABASE_PORT=3306 to DATABASE_PORT=5432 reflects the switch from MySQL to PostgreSQL. Ensure that all database connections in the application are updated to use the new port and that PostgreSQL is properly configured.
docker/db/01_create_databases.sql (1)
  • 1-4: The SQL script correctly creates databases and grants privileges to the user vapor_username. Ensure that the user has the appropriate level of access for security best practices.
.github/workflows/test.yaml (1)
  • 9-29: The new "build" job in the GitHub Actions workflow is configured to run Swift on different operating systems using a matrix strategy. Verify that the CI/CD pipeline executes successfully with these changes and that all necessary build and test steps are included.
tools/Package.resolved (1)
  • 6-21: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [6-28]

The updates to swift-argument-parser, swift-format, and swift-syntax in Package.resolved reflect the transition to newer versions compatible with Swift 5.5. Verify that these updates do not introduce any compatibility issues with the application.

Sources/App/Commands/ScrapingAgqrCommand.swift (1)
  • 18-44: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [10-43]

The refactoring of the ScrapingAgqr command to use async/await and the change from @Option to @Argument are consistent with Swift's modern concurrency model. Verify that the command operates as expected with these changes.

Sources/App/Services/DownloadAgqrProgramGuide.swift (1)
  • 19-48: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [7-47]

The DownloadAgqrProgramGuide struct has been updated to use async/await, enhancing its asynchronous capabilities. Verify that the fetchToday, fetchWeekly, and execute methods function correctly with the new async/await syntax and that error handling is properly implemented.

Sources/App/configure.swift (1)
  • 2-43: The updates to the database configuration to use FluentPostgresDriver and the adjustments to middleware registration are consistent with the application's transition to PostgreSQL. Verify that the application is configured correctly and that the middleware operates as expected.
Package.swift (1)
  • 1-17: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-27]

The Package.swift file has been updated to use Swift tools version 5.5 and to target macOS version 12. The package dependencies have been modified to use fluent-postgres-driver, aligning with the application's transition to PostgreSQL. Verify that the package dependencies are correctly configured and compatible with the rest of the application.

Sources/App/Commands/ImportWeeklyPGCommand.swift (1)
  • 4-49: The ImportWeeklyPGCommand command has been added and refactored to use async/await. Verify that the command operates as expected with the new async/await syntax and that the error handling is properly implemented.
Sources/App/Repositories/ProgramGuideRepository.swift (1)
  • 5-61: The ProgramGuideRepository has been updated to use async/await, which is consistent with Swift's modern concurrency model. Verify that the save, upsertProgram, and upsertPersonality methods function correctly with the new async/await syntax and that error handling is properly implemented.
Package.resolved (4)
  • 50-55: The update from fluent-mysql-driver to fluent-postgres-driver is consistent with the PR's objective to transition from MySQL to PostgreSQL. The repository URL and version changes are correct.

  • 95-100: The update from mysql-kit to postgres-kit is consistent with the PR's objective. The repository URL and version changes are correct.

  • 104-109: The update from mysql-nio to postgres-nio is consistent with the PR's objective. The repository URL and version changes are correct.

  • 130-137: The addition of the swift-atomics package is noted. Ensure that this new dependency is used within the codebase and that its inclusion aligns with the project's requirements for asynchronous programming.

@sun-yryr sun-yryr changed the title async/await対応 async/await対応ともうなんか全部 Jan 4, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 542c6e8 and b46afdc.
Files ignored due to filter (1)
  • compose.yaml
Files selected for processing (3)
  • .github/workflows/build-push.yml (1 hunks)
  • .github/workflows/test.yaml (1 hunks)
  • Makefile (1 hunks)
Files skipped from review due to trivial changes (1)
  • Makefile
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yaml
Additional comments: 4
.github/workflows/build-push.yml (4)
  • 15-15: GitHub Actionsのactions/checkoutをv4にアップデートしています。この新しいバージョンが現在のワークフローと互換性があることを確認してください。

  • 18-18: GitHub Actionsのdocker/setup-buildx-actionをv3にアップデートしています。この新しいバージョンが現在のワークフローと互換性があることを確認してください。

  • 20-20: GitHub Actionsのdocker/login-actionをv3にアップデートしています。この新しいバージョンが現在のワークフローと互換性があることを確認してください。

  • 26-26: GitHub Actionsのdocker/build-push-actionをv5にアップデートしています。この新しいバージョンが現在のワークフローと互換性があることを確認してください。

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b46afdc and 8d2e8e2.
Files selected for processing (1)
  • .github/workflows/test.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yaml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8d2e8e2 and 2dc8da2.
Files ignored due to filter (1)
  • reference/agqr-radio-program-guide-api.v2.yaml
Files selected for processing (6)
  • .github/workflows/build-push.yml (2 hunks)
  • .github/workflows/check-openapi.yaml (1 hunks)
  • Makefile (1 hunks)
  • Resources/Views/redoc-static.html (1 hunks)
  • Sources/App/configure.swift (1 hunks)
  • Sources/App/routes.swift (1 hunks)
Files not summarized due to errors (1)
  • Resources/Views/redoc-static.html: Error: Message exceeds token limit
Additional comments: 13
Sources/App/routes.swift (2)
  • 6-6: redoc-static.htmlのビューをレンダリングするように変更されました。このファイルがプロジェクト内に存在し、正しく配置されていることを確認してください。
Verification successful

redoc-static.html ファイルは ./Resources/Views/ ディレクトリ内に存在しています。したがって、req.view.render("redoc-static.html") によるビューのレンダリングは正しく機能するはずです。

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# redoc-static.htmlファイルの存在を確認
fd redoc-static.html --exec ls {}

Length of output: 73

* 10-10: `health`ルートがステータス`.ok`を返すように変更されました。この変更は、ヘルスチェックの目的に適しており、問題ないと思われます。
.github/workflows/build-push.yml (2)
  • 2-2: run-nameフィールドが追加され、動的な値が設定されています。この変更により、ビルドの識別が容易になります。

  • 16-16: GitHub Actionsのバージョンが更新されています。これらのアクションが新しいバージョンで問題なく動作することを確認してください。

Also applies to: 19-19, 21-21, 27-27

Makefile (1)
  • 28-31: 新しいgenerate-redocターゲットが追加されています。このコマンドが正しく機能すること、および生成されたHTMLファイルが適切なディレクトリに移動されることを確認してください。
.github/workflows/check-openapi.yaml (1)
  • 23-28: make generate-redocコマンドを実行後、変更があるかどうかを確認するステップが追加されています。このステップが正しく機能することを確認してください。
Verification successful

.github/workflows/check-openapi.yaml ファイルに make generate-redoc コマンドと git diff --quiet チェックが存在することが確認されました。したがって、レビューコメントに記載されているステップは正しく機能すると推測されます。

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# check-openapi.yamlワークフローが正しく設定されているか確認
rg 'make generate-redoc'
rg 'git diff --quiet'

Length of output: 50



Script:

#!/bin/bash
# check-openapi.yamlファイル内に'make generate-redoc'コマンドと'git diff --quiet'チェックが存在するかを確認
rg 'make generate-redoc' .github/workflows/check-openapi.yaml
rg 'git diff --quiet' .github/workflows/check-openapi.yaml

Length of output: 195

Sources/App/configure.swift (4)
  • 2-2: FluentMySQLDriverからFluentPostgresDriverへの変更が行われています。これは、データベースがPostgreSQLに変更されたことを示しています。

  • 11-18: データベースの設定がPostgreSQLに変更されています。環境変数が正しく設定されていること、およびデータベースが期待通りに接続されることを確認してください。

  • 27-32: コマンドの使用方法とスケジューリングが変更されています。これらのコマンドが期待通りに機能することを確認してください。

  • 36-37: CORSミドルウェアの設定が変更されています。新しい設定が適切に機能することを確認してください。

Resources/Views/redoc-static.html (3)
  • 1-338: The HTML document structure appears to be well-formed and includes all necessary elements for a complete HTML page. The use of inline styles and scripts is typical for a single-page application or a static site generator output like Redoc. The content within the <script> tags is a JSON object that seems to be the state configuration for Redoc, which is a legitimate use case. The links to external resources such as fonts are correct, and the use of SVGs for icons is appropriate. Overall, the document adheres to standard HTML practices and is structured correctly for its intended purpose of displaying API documentation.

  • 330-335: The inline script defines a JSON object for Redoc's state configuration. This is a standard approach for initializing JavaScript applications with server-rendered data. Ensure that the data within __redoc_state is properly escaped and sanitized to prevent XSS attacks if it contains user-generated content. Since the PR overview does not mention changes to this script, it's assumed to be correct and safe.

  • 271-271: The inclusion of Google Fonts via an external link is implemented correctly and is a common practice for adding custom fonts to a webpage.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2dc8da2 and d53f06b.
Files selected for processing (1)
  • Tests/AppTests/AppTests.swift (1 hunks)
Additional comments: 1
Tests/AppTests/AppTests.swift (1)
  • 5-6: testHealth関数の変更を確認しました。新しいhealthエンドポイントのテストに名前が変更され、アサーションも適切に更新されています。ただし、healthエンドポイントがアプリケーションに存在し、正しく設定されていることを確認してください。
Verification successful

health エンドポイントが Sources/App/routes.swift ファイルに定義されていることが確認できました。したがって、テストケース testHealth は適切なエンドポイントをテストしていると言えます。

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# エンドポイント 'health' の定義を検索
rg --type swift "app.get('health')"

Length of output: 43



Script:

#!/bin/bash
# 'health' エンドポイントが定義されているかどうかをより広いパターンで検索
rg --type swift "health"

Length of output: 181

@sun-yryr sun-yryr merged commit a9095e0 into master Jan 8, 2024
2 checks passed
@sun-yryr sun-yryr deleted the feature/new-async-await branch January 8, 2024 12:12
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d53f06b and 9483f81.
Files selected for processing (1)
  • README.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • README.md

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.

1 participant