From 5864efcf3e5942d67f52811724fda4423d979487 Mon Sep 17 00:00:00 2001
From: MiLla <18826902282@163.com>
Date: Tue, 19 Nov 2024 21:38:36 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=90=84=E4=B8=AAapi.py=E4=B8=AD?=
=?UTF-8?q?=E7=9A=84=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A?=
=?UTF-8?q?=E6=8E=89=E4=BA=86=EF=BC=8C=E7=A7=9F=E6=88=B7=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E7=AE=80=E5=8D=95=E5=AE=8C=E6=88=90=E4=BA=86=E5=88=97=E4=B8=BE?=
=?UTF-8?q?=E6=89=80=E6=9C=89=E7=A7=9F=E6=88=B7=EF=BC=8C=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AE=80=E5=8D=95=E5=AE=8C=E6=88=90=E4=BA=86?=
=?UTF-8?q?=E5=88=97=E4=B8=BE=E6=89=80=E6=9C=89=E9=A1=B9=E7=9B=AE=E3=80=82?=
=?UTF-8?q?=20=EF=BC=88=E8=AE=BE=E7=BD=AEpython=E7=8E=AF=E5=A2=83=E7=9A=84?=
=?UTF-8?q?=E6=97=B6=E5=80=99=E8=87=AA=E5=8A=A8=E5=8A=A0=E4=BA=86=E4=BA=9B?=
=?UTF-8?q?=E5=A5=87=E5=A5=87=E6=80=AA=E6=80=AA=E7=9A=84=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=8C=E5=BA=94=E8=AF=A5=E4=B8=8D=E8=87=B3?=
=?UTF-8?q?=E4=BA=8E=E5=87=BA=E9=97=AE=E9=A2=98=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/CostEvalPlatform.iml | 2 +-
.idea/dataSources.xml | 21 +++++++++++++++++++++
.idea/misc.xml | 2 +-
api/manage_project.py | 21 ++++++++++++++++++---
api/manage_tanant.py | 18 ++++++++++++++----
api/manage_user.py | 6 +++---
6 files changed, 58 insertions(+), 12 deletions(-)
diff --git a/.idea/CostEvalPlatform.iml b/.idea/CostEvalPlatform.iml
index d0876a7..909438d 100644
--- a/.idea/CostEvalPlatform.iml
+++ b/.idea/CostEvalPlatform.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 95b90ca..e38120e 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -16,5 +16,26 @@
+
+ sqlite.xerial
+ true
+ org.sqlite.JDBC
+ jdbc:sqlite:C:\Users\15089\PycharmProjects\CostEvalPlatform\test.db
+ $ProjectFileDir$
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 63337c1..2f33712 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -28,5 +28,5 @@
-
+
\ No newline at end of file
diff --git a/api/manage_project.py b/api/manage_project.py
index d833e8d..ed5d3ea 100644
--- a/api/manage_project.py
+++ b/api/manage_project.py
@@ -12,9 +12,24 @@ from sqlmodel import select
from models import Tenant, User, Project
from dependencies import *
+from typing import List
+
router = APIRouter()
-@router.get(...)
-def example():
- return "hello"
+#列举所有项目
+@router.get("/api/s1/project")
+async def get_project(response:Response, session: SessionDep):
+ projects = session.query(Project).filter().all()
+ if not projects:
+ raise HTTPException(status_code=404, detail="Project not found")
+ return {"projects": projects}
+
+#新增和修改项目
+# @router.post("/api/s1/project")
+# async def create_project(project_detail:dict, session: SessionDep):
+# project = {
+# "name": project_detail["name"],
+#
+# }
+# return {"newProject": project}
\ No newline at end of file
diff --git a/api/manage_tanant.py b/api/manage_tanant.py
index be34de0..250e259 100644
--- a/api/manage_tanant.py
+++ b/api/manage_tanant.py
@@ -14,7 +14,17 @@ from dependencies import *
router = APIRouter()
-#推送修改用注释
-@router.get(...)
-def example():
- return "hello"
+# 推送修改用注释
+# @router.get(...)
+# def example():
+# return "hello"
+
+# 列举所有租户
+@router.get("/api/s1/tenant")
+async def get_tenant(response: Response, session: SessionDep):
+ tenant = session.query(Tenant).filter().all()
+ if not tenant:
+ raise HTTPException(status_code=404, detail="Tenant not found")
+ return {"tenant": tenant}
+
+# 新增和修改租户
diff --git a/api/manage_user.py b/api/manage_user.py
index 59cf9ad..6e075de 100644
--- a/api/manage_user.py
+++ b/api/manage_user.py
@@ -16,6 +16,6 @@ from dependencies import *
router = APIRouter()
-@router.get(...)
-def example():
- return "hello"
+# @router.get(...)
+# def example():
+# return "hello"