Skip to content

Conversation

@hikahana
Copy link
Collaborator

@hikahana hikahana commented Feb 3, 2025

対応Issue

  • resolve #0
    なし!

概要

今までは
minioへ画像送信
insertImageを実行
insertPrizeを実行
としていたが
insert部分を一括で行うようにfunctionを作成した。
minio部分は修正不可な感じだったので放置

実装詳細

新たにcreate_prize_with_image functionを作成
ここでprize,imageを一括でpostするようにしている。
失敗時に何もデータが追加されないはず
pages/postPrizeのリファクタも行った。
カスタムフックだからuseEffectを使ってdata.prizesを格納するのは二度手間であるため修正した。

画面スクリーンショット等

テスト項目

  • 送信が正常に行われるか
  • postPrize pageのデザインが崩れていないか
  • コードレビュー

備考

down -vしてください!
関数部分はgptとコネコネしてたから変かも

@github-actions github-actions bot added frontend backend bug Something isn't working labels Feb 3, 2025
WHERE id = (SELECT id FROM reach_logs ORDER BY created_at DESC LIMIT 1);
END;
$$;
CREATE FUNCTION public.insert_prize_with_image(p_is_won boolean, p_name_jp text, p_name_en text, p_bucket_name text, p_file_name text, p_file_type text) RETURNS SETOF public.prizes
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

消したはずの関数残ってるなんで。。

metaData,
);
return res.status(200).json({ message: "Upload successful" });
return res.status(200).json({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ここレスポンスで取得できそうだったから返してる

CreateOneImageMutationVariables
>(CreateOneImageDocument);

const bingoPrizes: GetListPrizesQuery["prizes"] = data?.prizes ?? [];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

他の箇所もこんな感じに修正したい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants