letsfae / FaeMap-Frontend

2 stars 0 forks source link

database design for storing messages #14

Open felixjichao opened 7 years ago

felixjichao commented 7 years ago
Message: Object {
    userID_chatID_index: String  // primary key
    chatID: Int
    index: Int
    sender: User
    participant: List<User>  // all users in this chatID (compatible to group chat)
    created_at: String
    type: String / Int      1 - text, 2 - picture, 3 - video, 4 - audio, 5 - sticker, 
                            6 - gif, 7 - location, 8 - place, 9 - collection, 0 - unsupport
    text: String    1 - message content
                    2 - [Picture] / URL
                    3 - [Video] / URL
                    4 - [Audio] / URL
                    5 - [Sticker] / URL | sticker_key / Object_Sticker
                    6 - [Gif] / URL
                    7 - [Location] / (latitude, longitude) / JSON_Location
                    8 - [Place] / JSON_Place / Object_Place
                    9 - [Collection] / JSON_Collection / Object_Collection
    media: NSData    1 - N/A
                     2 - picture_encode
                     3 - video_encode
                     4 - audio_encode
                     5 - sticker_encode
                     6 - gif_encode
                     7 - snap_image_encode
                     8 - snap_image_encode
                     9 - snap_image_encode
    upload_to_server: Bool
    delivered: Bool // to user
    unread_count: Int // keep track of # of unread messaegs in the latest message
                      // used to be the datasource of recent table
}

User: Object {
    userID_ID: String // primary key
    ID: String/Int
    username: String
    nickname: String
    avatar: NSData
    is_friend: Bool
}
joshuayueshen commented 6 years ago

@felixjichao 超哥,这个issue可以关了吧?