Skip to content

[URL] 問題集の詳細ページを連番から作成者が文字列を指定できるようにしましょう #2020

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

Closed
55 of 66 tasks
KATO-Hiro opened this issue May 10, 2025 · 0 comments · Fixed by #2126
Closed
55 of 66 tasks

Comments

@KATO-Hiro
Copy link
Collaborator

KATO-Hiro commented May 10, 2025

WHY

  • 問題集そのものを削除して、新しく作り直すとき、これまでブログやツイートなどで貼られていたリンクが切れてしまう
  • 意味のある文字列の URL の方が、SEO 的に望ましい

TODO

  • 影響範囲の確認
  • 追加・修正内容の列挙(今後、類似したタスクの省力化につながる)
    • Prisma のスキーマに属性を追加
      • urlSlug Stirng?型
      • 型情報の追従
        • types
        • zod/schema
      • zod/schema のバリデーションの追加・修正
        • a-z、0-9、- (ハイフン) のみ許容
        • 0文字以上30文字以内
        • 2hoge-foo のような形式を満たしているか正規表現でチェック
        • fuga/barのように、指定された文字以外を使うのはNG
    • CRUD の追加・修正
      • createメソッドに属性を追加
      • urlSlugを使ってデータベースから問題集と該当する問題を取得
    • UI の更新
      • コンポーネントの修正
        • 追加したurlSlugの有無で表示するURLを切り替える
          • なし: 従来通り番号でアクセス
          • あり: urlSlugでアクセス
        • 入力用のinputを追加
        • tailwindcssでレスポンシブ対応
    • サーバ側の処理の追加・更新
      • 編集ページ
      • 詳細ページ
      • utilsを呼び出す
    • utils のヘルパー関数の追加・修正
      • 問題集を特定する識別子が、データベースで自動付番された数字か文字列かで処理を場合分け
        • 自動付番された数字の場合
          • idをキーとして、問題集が存在するか判定
          • Yesなら該当する問題集を返す
        • 文字列の場合
          • slugをキーとして問題集が存在するか判定
          • Yesなら該当する問題集を返す
          • Noなら「該当する問題集がない」ことを画面に表示
      • テストの追加・更新
        • urlSlug の正規表現が仕様を満たしているかチェック
          • ok、半角a-zのみ: "a" * 1、"a" * 2、"a" * 30、unionfind、bfs、dfs、dijkstra、dp
          • ok、半角a-zとハイフン: warshall-floyd、digit-dp
          • ok、半角a-z、整数、ハイフン混合: 2-sat
          • ng、大文字を含む: UnionFind
          • ng、半角a-z、整数、ハイフン以外の文字を含む: foo/bar
          • ng、整数のみ: "1"、"2"、"10"、"99"、"100"
          • ng、空白を含む: directed acyclic graph
          • ng、先頭や末尾にハイフンを含む: -hoge、fuga-
          • ng、連続でハイフンを含む: fuga--hoge
          • ng、全角のa-z、0-9、ハイフン
        • zod/schema のurlSlugのパターンをチェック
          • ok、0文字以上30字以下
          • ok、null、undefined、""
          • ng、31文字以上
  • リリース前の確認事項
    • 検証用環境
      • バックアップを取る
      • GHAでdbのスキーマが正常に更新されるのを確認
      • データの損失がないことを確認
        • もしNoなら、バックアップを使って復元
      • レビューツールの指摘事項を読み、必要だと判断した内容を修正
      • Pull Requestをmerge
      • 動作確認
    • 本番環境
      • バックアップを取る
      • GHAでdbのスキーマが正常に更新されるのを確認
      • データの損失がないことを確認
        • もしNoなら、バックアップを使って復元
      • 動作確認
@KATO-Hiro KATO-Hiro changed the title [URL] 問題集の詳細ページを連番から作成者が文字列を指定できるか、影響範囲の調査・実現可能性を判断をしましょう [URL] 問題集の詳細ページを連番から作成者が文字列を指定できるようにしましょう May 25, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 2, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 4, 2025
KATO-Hiro added a commit that referenced this issue Jun 5, 2025
✨ Enable to use url slug in workbook page (#2020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant