Skip to content

Instantly share code, notes, and snippets.

View Sama-004's full-sized avatar

samanyu Sama-004

View GitHub Profile
FROM oven/bun:alpine AS base
# Stage 1: Install dependencies
FROM base AS deps
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
# Stage 2: Build the application
FROM base AS builder
services:
web:
restart: always
build: .
ports:
- '3000:3000'
environment:
- NODE_ENV=production
- NEXT_PUBLIC_ADMIN_EMAIL=${NEXT_PUBLIC_ADMIN_EMAIL}
- NEXT_PUBLIC_ADMIN_PASSWORD=${NEXT_PUBLIC_ADMIN_PASSWORD}
export async function loader({ request }: LoaderFunctionArgs) {
const emails = db query 1 (without await)
const folders = db query 2 (without await)
return defer({
emails,
folders,
});
}
let cache = {
export async function action({ request, params }: ActionFunctionArgs) {
const formData = await request.formData();
const message = formData.get("message");
const userId = params.id;
const newChat = await db
.insert(chats)
.values({
userId: userId as string,
title: `New Chat ${Date.now().toString()}`,
export async function loader({ params }: LoaderFunctionArgs) {
//find messages from db
return {
chatMessages,
};
}
// this is for new messages
export async function action({ request, params }: ActionFunctionArgs) {
const formData = await request.formData();
@Sama-004
Sama-004 / store-draft.ts
Created February 26, 2025 17:13
earlier when we were storing draft without any reference, it was working fine
'From: ' + this.emailProvider.email,
'To: ' + data.to,
'Subject: ' + data.subject,
'Date: ' + date,
'Content-Type: multipart/alternative; boundary="boundary"',
'MIME-Version: 1.0',
'',
'--boundary',
'Content-Type: text/plain; charset=utf-8',
'Content-Transfer-Encoding: 7bit',
const messageParts = [
`From: ${emailProvider.email}`,
`To: ${Array.isArray(data.to) ? data.to.join(', ') : data.to}`,
`Subject: ${encodeHeader(data.subject || '')}`,
`Date: ${date}`,
`Message-ID: ${data.messageId}`,
//this is what is causing the error
data.references?.length
? `References: ${data.references.join(' ')}`
: null,