From aecc5dbaee9b4d0583dfb064d3d0000d6ffdab31 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 19 Mar 2025 09:13:39 +0000 Subject: [PATCH] Update code in endpoints/api/v1/endpoint.post.py --- endpoints/api/v1/endpoint.post.py | 49 ++++++++++++++++++------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/endpoints/api/v1/endpoint.post.py b/endpoints/api/v1/endpoint.post.py index 34664ea..0a0560d 100644 --- a/endpoints/api/v1/endpoint.post.py +++ b/endpoints/api/v1/endpoint.post.py @@ -1,42 +1,49 @@ from fastapi import APIRouter, Depends, HTTPException from core.database import fake_users_db -from pydantic import BaseModel, EmailStr import uuid +from pydantic import BaseModel, EmailStr router = APIRouter() -class UserRegistration(BaseModel): +class CookingCommunityRegistration(BaseModel): username: str email: EmailStr password: str - full_name: str + cooking_experience: str + favorite_cuisine: str @router.post("/api/v1/endpoint") -async def register_user(user_data: UserRegistration): - """Register a new user""" - if user_data.username in fake_users_db: +async def register_cooking_community( + registration: CookingCommunityRegistration +): + """Register new user for cooking community""" + if registration.username in fake_users_db: raise HTTPException(status_code=400, detail="Username already exists") user_id = str(uuid.uuid4()) - fake_users_db[user_data.username] = { + fake_users_db[registration.username] = { "id": user_id, - "email": user_data.email, - "password": user_data.password, - "full_name": user_data.full_name, - "disabled": False + "email": registration.email, + "password": registration.password, + "cooking_experience": registration.cooking_experience, + "favorite_cuisine": registration.favorite_cuisine, + "disabled": False, + "role": "community_member" } return { - "message": "User registered successfully", + "message": "Successfully registered in cooking community", "user_id": user_id, - "username": user_data.username, - "metadata": { - "account_status": "active", - "registration_complete": True - }, + "username": registration.username, "next_steps": [ - "Verify your email address", - "Complete your profile", - "Set up two-factor authentication" - ] + "Verify your email", + "Complete your cooking profile", + "Join cooking discussion groups", + "Share your favorite recipe" + ], + "features": { + "recipe_sharing": True, + "community_chat": True, + "cooking_tips_access": True + } } \ No newline at end of file