Skip to content
Open
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
13 changes: 7 additions & 6 deletions backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ class User(BaseModel):
created_at: datetime


class FounderTypeRequest(BaseModel):
founder_type: Literal["first_time", "technical", "non_technical", "repeat"]


class IdeaCreate(BaseModel):
title: str
one_liner: str
Expand Down Expand Up @@ -454,19 +458,16 @@ async def auth_me(

@api.post("/auth/founder-type")
async def set_founder_type(
payload: FounderTypeRequest,
request: Request,
session_token_cookie: Optional[str] = Cookie(None, alias="session_token"),
authorization: Optional[str] = Header(None),
):
user = await get_current_user(request, session_token_cookie, authorization)
body = await request.json()
ftype = body.get("founder_type")
if ftype not in ["first_time", "technical", "non_technical", "repeat"]:
raise HTTPException(status_code=400, detail="Invalid founder_type")
await db.users.update_one(
{"user_id": user.user_id}, {"$set": {"founder_type": ftype}}
{"user_id": user.user_id}, {"$set": {"founder_type": payload.founder_type}}
)
return {"ok": True, "founder_type": ftype}
return {"ok": True, "founder_type": payload.founder_type}


# ---------- Ideas ----------
Expand Down