2025-03-19 09:40:56 +00:00

49 lines
1.4 KiB
Python

from fastapi import APIRouter, Depends, HTTPException
from core.database import fake_users_db
import uuid
from pydantic import BaseModel
router = APIRouter()
class CompanyRegistration(BaseModel):
company_name: str
user_name: str
email: str
password: str
role: str = "employee"
@router.post("/register/company")
async def register_company_user(registration: CompanyRegistration):
"""Register a new user in a company"""
if registration.user_name in fake_users_db:
raise HTTPException(status_code=400, detail="Username already exists")
user_id = str(uuid.uuid4())
company_id = str(uuid.uuid4())
fake_users_db[registration.user_name] = {
"id": user_id,
"company_id": company_id,
"company_name": registration.company_name,
"email": registration.email,
"password": registration.password,
"role": registration.role,
"disabled": False
}
return {
"message": "Company user registered successfully",
"user_id": user_id,
"company_id": company_id,
"username": registration.user_name,
"next_steps": [
"Verify company email",
"Complete company profile",
"Invite team members"
],
"features": {
"max_team_members": 10,
"storage_limit": "5GB",
"trial_period_days": 30
}
}