feat: implement Phase 1 Foundation for AutoScheduler GTD System

- Initialize npm workspaces monorepo (backend, frontend, shared-types)
- Scaffold NestJS backend with modules: Auth, Users, Tasks, Projects, Inbox, Health
- Create React frontend with Vite, TailwindCSS, Radix UI
- Implement TypeORM entities: User, InboxItem, Task, Project
- Add JWT authentication with Passport.js and bcrypt
- Build Inbox capture API (POST /inbox, GET /inbox, POST /inbox/:id/process)
- Create Inbox UI with quick-add form and GTD processing workflow modal
- Configure Docker Compose stack (postgres, redis, backend, frontend)
- Add health check endpoint with database/Redis status
- Write unit tests for auth and inbox services

Phase 1 features complete:
- GTD Inbox Capture: Manual tasks via web form quick-add
- GTD Processing Workflow: Interactive inbox processing interface

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-01-11 08:42:54 +00:00
parent ce0e5f1769
commit 64b8e0d80c
90 changed files with 21021 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
import { Injectable, Logger } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import Redis from 'ioredis';
import type { HealthCheckResponseDto } from '@nick-tracker/shared-types';
@Injectable()
export class HealthService {
private readonly logger = new Logger(HealthService.name);
private redis: Redis | null = null;
constructor(
private readonly dataSource: DataSource,
private readonly configService: ConfigService,
) {
this.initRedis();
}
private initRedis() {
const redisUrl = this.configService.get<string>('REDIS_URL');
if (redisUrl) {
try {
this.redis = new Redis(redisUrl);
} catch (error) {
this.logger.warn('Failed to connect to Redis:', error);
}
}
}
async check(): Promise<HealthCheckResponseDto> {
const dbStatus = await this.checkDatabase();
const redisStatus = await this.checkRedis();
return {
status: dbStatus === 'connected' && redisStatus === 'connected' ? 'ok' : 'error',
database: dbStatus,
redis: redisStatus,
};
}
private async checkDatabase(): Promise<'connected' | 'disconnected'> {
try {
if (this.dataSource.isInitialized) {
await this.dataSource.query('SELECT 1');
return 'connected';
}
return 'disconnected';
} catch (error) {
this.logger.warn('Database health check failed:', error);
return 'disconnected';
}
}
private async checkRedis(): Promise<'connected' | 'disconnected'> {
if (!this.redis) {
return 'disconnected';
}
try {
const result = await this.redis.ping();
return result === 'PONG' ? 'connected' : 'disconnected';
} catch (error) {
this.logger.warn('Redis health check failed:', error);
return 'disconnected';
}
}
}