new api service and logic implemented
This commit is contained in:
49
Services/MongoDb/Models/action_models/password.py
Normal file
49
Services/MongoDb/Models/action_models/password.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""
|
||||
MongoDB Password Models.
|
||||
|
||||
This module provides Pydantic models for password management,
|
||||
including password history and access details.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
from pydantic import Field
|
||||
|
||||
from ApiLibrary import system_arrow
|
||||
from Services.MongoDb.Models.action_models.base import MongoBaseModel, MongoDocument
|
||||
|
||||
|
||||
class PasswordHistoryDetail(MongoBaseModel):
|
||||
"""Model for password history details."""
|
||||
|
||||
timestamp: datetime
|
||||
ip_address: Optional[str] = Field(None, alias="ipAddress")
|
||||
user_agent: Optional[str] = Field(None, alias="userAgent")
|
||||
location: Optional[Dict[str, Any]] = None
|
||||
|
||||
|
||||
class PasswordHistoryData(MongoBaseModel):
|
||||
"""Model for password history data."""
|
||||
|
||||
password_history: List[str] = Field([], alias="passwordHistory")
|
||||
access_history_detail: Dict[str, PasswordHistoryDetail] = Field(
|
||||
default_factory=dict, alias="accessHistoryDetail"
|
||||
)
|
||||
|
||||
|
||||
class PasswordDocument(MongoDocument):
|
||||
"""Model for password-related documents."""
|
||||
|
||||
data: PasswordHistoryData
|
||||
|
||||
|
||||
class PasswordDocumentCreate(MongoBaseModel):
|
||||
"""Model for creating new password documents."""
|
||||
|
||||
data: PasswordHistoryData = Field(..., description="Initial password data")
|
||||
|
||||
|
||||
class PasswordDocumentUpdate(MongoBaseModel):
|
||||
"""Model for updating existing password documents."""
|
||||
|
||||
data: PasswordHistoryData
|
||||
Reference in New Issue
Block a user