-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(it-6): dayly suggestions for all users
- Loading branch information
1 parent
518bc3f
commit 7381343
Showing
3 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
01-lecture/quemepongo/src/main/java/quemepongo/repositories/UsuariosRegistrados.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package quemepongo.repositories; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import quemepongo.model.usuario.Usuario; | ||
import quemepongo.model.usuario.guardarropa.Guardarropa; | ||
|
||
/** | ||
* Repositorio de Usuario de Que me Pongo. | ||
* | ||
* @since 06.10.2021 | ||
* @version 1.0 | ||
*/ | ||
public class UsuariosRegistrados { | ||
|
||
List<Usuario> usuarios = new ArrayList<Usuario>(); | ||
|
||
public List<Usuario> getUsuarios() { | ||
return usuarios; | ||
} | ||
|
||
public UsuariosRegistrados setUsuarios(List<Usuario> usuarios) { | ||
this.usuarios = usuarios; | ||
return this; | ||
} | ||
|
||
/** | ||
* Obtiene todos los guardarropas de los usuarios | ||
* | ||
* @return listado de guardarropas | ||
*/ | ||
public List<Guardarropa> getAllGuardarropas() { | ||
List<Guardarropa> guardarropas = new ArrayList<Guardarropa>(); | ||
getUsuarios().stream().map(Usuario::getAllGuardarropas).collect(Collectors.toList()) | ||
.forEach(list -> list.addAll(guardarropas)); | ||
return guardarropas; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...cture/quemepongo/src/main/java/quemepongo/service/usuario/LauncherDeSugerenciaDiaria.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package quemepongo.service.usuario; | ||
|
||
import quemepongo.model.usuario.guardarropa.Guardarropa; | ||
import quemepongo.repositories.UsuariosRegistrados; | ||
|
||
public class LauncherDeSugerenciaDiaria { | ||
|
||
UsuariosRegistrados repositorio; | ||
|
||
public LauncherDeSugerenciaDiaria(UsuariosRegistrados repositorio) { | ||
this.repositorio = repositorio; | ||
} | ||
|
||
public UsuariosRegistrados getRepositorio() { | ||
return repositorio; | ||
} | ||
|
||
public LauncherDeSugerenciaDiaria setRepositorio(UsuariosRegistrados repositorio) { | ||
this.repositorio = repositorio; | ||
return this; | ||
} | ||
|
||
public LauncherDeSugerenciaDiaria sugerirAtuendos() { | ||
repositorio.getAllGuardarropas().forEach(Guardarropa::sugerirAtuendo); | ||
return this; | ||
} | ||
|
||
} |