Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Introduction to using GraphQL for a bit
Search
Kazuki Ohashi
December 19, 2018
Technology
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to using GraphQL for a bit
Kazuki Ohashi
December 19, 2018
More Decks by Kazuki Ohashi
See All by Kazuki Ohashi
larave_vue_graphql_supplementation
kzkohashi
1
900
フォロワーがどの雑誌に興味があるのか可視化してみる / magazine-score
kzkohashi
0
750
Laravelを始めて DDDを実践するまで
kzkohashi
2
2k
Amazon Rekognitionを用いてフォロワーの男女比を出す
kzkohashi
1
3k
Other Decks in Technology
See All in Technology
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
6
1.9k
React Nativeでの OTA Updateって、 どう説明する?
ichiki1023
0
130
AWS FinOps Agent 結局何が得意なの?
siromi
0
220
企業の現実世界をグラフで写し取る
sansantech
PRO
0
220
なぜAI任せのゲームは面白くならないのか?
hirohasuyoutube
0
340
Harness Engineering on Rails
joelq
0
770
2026-09-26 Platform Engineering Kaigi 2026 インフラとアプリの境界線と委譲の設計 / Drawing the Infra and App Line
masasuzu
0
510
AIエージェント時代のPlatform as a Product —— テックリードがPdMとして回す発見・導入・計測 / Platform as a Product in the AI Agent Era
toshi0607
1
540
The kernel report
ennael
PRO
1
160
TiDBファミリーにDWHが新登場!! TiDB最新情報 / TiDB update 202609
yoshiakiyamasaki
0
160
Lambda MicroVMsが分からなすぎたので使い所を1から考えてみた
tsukuboshi
1
260
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
340
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
The SEO Collaboration Effect
kristinabergwall1
1
580
Mobile First: as difficult as doing things right
swwweet
225
10k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
310
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
380
Designing for Timeless Needs
cassininazir
1
510
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Product Roadmaps are Hard
iamctodd
55
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Ethics towards AI in product and experience design
skipperchong
2
400
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
ͪΐͬͱ͍ͨ͘ͳΔ (SBQI2-ೖ -BSBWFM 3FBDU ୈճΏΔͪJU(SBQI2-ʹ͍ͭͯΏΔ͘͢ େڮҰथ!L[LPIBTIJ
ࣗݾհ େڮҰथ!L[LPIBTIJ w '*4.גࣜձࣾ$50 w ϓϩμΫτ։ൃ͕͖ w -BSBWFM3FBDU0,3
ຊͷ༰ w (SBQI2-ΛͳΜͱͳͬͯ͘Δঢ়ଶ͔Βͪΐͬͱͬͯ ݟ͍ͨͳͱࢥ͑ΔΑ͏ͳ༰ w ࡉ͔͍༷ͷઆ໌͠ͳ͍ͷͰɺڵຯ͋Δํ ผ్ௐͯͶʂʂ w ࠓճ͋·Γઆ໌͠ͳ͍ͷ ϖʔδωʔγϣϯ
&EHFͱ/PEF
(SBQI2-ͱʁ
ʮεΩʔϚʯͷఆٛʹैͬͯɺΫϥΠΞϯτଆ͕ཉ͍͠ใΛ ʮΫΤϦʔʯͷܗࣜͰ͢ ΫΤϦʔ HSBQIRM جຊతʹ"1*ͷड͚ޱͻͱͭʂ
4DIFNBͱʁ w ͲͷσʔλΛΓͱΓ͢Δ͔ ͷ༰ΛܾΊΔ #BDLFOEଆ w ϑϩϯτΤϯυͱόοΫΤϯ υͷܖ type
Query { hero: Hero } type Hero { name: String friends: [Friend] } type Friend { name: String age: Int address: String } ༧ޠʂSPVUFͷఆٛΈ͍ͨͳΜ ಠࣗͷܕΛఆٛͰ͖Δ ෳฦ͢߹͕͋Δ߹ྻʹ͢Δ
2VFSZͱʁ w (FUϝιουͷ࣌ར༻ w ཉ͍͠σʔλ͚ͩهड़͢Ε ͦΕ͕ฦͬͯ͘Δ { hero { name
friends { name } } } ཉ͍͠ΦϒδΣΫτͷ ϑΟʔϧυ໊Λॻ͘ { hero(id: 1) { name friends { name } } } ˞εΩʔϚมߋ͢Δඞཁ͋Γ ݅Λࢦఆ͢Δ͜ͱͰ͖Δ
.VUBUJPOͱʁ extend type Mutation { createClientAccount( client_id: Int @rules(apply: ["required"])
staff_name: String @rules(apply: ["required"]) tel: String @rules(apply: ["required"]) department: String @rules(apply: ["required"]) email: String @rules(apply: ["required"]) password: String @rules(apply: ["required"]) role: Int @rules(apply: ["required"]) ): ClientAccount @create(model: "App\\Models\\ClientAccount") } w 1045165%&-&5&ϝιουͷ࣌ར༻ w ༧ޠ ϝιου ܕͱόϦσʔγϣϯ Λࢦఆ -BSBWFM
*OQVUͱʁ extend type Mutation { createClientAccount2(input: CreateClientAccount): ClientAccount @create(model: "App\\Models\\ClientAccount",
flatten: true) } input CreateClientAccount { client_id: Int @rules(apply: ["required"]) staff_name: String @rules(apply: ["required"]) tel: String @rules(apply: ["required"]) department: String @rules(apply: ["required"]) email: String @rules(apply: ["required"]) password: String @rules(apply: ["required"]) role: Int @rules(apply: ["required"]) } w .VUBUJPOͳͲͰར༻͢ΔೖྗΛ0CKFDUʹ·ͱΊΔ
&EHFͱ/PEF type InfluencerSearchPage implements Page { paginatorInfo: PaginatorInfo edges: [InfluencerSearchEdge]
} type InfluencerSearchEdge implements Edge { cursor: ID! node: InfluencerSearchNode } w ϖʔδωʔγϣϯ࣌ʹ&EHFͱ/PEFͷ֓೦Λར༻ w &EHF/PEFΛͪɺ/PEF$VSTPSΛ࣋ͭ
࣮ࡍͷσʔλͷσϞ
-BSBWFMͰͷ࣮
ϥΠϒϥϦͷબఆ w ࠓճ-JHIUIPVTFΛར༻ IUUQTHJUIVCDPNOVXBWFMJHIUIPVTF w (SBQI2-ϥΠΫʹεΩʔϚ͕ఆٛͰ͖Δ w طଘͷΞʔΩςΫνϟͰ͙͢ʹऔΓೖΕΒΕΔ
ΞʔΩςΫνϟ ɾεΩʔϚͷఆٛ ɾड͚ޱͷ४උ ɾόϦσʔγϣϯ มߋલ มߋޙ
εΩʔϚͷஔ͖ॴ w SPVUFTHSBQIRMʹఆٛ w ड͚ޱ͝ͱʹ༻ҙ͢Δ΄͏ ͕Αͦ͞͏
εΩʔϚͷఆٛ extend type Query @group(middleware: ["auth:api"]) { client_account(id: ID @eq):
ClientAccount @find(model: "App\\Models\\ClientAccount") client_accounts: [ClientAccount!]! @all } type ClientAccount { id: ID! client_id: Int! staff_name: String! tel: String! department: String! email: String! role: Int! created_at: DateTime! updated_at: DateTime! } ϛυϧΣΞ͕͑Δ Ϟσϧͦͷ··͏ͳΒ͜͜ͰఆٛͰ͖Δ
ಠࣗͷఆٛ extend type Query @group(middleware: ["auth:api"]) { fetchProjects: [PrProject!]! }
type PrProject { id: ID! item_id: Int! project_type: Int! name: String! media_type: Int! item_detail: String! item_image: String! hash_tags: String } .PEFMTʹఆ͕ٛͳ͍ͷ
6TF$BTF͔Βͷฦ٫ <?php namespace App\Http\GraphQL\Queries; use App\Domains\UseCases\FetchProjectList; use GraphQL\Type\Definition\ResolveInfo; use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
class FetchProjects extends BaseQuery { public function resolve($rootValue, array $args, GraphQLContext $context = null, ResolveInfo $resolveInfo) { $usecase = app(FetchProjectList::class); return $usecase($this->client_id); } } Ϩεϙϯεͷதܕʹม͞ΕΔ
3FBDUͰͷ࣮
ϥΠϒϥϦͷબఆ w ࠓճ3FBDU"QPMMPΛར༻ IUUQTHJUIVCDPNBQPMMPHSBQIRMSFBDUBQPMMP w 'BDFCPPL͕ग़͍ͯ͠ΔެࣜͷϥΠϒϥϦ3FMBZΑΓɺ Θ͔Γͦ͢͏ͳͷͰબ
ΞʔΩςΫνϟ "QPMMP͕৭ʑͬͯ͘ΕΔͨΊɺҎલΑΓؔ࿈͢Δॲཧ͕ඞཁͳ͍
ΫΤϦʔͷఆٛ const GET_SEARCH_INFLUENCER = gql` query ($page: Int!, $name: String){
query_search_influencers(page: $page, influencer_name: $name) { paginatorInfo { total count currentPage } edges { node { id influencer_name instagram_posts { id code comment_count is_video date } } } } } `;
ΫΤϦʔͷൃߦ render() { return ( <div className="GraphList3" style={{ width: "500px"
}}> <Query query={GET_SEARCH_INFLUENCER} variables={{ page: 1, name: "ా" }} > {({ data, error, loading, client, refetch }) => { if (error) return <p>{error.toString()}</p>; let pageInfo, graphData, dataElms; if (!loading) { pageInfo = data.query_search_influencers.paginatorInfo; graphData = data.query_search_influencers.edges; dataElms = graphData && graphData.map((v) => { let data = v.node; return ( <div key={data.id}>{data.influencer_name}</div> ); }); } return ( <div className="GraphList" style={{ padding: "40px"}}> . . . 2VFSZλάͰΫΤϦʔΛൃߦͰ͖Δ Ϩεϙϯεσʔλ͕དྷΔͷͰ ͍ͭ௨Γͷॲཧ
Α͔ͬͨࣄ
εΩʔϚத৺։ൃ w εΩʔϚΛڞ௨ݴޠͱ͠ɺϑϩϯτΤϯυͱόοΫΤϯυ Ͱ༷ͷڞ௨Խ͕Γͦ͏ w Ҏલ͔Β4XBHHFSΛ͍͕ͬͯͨɺඞਢͷमਖ਼Ͱͳ͍ͨ Ί์ஔؾຯʹͳ͍ͬͯͨ w ૹ͍͚ͬͯͳ͍ΧϥϜͷνΣοΫ༰қʹͳΓͦ͏
ཉ͍͠ใΛཉ͍࣌͠ʹ w ϑϩϯτΤϯυใ͕গͳ͘ͳخ͍͠ w αʔόʔαΠυใ͕গͳ͘ͳΓخ͍͠ w Ϣʔβʔʢϒϥβʣใ͕গͳ͘ͳΓخ͍͠
ͦͷଞ w QMBZHSPVOE͕ਆπʔϧ w -JHIUIPVTF͚ͩͰݟΕ։ൃ׆ൃ
՝
ॲཧͷ w όοΫΤϯυ-JHIUIPVTFͷมʹΑΓɺdNT ͘ͳΔ w ϑϩϯτଆࠓͷͱ͜Ζͳͦ͞͏
ॲཧͷվળํ๏ w εέʔϧΞοϓ ຊ൪ͱಉ͡ڥͰ·ͩࢼͯ͠ͳ͍ͷͰͦͷ··ɾɾ w ϥΠϒϥϦͷมߋ -BSBWFMͱ૬ੑ͍͍ͭ୳͢ͷେมͳͷͰ-JHIUIPVTFͷ· ·͕͍͍ɾɾ w ଞͷϛυϧΣΞͰվળ
(SBQI2-ʹ͠ͳ͍߹Ͱ༗ޮͳͨΊͪ͜ΒͨΊ͢
վળᾇ &MBTUJD4FBSDI ࣮ࡍʹࢼͯ͠ݟͨ ɾdNTૣ͘ͳͬͨ ɾӡ༻͕େม͚ͩͲɺΑͦ͞͏
վળᾈ 7BSOJTI 7BSOJTIΛೖΕΔ ɾϨεϙϯεࣗମΛશͯΩϟογϡ༧ఆ ɾ"VUIपΓͷઃఆ͚ͩؾΛ͚ͭΔ ɾ̍ճΩϟογϡ͞ΕΔਓҎ֎͓ͦΒ͘ɺ ̍̌ͷ̍Ҏ্ૣ͘ͳΔͱ༧
վળᾉ "QBDI*HOJUF "QBDIF*HOJUFΛೖΕΔ ɾσʔλϕʔεࣗମΛࢄΩϟογϡ͢Δ ɾޮՌ͋Γͦ͏ͩ͠ɺ ɹ&4ΑΓӡ༻ͦ͢͠͏ʁ