Home app: Create DB schemes for fitness and finances app

This commit is contained in:
t0xa 2025-09-14 18:02:49 +03:00
parent be420adc49
commit 5d21372122
6 changed files with 130 additions and 0 deletions

25
f1tness_parser/base.puml Normal file
View file

@ -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

View file

51
home_app/db_fitness.puml Normal file
View file

@ -0,0 +1,51 @@
@startuml
!include db_styling.puml
package "Fitness app" <<Frame>> {
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

7
home_app/db_home.puml Normal file
View file

@ -0,0 +1,7 @@
@startuml
title: Home app
!include db_fitness.puml
!include db_investments.puml
@enduml

View file

@ -0,0 +1,39 @@
@startuml
!include db_styling.puml
package "Finances app" <<Frame>> {
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

8
home_app/db_styling.puml Normal file
View file

@ -0,0 +1,8 @@
@startuml
!define PRIMARY_KEY(x) <color:#c6b709><&key></color> x
!define FOREIGN_KEY(x) <color:silver><&key></color> x
!define ENUM_FIELD(name, values) name : VARCHAR(20) <<ENUM values>>
@enduml