implement auth login and register with MongoDB
- Add AuthController login/register endpoints with error handling - Implement AuthService with password validation and user creation - Add MongoUserRepository with findByEmail and create methods - Implement password hashing with bcrypt - Add dotenv for environment variable support - Add Docker Compose setup for MongoDB + Mongo Express - Stub AuthMiddleware with fake user for testing - Update CLAUDE.md with implementation status
This commit is contained in:
@@ -8,10 +8,12 @@ export class MongoUserRepository implements UserRepository {
|
||||
}
|
||||
|
||||
async findByEmail(email: string): Promise<User | null> {
|
||||
throw new Error('Not implemented');
|
||||
const user = await UserModel.findOne({ email: email.toLowerCase() });
|
||||
return user ? user.toJSON() as User : null;
|
||||
}
|
||||
|
||||
async create(data: CreateUserData): Promise<User> {
|
||||
throw new Error('Not implemented');
|
||||
const user = await UserModel.create(data);
|
||||
return user.toJSON() as User;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user