Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix create data profile #124

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/databases/data_profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def create_dataprofile(self, data_profile_data: DataProfileCreateRequest):
"""Create a new DataProfile."""
new_data_profile = DataProfile(
name=data_profile_data.name,
file_type=data_profile_data.file_type, # Assuming it's included in the request
organization_id=data_profile_data.organization_id, # Assuming it's included in the request
file_type=data_profile_data.file_type,
organization_id=data_profile_data.organization_id,
description=data_profile_data.description,
)
self.session.add(new_data_profile)
self.session.commit()
return new_data_profile.to_dict()
return new_data_profile

def get_dataprofile_by_id(self, data_profile_id: int):
"""Retrieve a DataProfile by its ID."""
Expand Down
4 changes: 3 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ python-jose-cryptodome==1.3.2
passlib==1.7.4
bcrypt==3.2.0
alembic==1.12.1
pydantic[email]==2.4.2
pydantic[email]==2.4.2
pytest==6.2.5
pytest-asyncio==0.15.1
14 changes: 11 additions & 3 deletions backend/routes/data_profile_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ async def save_data_profiles(
with DatabaseManager() as session:
data_profile_manager = DataProfileManager(session)
if data_profile_manager.get_dataprofile_by_name(request.name):
raise HTTPException(status_code=400, detail="Data Profile alredy exists")
raise HTTPException(status_code=400, detail="Data Profile already exists")

new_data_profile = DataProfile(name=request.name)
new_data_profile = DataProfile(
name=request.name,
description=request.description,
)
created_data_profile = data_profile_manager.create_dataprofile(new_data_profile)
response = DataProfileCreateResponse(created_data_profile.name)

# Make sure to pass the fields as keyword arguments
response = DataProfileCreateResponse(
name=created_data_profile.name,
description=created_data_profile.description,
)
return response


Expand Down
Loading