Spaces:
Paused
Paused
from fastapi import APIRouter, Body, Request, status | |
from typing import List | |
import sys | |
# sys.path.append('/Users/benolojo/DCU/CA4/ca400_FinalYearProject/2024-ca400-olojob2-majdap2/src/backend/src/') | |
from ..models.users import User, UpdateUser | |
from ..operations import users as users | |
router = APIRouter(prefix="/user", | |
tags=["User"]) | |
async def create_user(request: Request, user: User = Body(...)): | |
return users.create_user(request,user) | |
async def list_users(request: Request): | |
return users.list_users(request, 100) | |
async def update_user(request: Request, user_id: str, user: UpdateUser = Body(...)): | |
return users.update_user(request, user_id, user) | |
async def find_user(request: Request, user_id: str): | |
return users.find_user(request, user_id) | |
async def find_user_name(request: Request, name: str): | |
return users.find_user_name(request, name) | |
async def find_user_email(request: Request, email: str): | |
return users.find_user_email(request, email) | |
async def delete_user(request: Request, user_id:str): | |
return users.delete_user(request, user_id) |