negyedik gyakorlat + megoldasok

This commit is contained in:
magdo
2026-03-04 20:02:39 +01:00
parent afc3777ac9
commit 388aa908de
217 changed files with 19791 additions and 0 deletions
@@ -0,0 +1,13 @@
const UserRepository = require('../../../infrastructure/repositories/UserRepository');
class GetAllUsersHandler {
constructor() {
this.userRepository = new UserRepository();
}
async handle(query) {
return await this.userRepository.findAll();
}
}
module.exports = GetAllUsersHandler;
@@ -0,0 +1,5 @@
class GetAllUsersQuery {
constructor() {}
}
module.exports = GetAllUsersQuery;
@@ -0,0 +1,17 @@
const UserRepository = require('../../../infrastructure/repositories/UserRepository');
class GetUserHandler {
constructor() {
this.userRepository = new UserRepository();
}
async handle(query) {
const user = await this.userRepository.findById(query.id);
if (!user) {
throw new Error('User nem található');
}
return user;
}
}
module.exports = GetUserHandler;
@@ -0,0 +1,7 @@
class GetUserQuery {
constructor(id) {
this.id = id;
}
}
module.exports = GetUserQuery;