-
Notifications
You must be signed in to change notification settings - Fork 0
[view-admin] 画像送信を関数によるトランザクション貼った。 #332
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
base: develop
Are you sure you want to change the base?
Conversation
| 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 |
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
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 ?? []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
他の箇所もこんな感じに修正したい
対応Issue
なし!
概要
今までは
minioへ画像送信
insertImageを実行
insertPrizeを実行
としていたが
insert部分を一括で行うようにfunctionを作成した。
minio部分は修正不可な感じだったので放置
実装詳細
新たにcreate_prize_with_image functionを作成
ここでprize,imageを一括でpostするようにしている。
失敗時に何もデータが追加されないはず
pages/postPrizeのリファクタも行った。
カスタムフックだからuseEffectを使ってdata.prizesを格納するのは二度手間であるため修正した。
画面スクリーンショット等
テスト項目
備考
down -vしてください!
関数部分はgptとコネコネしてたから変かも