sonatard
January 30, 2024
2.6k

# GraphQL実践ノウハウv2

GraphQL実践ノウハウ
https://speakerdeck.com/sonatard/graphql-knowhow

https://speakerdeck.com/sonatard/swiftui-graphql

January 30, 2024

## Transcript

಺෦"1* 8FCϖʔδ
9. ### 9 ෳ਺ͷ(SBQI2-"1*ΤϯυϙΠϯτͷ࣮ߦ w ύλʔϯ w ಺෦"1*Ͱऔಘͨ͠৘ใΛݩʹ֎෦"1*Λ࣮ߦ͢Δ ֎෦"1* ಺෦"1* 8FCϖʔδ நબ঎඼Ұཡ

QSPEVDU@JEΛऔಘ ঎඼৘ใ { "raffles": [ {“id": 1, "name": “நબA", “product_id": 100}, {"id": 2, "name": "நબB", “product_id": 200}, {"id": 3, “name”: “நબC", “product_id”: 300} ] } products([100, 200, 300]) { "products": [ {“id": 100, "name": “঎඼A", “quantity”: 10}, {"id": 200, "name": "঎඼B", “quantity”: 20}, {"id": 300, “name": “঎඼C”, "quantity": 30} ] } ΫϥΠΞϯτʹɺ಺෦"1*ͷ݁ՌΛ੔ܗͯ͠ ֎෦"1*ʹ౉͢ϩδοΫ͕૿͑Δ
10. ### 10 ෳ਺ͷ(SBQI2-"1*ΤϯυϙΠϯτͷ࣮ߦ w ղܾࡦ w ֎෦"1*Λ಺෦"1*Ͱϥοϓ͢Δ ֎෦"1* ಺෦"1* 8FCϖʔδ products([100,

200, 300]) { "raffles": [ {“id": 1, "name": “நબA”, “product_name”: “঎඼A” “quantity”: 10}, {“id": 2, "name": “நબB”, “product_name”: “঎඼B” “quantity”: 20}, {“id": 3, "name": “நબC”, “product_name”: “঎඼C” “quantity”: 30}, ] } 8FCϖʔδ͸಺෦"1*ʹϦΫΤετ͚ͩૹΔ நબ঎඼Ұཡ ঎඼৘ใ
11. ### 11 εΩʔϚઃܭόοΫΤϯυ͔Βͷ֎෦"1*ϦΫΤετͷ஫ҙ఺ w ղܾࡦͷ໰୊఺ w ҎԼͷΑ͏ʹϥοϓͨ͠εΩʔϚΛఆٛ͢Δͱɺ֎෦"1*ͷ੍໿Λ಺෦"1*͕ड͚Δ͜ͱ ʹͳΔ type RaffleProduct {

id: ID! name: String! productName: String! productQuantity: String! } extend type Query { raffleProducts: RaffleProductConnection! } query RaffleProducts { raffleProducts { nodes { id name } } } நબ঎඼*%ͱநબ໊ OBNF ͚ͩΛऔಘ͢Ε͹͍͍ ৔߹ʹ΋ɺ֎෦"1*΁ͷΞΫηεΛͯ͠͠·͏ ύϑΥʔϚϯεͷ௿Լ ҙຯ΋ͳ͘"1*3BUF-JNJUʹ͔͔Δ ຊ൪ɺ"1*ςετ؀ڥʹӨڹ͕ग़Δ
12. ### 12 εΩʔϚઃܭόοΫΤϯυ͔Βͷ֎෦"1*ϦΫΤετͷ஫ҙ఺ w ಺෦"1*ͷ֎෦"1*ͷӨڹͷղফ w ղܾࡦ֎෦"1*ͷϑΟʔϧυ͸SFTPMWFSΛੜ੒͢Δ type RaffleProduct { id:

ID! name: String! # resolverΛੜ੒ͯ͠ɺfield͕ࢀর͞Εͳ͚Ε͹࣮ߦ͞Εͳ͍Α͏ʹ͢Δ productName: String! @goField(forceResolver: true) productQuantity: String! @goField(forceResolver: true) } extend type Query { raffleProducts: RaffleProductConnection! } 3FTPMWFSΛੜ੒ͯ͠ɺ fi FME͕ࢀর͞Εͳ͚Ε͹࣮ߦ͞Εͳ͍Α͏ʹ͢Δ ͔͜͠͠Εͩͱɺ౓ͷ2VFSZͰQSPEVDU/BNFͱQSPEVDU2VBOUJUZͷ྆ํͷࢀর ͕͋Δ৔߹ʹɺճͷ֎෦"1*΁ͷϦΫΤετ͕ඈΜͰ͠·͏
13. ### 13 εΩʔϚઃܭόοΫΤϯυ͔Βͷ֎෦"1*ϦΫΤετͷ஫ҙ఺ w ಺෦"1*ͷ֎෦"1*ͷӨڹͷղফ w ղܾࡦ಺෦"1*ͱ֎෦"1*ͷUZQFΛ෼཭͢Δ # ಺෦API type RaffleProduct

{ id: ID! name: String! # ֎෦API product: Product! @goField(forceResolver: true) } # ֎෦API type Product { id: ID! name: String! quantity: String! }
14. ### 14 εΩʔϚઃܭόοΫΤϯυ͔Βͷ֎෦"1*ϦΫΤετͷ஫ҙ఺ w ಺෦"1*ͷ֎෦"1*ͷӨڹͷղফ w ղܾࡦ಺෦"1*ͱ֎෦"1*ͷUZQFΛ෼཭͢Δ query RaffleProducts { raffleProducts

{ nodes { id name } } } ಺෦ͷ"1*͚ͩΞΫηε͢Δ৔߹͸֎෦"1*ͷӨڹ Λड͚ͳ͘ͳΔ 1SPEVDU͕ඞཁͳ৔߹͚ͩ֎෦"1*ʹϦΫΤετ ౤͛ΔΑ͏ʹͳΔ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } }
15. ### 15 ෳ਺ͷ(SBQI2-"1*ΤϯυϙΠϯτͷ࣮ߦ εΩʔϚઃܭόοΫΤϯυ͔Βͷ֎෦"1*ϦΫΤετͷ஫ҙ఺ w ·ͱΊ w ಺෦"1*Λ࣮ߦͨ݁͠ՌΛݩʹ֎෦"1*Λ࣮ߦ͢ΔͱɺΫϥΠΞϯτͷ࣮૷ͷίετ্͕ ͕Δ w ղܾࡦ͸ɺ಺෦"1*Ͱ֎෦"1*Λϥοϓͯ͠ɺ಺෦"1*ͱ֎෦"1*ͷܕΛ෼཭͢Δ

w ࣮૷ίετ্͕͕Δͱ͍ͬͯ΋ɺঢ়گ࣍ୈͰ͸ࠣࡉͳ໰୊ͳͷͰؾʹ͠ͳ͍͜ͱ΋େ੾

17. ### 5FOBOU# 17 Ϛϧνςφϯτͷ"1*ઃܭ w Ϛϧνςφϯτͷ֓೦ਤ 5FOBOU" 6TFS" 6TFS" 1SPEVDU" 1SPEVDU"

6TFS# 6TFS# 1SPEVDU# 1SPEVDU#
18. ### 18 Ϛϧνςφϯτͷ"1*ઃܭ w ϚϧνςφϯτΛεΩʔϚͱͯ͠Ͳ͏දݱ͢Δ͔ʁ type Query { products: [Product!]! users:

[User!]! } ύλʔϯεΩʔϚͷϧʔτʹ7JFXFSΛ഑ஔ ύλʔϯεΩʔϚͷϧʔτΛ5FOBOUͱͯ͠ѻ͏ type Query { adminViewer: Admin! tenantAdminViewer: TenantAdmin! } type Admin { tenants: [Tenant!]! } type TenantAdmin { tenant: Tenant! } type Tenant { id: ID! name: String! products: [Product!]! users: [User!]! }
19. ### 19 Ϛϧνςφϯτͷ"1*ઃܭ w ύλʔϯεΩʔϚͷϧʔτʹ7JFXFSΛ഑ஔ w 5FOBOUΦϒδΣΫτͰ5FOBOUͷείʔϓΛදݱ͢Δ w γϯϓϧͰࣗવ w ͔͠͠΄ͱΜͲͷϢʔεέʔε͕UFOBOU"ENJO7JFXFSͩͱͨ͠

Βɺඞͣ5FOBOU"ENJO΍5FOBOUΛܦ༝͠ͳ͍ͱଞͷUZQFʹΞΫ ηεͰ͖ͳ͍ͷͰ2VFSZ͕৑௕ type Query { adminViewer: Admin! tenantAdminViewer: TenantAdmin! } type Admin { tenants: [Tenant!]! } type TenantAdmin { tenant: Tenant! } type Tenant { id: ID! name: String! products: [Product!]! users: [User!]! } 5FOBOU" 6TFS" 6TFS" 1SPEVDU" 1SPEVDU"
20. ### 20 Ϛϧνςφϯτͷ"1*ઃܭ w ύλʔϯεΩʔϚͷϧʔτΛ5FOBOUͱͯ͠ѻ͏ w εΩʔϚͦͷ΋ͷͰ5FOBOUͷείʔϓΛදݱ͢Δɻ w UFOBOU"ENJO7JFXFSͱͯ͠͸ɺ2VFSZ͸ͱͯ΋؆ܿʹॻ͚Δ w BENJO7JFXFSͷͨΊʹUFOBOUT͕༻ҙ͞Ε͍ͯΔ͕ɺ

UFOBOU"ENJO7JFXFSʹ͸ෆཁͰ͋Δ type Query { products: [Product!]! users: [User!]! tenants: [Tenant!]! } 5FOBOU" 6TFS" 6TFS" 1SPEVDU" 1SPEVDU"
21. ### 21 Ϛϧνςφϯτͷ"1*ઃܭ w Ҏ্ͷΑ͏ʹτϨʔυΦϑ͕ଘࡏ͢Δ w εΩʔϚͷར༻ऀʹ࠷దͳํ๏Λબ୒͢Δ͜ͱ΋Ͱ͖Δ w ྫ ಺෦"1*ͱެ։"1*ͰεΩʔϚΛ෼ׂ͢Δ w

ྫ "ENJO7JFXFS"1*ͱUFOBOU"ENJO7JFXFS"1*ͰεΩʔϚΛ෼ׂ͢Δ
22. ### 22 Ϛϧνςφϯτͷ"1*ઃܭ w ྫ ɹ಺෦"1*ͱެ։"1*ͰεΩʔϚΛ෼ׂ͢Δ type Query { products: [Product!]!

users: [User!]! } ಺෦"1*εΩʔϚͷϧʔτʹ5FOBOUTΛ഑ஔ ֎෦"1*εΩʔϚͷϧʔτΛ5FOBOUͱͯ͠ѻ͏ type Query { adminViewer: Admin! tenantAdminViewer: TenantAdmin! } type Admin { tenants: [Tenant!]! } type TenantAdmin { tenant: Tenant! } type Tenant { id: ID! name: String! products: [Product!]! users: [User!]! } ಺෦"1*Ͱ͸BENJO7JFXFSͷϢʔεέʔε͕গͳ͚ Ε͹ɺ2VFSZ͕৑௕ͳ໰୊ͷଟ͘͸ղܾ͢Δ
23. ### 23 Ϛϧνςφϯτͷ"1*ઃܭ w ྫ "ENJO7JFXFS"1*ͱUFOBOU"ENJO7JFXFS"1*ͰεΩʔϚΛ෼ׂ͢Δ type Query { products: [Product!]!

users: [User!]! } "ENJO7JFXFS"1* εΩʔϚͷϧʔτʹ5FOBOUTΛ഑ஔ UFOBOU"ENJO7JFXFS"1* εΩʔϚͷϧʔτΛ5FOBOUͱͯ͠ѻ͏ type Query { tenants: [Tenant!]! tenant(id: ID!): Tenant! } type Tenant { id: ID! name: String! products: [Product!]! users: [User!]! } λʔήοτ͝ͱʹ"1*Λఆٛ͢Δ͜ͱͰɺεΩʔϚ Λ࠷খݶʹ͢Δ͜ͱ͕Ͱ͖Δ
24. ### 24 Ϛϧνςφϯτͷ"1*ઃܭ w ෼ׂͷσϝϦοτ w ؅ཧର৅͕૿͑Δ w ઃܭͷݕ౼Օॴ͕૿͑Δ w εΩʔϚ͸෼͚͕ͨɺαʔό͸෼͚Δͷ͔ʁ

w αʔό෼͚Δ৔߹͸ɺ6TFDBTFͷ࠶ར༻͸Ͱ͖ͳ͍͕Ͳ͏͢Δ͔ʁ w ͳͲ w ෼ׂ͸ɺ໰୊఺Λղܾ͢Δखஈͱͯ҆͠қʹબͼ͕ͪͳͷͰ஫ҙ͕ඞཁ w ͜ͷεϥΠυͰ࿩ͨ͠Α͏ͳҰൠ࿦Ͱ൑அ͢ΔͷͰ͸ͳ͘ɺࣗ෼͕ͨͪຊ౰ʹͦͷ՝ ୊͕ଘࡏ͢Δͷ͔Λߟ͔͑ͯΒ෼ׂ͢Δ͜ͱ͕େ੾ w 2VFSZ͕৑௕ͱͳΔͱ͍͏͕ɺͦΕʹΑͬͯ։ൃੜ࢈ੑ͸མͪΔͷ͔ʁ
25. ### 25 Ϛϧνςφϯτͷ"1*ઃܭ w ·ͱΊ w ͭͷεΩʔϚͰ͢΂ͯΛղܾ͠Α͏ͱࢥ͏ͱτϨʔυΦϑ͕ଘࡏ͢Δ w ໨తʹ߹ΘͤͯεΩʔϚΛ෼ׂ͢Δ͜ͱͰղܾͰ͖Δ w ͔͠͠෼ׂʹ͸ίετ͕൐͏ͷͰɺਖ਼͠͞ͷັྗ͚ͩʹऒ͔Εͯ҆қʹऔΓ૊·ͳ͍͜ͱ

͕େ੾ w ෼ׂͤͣʹҰఆظؒաͯ͝͠ɺਏ͞Λ਎Λ΋ͬͯମײ͢Δ w ਏ͘ͳ͍ͳΒ෼ׂ͠ͳ͍

28. ### 28 / ͱ%BUB-PBEFS w நબ঎඼Ұཡ͔Β঎඼৘ใΛऔಘ͢Δ(SBQI2- ಺෦"1* 8FCϖʔδ query RaffleProducts {

raffleProducts { nodes { id name product { name quantity } } } } %# TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE / ͕ൃੜ͢Δ
29. ### 29 / ͱ%BUB-PBEFS ಺෦"1* 8FCϖʔδ { "raffles": [ {“id": 1,

"name": “நબA", “product_id": 100}, {"id": 2, "name": "நબB", “product_id": 200}, {"id": 3, “name”: “நબC", “product_id”: 300} ] } SB ff l F@QSPEVDUT QSPEVDUT JET   / ͕ൃੜ͠ͳ͍ w நબ঎඼Ұཡ͔Β঎඼৘ใΛऔಘ͢Δ3&45
30. ### 30 / ͱ%BUB-PBEFS w நબ঎඼Ұཡ͔Β঎඼৘ใΛऔಘ͢Δ3&45 ಺෦"1* 8FCϖʔδ { "raffles": [

{“id": 1, "name": “நબA", “product_id": 100}, {"id": 2, "name": "நબB", “product_id": 200}, {"id": 3, “name”: “நબC", “product_id”: 300} ] } SB ff l F@QSPEVDUT QSPEVDUT QSPEVDUT QSPEVDUT / ͕ൃੜ͢Δ
31. ### 31 / ͱ%BUB-PBEFS w 3&45Ͱ͸ɺෳ਺ͷ*%Λड͚ͯ݁ՌΛฦ͢"1*Λఆ͍ٛͯ͠Ε͹/ ΛճආͰ͖Δ w ΋͠3&45ͰQSPEVDUT JETͷΑ͏ͳ"1*Λఆ͍ٛͯ͠ͳ͔ͬͨͷͳΒɺ3&45Ͱ΋/ ͸

ൃੜ͍ͯͨ͠͸ͣͰ(SBQI2-͔ͩΒͱ͍͏໰୊Ͱ͸͋Γ·ͤΜ
32. ### 32 / ͱ%BUB-PBEFS w ࣍ʹ3&45ͰQSPEVDUT JETΛఆ͍ٛͯͨ͠৔߹ͱ(SBQI2-ͷ/ ͷൺֱ ಺෦"1* 8FCϖʔδ SB

ff l F@QSPEVDUT QSPEVDUT JET   ಺෦"1* 8FCϖʔδ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } %# TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE %# TFMFDU GSPNQSPEVDU XIFSFJEJO    TFMFDU GSPNQSPEVDUXIFSFJE
33. ### 33 / ͱ%BUB-PBEFS w ࣍ʹ3&45ͰQSPEVDUT JETΛఆ͍ٛͯͨ͠৔߹ͱ(SBQI2-ͷ/ ͷൺֱ ಺෦"1* 8FCϖʔδ SB

ff l F@QSPEVDUT QSPEVDUT JET   ಺෦"1* 8FCϖʔδ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } %# TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE %# TFMFDU GSPNQSPEVDU XIFSFJEJO    NT NT  TFMFDU GSPNQSPEVDUXIFSFJE NT  NT  ߹ܭ NT ߹ܭ NT
34. ### 34 / ͱ%BUB-PBEFS w ݁Ռ w / ͕ͳ͍3&45NT w /

͕͋Δ(SBQI2-NT w / ͸՝୊Ͱ͸ͳ͘ɺ/ ʹΑΓͲ͏͍͏՝୊͕͋ΓɺԿΛղܾ͍͔ͨ͠Λߟ͑Δ͜ͱ͕ େ੾Ͱ͢ɻ w ૝૾͍ͯͨ͠՝୊͕ʮ3&45͔Β(SBQI2-Ҡߦ࣌ʹ/ ͰύϑΥʔϚϯε͕ѱԽ͢Δͷ Ͱղܾ͍ͨ͠ʯͱ͍͏΋ͷͩͱͨ͠Βɺ͜ͷྫͰ͸3&45ΑΓ͔͸଎͘ͳ͍ͬͯΔͷͰ ղܾ͸ෆཁͱ͍͏͜ͱʹͳΓ·͢ɻ w ͳΜͱͳ͘ʮ/ ͸Α͘ͳ͍ͱݴΘΕ͍ͯΔ͔͔Βʯʮ/ ͸ແବͳॲཧ͔ͩΒʯͱ͍ ͏ཧ༝Ͱղܾ͢Δͷ͸ةݥͰ͢ɻ
35. ### 35 / ͱ%BUB-PBEFS w ࠷ޙʹ(SBQI2- %BUB-PBEFSΛߟ͑ͯΈ·͢ w ҎԼͷNT͔Β଎͘ͳΔͰ͠ΐ͏͔ʁ ಺෦"1* 8FCϖʔδ

query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } %# TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE NT  TFMFDU GSPNQSPEVDUXIFSFJE NT  ߹ܭ NT
36. ### 36 / ͱ%BUB-PBEFS w ࠷ޙʹ(SBQI2- %BUB-PBEFSΛߟ͑ͯΈ·͢ w %BUB-PBEFSΛಋೖͨ͜͠ͱͰɺ/ ͕ղܾͯ͠଎͘ͳΓ·ͨ͠ʂ w

ຊ౰Ͱ͠ΐ͏͔ʁ ಺෦"1* 8FCϖʔδ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } %# NT  ߹ܭ NT TFMFDU GSPNQSPEVDU XIFSFJEJO    NT 
37. ### 37 / ͱ%BUB-PBEFS w %BUB-PBEFSͷ࣮૷ʹΑͬͯ͸଴ػ͕࣌ؒઃఆ͞Ε͓ͯΓɺͦͷؒͷϦΫΤετΛ·ͱΊΔ ͜ͱͰ/ Λղফ͠·͢ɻ w ΋͠଴ػ͕࣌ؒNTͩͱͨ͠ΒҎԼͷΑ͏ʹͳΓ·͢ w

ݩͷNTΑΓ஗͘ͳ͍ͬͯΔ͔΋͠Ε·ͤΜɻ ಺෦"1* 8FCϖʔδ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } %# NT  ߹ܭ NT TFMFDU GSPNQSPEVDU XIFSFJEJO    NT  ଴ػ࣌ؒ NT
38. ### 38 / ͱ%BUB-PBEFS w ·ͨ΋͠଴ػ͕࣌ؒNTͰ%#΁ͷΞΫηε͕όονॲཧ͞Εͣ଴ػ͚࣌ؒͩ஗͘ͳ͍ͬͯ ΔՄೳੑ΋͋Γ·͢ɻ ಺෦"1* 8FCϖʔδ query RaffleProducts

{ raffleProducts { nodes { id name product { name quantity } } } } %# NT  ߹ܭ NT ଴ػ࣌ؒ NT TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE NT  TFMFDU GSPNQSPEVDUXIFSFJE
39. ### 39 / ͱ%BUB-PBEFS w ·ͨͦ΋ͦ΋(SBQI2-ͷSFTPMWFS͸ฒߦ࣮ߦ͞Ε·͢ɻ w ࠓ·Ͱ͸આ໌ͷศ্ٓNT ͱ͖ͯ͠·͕ͨ͠ɺͭฒߦʹಈ͚͹͔͔Δ࣌ؒ͸NT Ͱ͢ɻ w

ͦͷ৔߹଴ػ͚࣌ؒͩ஗͘ͳ͍ͬͯ·͢ɻ ಺෦"1* 8FCϖʔδ query RaffleProducts { raffleProducts { nodes { id name product { name quantity } } } } ֎෦"1* NT  ߹ܭ NT ଴ػ࣌ؒ NT NT  TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE
40. ### 40 / ͱ%BUB-PBEFS w ͞Βʹ֎෦"1*ʹΞΫηε͍ͯ͠Δ৔߹ʹɺ·ͱΊͯऔಘ͢Δ"1*͕஗͍͔΋͠Ε·ͤΜɻ ಺෦"1* 8FCϖʔδ ֎෦"1* NT 

߹ܭ NT NT QSPEVDUT JET   ಺෦"1* 8FCϖʔδ ֎෦"1* NT  ߹ܭ NT NT QSPEVDUT QSPEVDUT QSPEVDUT ଴ػ࣌ؒ NT /  / ͷղফ
41. ### 41 / ͱ%BUB-PBEFS w Ҏ্ͷΑ͏ʹ%BUB-PBEFSΛಋೖ͢Ε͹଎͘ͳΔͱ͍͏Θ͚Ͱ͸ͳ͘ɺඞͣܭଌͱ5SBDFͷ ֬ೝ͕ඞཁͱͳΓ·͢ɻ w ֬ೝࣄ߲ w /

͸ຊ౰ʹ·ͱΊΒΕ͍ͯΔ͔ʁ w όονॲཧͨ͜͠ͱͰ஗͘ͳ͍ͬͯͳ͍͔ʁ w ଴ػ࣌ؒ΋ؚΊͨ߹ܭͷ࣌ؒ͸଎͘ͳ͍ͬͯΔ͔ʁ w ΋֬͠ೝͰ͖͍ͯͳ͍ͱͨ͠ΒɺύϑΥʔϚϯεΛѱԽ͍ͤͯ͞ΔՄೳੑ͕͋Γ·͢ɻ w ͦͯ֬͠ೝͰ͖͍ͯͳ͍ͷͰ͋Ε͹ɺ%BUB-PBEFSͷಋೖ͸ૣ͗͢Δ࠷దԽ͔΋͠Ε·ͤΜ w 3PC1JLFT3VMFTPG1SPHSBNNJOHDPNQMFYJUZ w IUUQTEFWUPTPOBUBSESPCQJLFTSVMFTPGQSPHSBNNJOHDPNQMFYJUZEO
42. ### 42 / ͱ%BUB-PBEFS w ͔͠͠/ ͷ໰୊͸ύϑΥʔϚϯε͚ͩͰ͸͋Γ·ͤΜ w \$16ɺ%#࢖༻཰ͷ૿Ճɺ\$16ɺ%#ͷඅ༻ w ֎෦"1*3BUF-JNJUͷফඅͳͲ

w ্هͷ໰୊Λղܾ͢ΔͨΊʹ%BUB-PBEFSΛಋೖ͢ΔͷͰ͋Ε͹ɺύϑΥʔϚϯε͕མͪͯ ΋ಋೖ͢ΔՁ஋͕͋Γ·͢ɻ w ͦͷͨΊඞͣ໨తΛ໌֬ʹͯ͠ɺ໨తΛղܾ͢ΔͨΊʹ%BUB-PBEFSΛར༻͠·͠ΐ͏ɻ w ͋ͱ͸%BUB-PBEFSͷ࣮૷ɺอकίετͱͷ݉Ͷ߹͍ͰɺνʔϜʹΑͬͯํ਑ΛܾΊΔͱྑ ͍ͱࢥ͍·͢ɻ w %BUB-PBEFSͷ࣮૷Λࣗಈతʹૠೖ͢Δ࢓૊Έ͕͋ΔͷͰɺ࣮૷ɺอकίετ͸ͳͷ Ͱɺඞͣ%BUB-PBEFSΛಋೖ͢Δ w සग़͢ΔέʔεͰݕূͨ͠ͱ͜ΖύϑΥʔϚϯεͷ޲্͕֬ೝͰ͖ͨͷͰɺඞͣ %BUB-PBEFSΛಋೖ͢Δ w %#͕εέʔϧΞ΢τ͠ͳ͍ͷͰෛՙΛؾʹͯ͠ɺඞͣ%BUB-PBEFSΛಋೖ͢Δ
43. ### 43 / ͱ%BUB-PBEFS w 4UBDLࣾͷ%BUB-PBEFSͷํ਑ w %BUB-PBEFS͸ɺجຊతʹ͸࣮૷͠·ͤΜ w HRMHFOͰ͸%BUB-PBEFSͷ࣮૷ίετͱϝϯςίετ͕͋ΔͨΊɺ͜ΕΛճආ͠·͢ w

νʔϜͱͯ͠௨ৗͷ։ൃϑϩʔͰߟ͑Δ͜ͱ͸࠷௿ݶʹͯ͠ɺػೳ։ൃʹूத͠·͢ w %BUB-PBEFSΛ࣮૷͔ͨ͠Βʹ͸ɺ5SBDFΛݟͯόονॲཧͷ࣮ݱΛ֬ೝ͠ͳ͚Ε͹ͳΓ·ͤΜ͕ɺͦͷίετΛ ճආ͠·͢ w ܦӦ൑அͱͯ͠ɺࠓ͸αʔόίετΑΓΤϯδχΞϦιʔε͕େ੾Ͱ͢ɻͦͷͨΊαʔόίετΛ෷͍·͢ɻ w \$16ͱ%#ͷෛՙ w \$MPVE3VOͱ4QBOOFS͕εέʔϧΞ΢τ͢ΔͨΊෛՙ͸ؾʹ͍ͯ͠·ͤΜ w \$16ͱ%#ͷඅ༻ w අ༻͸ଟ͘ͷϢʔβ͕ར༻͢Δ·ͰӨڹ͕ͳ͍ͷͰ༏ઌ౓ΛԼ͍͛ͯ·͢ w අ༻͕େ͖͘ͳͬͨ࣌఺Ͱɺ%BUB-PBEFSͷσϑΥϧτ࣮૷Λ࠶ݕ౼͠·͢ w ֎෦"1*3BUF-JNJUͷӨڹ w దٓݕ౼ͯ͠%BUB-PBEFSΛಋೖ͍ͯ͠·͢ɻաڈʹ͸౓͚ͩ͋Γ·ͨ͠ɻ w 69ʹ༩͑ΔӨڹ͕͋Δ৔߹ w ࣮ࡍʹαʔϏεΛར༻͍ͯͯ͠ੑೳͷ໰୊Λײ͡Δ৔߹ʹಋೖͷݕ౼Λ͠·͢ w աڈʹ໰୊ʹͳͬͨ͜ͱ͸͋Γ·ͤΜ

46. ### 46 ެ։"1*ͷεΩʔϚઃܭ1FSNJTTJPO w 1FSNJTTJPO͸ೝূͨ͠τʔΫϯʹؚ·Ε͍ͯ·͢ɻ w ͜ͷ৔߹͸3PMFͰ੍ޚ͢ΔͷͰ͸ͳ͘ɺڐՄ͍ͨ͠৔߹͸3PMFʹ1FSNJTTJPOΛ෇༩͠· ͢ɻ w 4UBDLࣾͰ͸3PMFͱ1FSNJTTJPOͷ؅ཧ͸\$MFSLΛར༻͍ͯ͠·͢ɻ type

Order @permission(permissions: ["order:read", "order:write"]) { id: ID! @goField(forceResolver: true) cancelledAt: DateTime note: String! } type Mutation { orderCreate(input: OrderCreateInput!): OrderCreatePayload! @permission(permissions: ["order:write"]) }

48. ### 48 34\$ͱ(SBQI2- w 34\$ 3FBDU4FSWFS\$PNQPOFOU ͷొ৔Ͱ(SBQI2-͸ͲͷΑ͏ʹӨڹΛड͚Δ͔ʁ w 3&45͔Βͷྺ࢙ͰৼΓฦΓ·͢ 3&45"1* 8FCϖʔδ

SB ff l F@QSPEVDUT QSPEVDUT JET   %# TFMFDU GSPNQSPEVDU XIFSFJEJO    3&45 ΢ΥʔλʔϑΥʔϧ໰୊͕ى͖Δ SB ffl F@QSPEVDUTΛऔಘ͔ͯ͠Βɺ࣍ʹQSPEVDUTΛ౤͛Δඞཁ͕͋Δ ΫϥΠΞϯτͱαʔόͰ͸෺ཧతͳڑ཭͕͋Γ஗͍
49. ### 49 34\$ͱ(SBQI2- w ΢ΥʔλʔϑΥʔϧΛղܾ͢ΔͨΊʹ(SBQI2-Ͱ͸ɺ2VFSZΛαʔόʹ౤͛ͯόοΫΤϯ υͰղܾ͢Δ (SBQI2-"1* 8FCϖʔδ query RaffleProducts {

raffleProducts { nodes { id name product { name quantity } } } } %# TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNQSPEVDUXIFSFJE TFMFDU GSPNSB ffl F@QSPEVDU ΢ΥʔλʔϑΥʔϧʹΑΔύϑΥʔϚϯεͷ໰୊͸ղܾͨ͠ ΢ΥʔλʔϑΥʔϧ͕ͳ͘ͳͬͨΘ͚Ͱ͸ͳ͍͕ɺ"1*αʔόͱ%#ͷؒͳͷ Ͱ෺ཧతڑ཭͕ۙ͘ɺ3&45ͱൺֱͯ͠Өڹ͕খ͍͞
50. ### 50 34\$ͱ(SBQI2- w ίϯϙʔωϯτʹ͓͚Δ΢ΥʔλʔϑΥʔϧ໰୊ w औಘ͢Δ஋͸ՄೳͳݶΓର৅ίϯϙʔωϯτʹఆ͍ٛͨ͠ w \$PMPDBUJPO (SBQI2-"1* 3B

ffl F1SPEVDU \$PNQPOFOU 1SPEVDU \$PNQPOFOU (FU3B ffl F (FU1SPEVDU    3B ffl F1SPEVDU\$PNQPOFOUͷ (FU3B ffl F͕ऴΘΓ࣍ୈ 1SPEVDU\$PNQPOFOUΛඳը 2VFSZΛ\$PNQPOFOUʹ \$PMPDBUJPO͢Δ͜ͱͰɺ ϦΫΤετ͕෼ׂ͞Εͯ (SBQI2-ͷϝϦοτ͕ͳ͘ͳΔ
51. ### 51 34\$ͱ(SBQI2- w \$PMPDBUJPOʹΑΔ΢ΥʔλʔϑΥʔϧ໰୊ͷղফ w VTF#BDLHSPVOE2VFSZɺVTF'SBHNFOUɺ4VTQFOTFɺEFGFSʹΑΔରԠ (SBQI2-"1* 3B ffl F1SPEVDU

\$PNQPOFOU 1SPEVDU \$PNQPOFOU VTF#BDLHSPVOE2VFSZ (FU3B ffl F1SPEVDU     2VFSZʹEFGFSEJSFDUJWFΛࢦఆ VTF'SBHNFOUͰ ݁Ռ͕औಘͰ͖ͳ͚Ε͹ 4VTQFOE 3FMBZ͸ରԠͰ͖͍ͯΔ͕ ଞͷ(SBQI2-ΫϥΠΞϯτ͸ ௥͍͚͍ͭͯͳ͍ʁ "QPMMP͸ͰରԠ༧ఆ ରԠ·Ͱʹ਺೥͔͔Δ΄Ͳ ΫϥΠΞϯτͷෳࡶʹͳ͍ͬͯΔ ཧ૝తͳঢ়ଶΛ໨ࢦ͢ͳΒ 'SBHNFOU͝ͱͷΤϥʔϋϯυϦϯά ΋ߟ͑Δඞཁ͕Ͱͯ͘Δ (FU3B ffl F1SPEVDUͷ݁ՌΛ ଴ͨͣʹϨϯμϦϯά
52. ### 52 34\$ͱ(SBQI2- w 34\$ w (SBQI2-ͷෳࡶ͕͞໰୊͕ͩɺαʔόʹίϯϙʔωϯτ͕͋Ε͹(SBQI2-͸ෆཁʹͳΓ ໰୊͸ղܾ͢Δɻ34\$͸(SBQI2-ͷSFTPMWFSͷΑ͏ͳ΋ͷʹͳΔɻ 3B ffl F1SPEVDU

\$PNQPOFOU 1SPEVDU \$PNQPOFOU %# PS "1* TFMFDU GSPNSB ffl F@QSPEVDU TFMFDU GSPNQSPEVDU XIFSFJEJO    3B ffl F1SPEVDU\$PNQPOFOUͷ (FU3B ffl F͕ऴΘΓ࣍ୈ 1SPEVDU\$PNQPOFOUΛඳը αʔό 34\$ʹΑΓαʔό͔Βڑ཭͕͍ۙ%#ʹ ΞΫηε͢Δ ΢ΥʔλʔϑΥʔϧ͕ͳ͘ͳͬͨΘ͚Ͱ ͸ͳ͍͕ɺύϑΥʔϚϯεͷ໰୊͕ղܾ
53. ### 53 34\$ͱ(SBQI2- w (SBQI2-΍34\$ͱͲͷΑ͏ʹ෇͖߹͏΂͖͔ʁ w ީิ(SBQI2-ΛׂΓ੾ͬͯ࢖͏ w ίϯϙʔωϯτͷ΢ΥʔλʔϑΥʔϧ໰୊ͷղܾΛఘΊͯ\$PMPDBUJPO͚ͩΛ࣮ݱ͢Δ w ϧʔτͰVTF2VFSZΛͯ͠ίϯϙʔωϯτͰVTF'SBHNFOU

w ͢΂ͯͷ݁Ռ͕ฦͬͯ͘Δ·Ͱɺ͢΂ͯͷίϯϙʔωϯτ͕දࣔ͞Εͳׂ͍͕Γ੾Δ w ީิ(SBQI2-Λਅ݋ʹ࢖͏ w 3FMBZΛ࠾༻ͯ͠'SBHNFOUΛཧ૝తͳঢ়ଶͰར༻͢Δ w VTF'SBHNFOUɺ4VTQFOTFɺEFGFS w αʔόͷεΩʔϚ΋جຊతʹ͸0QUJPOBMʹͯ͠ɺ2VFSZશମΛΤϥʔʹͤͣର৅ͷ 'JFME͚ͩΛΤϥʔʹ͢ΔͨΊʹSFRVJSFEEJSFDUJWFΛࢦఆ͢Δɻ
54. ### 54 34\$ͱ(SBQI2- w (SBQI2-΍34\$ͱͲͷΑ͏ʹ෇͖߹͏΂͖͔ʁ w ީิ(SBQI2-TQFDͱ"QPMMPରԠΛ଴ͬͯ(SBQI2-Λਅ݋ʹ࢖͏ w "QPMMPͷVTF'SBHNFOUɺ4VTQFOTFɺEFGFSͷରԠΛ଴ͭ w (SBQI2-TQFDͰ4FNBOUJD/PO/VMMͷ࢓༷͕ܾ·Γɺ"QPMMP͕࣮૷͢ΔͷΛ଴ͭ

w αʔόͷεΩʔϚ΋جຊతʹ͸4FNBOUJD/PO/VMMʹͯ͠ɺ2VFSZશମΛΤϥʔʹ ͤͣର৅ͷ'JFME͚ͩΛΤϥʔʹ͢Δɻ w ͦΕ·Ͱ͸ީิͰ଴ػ
55. ### 55 34\$ͱ(SBQI2- w (SBQI2-΍34\$ͱͲͷΑ͏ʹ෇͖߹͏΂͖͔ʁ w ީิ34\$Λ࠾༻͢Δ w 34\$Λ࠾༻ͯ͠ɺ(SBQI2- 'SBHNFOUͷ೉͔͠͞Β཭ΕΔ w

34\$͕ൃల్্ͳͨΊݱ࣌఺ͩͱ34\$Λ௥͍੾ΕΔύϫʔ͕ඞཁ
56. ### 56 34\$ͱ(SBQI2- w (SBQI2-΍34\$ͱͲͷΑ͏ʹ෇͖߹͏΂͖͔ʁ w ύϑΥʔϚϯε͕՝୊͸ͳ͘ɺػೳ։ൃʹूத͚ͨ͠Ε͹ީิ w ඞཁʹԠͯ͡ީิ w ύϑΥʔϚϯεʹ՝୊͕͋Γɺ3FMBZΛ࢖͍͜ͳͤΕ͹ީิ

w ύϑΥʔϚϯεʹ՝୊͕͋Γɺ34\$Λૣ͔͘Β௅ઓ͍ͨ͠৔߹͸ީิ

58. ### 58 34\$ͱ(SBQI2- w (SBQI2-ͷSFTPMWFSͱ34\$ͷҧ͍ w (SBQI2- w σʔλߏ଄ʹରͯ͠ɺऔಘॲཧ͕࣮૷͞ΕΔ w 6*ͷมߋ͕͋ͬͨͱ͖ʹɺίϯϙʔωϯτ্ͷ2VFSZΛมߋ͢Δ

w 34\$ w ίϯϙʔωϯτͷ6*ߏ଄ʹରͯ͠ɺऔಘॲཧ͕࣮૷͞ΕΔ w 6*ͷมߋ͕͋ͬͨͱ͖ʹɺίϯϙʔωϯτ্Ͱऔಘॲཧͷ࣮૷ͷมߋΛ͢Δ
59. ### 59 34\$ͱ(SBQI2- w εΩʔϚͱͯ͠ͷརศੑ w (SBQI2- w 4DBMBSɺEJSFDUJWFͳͲ͸ศར w 34\$

3&45 w 0QFO"1*͸͋Δ͕རศੑ͸ྼΔ w ࠷ۙొ৔ͨ͠5ZQF4QFD͸εΩʔϚͷγϯϓϧ͞΍རศੑ͕(SBQI2-ʹ͍ۙͷͰ஫໨ ͍ͨ͠IUUQTUZQFTQFDJP
60. ### 60 34\$ͱ(SBQI2- w ΞϓϦ w (SBQI2- w (SBQI2-ΫϥΠΞϯτ͸֤छଘࡏͯ͠࠾༻Մೳ w "OESPJE

+FUQBDL\$PNQPTFF "QPMMP,PUMJO w J04 4XJGU6* "QPMMPJ04 w 'MVUUFSHSBQIRM@ fl VUUFSɺGFSSZ w 3FBDU/BUJWF3FMBZ w 34\$ w "OESPJEɺJ04ɺ'MVUUFSͰ͸ར༻Ͱ͖ͳ͍ w 3FBDU/BUJWF&YQPͰରԠΛਐΊ͍ͯΔ