-
Notifications
You must be signed in to change notification settings - Fork 0
Install dependencies and setup environment from .env.example #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: copilot/implement-erp-pos-ui
Are you sure you want to change the base?
Install dependencies and setup environment from .env.example #151
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
|
@copilot Try again |
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Fixed all remaining TypeScript errors and verified the build completes successfully (ab4afd5). The type-check now passes with 0 errors, and Key fixes in this commit:
|
|
@copilot Install all the dependencies, setup env from .env.example, run type-check and lint and fix all the errors and warnings by reviewing the codebase. Run browser automation test all the erp pages and perform all the actions, check all the console errors and fix it |
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
|
@copilot Install all the dependencies, setup env from .env.example, run type-check and lint and fix all the errors and warnings by reviewing the codebase. Run browser automation test all the erp pages and perform all the actions, check all the console errors and fix it |
All tasks completed in commit cad5a04: Dependencies & Environment:
Type-check & Lint:
Browser Testing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request focuses on setting up the development environment and fixing all TypeScript and ESLint errors to achieve a clean build. The changes include installing dependencies, creating environment configuration, replacing any types with proper interfaces, removing unused imports, fixing async route handler parameters for Next.js 15+ compatibility, and addressing various code quality issues.
Changes:
- Fixed TypeScript type errors by replacing
anytypes with proper Prisma-generated types and custom interfaces across ERP services and API routes - Updated Next.js 15+ async route params (
paramschanged from object to Promise) in API routes - Removed unused imports and added
eslint-disablecomments for legitimate uses ofanyin test files and pattern components - Added new Badge variants (
success,warning) and fixed Badge usage with proper type-safe variant strings - Fixed React Compiler issue by extracting
Date.now()call into a pure helper function in stock report
Reviewed changes
Copilot reviewed 43 out of 44 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/services/erp/*.test.ts | Added eslint-disable comments for legitimate test mock usage |
| src/lib/services/erp/*.service.ts | Replaced any return types with proper Prisma types (ErpSupplier, ErpShipmentLine, etc.) |
| src/components/ui/badge.tsx | Added success and warning Badge variants for ERP status displays |
| src/components/erp/erp-*.tsx | Removed unused imports (IconMenu2, usePathname) |
| src/app/api/pos/prescriptions/*.ts | Updated schema to match new database fields, fixed async params |
| src/app/api/erp/sales/shipments/*.ts | Fixed async params, added missing fields (shipmentNumber, totalValue) |
| src/app/api/erp/procurement/supplier-bills/*.ts | Simplified schema, removed unused fields, fixed async params |
| src/app/api/erp/inventory/lots/*.ts | Fixed async params, updated to use proper enum types |
| src/app/api/erp/inventory/adjustments/route.ts | Simplified from multi-line to single adjustment model |
| src/app/api/erp/approvals/route.ts | Added proper interfaces, fixed approval logic to use correct enum values |
| src/app/(erp)/erp/**/*-client.tsx | Fixed type-safe Badge variants, updated prop names (loading → isLoading), added proper interfaces |
| src/app/(erp)/erp/reports/**.tsx | Fixed field name mismatches (category → dosageForm, unitCost → standardCost) |
| src/app/(erp)/erp/components/patterns/*.tsx | Added proper TypeScript types, fixed generic type constraints |
| src/app/(erp)/erp/dashboard/page.tsx | Fixed unescaped entity (apostrophe in "Here's") |
| package-lock.json | Removed incorrect dev dependency flag from fsevents |
|
|
||
| if (adjustment) { | ||
| // Approve/Reject Inventory Adjustment | ||
| const newStatus = action === "approve" ? "APPROVED" : "REJECTED"; | ||
| const newStatus = action === "approve" ? "POSTED" : "DRAFT"; // No REJECTED status, just keep as DRAFT | ||
| const updatedAdjustment = await prisma.erpInventoryAdjustment.update({ | ||
| where: { id: requestId }, | ||
| data: { | ||
| status: newStatus, | ||
| approvedBy: action === "approve" ? userId : null, | ||
| approvedAt: action === "approve" ? new Date() : null, | ||
| rejectedBy: action === "reject" ? userId : null, | ||
| rejectedAt: action === "reject" ? new Date() : null, | ||
| rejectionReason: action === "reject" ? reason : null, | ||
| postedAt: action === "approve" ? new Date() : null, | ||
| }, | ||
| }); |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The adjustment.adjustmentNumber field may be null according to the interface definition (adjustmentNumber: string | null), but the success message uses it directly in template string interpolation without handling the null case. This could result in displaying "Adjustment null approved/rejected successfully" in the message. Consider providing a fallback value or default identifier when adjustmentNumber is null.
| const shipment = await prisma.erpShipment.create({ | ||
| data: { | ||
| organizationId: membership.organizationId, | ||
| shipmentNumber: `SHIP-${Date.now().toString().slice(-8)}`, |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now() at module level to generate unique numbers (e.g., for shipment numbers, prescription numbers) can create collisions when multiple records are created in rapid succession within the same millisecond. Consider using a more robust unique identifier generation approach, such as a database sequence, UUID, or including additional randomness beyond just the timestamp.
| customerName: validated.customerName, | ||
| customerPhone: validated.customerPhone, | ||
| customerId: validated.customerId, | ||
| prescriptionNumber: `RX-${Date.now().toString().slice(-8)}`, |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now() at module level to generate unique numbers (e.g., for prescription numbers) can create collisions when multiple records are created in rapid succession within the same millisecond. Consider using a more robust unique identifier generation approach, such as a database sequence, UUID, or including additional randomness beyond just the timestamp.
| organizationId: membership.organizationId, | ||
| adjustmentDate: validated.adjustmentDate, | ||
| status: requiresApproval ? "PENDING" : "APPROVED", | ||
| adjustmentNumber: `ADJ-${Date.now().toString().slice(-8)}`, |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now() at module level to generate unique numbers (e.g., for adjustment numbers) can create collisions when multiple records are created in rapid succession within the same millisecond. Consider using a more robust unique identifier generation approach, such as a database sequence, UUID, or including additional randomness beyond just the timestamp.
src/app/api/erp/approvals/route.ts
Outdated
| // Cannot reject to a different status, just return success without change | ||
| return { | ||
| success: true, | ||
| message: `Journal ${journal.journalNumber} rejection noted (status unchanged)`, | ||
| data: journal, |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rejection logic for GL journals silently succeeds without actually changing the status, which could be confusing for users. The message says "rejection noted (status unchanged)" but the journal remains in DRAFT status. Consider either implementing a proper rejection flow with a separate status/field to track rejections, or returning an error to indicate that rejection is not supported for journals.
| // Cannot reject to a different status, just return success without change | |
| return { | |
| success: true, | |
| message: `Journal ${journal.journalNumber} rejection noted (status unchanged)`, | |
| data: journal, | |
| // Rejection is not supported for GL journals; do not change status | |
| return { | |
| success: false, | |
| error: `Rejection is not supported for GL journals. Journal ${journal.journalNumber} remains in ${journal.status} status.`, |
|
@copilot apply changes based on the comments in this thread |
…, and GL journal rejection Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
Applied all code review changes in commit b32e3a1:
|
Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
Added comprehensive implementation plan for AR, AP, Payment, and Bank Account APIs in docs/AR_AP_PAYMENT_BANK_API_IMPLEMENTATION_PLAN.md. Also added a summary of Phase 4a accounting API progress in docs/pharma-erp/PHASE_4A_ACCOUNTING_APIS_SUMMARY.md.


This PR sets up the development environment and fixes all TypeScript and ESLint errors to achieve a clean build.
Changes Made
.env.localfrom.env.exampleanytypes with proper interfaces in ERP pagesDate.now()impure function call in stock-client.tsxsuccess,warning) with proper type-safe variant stringsgenerateDocumentNumberutility usingcrypto.randomBytesfor secure unique ID generationadjustmentNumberin approvals routeBrowser Testing Results
Verified the following pages load correctly with no console errors:
Screenshots
Homepage
Login Page
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.