-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#5 Added Botalka service design document #20
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Design Document of 'botalka' service | ||
|
||
## Overall Description | ||
|
||
Service manages homework statements and submissions. It provides a way to | ||
create a homework event post and schedule it to be published at specified | ||
time. Also, it supports gradual homework development for teacher by working | ||
with drafts. It stores each homework description and attached files. After | ||
publication, it receives submissions and drives an interaction between teacher | ||
and student. | ||
|
||
I propose to have a Telegram Bot UI. | ||
|
||
## Functional Requirements | ||
|
||
**FR1**. Teacher must be able to create a homework statement draft. | ||
|
||
**FR2**. Homework statement must contain a title, text description and | ||
deadline. | ||
|
||
**FR3**. Homework statement can have attached pdf files. | ||
|
||
**FR4**. Homework publication can be scheduled to a given time moment. | ||
|
||
**FR5**. Service must store scheduled homeworks as well as drafts. | ||
|
||
**FR6**. Service must send a notification when homework is published. | ||
|
||
**FR7**. Homework statement must be readonly after publication for simplicity. | ||
|
||
**FR8**. Student must be able to add submissions for the homework with | ||
text and attachments such as pdf document. | ||
|
||
**FR9**. Teacher must be able to view submissions. | ||
|
||
**FR10**. Teacher must be able to send a submission text feedback. | ||
|
||
**FR11**. Service must send a notification to teacher when submission is sent. | ||
|
||
**FR12**. Service must send a notification to student when feedback is sent. | ||
|
||
**FR13**. Student must not be able to send submission after homework deadline. | ||
|
||
**FR14**. Student must not be able to send submission after acceptance. | ||
|
||
## Deployment Diagram | ||
|
||
```mermaid | ||
C4Context | ||
title System Context diagram for Botalka | ||
|
||
Enterprise_Boundary(telegram-boundary, "Telegram") { | ||
System(telegram, "Telegram", "Instant Messenger.") | ||
} | ||
|
||
Enterprise_Boundary(lms-boundary, "LMS") { | ||
System(botalka, "Botalka Service", "Manages homeworks.") | ||
System(frontend, "LMS Frontend", "Telegram Bot Application.") | ||
Person(user, "User", "Teacher or Student.") | ||
} | ||
|
||
BiRel(user, telegram, "") | ||
BiRel(frontend, telegram, "") | ||
Rel(frontend, botalka, "") | ||
Rel(botalka, telegram, "") | ||
``` | ||
|
||
## Entity Relationship Diagram | ||
|
||
```mermaid | ||
erDiagram | ||
user { | ||
integer id PK | ||
string alias UN | ||
} | ||
|
||
student { | ||
integer user_id PK, FK | ||
} | ||
|
||
teacher { | ||
integer user_id PK, FK | ||
} | ||
|
||
homework { | ||
integer id PK | ||
string title | ||
string description | ||
integer weight | ||
timestamp post_moment "nullable" | ||
} | ||
|
||
homework_workspace { | ||
integer homework_id PK, FK | ||
integer student_id PK, FK | ||
} | ||
|
||
homework_submission { | ||
integer id PK | ||
integer homework_id FK | ||
integer student_id FK | ||
string comment | ||
timestamp moment | ||
} | ||
|
||
homework_feedback { | ||
integer id PK | ||
integer homework_id FK | ||
integer student_id FK | ||
integer teacher_id FK | ||
string comment | ||
integer score "nullable" | ||
timestamp moment | ||
} | ||
|
||
student ||--o{ homework_submission : submit | ||
homework_submission }o--|| homework_workspace : for | ||
teacher ||--o{ homework_feedback : answer | ||
homework_feedback }o--|| homework_workspace : for | ||
user ||--o{ student : is | ||
user ||--o{ teacher : is | ||
``` | ||
|
||
## HTTP API | ||
|
||
```kotlin | ||
object BotalkaHttpApi { | ||
val `POST /homework`: (Homework.Draft) -> Homework | ||
val `GET /homework/list`: () -> List<Homework.Header> | ||
val `POST /homework/{}/workspace/{}/submission`: (Workspace.Id, Submission.Draft) -> Submission | ||
val `POST /homework/{}/workspace/{}/feedback`: (Workspace.Id, Feedback.Draft) -> Feedback | ||
val `GET /homework/{}/workspace/{}`: (Workspace.Id) -> Workspace | ||
val `GET /homework/{}/result`: (Homework.Id) -> List<Homework.Result> | ||
} | ||
``` | ||
|
||
## Produced Events | ||
|
||
```kotlin | ||
object BotalkaEvent { | ||
class HomeworkPosted(homework: Homework) | ||
class SubmissionAdded(submission: Submission) | ||
class FeedbackAdded(feedback: Feedback) | ||
} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так понимаю ты собираешься делать switch-case по типу события, тогда тебе действительно нужно иметь зафиксированную иерархию с помощью sealed class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не, эти события будут лететь в кафку и потом кем-то разгребаться. Но так да, согласен.