From ab7c73f6c234399039325ec48db79d23aaafa31e Mon Sep 17 00:00:00 2001 From: nezouse Date: Mon, 19 Feb 2024 14:50:57 -0600 Subject: [PATCH] Add database diagram --- diagrams/database.puml | 138 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 diagrams/database.puml diff --git a/diagrams/database.puml b/diagrams/database.puml new file mode 100644 index 00000000..c5f5093c --- /dev/null +++ b/diagrams/database.puml @@ -0,0 +1,138 @@ +@startuml + +entity UserAccounts { + id: ID <> + created_at: DateTime + updated_at: DateTime + ethereumAddress: Text +} + +'if account type is managed by ethereum address then best way will be to store it in separate tables +entity Reviewers { + id: ID <> + claimed: boolean + -- + ethereumAddress: Text <>/'(? depends on requirements)'/ +} + +entity Moderators { + id: ID <> + -- + ethereumAddress: Text <>/'(? depends on requirements)'/ +} + +entity BlockedUsers { + blocked_user_id: ID <> + blocked_by_user_id: ID <> +} + +entity Applications { + id: ID <> + created_at: DateTime + updated_at: DateTime + name: Text + -- + wave_id: ID <> + user_id: ID <> + category_id: ID <> +} + +'private data of application +entity ApplicationContacts { + id: ID <> + created_at: DateTime + updated_at: DateTime + name: Text + email: Text + -- + application_id: ID <> + +} + +entity ApplicationCategories { + id: ID <> + name: Text +} + +entity ApplicationSpam { + application_id: ID <> + user_id: ID <> +} + +entity ApplicationValue { + application_id: ID <> + user_id: ID <> + value: Number +} + +entity Comments { + id: ID <> + created_at: DateTime + updated_at: DateTime + -- + application_id: ID <> + user_id: ID <> +} + +entity CommentsSpam { + comment_id: ID <> + user_id: ID <> +} + +entity CommentsHelpful { + comment_id: ID <> + user_id: ID <> +} + +entity Reviews { + comment_id: ID <> + application_id: ID <> + reviewer_id: ID <> + + PrimaryKey(reviewer_id, application_id) +} + +entity Wave { + id: ID <> + created_at: DateTime + updated_at: DateTime + name: Text + start_date: DateTime + end_date: DateTime + phase: WavePhase + +} + +Reviewers ||--o{ UserAccounts +Moderators ||--o{ UserAccounts +Applications ||--o{ Wave +Applications ||--o{ UserAccounts +Comments ||--o{ Applications +Comments ||--o{ UserAccounts +Reviews ||--o{ Comments +Reviews ||--o{ Applications +Reviews ||--o{ UserAccounts +ApplicationContacts ||--o{ Applications +BlockedUsers ||--o{ UserAccounts +BlockedUsers ||--o{ UserAccounts +Applications ||--o{ ApplicationCategories +ApplicationSpam ||--o{ Applications +ApplicationSpam ||--o{ UserAccounts +CommentsSpam ||--o{ Comments +CommentsSpam ||--o{ UserAccounts +CommentsHelpful ||--o{ Comments +CommentsHelpful ||--o{ UserAccounts +ApplicationValue ||--o{ Applications +ApplicationValue ||--o{ UserAccounts + + +enum WavePhase { + OPEN + DENOISING + ASSESEMENT + CLOSED +} + +WavePhase --o{ Wave + +@enduml \ No newline at end of file