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
ぜひ使って欲しいCloud Functions for Firebase
Search
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
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
280
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
180
Intent as Code
shoppingjaws
6
1.1k
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
210
一人だけ、Kiroが静止する日
hideg
0
130
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
910
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
130
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
7
5.1k
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
560
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
310
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
3.3k
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
320
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Test your architecture with Archunit
thirion
2
2.4k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
560
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
First, design no harm
axbom
PRO
2
1.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
520
How to build a perfect <img>
jonoalderson
1
6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
510
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