shihyuuuuuuu / ReadingAPP

0 stars 0 forks source link

data schema 設計 #12

Closed shihyuuuuuuu closed 3 months ago

shihyuuuuuuu commented 3 months ago

Issue

設計 data schema,列出目前需要的 model 以及其欄位,並標示 model 間的關係

目前設計: image

shihyuuuuuuu commented 3 months ago

@RitaHsieh 目前想到的資料欄位先規劃如下,一些欄位還有關聯的方式之後可能再依實際使用情形調整。 如果 ok 的話應該就可以先依這邊寫 model 了,前端之後要測試的話可以透過這些格式去 input 測試資料~

{
    "User": {
        "id": "String",
        "name": "String",
        "avatarUrl": "String"
    },
    "Book": {
        "id": "String",
        "title": "String",
        "subtitle": "String",
        "authors": ["String"],
        "publisher": "String",
        "publishedDate": "String",
        "description": "String",
        "categories": ["String"],
        "pageCount": "Integer",
        "coverImage": "String"
    },
    "UserBook": {  // 某 User 書架上的書
        "id":"String",
        "userId": "String", // reference to User
        "bookId": "String", // reference to Book
        "state": "BookState",
        "startDate": "String",
        "currentPage": "Integer" // 目前讀到的頁數,可用來計算 process
    },
    "BookState": {
        "title": "String"
    },
    "Note": {
        "id": "String",
        "userId": "String", // reference to User
        "userBookId": "String", // reference to UserBook
        "readingSessionId": "String", // reference to ReadingSession
        "title": "String",
        "type": "NoteType",
        "content": "String",
        "startPage": "Integer",
        "endPage":"Integer",
        "createdAt": "Timestamp",
        "updatedAt": "Timestamp"
    },
    "NoteType": {
        "title": "String"
    },
    "ReadingSession": {
        "id": "String",
        "userBookId": "String", // reference to UserBook
        "startTime": "Timestamp",
        "endTime": "Timestamp",
        "startPage": "Integer",
        "endPage": "Integer",
        "duration": "Integer", // 分鐘數
        "earnedExp": "Integer"
    }
}