From 5d213721228f0bf019b6779e9aa27dc775e78328 Mon Sep 17 00:00:00 2001 From: t0xa Date: Sun, 14 Sep 2025 18:02:49 +0300 Subject: [PATCH] Home app: Create DB schemes for fitness and finances app --- f1tness_parser/base.puml | 25 ++++++++++++++++++ home_app/db_finances.puml | 0 home_app/db_fitness.puml | 51 ++++++++++++++++++++++++++++++++++++ home_app/db_home.puml | 7 +++++ home_app/db_investments.puml | 39 +++++++++++++++++++++++++++ home_app/db_styling.puml | 8 ++++++ 6 files changed, 130 insertions(+) create mode 100644 f1tness_parser/base.puml create mode 100644 home_app/db_finances.puml create mode 100644 home_app/db_fitness.puml create mode 100644 home_app/db_home.puml create mode 100644 home_app/db_investments.puml create mode 100644 home_app/db_styling.puml diff --git a/f1tness_parser/base.puml b/f1tness_parser/base.puml new file mode 100644 index 0000000..13008f2 --- /dev/null +++ b/f1tness_parser/base.puml @@ -0,0 +1,25 @@ +@startuml +actor client +agent "web interface" as WEB_UI +agent "ios app" as IOS_APP +agent "telegram app" as TG_APP + +frame docker:f1tness_db { + database "PostgreSQL" as db +} + +frame docker:fastAPI { + node backend_API + node frontend_renderer +} + +client <--> WEB_UI +client <--> IOS_APP +client <--> TG_APP + +WEB_UI <--> frontend_renderer +IOS_APP <--> backend_API +TG_APP <--> backend_API + +backend_API --> db +@enduml \ No newline at end of file diff --git a/home_app/db_finances.puml b/home_app/db_finances.puml new file mode 100644 index 0000000..e69de29 diff --git a/home_app/db_fitness.puml b/home_app/db_fitness.puml new file mode 100644 index 0000000..edd6b19 --- /dev/null +++ b/home_app/db_fitness.puml @@ -0,0 +1,51 @@ +@startuml + +!include db_styling.puml + +package "Fitness app" <> { + entity "Training" as training_table { + PRIMARY_KEY(id): INTEGER + --- + date : DATETIME + tariner: ENUM + } + + entity "Exercise" as exercise_table { + PRIMARY_KEY(id): INTEGER + --- + FOREIGN_KEY(training_id): INTEGER + name: VARCHAR(300) + } + + entity "Approach" as approach_table { + PRIMARY_KEY(id): INTEGER + --- + FOREIGN_KEY(exercise_id): INTEGER + weight: REAL + reps: INTEGER + splitted_weight: BOOL + } + + ' Monthly Fitness Log table + entity "MonthlyLog" as monthly_log { + PRIMARY_KEY(id) : INTEGER + -- + FOREIGN_KEY(activity_id) : INTEGER + month_name : VARCHAR(20) + duration : TIME + distance : DECIMAL(6,2) + } + + entity "CardioActivity" as cardio_activity_table { + PRIMARY_KEY(id) : INTEGER + --- + name : VARCHAR(255) + } +} + +approach_table }o--|| exercise_table +exercise_table }o--|| training_table + +monthly_log ||-|| cardio_activity_table + +@enduml \ No newline at end of file diff --git a/home_app/db_home.puml b/home_app/db_home.puml new file mode 100644 index 0000000..ac683f1 --- /dev/null +++ b/home_app/db_home.puml @@ -0,0 +1,7 @@ +@startuml +title: Home app + +!include db_fitness.puml +!include db_investments.puml + +@enduml \ No newline at end of file diff --git a/home_app/db_investments.puml b/home_app/db_investments.puml new file mode 100644 index 0000000..783d8fc --- /dev/null +++ b/home_app/db_investments.puml @@ -0,0 +1,39 @@ + +@startuml + +!include db_styling.puml + +package "Finances app" <> { + entity "Deal" as deal_table { + PRIMARY_KEY(id) : INTEGER + -- + FOREIGN_KEY(account_id) : INTEGER + FOREIGN_KEY(asset_id) : INTEGER + price : REAL + amount: INTEGER + commission : REAL + action : ENUM('buy', 'sell') + created_at : TIMESTAMP + description : TEXT + } + + entity "Account" as account_table { + PRIMARY_KEY(id) : INTEGER + -- + name : VARCHAR(10) + description : TEXT + is_active : BOOLEAN + } + + entity "Asset" as asset_table { + PRIMARY_KEY(id) : INTEGER + --- + name: VARCHAR(100) + ticker: VARCHAR(10) + } +} + +deal_table ||--|| account_table +deal_table ||--|| asset_table + +@enduml \ No newline at end of file diff --git a/home_app/db_styling.puml b/home_app/db_styling.puml new file mode 100644 index 0000000..341fb3f --- /dev/null +++ b/home_app/db_styling.puml @@ -0,0 +1,8 @@ + +@startuml + +!define PRIMARY_KEY(x) <&key> x +!define FOREIGN_KEY(x) <&key> x +!define ENUM_FIELD(name, values) name : VARCHAR(20) <> + +@enduml \ No newline at end of file