Upgrade to Pro — share decks privately, control downloads, hide ads and more …

機材管理ツールをFirebaseで構築しようとした話 / Building equipment management software with Firebase

Yusei Yamanaka
September 13, 2018

機材管理ツールをFirebaseで構築しようとした話 / Building equipment management software with Firebase

Yusei Yamanaka

September 13, 2018
Tweet

More Decks by Yusei Yamanaka

Other Decks in Technology

Transcript

  1. ػࡐ؅ཧπʔϧΛ'JSFCBTFͰ
    ߏங͠Α͏ͱͨ͠࿩
    גࣜձࣾ"CFNB57
    :VTFJ:"."/"," !UPSJJNJZVLLJ

    View full-size slide

  2. ࣗݾ঺հ

    山中勇成 @toriimiyukki
    株式会社サイバーエージェント 2017年新卒
    株式会社AbemaTV 開発本部 コンテンツ配信チーム
    慶應義塾大学湘南藤沢キャンパス(SFC) 卒業

    View full-size slide

  3. ػࡐ؅ཧπʔϧ

    View full-size slide

  4. ػࡐ؅ཧͷ՝୊
    ‎ ػࡐ͕୭ͷ΋ͷͳͷ͔͕෼͔Βͳ͍

    ‎ ػࡐΛ͍ͭ࢖͔͕ͬͨ෼͔Βͳ͍
    ‎ ୭͔ʹିͯ͠͠͹Βͨ͘͠ޙʹͦͷػࡐ͕Ͳ͜ʹ͋Δͷ͔෼͔Βͳ͍
    ‎ ػࡐʹ͸Կ͕ηοτͰೖ͍ͬͯΔͷ͔෼͔Βͳ͍
    ͢΂ͯ'JSFCBTFͰղܾʂ

    View full-size slide

  5. ͳͥ'JSFCBTFʜʁ
    ‎ खܰʹΞϓϦέʔγϣϯΛ࡞Γ͔ͨͬͨ
    ‎ αʔόͷ؀ڥ΍σʔλϕʔεͷߏஙʹ࣌ؒΛ࢖͍ͨ͘ͳ͔ͬͨ

    ‎ Ͱ͖Δ͚͓ͩۚΛ͔͚ͣʹ࡞Γ͔ͨͬͨ
    ‎ ਺೥લʹ3FBMUJNF%BUBCBTFΛ࢖ͬͨ͜ͱ͸͕͋ͬͨɺ

    $MPVE'JSFTUPSFΛ࢖ͬͨ͜ͱ͕ͳ͔ͬͨͷͰ࢖ͬͯΈ͔ͨͬͨ

    View full-size slide

  6. ػࡐ؅ཧͷ՝୊ղܾํ๏
    ‎ ػࡐ͕୭ͷ΋ͷͳͷ͔͕෼͔Βͳ͍

    ‎ ػࡐΛ͍ͭ࢖͔͕ͬͨ෼͔Βͳ͍
    ‎ ୭͔ʹିͯ͠͠͹Βͨ͘͠ޙʹͦͷػࡐ͕Ͳ͜ʹ͋Δͷ͔෼͔Βͳ͍
    ‎ ػࡐʹ͸Կ͕ηοτͰೖ͍ͬͯΔͷ͔෼͔Βͳ͍
    ‎ ػࡐʹ23ίʔυΛ෇͚ͯɺಡΈऔΔͱ8FCϖʔδ͕දࣔ͞ΕΔ
    ‎ ͭͷػࡐʹԿͷػࡐ͕ಉࠝ͞Ε͍ͯΔ͔ΛσʔλԽ͢Δ
    ‎ ػࡐΛ࢖͏࣌ʹɺ23ίʔυΛಡΈࠐΉ͜ͱͰ࢖༻ཤྺΛ؅ཧ͢Δ
    ‎ 23ίʔυΛಡΈऔͬͨࡍʹݱࡏͷ৔ॴΛه࿥͢Δ

    View full-size slide

  7. ػࡐλά

    ‎ ػࡐ͝ͱʹλάΛൃߦ͢Δ
    ‎ 23ίʔυ͸ػࡐ͝ͱʹݻ༗ͷ63-͕ೖ͍ͬͯΔ

    View full-size slide

  8. "OESPJEΞϓϦͱ8FCαΠτ
    ‎ ػࡐΛ؅ཧ͢Δਓ͕࢖͏ͨΊͷ"OESPJEΞϓϦ
    ‎ 23ίʔυͷεΩϟϯ
    ‎ ػࡐͷ௥Ճฤू

    ‎ ػࡐλάͷ23ίʔυΛεΩϟϯͨ࣌͠ʹ։͘8FCαΠτ
    ‎ खೖྗ΋Ͱ͖ΔΑ͏ʹ୹͍63-Λൃߦ͢ΔʢγϣʔτΧοτʣ
    ‎ ػࡐͷৄࡉͷ֬ೝ
    ‎ ΞϓϦΛ͍࣋ͬͯͳ͍ਓͰ΋࢖͑Δ
    ‎ ฆࣦ࣌ʹ23ίʔυ͔Β࿈བྷઌΛ஌Δ͜ͱ͕Ͱ͖Δ

    View full-size slide

  9. ࢖༻ྫ

    ػࡐΛ࢖͏࣌
    ػࡐͷ࢖༻ཤྺΛ௥Ճ
    ಡΈऔͬͨ৔ॴͷه࿥
    ઐ༻ΞϓϦ

    View full-size slide

  10. ࢖༻ྫ

    ػࡐΛ୳͍ͨ࣌͠
    ػࡐͷҰཡ
    ػࡐͷಡΈऔΓཤྺ

    View full-size slide

  11. ࢖༻ྫ

    த਎͕஌Γ͍ͨฆࣦͨ࣌͠
    ػࡐͷৄࡉͷ8FCϖʔδ

    View full-size slide

  12. σʔλߏ଄
    ‎ ෳ਺ͷάϧʔϓͰར༻Ͱ͖ΔΑ͏ͳߏ଄ʹ͢Δ
    ‎ γϣʔτΧοτ͸શάϧʔϓͰڞ௨ͱ͢Δ

    /groups/{group}
    /addresses
    /equipments
    /scans
    /tags
    /shortcuts/{code}
    /users/{id} ‐Ϣʔβʔ
    ‐ػࡐͷอ؅৔ॴ
    ‐ػࡐ
    ‐ػࡐͷεΩϟϯཤྺ
    ‐λάϦετ
    ‐γϣʔτΧοτίʔυ
    ‐σόΠε
    /devices/{id}
    ‐άϧʔϓ

    View full-size slide

  13. Ϣʔβʔ
    ‎ Ϣʔβʔͷσʔλ
    ‎ 'JSFCBTF"VUIFOUJDBUJPOͰαΠϯΠϯαΠϯΦϯͨ͠ޙʹ࡞੒

    /users/{id}
    -uid String
    -belongingGroups Array(Reference(Group))
    -name String
    /users/{id}/devices/{id}
    -name String

    View full-size slide

  14. ػࡐ
    ‎ Ұ൪ॏཁͳσʔλ
    ‎ ໊લɺը૾ͷύεɺಉࠝ͢ΔػࡐɺλάͳͲΛೖΕΔ

    /groups/{group}/equipments/{id}
    -image String
    -includingEquipments Array(Reference(Equipments))
    -name String
    -tags Array(String)

    View full-size slide

  15. γϣʔτΧοτ
    ‎ 23ίʔυΛੜ੒͢ΔͨΊͷγϣʔτΧοτίʔυͱػࡐΛඥ͚ͮͨ
    σʔλ

    /shortcuts/{code}
    -group Reference(Group)
    -equipment Reference(Equipments)
    IUUQTYYYYYT\DPEF^

    View full-size slide

  16. "OESPJEΞϓϦ

    View full-size slide

  17. "OESPJEΞϓϦ
    ‎ "OESPJE4UVEJPΛ࢖ͬͯ։ൃ

    ػࡐҰཡ ػࡐৄࡉ εΩϟϯ

    View full-size slide

  18. "OESPJEΞϓϦ

    // Lombok
    compileOnly 'org.projectlombok:lombok:1.16.22'
    annotationProcessor "org.projectlombok:lombok:1.16.22"
    // ZXing
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
    // Firestore
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    // FirebaseUI (for authentication)
    implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
    // Other Firebase/Play services deps
    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    // Butterknife
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    // Glide
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    // Tag
    implementation 'me.gujun.android.taggroup:library:1.4@aar'
    ࢖༻ͨ͠ओͳϥΠϒϥϦ

    View full-size slide

  19. 8FCαΠτ
    ‎ 3FBDUΛ࢖ͬͯ։ൃ
    ‎ ϗεςΟϯά͸'JSFCBTF)PTUJOHΛ࢖༻
    ‎ ඞཁͳ"1*͸$MPVE'VODUJPOTͰ"1*Λߏங

    View full-size slide

  20. Ϛελʔσʔλͷ౤ೖ

    View full-size slide

  21. Ϛελʔσʔλͷ౤ೖ
    ‎ શͯͷػࡐΛεϚϗ΍ϒϥ΢βͷϑΥʔϜͰೖྗ͢Δͷ͸ۤ௧

    grahamearley / FirestoreGoogleAppsScript
    IUUQTHJUIVCDPNHSBIBNFBSMFZ'JSFTUPSF(PPHMF"QQT4DSJQU
    ‎ ϘλϯͭͰ'JSFTUPSFʹσʔλΛ౤ೖͯ͠ཉ͍͠
    ‎ εϓϨουγʔτͰ࠷ॳͷσʔλΛೖྗͰ͖ΔΑ͏ʹ͢Δ
    ʴ

    View full-size slide

  22. Ϛελʔσʔλͷ౤ೖ
    ‎ ("4Λ࢖ͬͯπʔϧόʔͷϘλϯΛԡ͢ͱσʔλͷߋ৽Λߦ͏Α͏ʹ

    View full-size slide

  23. ͭ·͍ͣͨͱ͜Ζ

    View full-size slide

  24. ͭ·͍ͣͨͱ͜Ζ
    ‎ 'JSFTUPSFͷ3VMF4JNVMBUPS͕3FGFSFODFΛ͏·͘ѻ͑ͳ͍ʜʁ
    ‎ Ϣʔβʔ͕ॴଐ͍ͯ͠ΔάϧʔϓͷΈɺಡΈॻ͖ͷݖݶΛ༩͍͑ͨ

    TFSWJDFDMPVEpSFTUPSF\
    NBUDIEBUBCBTFT\EBUBCBTF^EPDVNFOUT\
    ʜ
    NBUDIHSPVQT\HSPVQ^\
    BMMPXSFBE VQEBUF EFMFUF
    JGSFRVFTUBVUIVJEOVMMEBUBCBTFT EBUBCBTF
    EPDVNFOUTHSPVQT HSPVQ
    JO
    HFU EBUBCBTFT EBUBCBTF
    EPDVNFOUTVTFST SFRVFTUBVUIVJE

    EBUBCFMPOHJOH(SPVQT
    ʜ
    ‎ ࣮ࡍͷϦΫΤετ͸͏·͘ಈ͚͘ͲγϛϡϨʔλʔ͚ͩಈ͔ͳ͍ʜʁ

    View full-size slide

  25. ͭ·͍ͣͨͱ͜Ζ
    ‎ 'JSFTUPSF(PPHMF"QQT4DSJQUͰಛఆͷΩʔͷΈߋ৽͢Δग़དྷͳ͍
    ‎ ΦϒδΣΫτΛճऔಘ͔ͯ͠Βɺߋ৽͢Δඞཁ͕͋Δ

    \
    lOBNFzl໊લz
    ^
    \
    lBOPUIFS,FZzl໊લz
    ^
    \
    lBOPUIFS,FZzl໊લz
    ^
    ݩͷσʔλ ߋ৽͢Δσʔλ อଘ͞ΕΔσʔλ

    View full-size slide

  26. ͭ·͍ͣͨͱ͜Ζ
    ‎ λάʹΑΔݕࡧΛ͍ͨ͠
    ‎ $MPVE'JSFTUPSFͰ͸ɺ഑ྻͷத਎ʹରͯ͠ΫΤϦΛ࣮ߦ͢Δ͜ͱ
    ͸ग़དྷͳ͍

    View full-size slide

  27. λάʹΑΔݕࡧ
    ‎ $MPVE'VODUJPOTΛ࢖༻͠ɺ'JSFTUPSFͷPO8SJUFΠϕϯτΛϑοΫ
    ‎ ػࡐͷσʔλ͕ߋ৽͞ΕͨλΠϛϯάʹ߹ΘͤͯλάΛߋ৽͢Δ

    /groups/{group}/tags/{name}
    -equipments Array(Reference(Equipment))

    View full-size slide

  28. ·ͱΊ
    ‎ 'JSFCBTFΛ࢖ͬͯαʔϏεΛ࡞Δͱ͢͹΍͘࡞ΕΔ
    ‎ 'JSFTUPSF)PTUJOH'VODUJPOT͕Ϛδศར
    ‎ "OESPJEΞϓϦΛ࡞Δͷ΋ϥΠϒϥϦ͕͋ΔͷͰศར

    ‎ εϓϨουγʔτܦ༝ͰσʔλΛೖΕΔͷ΋Ϛδศར
    ‎ 'JSFTUPSF(PPHMF"QQT4DSJQU͸ಡΊΔίʔυͷྔͳͷͰಡΉͱྑ
    ‎ 3FGFSFODF͸ϊϦͰ࢖͏ͱ௧͍໨ΛݟΔ

    View full-size slide