mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
✅ Core Stability Achievements: - Demo user login working (demo@omnivore.app / demo_password) - PDF upload, viewing, highlighting, and notes fully functional - Database persistence across container restarts - Redis connection issues resolved 🔧 Infrastructure Improvements: - Added PostgreSQL persistent volumes (postgres_data, postgres_replica_data) - Fixed Redis configuration with proper URLs and missing MQ_REDIS_URL - Enhanced demo user creation with corrected ON CONFLICT clause - Improved PDF content handler with better title extraction 🐛 Bug Fixes: - Fixed demo user authentication by correcting setup.sh ON CONFLICT - Resolved Redis connection errors in API and content-fetch services - Enhanced RSS handler Redis client with null-check safety - Added mail server data to gitignore 📚 Documentation: - Added development vs production guide - Added troubleshooting documentation - Added Cursor AI rules for consistent development 🎯 Next Phase Ready: Stable foundation established for implementing link upload/saving functionality.
82 lines
2.2 KiB
TypeScript
82 lines
2.2 KiB
TypeScript
import { ConnectionOptions, Job, QueueEvents, Worker } from 'bullmq'
|
|
import { createServer, Server } from 'http'
|
|
// import { nanoid } from 'nanoid'
|
|
import supertest, { SuperTest, Test } from 'supertest'
|
|
import { v4 } from 'uuid'
|
|
import { makeApolloServer } from '../src/apollo'
|
|
import { BACKEND_QUEUE_NAME, createWorker } from '../src/queue-processor'
|
|
import { createApp } from '../src/server'
|
|
import { corsConfig } from '../src/utils/corsConfig'
|
|
|
|
import express from 'express'
|
|
import { ApolloServer } from 'apollo-server-express'
|
|
|
|
let app: express.Application
|
|
let httpServer: Server
|
|
let apollo: ApolloServer
|
|
export let request: ReturnType<typeof supertest>
|
|
|
|
let worker: Worker
|
|
let queueEvents: QueueEvents
|
|
|
|
export const startApolloServer = async () => {
|
|
const expressApp = await createApp()
|
|
app = expressApp
|
|
httpServer = createServer(app)
|
|
apollo = await makeApolloServer(app as any, httpServer)
|
|
request = supertest(app)
|
|
|
|
await apollo.start()
|
|
void apollo.applyMiddleware({ app, path: '/api/graphql', cors: corsConfig })
|
|
}
|
|
|
|
export const stopApolloServer = async () => {
|
|
await apollo.stop()
|
|
}
|
|
|
|
export const startWorker = (connection: ConnectionOptions) => {
|
|
worker = createWorker(connection)
|
|
queueEvents = new QueueEvents(BACKEND_QUEUE_NAME, {
|
|
connection,
|
|
})
|
|
}
|
|
|
|
export const stopWorker = async () => {
|
|
await queueEvents.close()
|
|
await worker.close()
|
|
}
|
|
|
|
export const waitUntilJobsDone = async (jobs: Job[]) => {
|
|
await Promise.all(
|
|
jobs.map((job) => job.waitUntilFinished(queueEvents, 10000))
|
|
)
|
|
}
|
|
|
|
export const graphqlRequest = (
|
|
query: string,
|
|
authToken: string,
|
|
variables?: Record<string, unknown>
|
|
): supertest.Test => {
|
|
return request
|
|
.post(apollo.graphqlPath)
|
|
.send({ query, variables })
|
|
.set('Accept', 'application/json')
|
|
.set('authorization', authToken)
|
|
.expect('Content-Type', /json/)
|
|
}
|
|
|
|
export const generateFakeUuid = () => {
|
|
return v4()
|
|
}
|
|
|
|
export const generateFakeShortId = () => {
|
|
return crypto.randomUUID().slice(0, 8)
|
|
}
|
|
|
|
export const loginAndGetAuthToken = async (email: string) => {
|
|
const res = await request
|
|
.post('/local/debug/fake-user-login')
|
|
.send({ fakeEmail: email })
|
|
|
|
return res.body.authToken as string
|
|
}
|