Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/db_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
2 changes: 1 addition & 1 deletion docs/dataModel/db_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ t_cf_users:

# Примерная схема (не самая красивая)

![context](../assets/db_base_schema.png)
![context](../assets/db_old.png)
8 changes: 8 additions & 0 deletions docs/diagram/diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Итоговая база данных
1. Решил разделить группы четко на 2 вида: группы команд и группа пользователей
2. Жестко принимаю, что в команде может быть до 3 человек (потому что на командных олимпиадах можно участвовать максимум
втроем).
3. По хорошему стоило сделать дополнительные таблицы, может быть, объединить t_cf_users_groups и
t_cf_users_team_groups в одну таблицу. Однако я не до конца придумал, как обработать все случаи в таком виде. При
этом у меня небольшое приложение, и считаю что текущее разбиение вполне подходит. Большая нормализация усложнит проект.
![db](../assets/db_new.png)
67 changes: 67 additions & 0 deletions docs/diagram/sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Итоговая база данных
```PlantUML
@startuml

' Указываем пакеты для схем
package "security" {
class t_users {
+id: BIGSERIAL
+c_name: TEXT
+c_login: TEXT [UNIQUE]
+c_hashed_password: TEXT
+c_role: TEXT
}

class t_tokens {
+id: BIGSERIAL
+c_token: TEXT
+c_revoked: BOOLEAN
+c_user_id: BIGINT
}

t_users --> t_tokens: "1 -> N"
}

package "codeforces" {
class t_cf_users_teams_groups {
+id: BIGSERIAL
+c_name: TEXT
+c_description: TEXT
+c_user_id: BIGINT
}

class t_cf_teams {
+id: BIGSERIAL
+c_name: TEXT
+c_description: TEXT
+c_first_user_login: TEXT
+c_second_user_login: TEXT
+c_third_user_login: TEXT
+c_group_id: BIGINT
}

class t_cf_users_groups {
+id: BIGSERIAL
+c_name: TEXT
+c_description: TEXT
+c_user_id: BIGINT
}

class cf_users {
+id: BIGSERIAL
+c_name: TEXT
+c_description: TEXT
+c_group_id: BIGINT
}

t_cf_users_teams_groups --> t_cf_teams: "1 -> N"
t_cf_users_groups --> cf_users: "1 -> N"
}

' Внешние ключи между схемами
security.t_users --> codeforces.t_cf_users_teams_groups: "1 -> N"
security.t_users --> codeforces.t_cf_users_groups: "1 -> N"

@enduml

```
3 changes: 3 additions & 0 deletions docs/other/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Небольшой список вопрос
1. Может не хранить токен в бд? По идее мы не должны отвечать за хранение токена. За это отвечает пользователь.
2. Как в итоге быть с таблицами по группам? Оставить как есть, или что-то поменять?