-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrv2.py
113 lines (96 loc) · 3 KB
/
qrv2.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import Optional
from datetime import date, time
app = FastAPI(
title="User Management and Banking API",
description="API for managing users, devices, transfers, and banking operations",
version="1.0.0",
servers=[
{"url": "https://washmevmm.com/fridayqr-sdk-apiv2/api/api.php", "description": "Local development server"}
]
)
class LoginRequest(BaseModel):
type: str = "login"
username: str
password: str
class UserRequest(BaseModel):
type: str
username: str
password: str
name: Optional[str] = None
phone: Optional[str] = None
nickname: Optional[str] = None
bank_name: Optional[str] = None
bank_number: Optional[str] = None
role: Optional[str] = None
createdate: Optional[date] = None
user_id: Optional[int] = None
class DeviceRequest(BaseModel):
type: str
user_id: int
macaddress: str
boardname: str
status: int
amounts: int
date: date
createdate: date
datestamp: str
class TransactionRequest(BaseModel):
type: str
user_id: int
operation_id: str
macaddress: str
amounts: int
ws_id: int
date: date
time: time
class ReportRequest(BaseModel):
type: str
form: date
to: date
user_id: Optional[int] = None
@app.post("/login")
async def login(request: LoginRequest):
# Login logic here
return {"message": "Successful login"}
@app.post("/adduser")
async def add_user(request: UserRequest):
# Add user logic here
return {"message": "User added successfully"}
@app.post("/updateuser")
async def update_user(request: UserRequest):
# Update user logic here
return {"message": "User updated successfully"}
@app.post("/removeuser")
async def remove_user(request: UserRequest):
# Remove user logic here
return {"message": "User removed successfully"}
@app.post("/adddevice")
async def add_device(request: DeviceRequest):
# Add device logic here
return {"message": "Device added successfully"}
@app.post("/removedevice")
async def remove_device(request: DeviceRequest):
# Remove device logic here
return {"message": "Device removed successfully"}
@app.post("/deposit")
async def deposit(request: TransactionRequest):
# Deposit logic here
return {"message": "Deposit successful"}
@app.post("/withdraw")
async def withdraw(request: TransactionRequest):
# Withdraw logic here
return {"message": "Withdrawal successful"}
@app.post("/allreport")
async def get_all_reports(request: ReportRequest):
# Get all reports logic here
return {"message": "Returned all reports successfully"}
@app.post("/perdayreport")
async def get_per_day_report(request: ReportRequest):
# Get per day report logic here
return {"message": "Returned per day report successfully"}
@app.post("/perweekreport")
async def get_per_week_report(request: ReportRequest):
# Get per week report logic here
return {"message": "Returned per week report successfully"}