move kontor_model in kontor-api
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from kontor_model.db.models.admin import Assignment
|
||||
|
||||
|
||||
class AssignmentResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
profile_id: str
|
||||
permission_id: str
|
||||
|
||||
|
||||
def to_response(assignment: Assignment) -> AssignmentResponse:
|
||||
response: AssignmentResponse = AssignmentResponse(
|
||||
id=assignment.id,
|
||||
created_date=assignment.created_date,
|
||||
last_modified_date=assignment.last_modified_date,
|
||||
version=assignment.version,
|
||||
profile_id=str(assignment.profile_id),
|
||||
permission_id=str(assignment.permission_id)
|
||||
)
|
||||
return response
|
||||
Reference in New Issue
Block a user