Chilli-Saewoo / Roll-in

Apple Developer Acadmey @ POSTECH Macro Project
3 stars 0 forks source link

[Halloween_TF]데이터 모델(구조) 확정 #8

Open yeahaluu opened 1 year ago

yeahaluu commented 1 year ago

Contents

Firebase의 Realtime DB의 경우 table이 아닌 json트리로 데이터가 구조화되어 있습니다. 따라서 스닥이 User Model에 대해 고민해주신것(#4)을 반영하여 아래와 같은 구조로 json 데이터를 읽고(앱) 쓰는 것(웹, 앱)을 제안드립니다.

{
  "users": {
    "UUID1(xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx)": {
      "nickname": "sherry",
      "notes": {
    "uid1(xxxxxxxxxxxxxxxxxx)": { 
          "sender": "Noasdaq", 
          "image": 1, 
          "message": "안녕", 
          "timestamp": 1459361875337 
        },
    "uid2(xxxxxxxxxxxxxxxxxx)": { 
          "sender": "Taek", 
          "image": 4, 
          "message": "메시지", 
          "timestamp": 12573324753324
        },
      },
    },
    "UUID2(xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx)": { ... },
  }
}

데이터 읽고 쓰는 방식은 다음 공식문서에서 확인할 수 있습니다. 앱: https://firebase.google.com/docs/database/ios/read-and-write?hl=ko 웹: https://firebase.google.com/docs/database/web/read-and-write?hl=ko

그 외 궁금한 점과 건의사항은 댓글로 부탁드리겠습니다!😊

feldblume5263 commented 1 year ago

확정해주신 모델 잘 확인했습니다 👍 깔끔하게 정리해주셔서 이해가 잘 가는 것 같아요! 참고문서도 감사합니다! 😇 혹시 sticker에 image 필드의 type을 Int로 하는건 어떻게 생각하시나요??

yeahaluu commented 1 year ago

확정해주신 모델 잘 확인했습니다 👍 깔끔하게 정리해주셔서 이해가 잘 가는 것 같아요! 참고문서도 감사합니다! 😇 혹시 sticker에 image 필드의 type을 Int로 하는건 어떻게 생각하시나요??

좋습니다! 👍👍👍👍👍👍👍👍👍👍👍

yeahaluu commented 1 year ago

notesnote(n)안에 timestamp를 추가했습니다. 현재 스프린트에서 note가 어떻게 배치될지 정하지 않았지만, note의 밀집과 배치, 더 나아가 note의 가독성을 이유로 정렬이 필요합니다. timestampnote를 기록한 시간을 저장할 때 사용합니다.

Reference https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Timestamp https://rnfirebase.io/reference/firestore/timestamp

Tips DB에 서버시간 등록 for JS: https://cionman.tistory.com/59 Timestamp의 시간을 readable data로 읽고 싶다면... for iOS: https://medium.com/swift-productions/convert-date-into-string-from-firestore-swiftui-a70a9297e0af for JS: https://dulki.tistory.com/224#google_vignette

yeahaluu commented 1 year ago

[변경사항에 대해 뒤늦은 기록] sticker 네이밍이 이미지를 의미하는 느낌이 강하여 쪽지를 뜻하는 note 로 수정합니다.

이에 대한 논의는 아래 PR에서 이루어졌습니다.

12

feldblume5263 commented 1 year ago

확인했습니다! 좋은 변경사항 감사합니다 👍

yeahaluu commented 1 year ago

세번째 수정입니다.🥲 users - uuid(user) - notes - n(note) 를 통해 note를 나타내었던 것을 users - uuid(user) - notes - uid(note) 로 나타내도록 바꾸겠습니다. n1, n2, n3, ... 로 나타내는 기존의 방식은 Firebase 공식문서의 데이터베이스 구조화를 참고하여 작성하였습니다. 하지만 n의 번호를 붙이기 위해서 카운팅을 해야하는 문제가 생깁니다. 따라서 uid를 사용해 해당 유저의 note들을 구분하고 정렬은 stamptime을 통해서 하겠습니다!