mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-19 23:01:29 +02:00
- Added `clean_name` function to `validation.py` for name validation with max length. - Simplified docstrings in `dnsx` client, parser, and service files for clarity. - Enhanced error handling in `ViewDNSService` to prevent disabling keys on rate limits. - Improved WHOIS service to handle concurrent inserts gracefully with integrity checks. - Updated `Settings` class in worker config to inherit from `BaseAppSettings`. - Added new dependencies in `pyproject.toml` for `apprise` and `cryptography`.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
from shared.utils.datetime import utc_now
|
|
|
|
|
|
class ProjectBase(SQLModel):
|
|
name: str = Field(max_length=50)
|
|
|
|
|
|
class Project(ProjectBase, table=True):
|
|
__tablename__ = "projects"
|
|
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True, index=True)
|
|
slug: str = Field(max_length=100, unique=True, index=True)
|
|
description: str | None = Field(default=None, max_length=1000)
|
|
label: str | None = Field(default=None, max_length=50)
|
|
is_active: bool = Field(default=True)
|
|
created_at: datetime = Field(default_factory=utc_now)
|
|
created_by: uuid.UUID = Field(foreign_key="users.id")
|
|
|
|
|
|
class ProjectCreate(ProjectBase):
|
|
description: str | None = None
|
|
label: str | None = None
|
|
|
|
|
|
class ProjectRead(ProjectBase):
|
|
id: uuid.UUID
|
|
slug: str
|
|
description: str | None = None
|
|
label: str | None = None
|
|
is_active: bool
|
|
created_at: datetime
|
|
created_by: uuid.UUID
|
|
|
|
|
|
class ProjectSummary(BaseModel):
|
|
project: ProjectRead
|
|
stats: dict[str, int]
|