Conversation
- Enhanced currency formatting in invoice preview and email templates - Added proper IDR formatting (no decimals, thousands separators) using Intl.NumberFormat - Updated formatCurrency and formatDecimal utility functions in server utils - Improved invoice preview dialog with organization logo display and responsive design - Added comprehensive currency formatting utilities in /lib/currency-utils.ts - Updated backend invoice email generation to use proper IDR formatting - Enhanced organization logo support across invoice preview and email templates - Added image upload functionality for organization logos - Created responsive invoice preview dialog with print/download capabilities - Updated invoice router to include organization data in API responses The changes ensure IDR amounts display as '1.000.000' instead of '1000000.00' while maintaining proper formatting for other currencies like USD, EUR, etc.
- Remove trailing whitespace - Improve line breaks for better readability - Apply consistent spacing and formatting - No functional changes, only style improvements
…and code refactoring
- Add address field to Organization model in Prisma schema - Update organization creation and editing forms to include address input - Add address field to organization info form with textarea component - Update tRPC organization router to handle address field in create/update operations - Update invoice email template to display organization address - Regenerate Zod schemas to include new address field - Ensure address is properly handled in both frontend forms and backend API
- Replace custom file upload with UploadThing service - Add UploadThing configuration and API routes - Create new uploadthing-image-upload component with improved UX - Update environment variables for UploadThing integration - Remove legacy upload route and image-upload component - Add comprehensive error handling and loading states - Support organization logos and other file uploads - Add documentation for UploadThing integration setup Breaking changes: - Removed src/app/api/upload/route.ts (replaced with UploadThing) - Removed src/components/ui/image-upload.tsx (replaced with uploadthing version) - Removed src/hooks/use-file-upload.ts (no longer needed) New files: - src/app/api/uploadthing/route.ts - UploadThing API endpoint - src/lib/uploadthing.ts - UploadThing client configuration - src/server/uploadthing.ts - UploadThing server configuration - src/components/ui/uploadthing-image-upload.tsx - New upload component - docs/guides/uploadthing-integration.md - Integration documentation
|
will review, wait! |
|
please migrate the db changes, I will test it ASAP |
|
also you should delete your prev PR #18 |
sorry i got an email that needed no add to prisma wheres the comment?
okay ill delete it |
Never mind, I deleted the comment |
|
and please make sure to run |
|
and please remove the organization-logo & user-avatar, since we don't need them |
on my way to fix it wait like 5-10 minutes, and is it in the prisma too ? or just the just in the uploadthing ? |
No, I meant to delete them from the |
its fine im waiting for your reply btw ahaha. i just make re-code and delete so its fine |
theres error in the nextjs build why is that ? |
🐛 Fix: Environment Variable Loading IssuesThis PR resolves critical environment variable loading issues that were preventing the application from starting properly. 🔧 Issues Fixed
💡 Root CauseThe main issue was in the // ❌ BEFORE - Immediate instantiation
export class WorkflowExecutionEngine {
private emailService = new EmailService(); // Fails if env vars not loaded
// ...
}This caused the 🛠️ Changes Made1. Enhanced Environment Schema (env.js)// Added missing Better Auth and Google OAuth variables
BETTER_AUTH_SECRET: z.string().min(1, "BETTER_AUTH_SECRET is required"),
BETTER_AUTH_URL: z.string().url().optional().default("http://localhost:3000"),
GOOGLE_CLIENT_ID: z.string().min(1, "GOOGLE_CLIENT_ID is required"),
GOOGLE_CLIENT_SECRET: z.string().min(1, "GOOGLE_CLIENT_SECRET is required"),2. Better Auth Configuration (auth.ts)// Added proper secret and baseURL configuration
export const auth = betterAuth({
database: prismaAdapter(prisma, { provider: "postgresql" }),
secret: process.env.BETTER_AUTH_SECRET!,
baseURL: process.env.BETTER_AUTH_URL,
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
},
});3. Lazy EmailService Initialization (workflow-engine.ts)// ✅ AFTER - Lazy initialization
export class WorkflowExecutionEngine {
private emailService?: EmailService; // Optional, created on demand
private getEmailService(): EmailService {
if (!this.emailService) {
this.emailService = new EmailService(); // Only create when needed
}
return this.emailService;
}
}✅ Testing
🚀 Benefits
📝 Environment File UpdatesThe .env file structure has been cleaned up and organized: # Better Auth
BETTER_AUTH_SECRET=...
BETTER_AUTH_URL=http://localhost:3000
# Google OAuth
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
# Resend
RESEND_API_KEY=...
RESEND_FROM_EMAIL=...
RESEND_FROM_NAME=...This PR ensures a smooth development experience and prevents the environment variable loading race conditions that were causing startup failures. |
- Add missing Better Auth environment variables to env.js schema - Configure Better Auth with secret and baseURL from environment - Implement lazy initialization for EmailService in WorkflowEngine - Fix Resend API key loading order issue preventing server startup Fixes startup errors: - Better Auth default secret warning - Google OAuth missing credentials warning - Resend API key initialization failure The WorkflowEngine now uses lazy initialization to prevent EmailService from being instantiated before environment variables are loaded.
15e3159 to
747d434
Compare
|
Hey man, sorry i can't accept your PR now because we are changing some things in the project, i really recommend working on the other issues in github i made, it is going to be helpful! |
Did you have discussion forum like discord or something my be i need more frequence discussion. I need to ask about the workflow too |
🚀 Add Organization Address Field & UploadThing Integration
📋 Overview
This PR introduces two major enhancements to the OpenSyte platform:
✨ Features
🏢 Organization Address Management
addressfield to the Organization model📤 UploadThing Integration
🔧 Technical Changes
Database & Schema
address: String?field toOrganizationmodelFrontend Components
Organization Forms Updated:
add-organization-dialog.tsx- Address field in creation formedit-organization-dialog.tsx- Address field in editing formNew Upload Component:
uploadthing-image-upload.tsx- Modern upload component with improved UXimage-upload.tsxcomponentBackend API
Organization Router:
Invoice Integration:
Infrastructure
UploadThing Setup:
📁 Files Changed
Added Files
Modified Files
Removed Files
🧪 Testing
📚 Documentation
🔄 Migration Notes
Database
nulladdress valuesEnvironment Variables
New required variables for UploadThing:
Breaking Changes
🎯 Impact
User Experience
Developer Experience
📋 Checklist
🚀 Deployment Notes
bun run db:pushCommits:
3829eea- feat: add organization address field1827270- feat: implement UploadThing integration for file uploads