From dd8ccc62b9eb2ecce5d0698f0125dbfc677e5c26 Mon Sep 17 00:00:00 2001
From: Dennis Chen <41879777+chennisden@users.noreply.github.com>
Date: Mon, 17 Jun 2024 13:36:09 -0700
Subject: [PATCH] Query batch (#141)
* Apparently Edit Part was removed somehow??
* Make card heights consistent
* Query owners in batch
* paginate in case of >100 users
---
frontend/src/App.css | 4 ++++
frontend/src/App.tsx | 2 ++
frontend/src/hooks/api.tsx | 15 +++++++++++++++
frontend/src/pages/Parts.tsx | 18 +-----------------
frontend/src/pages/Robots.tsx | 14 +-------------
store/app/crud/users.py | 10 ++++++++++
store/app/routers/users.py | 33 ++++++++++++++++++++++++++-------
7 files changed, 59 insertions(+), 37 deletions(-)
diff --git a/frontend/src/App.css b/frontend/src/App.css
index 61653ecc..69e77761 100644
--- a/frontend/src/App.css
+++ b/frontend/src/App.css
@@ -27,6 +27,10 @@ form button {
width: 100%;
}
+div.card {
+ height: 100%;
+}
+
p.card-text {
flex-grow: 1;
max-height: 100%;
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index fb8e7927..eca9af32 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -7,6 +7,7 @@ import { AuthenticationProvider } from "hooks/auth";
import { ThemeProvider } from "hooks/theme";
import About from "pages/About";
import ChangeEmail from "pages/ChangeEmail";
+import EditPartForm from "pages/EditPartForm";
import EditRobotForm from "pages/EditRobotForm";
import Forgot from "pages/Forgot";
import Home from "pages/Home";
@@ -66,6 +67,7 @@ const App = () => {
} />
} />
} />
+ } />
} />
} />
} />
diff --git a/frontend/src/hooks/api.tsx b/frontend/src/hooks/api.tsx
index 88f0f837..477271bf 100644
--- a/frontend/src/hooks/api.tsx
+++ b/frontend/src/hooks/api.tsx
@@ -240,6 +240,7 @@ export class api {
const response = await this.api.get(`/users/${userId}`);
return response.data.username;
}
+
public async getRobots(): Promise {
try {
const response = await this.api.get("/robots/");
@@ -256,6 +257,20 @@ export class api {
}
}
}
+
+ public async getUserBatch(userIds: string[]): Promise