- fetchActiveLessonRoomByUid
- LINE ユーザーからのリクエストに含まれる UID から、進行中のレッスンルーム ID を 1 件取得する
- putLessonRoom
- 新しいレッスンルームを 1 件作成する
- fetchConversationsByLessonRoomId
- レッスンルーム ID をもとに会話履歴を全件取得する
- ソート順は、送信日の降順 1 . putLessonRoom
- レッスンルーム ID をもとにレッスンルームを「終了」に変更する
erDiagram
user {
string uid PK
}
lesson_room {
uuid room_id PK "検索条件"
string uid FK "検索条件"
string status
timestamp created_at
}
conversation {
uuid room_id "検索条件"
timestamp sent_at "ソート条件"
string speaker "検索条件"
string message
}
user ||--}o lesson_room: "attend multiple lessons"
lesson_room ||--o{ conversation: "have conversations"
PrimaryKey | Attributes | |||
---|---|---|---|---|
Record Type | PK | SK | ||
lesson_room (type) |
room_id [LESSON#uuid] |
uid [USER#string] |
status [string] |
created_at [number] |
lesson_room (example) |
LESSON#fdba3e0a-9a... | USER#4fab7256-ac.. | IN_PROGGRESS | 1677885697470 |
conversation (type) |
room_id [LESSON#uuid] |
sent_at [SENT_AT#number] |
sender [string] |
message [string] |
conversation (example) |
LESSON#fdba3e0a-9a... | SENT_AT#1677885697470 |
user | Hello!!! |
Keys | Attribute Name |
---|---|
Partition Key | PK |
Sort Key | SK |
For the fetchLessonRoomByUid usecase.
Keys | Attribute Name |
---|---|
Partition Key | SK (USERS#{string}) |
Sort Key | created_at |