implement chat messaging with event proposals
- Add functional chat with server communication and test responses - Add ProposedEventCard component for confirm/reject actions - Move Constants (Day, Month) from client to shared package - Add dateHelpers utility for weekday calculations - Extend Themes.tsx with button and text colors - Update CLAUDE.md with current implementation status - Add *.tsbuildinfo to .gitignore
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Response } from 'express';
|
||||
import { SendMessageDTO } from '@caldav/shared';
|
||||
import { ChatService } from '../services';
|
||||
import { AuthenticatedRequest } from '../middleware';
|
||||
|
||||
@@ -6,15 +7,36 @@ export class ChatController {
|
||||
constructor(private chatService: ChatService) {}
|
||||
|
||||
async sendMessage(req: AuthenticatedRequest, res: Response): Promise<void> {
|
||||
throw new Error('Not implemented');
|
||||
try {
|
||||
const userId = req.user!.userId;
|
||||
const data: SendMessageDTO = req.body;
|
||||
const response = await this.chatService.processMessage(userId, data);
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to process message' });
|
||||
}
|
||||
}
|
||||
|
||||
async confirmEvent(req: AuthenticatedRequest, res: Response): Promise<void> {
|
||||
throw new Error('Not implemented');
|
||||
try {
|
||||
const userId = req.user!.userId;
|
||||
const { conversationId, messageId } = req.params;
|
||||
const response = await this.chatService.confirmEvent(userId, conversationId, messageId);
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to confirm event' });
|
||||
}
|
||||
}
|
||||
|
||||
async rejectEvent(req: AuthenticatedRequest, res: Response): Promise<void> {
|
||||
throw new Error('Not implemented');
|
||||
try {
|
||||
const userId = req.user!.userId;
|
||||
const { conversationId, messageId } = req.params;
|
||||
const response = await this.chatService.rejectEvent(userId, conversationId, messageId);
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to reject event' });
|
||||
}
|
||||
}
|
||||
|
||||
async getConversations(req: AuthenticatedRequest, res: Response): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user