Интегрирован wesp в сайт
CI / quality (push) Canceled after 0s

This commit is contained in:
влад
2026-07-17 12:57:18 +03:00
parent 5dfa06ddbe
commit 355c0ef9f1
883 changed files with 194576 additions and 177 deletions
+31
View File
@@ -30,9 +30,26 @@ from app.modules.zootech.catalog_models import (
ZootechFeedingPoint,
ZootechFeedMixer,
ZootechPeriodRecipe,
ZootechSkladStock,
ZootechTrip,
ZootechUnloadingGroup,
)
from app.modules.zootech.models import ZootechComponent, ZootechIngredient, ZootechRecipe
from app.modules.zootech.lab_models import (
ZootechLabAnimalProfile,
ZootechLabComponentNutrientValue,
ZootechLabProfileNorm,
ZootechLabRacionNormyInfo,
ZootechLabRacionNormyMoskwa,
ZootechLabRacionNormyMoskwaMeta,
ZootechLabRacionNormyPiter,
ZootechLabRacionNormyPiterMeta,
ZootechLabRationCalcIndicator,
ZootechLabRationCalcTotal,
ZootechLabRationCompoundLine,
ZootechLabRationLine,
ZootechLabRecipeRation,
)
from app.modules.zootech.report_models import ZootechFeedAlert, ZootechLoadingReport, ZootechUnloadingReport
__all__ = [
@@ -67,6 +84,7 @@ __all__ = [
"ZootechFeedingPoint",
"ZootechPeriodRecipe",
"ZootechTrip",
"ZootechSkladStock",
"ZootechDailyTripSkip",
"ZootechDailyIngredientSkip",
"ZootechDailyUnloadingGroupSkip",
@@ -77,4 +95,17 @@ __all__ = [
"ZootechFeedAlert",
"ZootechOrgSettings",
"ZootechFeedQualitySettings",
"ZootechLabAnimalProfile",
"ZootechLabProfileNorm",
"ZootechLabComponentNutrientValue",
"ZootechLabRecipeRation",
"ZootechLabRationLine",
"ZootechLabRationCalcIndicator",
"ZootechLabRationCalcTotal",
"ZootechLabRationCompoundLine",
"ZootechLabRacionNormyMoskwa",
"ZootechLabRacionNormyMoskwaMeta",
"ZootechLabRacionNormyPiter",
"ZootechLabRacionNormyPiterMeta",
"ZootechLabRacionNormyInfo",
]
+17
View File
@@ -5,8 +5,13 @@ from datetime import UTC, datetime
from app.core.config import settings
from app.core.security import hash_password
from app.modules.content.repository import create_page, get_page_by_slug
from app.modules.sync import repository as sync_repo
from app.modules.sync.repository import get_enterprise_by_slug
from app.modules.users.models import User
from app.modules.users.repository import create_user, get_user_by_email
_DEMO_ENTERPRISE_SLUG = "demo-farm"
def _ensure_user(email: str, password: str, role: str, is_superuser: bool, status: str):
from app.modules.users import repository
@@ -42,6 +47,17 @@ def _ensure_user(email: str, password: str, role: str, is_superuser: bool, statu
return user
def _ensure_demo_enterprise(admin: User) -> None:
ent = get_enterprise_by_slug(_DEMO_ENTERPRISE_SLUG)
if not ent:
ent = sync_repo.create_enterprise("Demo Farm", _DEMO_ENTERPRISE_SLUG)
if not sync_repo.get_member(admin.id, ent.id):
sync_repo.add_member(admin.id, ent.id, "admin")
ops = get_user_by_email("ops@compton.example")
if ops and not sync_repo.get_member(ops.id, ent.id):
sync_repo.add_member(ops.id, ent.id, "zootech")
def run_seed(include_demo_pages: bool = True) -> None:
admin = _ensure_user(
email="admin@compton.example",
@@ -65,6 +81,7 @@ def run_seed(include_demo_pages: bool = True) -> None:
is_superuser=False,
status="active",
)
_ensure_demo_enterprise(admin)
if not include_demo_pages:
return