-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed_data.py
More file actions
30 lines (25 loc) · 992 Bytes
/
seed_data.py
File metadata and controls
30 lines (25 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from backend.db.connection import SessionLocal
from backend.db.repositories.activity_types_repo import ActivityTypesRepository
from backend.models import ActivityCategory
def seed_activity_types():
db = SessionLocal()
repo = ActivityTypesRepository(db)
defaults = [
("Coding", ActivityCategory.Work),
("Deep Work", ActivityCategory.Work),
("Research", ActivityCategory.Academic),
("Learning", ActivityCategory.Academic),
("Meeting", ActivityCategory.Work),
("Exercise", ActivityCategory.Health),
("Meditation", ActivityCategory.Health),
("Reading", ActivityCategory.Personal),
("Leisure", ActivityCategory.Leisure)
]
for name, cat in defaults:
if not repo.get_activity_type_by_name(name):
print(f"Seeding: {name}")
repo.create_activity_type(name, cat)
db.close()
print("Seeding complete!")
if __name__ == "__main__":
seed_activity_types()