-
Notifications
You must be signed in to change notification settings - Fork 0
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
DB を PostgreSQL に移行 #13
Conversation
rokoucha
commented
Nov 27, 2022
•
edited
Loading
edited
- 既存の API を Postgres に移行する
- READMEのSetup部分更新 (Postgresql移行時のドキュメント等更新 #17 )
Co-authored-by: rinsuki <428rinsuki+contact.github@gmail.com> Co-authored-by: tosuke <tosuke@users.noreply.github.com>
タグのデータ持ち方多分大幅に変えるので置き換えるのであればなるべく後の方に回してください(#15 で修正予定) |
Co-authored-by: rinsuki <428rinsuki+contact.github@gmail.com>
Co-authored-by: tosuke <tosuke@users.noreply.github.com> Co-authored-by: rinsuki <428rinsuki+contact.github@gmail.com> Co-authored-by: SnO₂WMaN <me@sno2wman.net>
手元で検証するとき面倒なのでAuthorizationヘッダにトークン入れて認証するハッチ |
3268515 いれた |
3268515
to
e0343fa
Compare
src/index.ts
Outdated
.object({ | ||
query: z.string(), | ||
variables: z.optional(z.record(z.string(), z.any())), | ||
operationName: z.optional(z.string()), |
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.
operationName
はz.optional
ではなくz.nullable
.
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.
なおす
src/resolvers/videos.ts
Outdated
|
||
function videoEntityToGraphQLVideo(video: Video) { | ||
return { | ||
id: "video:" + video.id, |
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.
返却される値にvideo:
のprefixが付いているのはGraphQLの設計としておかしいと思う(取得時の引数には必要がないので)
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.
@rinsuki これなんでつけたんだっけ、自分も昨日見て思い出せなかった
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.
その他同様
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.
GraphQLのidって基本的にそれだけで取れないといけないんじゃないっけ (node(id: ID)
に渡されるので)
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.
あー GraphQL API の空間内でユニークな ID じゃないと駄目ってことか
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.
じゃあ base64 とか通す?
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.
良いけど,長すぎない?
echo "video:01GK78BVF1CQGPW58FKSABW65G" | base64
dmlkZW86MDFHSzc4QlZGMUNRR1BXNThGS1NBQlc2NUcK
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.
別にweb/クライアント側で取得時に適当にprefix付け外したりbase64エンコードなりすれば良いか
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.
確かにGraphQL上のidとは別にrecordIdとかあってもいいかも
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.
それはちょっと煩雑感あるねー良い感じにグローバルでウニークな ID 採番できると良いんだけど
e0343fa
to
0727a5c
Compare
Co-authored-by: SnO₂WMaN <me@sno2wman.net>
Co-authored-by: rinsuki <428rinsuki+git@gmail.com>
mutation RegisterVideo($input: RegisterVideoInput!) {
registerVideo(input: $input) {
video {
id
title
tags {
id
name
}
}
}
}
備考: {
"errors": [
{
"message": "null value in column \"source\" of relation \"video_sources\" violates not-null constraint",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"registerVideo"
]
}
],
"data": null
} |
Co-authored-by: SnO₂WMaN <me@sno2wman.net> Co-authored-by: rinsuki <428rinsuki+contact.github@gmail.com>
Co-authored-by: Rokoucha <git@rokoucha.net> Co-authored-by: SnO₂WMaN <me@sno2wman.net> Co-authored-by: rinsuki <428rinsuki+git@gmail.com> Co-authored-by: SnO2WMaN <me@sno2wman.net>