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:
39
apps/server/src/repositories/mongo/models/UserModel.ts
Normal file
39
apps/server/src/repositories/mongo/models/UserModel.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import mongoose, { Schema, Document } from 'mongoose';
|
||||
import { User } from '@caldav/shared';
|
||||
|
||||
export interface UserDocument extends Omit<User, 'id'>, Document {}
|
||||
|
||||
const UserSchema = new Schema<UserDocument>(
|
||||
{
|
||||
email: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
lowercase: true,
|
||||
trim: true,
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
},
|
||||
passwordHash: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: {
|
||||
transform: (_, ret: Record<string, unknown>) => {
|
||||
ret.id = String(ret._id);
|
||||
delete ret._id;
|
||||
delete ret.__v;
|
||||
delete ret.passwordHash;
|
||||
return ret;
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
export const UserModel = mongoose.model<UserDocument>('User', UserSchema);
|
||||
Reference in New Issue
Block a user