Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ぜひ使って欲しいCloud Functions for Firebase
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
DaikiOKA
August 21, 2019
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ぜひ使って欲しいCloud Functions for Firebase
DaikiOKA
August 21, 2019
More Decks by DaikiOKA
See All by DaikiOKA
スマホアプリのアナリティクス最適解
daikioka
0
220
Firestoreを利用したMAPアプリの開発について
daikioka
0
300
位置情報を利用したMAPアプリの開発
daikioka
0
300
nori-na Tech Night vol.3
daikioka
0
330
相乗りアプリを構想から1ヶ月でストアにリリースできたわけ
daikioka
0
260
nori-na_tech_night_vol2.pdf
daikioka
0
570
Other Decks in Programming
See All in Programming
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
170
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
150
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.7k
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
340
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
230
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
110
Google Apps Script で Ruby を動かす
kawahara
0
150
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
490
Built Our Own Background Agent at LayerX
layerx
PRO
10
5.3k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
630
Writing Fast Ruby
sferik
630
63k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
240
Embracing the Ebb and Flow
colly
88
5.1k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
510
Why Our Code Smells
bkeepers
PRO
340
58k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Mind Mapping
helmedeiros
PRO
1
310
Transcript
ͥͻͬͯཉ͍͠ Cloud functions for Firebase
Cloud functions for firebaseͱ 'JSFCBTFͷϢʔβೝূɺσʔλϕʔεͷՃͳͲͷΠϕϯτ Λड͚औͬͯॲཧΛߦ͏αʔϏε ରԠݴޠɿ+BWB4DSJQUPS5ZQF4DSJQU 'JSFTUPSFτϦΨʔ w PO$SFBUF
w PO6QEBUF w PO%FMFUF w PO8SJUF
nori-naͰͷར༻ํ๏ • ϓογϡ௨ • σʔλͷूܭ • ֎෦αʔϏεͱͷ࿈ܞ(ܾࡁɺݕࡧ)
ϓογϡ௨ onCreate export const pushRideshareRequest = functions.firestore .document(commonUtil.makePath('ridesharerequest/{requestId}')) .onCreate((snap, context)
=> { const newValue = new firestoreModels.RideShareRequest(snap.data()); const to = newValue.to; console.log(`push start ridesharerequest : ${context.params.requestId}`); return pushMessageByUserId(to, '૬Γґཔ͕ಧ͖·ͨ͠ɻ༰Λ֬ೝͯ͠ڐՄ͠·͠ΐ͏ɻ'); });
ϓογϡ௨ onUpdate export const pushLikeComment = functions.firestore .document(commonUtil.makePath('mapcomment/{mapcommentId}')) .onUpdate((change, context)
=> { const afterData = new firestoreModels.MapComment(change.after.data()); const afterLike = afterData.likeMembers.length; const beforeData = new firestoreModels.MapComment(change.before.data()); const beforeLike = beforeData.likeMembers.length; const toUserId = afterData.user; if (!toUserId) return null; if (beforeLike < afterLike) { return pushMessageByUserId(toUserId, '͍͍Ͷ͕ԡ͞Ε·ͨ͠ʂ'); } return null; });
ϩʔΧϧͰςετՄೳ $npm run shell
ςετίʔυ QVTI%FTUJOBUJPO6QEBUF \ CFGPSF\ TDSFFO/BNFVTF MPDBUJPO\ MBUJUVEF
MPOHJUVEF ^ EFTUJOBUJPO\ OBNF5 HFP-PDBUJPO\ MBUJUVEF MPOHJUVEF ^ ^ ^ BGUFS\ TDSFFO/BNFVTFS MPDBUJPO\ MBUJUVEF MPOHJUVEF ^ EFTUJOBUJPO\ OBNF5PLZP5PXFS HFP-PDBUJPO\ MBUJUVEF MPOHJUVEF ^ ^ ^ ^ \ QBSBNT\ VTFS*EVTFS ^ ^ • beforeͱafterʹͦΕͧ ΕσʔλΛهड़ • paramsඞཁͳ࣌ͷ Έ
Cloud Functionͷ৽ػೳ Scheduler export const cronRemindShare = functions.pubsub //.schedule("0 18
* * *")//ຖ18࣌ʹ࣮ߦ .schedule("every 5 minutes")//͓͖̑ .timeZone("Asia/Tokyo") .onRun(async context => { console.log("͜͜Ͱఆظ࣮ߦ") });
͋Γ͕ͱ͏͍͟͝·ͨ͠
OPSJOB 5FDI /JHIU