-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcli.py
More file actions
92 lines (62 loc) · 2.18 KB
/
cli.py
File metadata and controls
92 lines (62 loc) · 2.18 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import typer
app = typer.Typer()
@app.command()
def hello(name: str):
print(f"Hello {name}")
@app.command()
def create_management_user():
from models import factory_session
from repository.user import create_user
from core.security import generate_hash_password
from models.User import MANAGEMENT_PARTICIPANT
email = typer.prompt("email")
password = typer.prompt("password", hide_input=True)
with factory_session() as db:
create_user(
db=db,
email=email,
username=email,
password=generate_hash_password(password),
participant_type=MANAGEMENT_PARTICIPANT,
is_active=True,
is_commit=True,
)
@app.command()
def create_initial_organizer_types():
from models import factory_session
from repository.organizer_type import insert_initial_organizer_types
with factory_session() as db:
insert_initial_organizer_types(db=db)
@app.command()
def initial_data():
from seeders.initial_seeders import initial_seeders
initial_seeders()
@app.command()
def send_test_email(email: str, name: str):
from core.email import try_send_email
import asyncio
asyncio.run(try_send_email(recipient=email, name=name))
@app.command()
def download_location_data():
from scripts.download_location_data import download_location_data
download_location_data()
@app.command()
def import_location_data():
from seeders.initial_country_city_state import initial_country_city_state_seeders
from models import factory_session
with factory_session() as session:
initial_country_city_state_seeders(db=session, is_commit=True)
@app.command()
def clear_location_data():
from models import factory_session
from seeders.initial_country_city_state import clear_data_location
with factory_session() as session:
clear_data_location(db=session, is_commit=True)
@app.command()
def checkin_example_data():
from models import factory_session
from seeders.initial_checkin_data import initialize_checkin_data
with factory_session() as session:
initialize_checkin_data(db=session)
if __name__ == "__main__":
app()