Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions backend/src/lambda/email-processor/lambda-src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const handler = async (event: SQSEvent): Promise<SQSBatchResponse> => {
for (const record of event.Records) {
try {
await processRecord(record);
console.log(`Successfully processed message ${record.messageId}`);
} catch (error) {
console.error(`Failed to process message ${record.messageId}:`, error);

Expand All @@ -35,13 +34,9 @@ export const handler = async (event: SQSEvent): Promise<SQSBatchResponse> => {
async function processRecord(record: SQSRecord): Promise<void> {
const message: DisasterEmailMessage = JSON.parse(record.body);

console.log(`Sending email to ${message.to} for disaster ${message.disasterId}`);

if (!message.to || !message.firstName || !message.declarationType) {
throw new Error("Missing required fields in message");
}

await sesService.sendDisasterEmail(message);

console.log(`Email sent successfully to ${message.to}`);
}
1 change: 0 additions & 1 deletion backend/src/modules/claim/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ export class ClaimTransaction implements IClaimTransaction {

return { claimId: claimId, purchaseLineItemId: lineItemId };
} catch (error) {
console.log(error);
logMessageToFile(`Transaction error: ${error}`);
return null;
}
Expand Down
1 change: 0 additions & 1 deletion backend/src/modules/fema-risk-index-data/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class FemaRiskIndexService implements IFemaRiskIndexService {
private async deleteAllFilesInFolder(folderPath: string): Promise<void> {
try {
if (!fs.existsSync(folderPath)) {
console.log(`Folder does not exist: ${folderPath}`);
return;
}

Expand Down
21 changes: 8 additions & 13 deletions backend/src/modules/location-address/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,15 @@ export class LocationAddressTransactions implements ILocationAddressTransaction
payload: CreateLocationAddressBulkDTO,
companyId: string
): Promise<LocationAddress[]> {
try {
const addresses: LocationAddress[] = payload.map((element) =>
plainToClass(LocationAddress, {
...element,
companyId: companyId,
})
);
const newAddress: LocationAddress[] = await this.db.getRepository(LocationAddress).save(addresses);
const addresses: LocationAddress[] = payload.map((element) =>
plainToClass(LocationAddress, {
...element,
companyId: companyId,
})
);
const newAddress: LocationAddress[] = await this.db.getRepository(LocationAddress).save(addresses);

return newAddress;
} catch (err) {
console.log(err);
throw err;
}
return newAddress;
}

/**
Expand Down
1 change: 0 additions & 1 deletion backend/src/utilities/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const withServiceErrorHandling = <T extends any[], R>(handler: (...args:
return await handler(...args);
} catch (error: any) {
if (process.env.NODE_ENV !== "test") {
console.log(error);
console.error(error);
}
if (Boom.isBoom(error)) {
Expand Down
10 changes: 4 additions & 6 deletions frontend/api/quickbooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ export const importQuickbooksData = async (): Promise<{ success: true } | undefi
});
if (response.ok) {
return data!;
} else if (response.status === 401) {
console.log("Warning: No quickbooks client");
} else {
console.log("No quickbooks client");
// TODO: error message?
return undefined;
}
};
return authWrapper<{ success: true } | undefined>()(req);
Expand All @@ -28,10 +27,9 @@ export const redirectToQuickbooks = async (): Promise<string | undefined> => {

if (response.ok && data?.url) {
return data.url;
} else if (response.status === 401) {
console.log("Warning: Unauthorized access to QuickBooks");
} else {
console.log("Error: Unable to fetch QuickBooks URL");
// TODO: error message
return undefined;
}
};

Expand Down
1 change: 0 additions & 1 deletion frontend/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const createUser = async (payload: CreateUserRequest): Promise<User> => {
onboarding_step: requiredOnboardingProgress.COMPANY,
},
});
console.log(error);
return data!;
} else {
throw Error(error?.error);
Expand Down
7 changes: 5 additions & 2 deletions frontend/app/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ import { HiOutlineTableCells } from "react-icons/hi2";
import { RiFilePaperLine } from "react-icons/ri";
import { IoPersonOutline, IoSettingsOutline } from "react-icons/io5";
import Image from "next/image";
import { useQueryClient } from "@tanstack/react-query";

export default function NavBar() {
const pathname = usePathname();
const queryClient = useQueryClient();

const logout = async () => {
queryClient.clear();
await logoutUser();
};

const navigationItems = [
{ name: "Dashboard", href: "/", icon: <LuLayoutDashboard /> },
{ name: "Notifications", href: "/notifications", icon: <IoIosNotificationsOutline /> },
{ name: "Expense Tracker", href: "/expense-tracker", icon: <HiOutlineTableCells /> },
{ name: "Claims", href: "/claims", icon: <RiFilePaperLine /> },
{ name: "Reports", href: "/claims", icon: <RiFilePaperLine /> },
{ name: "Business Profile", href: "/business-profile", icon: <IoPersonOutline /> },
];

Expand All @@ -33,7 +36,7 @@ export default function NavBar() {
<div className="flex flex-col gap-5">
{navigationItems.map((item) => (
<li className="flex flex-col gap-5" key={item.name}>
<Link href={item.href} className={`rounded-lg ${pathname === item.href && "bg-[#F7DCE5]"}`}>
<Link href={item.href} className={`rounded-lg`}>
<div
className={`flex text-lg m-1 items-center gap-3 ${pathname === item.href && "text-fuchsia"}`}
>
Expand Down
1 change: 0 additions & 1 deletion frontend/app/business-profile/overview/LocationsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export default function LocationsCard({
};

const handleSave = () => {
console.log("HITTING HERE");
if (editingLocationIndex === null) return;

const location = locationInfo[editingLocationIndex];
Expand Down
23 changes: 14 additions & 9 deletions frontend/app/business-profile/view-documents/ViewDocuments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ import {
uploadToS3,
} from "@/api/business-profile";
import { BusinessDocument, DocumentCategories } from "@/types/documents";
import { Spinner } from "@/components/ui/spinner";
import Loading from "@/components/loading";
import ErrorDisplay from "@/components/ErrorDisplay";

type SortOrder = "asc" | "desc";

export default function ViewDocuments() {
// Replace hardcoded documents with state
const [documents, setDocuments] = useState<BusinessDocument[]>([]);
const [isLoadingDocuments, setIsLoadingDocuments] = useState(true);
const [error, setError] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [categoryFilter, setCategoryFilter] = useState("All Categories");
const [dateFilter, setDateFilter] = useState("All Dates");
Expand All @@ -43,10 +45,10 @@ export default function ViewDocuments() {
try {
setIsLoadingDocuments(true);

// Fetch documents from the backend
const docs = await getAllDocuments();

// Transform the response into the BusinessDocument type
const transformedDocs: BusinessDocument[] = docs.map((doc) => {
const transformedDocs: BusinessDocument[] = docs!.map((doc) => {
// Access the nested document object
const { document, downloadUrl } = doc;

Expand Down Expand Up @@ -74,9 +76,8 @@ export default function ViewDocuments() {

// Update the state with the transformed documents
setDocuments(transformedDocs);
} catch (error) {
console.error("Error loading documents:", error);
alert("Failed to load documents. Please try again.");
} catch (_error) {
setError(true);
} finally {
setIsLoadingDocuments(false);
}
Expand Down Expand Up @@ -216,7 +217,7 @@ export default function ViewDocuments() {
};

return (
<Card>
<Card className="border-none shadow-none">
<CardHeader className="flex justify-between">
<div className="flex flex-col gap-[10px]">
<h3 className="text-[24px]">Business Documents</h3>
Expand Down Expand Up @@ -255,13 +256,17 @@ export default function ViewDocuments() {

{/* Show loading state or documents */}
{isLoadingDocuments ? (
<div className="text-center py-8 text-gray-500 flex items-center justify-center">
<Spinner />
<div className="py-8 flex items-center justify-center w-full">
<Loading lines={2} />
</div>
) : documents.length === 0 ? (
<div className="text-center py-8 text-gray-500">
No documents found. Upload your first document to get started!
</div>
) : error ? (
<div className="py-8 flex items-center justify-center w-full">
<ErrorDisplay />
</div>
) : (
<DocumentTable
documents={filteredAndSortedDocuments}
Expand Down
2 changes: 0 additions & 2 deletions frontend/app/expense-tracker/expense-table/table-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ export default function TableContent({
return selected ? "bg-slate-100" : "";
};

if (purchases.error) return <div>Error loading expenses</div>;

return (
<Table
table={table}
Expand Down
Loading
Loading