Add all layers.
This commit is contained in:
29
sportshub-infrastructure/pom.xml
Normal file
29
sportshub-infrastructure/pom.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.sportshub</groupId>
|
||||
<artifactId>sportshub-parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<artifactId>sportshub-infrastructure</artifactId>
|
||||
|
||||
<name>sportshub-infrastructure</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.sportshub</groupId>
|
||||
<artifactId>sportshub-domain</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.sportshub.infrastructure.user.adapter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.sportshub.domain.user.model.User;
|
||||
import org.sportshub.domain.user.port.UserPort;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class UserInMemoryAdapter implements UserPort {
|
||||
private static final List<User> users = List.of(
|
||||
new User(UUID.fromString("c1a0805f-c618-47dc-bae7-bee70503644e"), "password"),
|
||||
new User(UUID.fromString("4eff194d-dd8e-463e-974f-034bfd509f84"), "password"),
|
||||
new User(UUID.fromString("c78d7d7c-0386-415d-86dc-98a470591e07"), "password")
|
||||
);
|
||||
|
||||
@Override
|
||||
public Optional<User> findById(final UUID userId) {
|
||||
return users.stream()
|
||||
.filter(user -> userId.equals(user.id()))
|
||||
.findFirst();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user