diff --git a/app/src/pages/403.test.tsx b/app/src/pages/403.test.tsx index 8abd7e0..e5929bd 100644 --- a/app/src/pages/403.test.tsx +++ b/app/src/pages/403.test.tsx @@ -10,10 +10,10 @@ const test = suite>(""); test.before.each((context) => { const returnValue = render(() => ); - Object.getOwnPropertyNames(returnValue).forEach((name) => { + for (const name of Object.getOwnPropertyNames(returnValue)) { // @ts-expect-error context[name] = returnValue[name]; - }); + } }); test.after.each(({ unmount }) => unmount()); diff --git a/app/src/pages/account/addAccount.test.tsx b/app/src/pages/account/addAccount.test.tsx index 6b349d0..0909340 100644 --- a/app/src/pages/account/addAccount.test.tsx +++ b/app/src/pages/account/addAccount.test.tsx @@ -10,10 +10,10 @@ const test = suite>(""); test.before.each((context) => { const returnValue = render(() => ); - Object.getOwnPropertyNames(returnValue).forEach((name) => { + for (const name of Object.getOwnPropertyNames(returnValue)) { // @ts-expect-error context[name] = returnValue[name]; - }); + } }); test.after.each(({ unmount }) => unmount()); diff --git a/app/src/pages/dashboard.test.tsx b/app/src/pages/dashboard.test.tsx index dda541d..924205e 100644 --- a/app/src/pages/dashboard.test.tsx +++ b/app/src/pages/dashboard.test.tsx @@ -10,10 +10,10 @@ const test = suite>(""); test.before.each((context) => { const returnValue = render(() => ); - Object.getOwnPropertyNames(returnValue).forEach((name) => { + for (const name of Object.getOwnPropertyNames(returnValue)) { // @ts-expect-error context[name] = returnValue[name]; - }); + } }); test.after.each(({ unmount }) => unmount()); diff --git a/app/src/pages/dashboard.tsx b/app/src/pages/dashboard.tsx index f46425f..c2ab646 100644 --- a/app/src/pages/dashboard.tsx +++ b/app/src/pages/dashboard.tsx @@ -1,6 +1,7 @@ import { getCurrentUser } from "../service/auth"; -import { QueryObj, getDocumentsWithQuery } from "../service/firestore"; -import { DocumentData } from "firebase/firestore"; +import { getDocumentsWithQuery, firestore }from "../service/firestore"; +import type { QueryObj } from "../service/firestore"; +import type { DocumentData } from "firebase/firestore"; const Dashboard = () => { return ( @@ -12,21 +13,20 @@ const Dashboard = () => {
- {/* pulldown menu select */} -
-
+
@@ -35,7 +35,7 @@ const Dashboard = () => { Register Tenant @@ -58,7 +58,7 @@ async function getAccountInfo(): Promise { operator: "==", value: uid, }; - const result = await getDocumentsWithQuery(collectionName, queryObj); + const result = await getDocumentsWithQuery(firestore, collectionName, queryObj); if (result instanceof Error) { return null; } diff --git a/app/src/pages/login.test.tsx b/app/src/pages/login.test.tsx index d3fcdf0..b312658 100644 --- a/app/src/pages/login.test.tsx +++ b/app/src/pages/login.test.tsx @@ -10,10 +10,10 @@ const test = suite>(""); test.before.each((context) => { const returnValue = render(() => ); - Object.getOwnPropertyNames(returnValue).forEach((name) => { + for (const name of Object.getOwnPropertyNames(returnValue)) { // @ts-expect-error context[name] = returnValue[name]; - }); + } }); test.after.each(({ unmount }) => unmount()); diff --git a/app/src/pages/login.tsx b/app/src/pages/login.tsx index b9fec67..1577c3d 100644 --- a/app/src/pages/login.tsx +++ b/app/src/pages/login.tsx @@ -80,7 +80,7 @@ const Login = () => { type="password" autocomplete="current-password" required - class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + class="block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" onChange={(e) => handlePasswordChange(e)} />
diff --git a/app/src/pages/tenant/addTenant.test.tsx b/app/src/pages/tenant/addTenant.test.tsx index cce82eb..095dab4 100644 --- a/app/src/pages/tenant/addTenant.test.tsx +++ b/app/src/pages/tenant/addTenant.test.tsx @@ -10,10 +10,10 @@ const test = suite>(""); test.before.each((context) => { const returnValue = render(() => ); - Object.getOwnPropertyNames(returnValue).forEach((name) => { + for (const name of Object.getOwnPropertyNames(returnValue)) { // @ts-expect-error context[name] = returnValue[name]; - }); + } }); test.after.each(({ unmount }) => unmount()); diff --git a/app/src/service/firestore.test.ts b/app/src/service/firestore.test.ts index 50d210a..65b6e67 100644 --- a/app/src/service/firestore.test.ts +++ b/app/src/service/firestore.test.ts @@ -1,10 +1,10 @@ import { test } from "uvu"; import * as assert from "uvu/assert"; import fs from "node:fs"; -import { - initializeTestEnvironment, +import type { RulesTestEnvironment, } from "@firebase/rules-unit-testing"; +import { initializeTestEnvironment } from "@firebase/rules-unit-testing"; import { getAllDocumentsWithCollectionName } from "./firestore"; import type { Firestore } from "firebase/firestore"; diff --git a/app/src/service/firestore.ts b/app/src/service/firestore.ts index efd29fa..2dc738d 100644 --- a/app/src/service/firestore.ts +++ b/app/src/service/firestore.ts @@ -1,22 +1,9 @@ import { firebaseApp } from "./firebase"; -import { +import { getFirestore, collection, getDocs,getDoc, setDoc, doc, addDoc, updateDoc, deleteDoc, query,where } from "firebase/firestore"; +import type { CollectionReference, DocumentData, Firestore, - query, - Query, - addDoc, - collection, - collectionGroup, - deleteDoc, - doc, - getDoc, - getFirestore, - setDoc, - updateDoc, - getDocs, - where, - QuerySnapshot, } from "firebase/firestore"; export const firestore: Firestore = getFirestore(firebaseApp); @@ -46,7 +33,7 @@ export async function getAllDocumentsWithCollectionName( } return documents; } catch (error) { - return new Error("Error getting documents: " + error); + return new Error(`Error getting documents: ${error}`); } } @@ -62,7 +49,7 @@ export async function addNewDocument( return null; }) .catch((error) => { - return new Error("Error adding document: " + error); + return new Error(`Error adding document: ${error}`); }); } @@ -78,7 +65,7 @@ export async function addNewDocumentWithAutoId( return null; }) .catch((error) => { - return new Error("Error adding document: " + error); + return new Error(`Error adding document: ${error}`); }); } @@ -91,9 +78,8 @@ export async function getDocumentById( const documentSnapshot = await getDoc(documentRef); if (documentSnapshot.exists()) { return documentSnapshot.data(); - } else { - return null; } + return null; } export async function updateDocument( @@ -108,7 +94,7 @@ export async function updateDocument( return null; }) .catch((error) => { - return new Error("Error updating document: " + error); + return new Error(`Error updating document: ${error}`); }); } @@ -123,7 +109,7 @@ export async function deleteDocument( return null; }) .catch((error) => { - return new Error("Error deleting document: " + error); + return new Error(`Error deleting document: ${error}`); }); }