Improve the frontend modals
This commit is contained in:
@@ -156,7 +156,8 @@ class BaseRepository(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
db: AsyncSession,
|
||||
*,
|
||||
obj_in: CreateSchemaType,
|
||||
created_by: Optional[UUID] = None
|
||||
created_by: Optional[UUID] = None,
|
||||
tenant_id: Optional[UUID] = None
|
||||
) -> ModelType:
|
||||
"""Create a new record"""
|
||||
try:
|
||||
@@ -166,6 +167,10 @@ class BaseRepository(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
else:
|
||||
obj_data = obj_in
|
||||
|
||||
# Add tenant_id if the model supports it and it's provided
|
||||
if tenant_id and hasattr(self.model, 'tenant_id'):
|
||||
obj_data['tenant_id'] = tenant_id
|
||||
|
||||
# Add created_by if the model supports it
|
||||
if created_by and hasattr(self.model, 'created_by'):
|
||||
obj_data['created_by'] = created_by
|
||||
@@ -281,4 +286,4 @@ class BaseRepository(Generic[ModelType, CreateSchemaType, UpdateSchemaType]):
|
||||
model=self.model.__name__,
|
||||
id=str(id),
|
||||
error=str(e))
|
||||
raise
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user