Skip to content

feat: 必須な OAuth 連携のチェック#347

Merged
a01sa01to merged 9 commits intomainfrom
feat/require-discord-connect
Mar 17, 2026
Merged

feat: 必須な OAuth 連携のチェック#347
a01sa01to merged 9 commits intomainfrom
feat/require-discord-connect

Conversation

@a01sa01to
Copy link
Member

@a01sa01to a01sa01to commented Mar 16, 2026

IdP - Discord ロール連携とかに向けて、 Discord 連携必須化への準備です

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 16, 2026

Deploying id with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3e4ab3a
Status: ✅  Deploy successful!
Preview URL: https://05544829.id-131.pages.dev
Branch Preview URL: https://feat-require-discord-connect.id-131.pages.dev

View logs

Copy link
Contributor

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

Discord 連携必須化に向けて、「必須 OAuth 連携が未完了のユーザーを誘導する仕組み」と「必須 OAuth の連携解除を防ぐ仕組み」を、Server/Client 両方に追加するPRです。

Changes:

  • OAuth provider 定義をメタ情報(required / loginPath など)込みで集約し、必須 provider 一覧を導出
  • 必須 OAuth が未連携の場合に専用ページへリダイレクトし、連携導線を表示
  • Server 側で必須 OAuth connection の削除を拒否

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
workspaces/server/src/routes/user.ts OAuth connection 削除時に providerId 検証・必須 provider の削除拒否を追加
workspaces/server/src/constants/oauth.ts provider 定義を OAUTH_PROVIDERS に集約し、REQUIRED_OAUTH_PROVIDER_IDS と型ガードを追加
workspaces/client/app/types/oauth-internal.ts providerIdOAuthProviderId 型に強化
workspaces/client/app/routes/dashboard/settings/internal/components/oauth-conn-row.tsx provider 表示/UI を共通 Badge コンポーネントへ置換し、required 判定を定数へ寄せる
workspaces/client/app/routes/dashboard/layout.tsx 必須 OAuth 未連携時に /connect-required-oauth へ誘導する分岐を追加
workspaces/client/app/routes/connect-required-oauth/page.tsx 必須 OAuth 連携を促す新規ページを追加
workspaces/client/app/routes.ts 新規ページのルーティングを追加
workspaces/client/app/hooks/use-auth.ts 必須 OAuth 未連携フラグを追加
workspaces/client/app/components/feature/oauth-internal/user-badge.tsx OAuth ユーザー表示を共通化する新規コンポーネント
workspaces/client/app/components/feature/oauth-internal/service-provider-badge.tsx OAuth provider 表示を共通化する新規コンポーネント

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

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

IdP の「必須な OAuth 連携」を扱えるようにするため、OAuth provider 定義を型安全に集約し、必須連携の未達ユーザーを接続フローへ誘導できるようにする PR です(Discord ロール連携等に向けた準備)。

Changes:

  • OAuth provider ID を OAuthProviderId(リテラル union)として型付けし、provider メタ情報(required/loginPath/name)を OAUTH_PROVIDERS に集約
  • 必須 OAuth 未連携ユーザーを /connect-required-oauth に誘導する UI/ルーティングを追加
  • 必須 provider の OAuth 連携解除をサーバ側で禁止

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
workspaces/server/src/constants/oauth.ts provider 定義を as const 化し、OAuthProviderId / OAUTH_PROVIDERS / REQUIRED_OAUTH_PROVIDER_IDS 等を追加
workspaces/server/src/shared/oauth.ts server 定数の re-export(client 共有入口)
workspaces/server/src/utils/oauth-login-provider.ts getProviderId()OAuthProviderId に型変更
workspaces/server/src/routes/auth-login/github.ts provider ID の返却を型変更に追従
workspaces/server/src/repository/oauth-internal.ts OAuthConnection / repository API の providerIdOAuthProviderId
workspaces/server/src/infrastructure/repository/cloudflare/oauth-internal.ts 内部 OAuth connection 取得/削除等の引数・返り値を OAuthProviderId に追従
workspaces/server/src/infrastructure/repository/cloudflare/user.ts user profile 内の oauthConnections の providerIdOAuthProviderId として返すよう追従
workspaces/server/src/routes/user.ts OAuth connection 削除時の providerId 妥当性チェック強化&必須 provider の削除を拒否
workspaces/client/app/types/oauth-internal.ts client 側 OAuthConnection.providerIdOAuthProviderId に変更
workspaces/client/app/hooks/use-auth.ts 必須 OAuth 未連携フラグ lacksRequiredOAuthConnections を追加
workspaces/client/app/routes/dashboard/layout.tsx 必須 OAuth 未連携なら /connect-required-oauth にリダイレクト
workspaces/client/app/routes/connect-required-oauth/page.tsx 必須 OAuth を接続させる専用ページを新規追加
workspaces/client/app/routes.ts /connect-required-oauth ルートを追加
workspaces/client/app/routes/dashboard/settings/internal/components/oauth-conn-row.tsx provider メタ情報に基づいて表示/リンク/削除可否を切り替え
workspaces/client/app/components/feature/oauth-internal/service-provider-badge.tsx provider 表示(アイコン+名称)をコンポーネント化
workspaces/client/app/components/feature/oauth-internal/user-badge.tsx OAuth user 表示(アイコン+表示名)をコンポーネント化

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

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

IdP の OAuth 連携を「必須/任意」で扱えるようにするための土台を整え、必須 OAuth が未連携のユーザーを接続フローへ誘導できるようにする PR です(Discord ロール連携等に向けた準備)。

Changes:

  • OAuth Provider ID を number から OAuthProviderId(リテラル union)へ型付けし、OAUTH_PROVIDERS / REQUIRED_OAUTH_PROVIDER_IDS を追加
  • 必須 OAuth 連携の解除をサーバー側でも禁止(DELETE /oauth-connection/:providerId
  • クライアント側で必須 OAuth 未連携時に専用ページへリダイレクトし、バッジ UI を共通化

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
workspaces/server/src/utils/oauth-login-provider.ts getProviderId()OAuthProviderId に型付け
workspaces/server/src/routes/user.ts providerId の厳密バリデーション + 必須 provider の削除禁止
workspaces/server/src/routes/auth-login/github.ts Provider ID 返却メソッドの型追従
workspaces/server/src/repository/oauth-internal.ts OAuthConnection / repository I/F の providerId を OAuthProviderId に変更
workspaces/server/src/infrastructure/repository/cloudflare/user.ts DB から読む OAuthConnection の providerId を OAuthProviderId に変換
workspaces/server/src/infrastructure/repository/cloudflare/oauth-internal.ts 同上(内部 OAuth リポジトリ)
workspaces/server/src/constants/oauth.ts OAuthProviderId 型、provider メタ情報、必須 provider 一覧を追加
workspaces/client/app/types/oauth-internal.ts client 側の OAuthConnection.providerId を OAuthProviderId に変更
workspaces/client/app/routes/dashboard/settings/internal/components/oauth-conn-row.tsx provider 表示/ユーザー表示をバッジ化、必須判定を OAUTH_PROVIDERS 基準に統一
workspaces/client/app/routes/dashboard/layout.tsx 必須 OAuth 未連携なら /connect-required-oauth へ誘導
workspaces/client/app/routes/connect-required-oauth/page.tsx 必須 OAuth 接続を促す新規ページを追加
workspaces/client/app/routes.ts /connect-required-oauth ルート追加
workspaces/client/app/hooks/use-auth.ts 必須 OAuth 未連携フラグを追加
workspaces/client/app/components/feature/oauth-internal/user-badge.tsx OAuth ユーザー表示用の共通バッジを追加
workspaces/client/app/components/feature/oauth-internal/service-provider-badge.tsx OAuth サービス表示用の共通バッジを追加

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

@batora9 batora9 left a comment

Choose a reason for hiding this comment

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

ぱっと見よさそうだと思います

@a01sa01to a01sa01to merged commit 2907c2b into main Mar 17, 2026
11 checks passed
@a01sa01to a01sa01to deleted the feat/require-discord-connect branch March 17, 2026 06:41
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