You've already forked RekomenciBackend
feat(): unit tests for domain entities and basic invariants
This commit is contained in:
+10
-10
@@ -1,25 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import subprocess # noqa: S404
|
||||
from pathlib import Path
|
||||
|
||||
from template_project.web_api.configuration import load_configuration
|
||||
|
||||
|
||||
def main() -> None:
|
||||
config_path = Path("config.toml")
|
||||
configuration = load_configuration(config_path)
|
||||
|
||||
|
||||
db_url = str(configuration.database.url.get_value())
|
||||
db_url = db_url.replace("postgresql+psycopg://", "postgresql://")
|
||||
|
||||
|
||||
output_dir = Path("dumps")
|
||||
output_dir.mkdir(exist_ok=True)
|
||||
|
||||
|
||||
output_file = output_dir / "data_dump.sql"
|
||||
|
||||
|
||||
print("Создание дампа таблиц vacancy, vacancy_embedding, key_skills...")
|
||||
|
||||
subprocess.run(
|
||||
[
|
||||
|
||||
subprocess.run( # noqa: S603
|
||||
[ # noqa: S607
|
||||
"pg_dump",
|
||||
db_url,
|
||||
"--table=vacancy",
|
||||
@@ -31,7 +32,7 @@ def main() -> None:
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
print(f"\nДамп создан: {output_file}")
|
||||
print(f"Размер файла: {output_file.stat().st_size / 1024 / 1024:.2f} MB")
|
||||
print("\nДля импорта на прод сервере выполните:")
|
||||
@@ -40,4 +41,3 @@ def main() -> None:
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ class ExperienceTypeType(TypeDecorator[ExperienceType]):
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
return ExperienceType(value)
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid experience_type value: {value}")
|
||||
except ValueError as err:
|
||||
raise ValueError(f"Invalid experience_type value: {value}") from err
|
||||
raise ValueError(f"Cannot convert {type(value)} to ExperienceType")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user