Skip to content

シードデータの追加#46

Merged
newt239 merged 4 commits intomainfrom
chore/improve-seed
Apr 6, 2025
Merged

シードデータの追加#46
newt239 merged 4 commits intomainfrom
chore/improve-seed

Conversation

@newt239
Copy link
Copy Markdown
Member

@newt239 newt239 commented Apr 4, 2025

close #41

Prismaのseedコマンドにリセット処理を追加し、シードデータの種類を増やしました。

  • ロール
    • admin, moderator, member
  • ユーザー
    • モデレーター太郎, 一般ユーザー花子, 一般ユーザー次郎
  • チャンネル
    • general, random, private
  • メッセージ
    • シンプルテキスト, Markdown, TeX, HTML, リンク入りメッセージ, GFMのサンプルテキスト
  • その他
    • メッセージに含まれるリンク, メンション
    • チャンネルメンバー
スクリーンショット 2025-04-04 19 01 04

Copy link
Copy Markdown
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.

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • package.json: Language not supported
  • prisma/seed/GFM.txt: Language not supported
Comments suppressed due to low confidence (1)

prisma/seed/init.ts:225

  • [nitpick] Consider using a more user-friendly identifier such as a username or slug in the mention message instead of the raw user ID for improved readability.
content: `Hello @${adminUser.id}, please review the latest update.`


// 様々なパターンが入ったメッセージ
const filePath = path.join(__dirname, "GFM.txt");
const content = fs.readFileSync(filePath, "utf8");
Copy link

Copilot AI Apr 4, 2025

Choose a reason for hiding this comment

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

Consider adding error handling around the file read operation to gracefully manage cases where 'GFM.txt' might be missing or inaccessible.

Suggested change
const content = fs.readFileSync(filePath, "utf8");
let content = "";
try {
content = fs.readFileSync(filePath, "utf8");
} catch (err) {
console.error(`Error reading file ${filePath}:`, err);
}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@saka-naname saka-naname left a comment

Choose a reason for hiding this comment

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

LGTMeow

動作自体は問題ないと思うのでApproveします。
1点動作に影響のほとんどない誤字(と思われるもの?)があったのでそこだけ指摘しておきます、問題なければマージしてしまって構いません

// ワークスペース作成
const workspace = await prisma.workspace.create({
data: {
name: "Digichart for Insider",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nits-badge
Digichatの誤字…?

Suggested change
name: "Digichart for Insider",
name: "Digichat for Insider",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

誤字です!修正しておきます🙇‍♂️


// 様々なパターンが入ったメッセージ
const filePath = path.join(__dirname, "GFM.txt");
const content = fs.readFileSync(filePath, "utf8");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilotによってファイルの読み込み失敗時の処理について指摘がされていますが、今回のケースにおいてはGFM.txtが存在しない時abortしてしまった方が
Markdownの表示確認がうまくできなかった際に「ファイルが読み込めていなかった」という可能性を潰すことができるので、個人的にはこのままで構わないと思います。

@newt239 newt239 self-assigned this Apr 6, 2025
@newt239 newt239 merged commit acd8801 into main Apr 6, 2025
1 check passed
@newt239 newt239 deleted the chore/improve-seed branch April 6, 2025 07:09
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