1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Создания скрипта, юзера3

This commit is contained in:
MoonTestUse1
2024-12-28 07:51:35 +06:00
parent 50ebfdc2b7
commit f169ec51ae
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
"""Scripts package initialization"""
from .create_test_user import create_test_employee

View File

@@ -1,5 +1,10 @@
"""Script to create a test user in the database"""
from sqlalchemy.orm import Session
import sys
from pathlib import Path
# Add the parent directory to sys.path
sys.path.append(str(Path(__file__).resolve().parents[1]))
from app.database import SessionLocal
from app.crud import employees
from app.models.employee import EmployeeCreate
@@ -28,6 +33,7 @@ def create_test_employee():
except Exception as e:
print(f"Error creating test employee: {e}")
raise e
finally:
db.close()