File size: 1,178 Bytes
c4dc0b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from fastapi import APIRouter
from fastapi.responses import JSONResponse
import sqlite3
from pydantic import BaseModel
class DataType(BaseModel):
    AdminEmail:str
    AdminPassword:str
GetUserRouter=APIRouter(prefix="/Users")
@GetUserRouter.post("/GetAllUsers")
def adduser(Data:DataType):
    try:
        AdminPassword="$2b$12$33H14GFBvtomzLrEaM6Tqu7Jr621eHlXL9TVtdPU6YCljxc4eug2a"
        if Data.AdminEmail =="[email protected]":
            if not (Data.AdminPassword==AdminPassword):
                response=JSONResponse({"Status":False},status_code=200)
                
                return response
            connect=sqlite3.connect("DataBase/DataBase.bd")
            cursor=connect.execute(f'''

                            SELECT * FROM Users 

                            ''')

            Data=cursor.fetchall()
            return {"Status":True,"Data":Data}
        else:
            response=JSONResponse({"Status":False,"Message":"Email Or password is in corredct try to login again"},status_code=200)
                
            return response
        
    except Exception as e:
        return {"Status":False,"Message":e}