implement backend skeleton with MongoDB and Claude AI integration
- Add controllers (Auth, Chat, Event) with placeholder implementations - Add services (Auth, Chat, Event) with business logic interfaces - Add repositories with MongoDB/Mongoose models (User, Event, Chat) - Add middleware for JWT authentication - Add Claude AI adapter implementing AIProvider interface - Add utility modules for JWT and password handling - Add shared types and DTOs for User, CalendarEvent, ChatMessage - Configure routes with proper endpoint structure - Update app.ts with dependency injection setup - Add required dependencies: mongoose, bcrypt, jsonwebtoken, @anthropic-ai/sdk
This commit is contained in:
56
apps/server/src/repositories/mongo/models/EventModel.ts
Normal file
56
apps/server/src/repositories/mongo/models/EventModel.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import mongoose, { Schema, Document } from 'mongoose';
|
||||
import { CalendarEvent } from '@caldav/shared';
|
||||
|
||||
export interface EventDocument extends Omit<CalendarEvent, 'id'>, Document {}
|
||||
|
||||
const EventSchema = new Schema<EventDocument>(
|
||||
{
|
||||
userId: {
|
||||
type: String,
|
||||
required: true,
|
||||
index: true,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
startTime: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
endTime: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
note: {
|
||||
type: String,
|
||||
},
|
||||
isRecurring: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
recurrenceRule: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: {
|
||||
transform: (_, ret: Record<string, unknown>) => {
|
||||
ret.id = String(ret._id);
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
return ret;
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
EventSchema.index({ userId: 1, startTime: 1, endTime: 1 });
|
||||
|
||||
export const EventModel = mongoose.model<EventDocument>('Event', EventSchema);
|
||||
Reference in New Issue
Block a user