Skip to content

Commit

Permalink
DDD & Hexagonal Arch
Browse files Browse the repository at this point in the history
  • Loading branch information
Guuri11 committed Jan 23, 2023
1 parent 3bd9116 commit dcac39c
Show file tree
Hide file tree
Showing 46 changed files with 112 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/swish/app/config/ApplicationConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.config;

import com.swish.app.repository.UserRepository;
import com.swish.app.infrastructure.persistence.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.swish.app.config;

import com.swish.app.infrastructure.security.JwtAuthenticationFilter;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import java.time.LocalDateTime;
import javax.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

public enum GameStatus {
SCHEDULED,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

public enum PlayerStatus {
HEALTHY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

public enum Role {
ADMIN,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.entity;
package com.swish.app.domain;

import java.util.Collection;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.GameController;
import com.swish.app.entity.Game;
import com.swish.app.domain.Game;
import com.swish.app.infrastructure.web.controller.GameController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.PlayerController;
import com.swish.app.entity.Player;
import com.swish.app.domain.Player;
import com.swish.app.infrastructure.web.controller.PlayerController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.PlayerStatsController;
import com.swish.app.entity.PlayerStats;
import com.swish.app.domain.PlayerStats;
import com.swish.app.infrastructure.web.controller.PlayerStatsController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.TeamController;
import com.swish.app.entity.Team;
import com.swish.app.domain.Team;
import com.swish.app.infrastructure.web.controller.TeamController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.TeamStatsController;
import com.swish.app.entity.TeamStats;
import com.swish.app.domain.TeamStats;
import com.swish.app.infrastructure.web.controller.TeamStatsController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.swish.app.entity.assembler;
package com.swish.app.domain.assembler;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.UserController;
import com.swish.app.entity.User;
import com.swish.app.domain.User;
import com.swish.app.infrastructure.web.controller.UserController;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.Game;
import com.swish.app.domain.Game;
import org.springframework.data.jpa.repository.JpaRepository;

public interface GameRepository extends JpaRepository<Game, Long> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.Player;
import com.swish.app.entity.Team;
import com.swish.app.domain.Player;
import com.swish.app.domain.Team;
import java.util.Collection;
import org.springframework.data.jpa.repository.JpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.Game;
import com.swish.app.entity.Player;
import com.swish.app.entity.PlayerStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.Player;
import com.swish.app.domain.PlayerStats;
import java.util.Collection;
import org.springframework.data.jpa.repository.JpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.Team;
import com.swish.app.domain.Team;
import org.springframework.data.jpa.repository.JpaRepository;

public interface TeamRepository extends JpaRepository<Team, Long> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.Game;
import com.swish.app.entity.Team;
import com.swish.app.entity.TeamStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.Team;
import com.swish.app.domain.TeamStats;
import java.util.Collection;
import org.springframework.data.jpa.repository.JpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.repository;
package com.swish.app.infrastructure.persistence;

import com.swish.app.entity.User;
import com.swish.app.domain.User;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.swish.app.config;
package com.swish.app.infrastructure.security;

import com.swish.app.security.JwtService;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.security;
package com.swish.app.infrastructure.security;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web;

import com.swish.app.entity.Game;
import com.swish.app.entity.PlayerStats;
import com.swish.app.entity.TeamStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.PlayerStats;
import com.swish.app.domain.TeamStats;
import com.swish.app.service.GameService;
import com.swish.app.service.PlayerStatsService;
import com.swish.app.service.TeamStatsService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.request.AuthenticationRequest;
import com.swish.app.request.RegisterRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.Game;
import com.swish.app.entity.Player;
import com.swish.app.entity.PlayerStats;
import com.swish.app.entity.TeamStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.Player;
import com.swish.app.domain.PlayerStats;
import com.swish.app.domain.TeamStats;
import com.swish.app.service.GameService;
import com.swish.app.service.PlayerService;
import com.swish.app.service.PlayerStatsService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.GameNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.Player;
import com.swish.app.entity.Team;
import com.swish.app.domain.Player;
import com.swish.app.domain.Team;
import com.swish.app.service.PlayerService;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.PlayerNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.Game;
import com.swish.app.entity.Player;
import com.swish.app.entity.PlayerStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.Player;
import com.swish.app.domain.PlayerStats;
import com.swish.app.service.PlayerStatsService;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.PlayerStatsNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.Team;
import com.swish.app.domain.Team;
import com.swish.app.service.TeamService;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.TeamNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.Game;
import com.swish.app.entity.Team;
import com.swish.app.entity.TeamStats;
import com.swish.app.domain.Game;
import com.swish.app.domain.Team;
import com.swish.app.domain.TeamStats;
import com.swish.app.service.TeamStatsService;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.TeamStatsNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.entity.User;
import com.swish.app.domain.User;
import com.swish.app.service.UserService;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.swish.app.controller;
package com.swish.app.infrastructure.web.controller;

import com.swish.app.exception.UserNotFoundException;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.swish.app.service;

import com.swish.app.entity.Role;
import com.swish.app.entity.User;
import com.swish.app.repository.UserRepository;
import com.swish.app.domain.Role;
import com.swish.app.domain.User;
import com.swish.app.infrastructure.persistence.UserRepository;
import com.swish.app.infrastructure.security.JwtService;
import com.swish.app.request.AuthenticationRequest;
import com.swish.app.request.RegisterRequest;
import com.swish.app.response.AuthenticationResponse;
import com.swish.app.security.JwtService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/swish/app/service/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import com.swish.app.controller.GameController;
import com.swish.app.entity.Game;
import com.swish.app.entity.assembler.GameAssembler;
import com.swish.app.domain.Game;
import com.swish.app.domain.assembler.GameAssembler;
import com.swish.app.exception.GameNotFoundException;
import com.swish.app.repository.GameRepository;
import com.swish.app.infrastructure.persistence.GameRepository;
import com.swish.app.infrastructure.web.controller.GameController;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.hateoas.CollectionModel;
Expand Down
Loading

0 comments on commit dcac39c

Please sign in to comment.