chore: modularized persistence package (entity, repo, adapter)
This commit is contained in:
parent
1033c96d65
commit
5368425c1d
@ -6,8 +6,8 @@ import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = "com.pablotj")
|
||||
@EnableJpaRepositories(basePackages = "com.pablotj.portfolio.infrastructure.persistence.repo")
|
||||
@EntityScan(basePackages = "com.pablotj.portfolio.infrastructure.persistence.entity")
|
||||
@EnableJpaRepositories(basePackages = { "com.pablotj.portfolio.infrastructure.persistence.project.repo" })
|
||||
@EntityScan(basePackages = { "com.pablotj.portfolio.infrastructure.persistence.project.entity" })
|
||||
public class PortfolioApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
spring:
|
||||
application:
|
||||
name: portfolio-api
|
||||
web:
|
||||
resources:
|
||||
add-mappings: false
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
@ -13,6 +16,8 @@ spring:
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
context-path: /api
|
||||
|
||||
---
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.pablotj.portfolio.infrastructure.persistence.adapter;
|
||||
package com.pablotj.portfolio.infrastructure.persistence.project.adapter;
|
||||
|
||||
import com.pablotj.portfolio.domain.project.Project;
|
||||
import com.pablotj.portfolio.domain.project.ProjectId;
|
||||
import com.pablotj.portfolio.domain.project.port.ProjectRepositoryPort;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.entity.ProjectJpaEntity;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.mapper.ProjectJpaMapper;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.repo.SpringDataProjectRepository;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.project.entity.ProjectJpaEntity;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.project.mapper.ProjectJpaMapper;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.project.repo.SpringDataProjectRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package com.pablotj.portfolio.infrastructure.persistence.entity;
|
||||
package com.pablotj.portfolio.infrastructure.persistence.project.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
@ -1,8 +1,8 @@
|
||||
package com.pablotj.portfolio.infrastructure.persistence.mapper;
|
||||
package com.pablotj.portfolio.infrastructure.persistence.project.mapper;
|
||||
|
||||
import com.pablotj.portfolio.domain.project.Project;
|
||||
import com.pablotj.portfolio.domain.project.ProjectId;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.entity.ProjectJpaEntity;
|
||||
import com.pablotj.portfolio.infrastructure.persistence.project.entity.ProjectJpaEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
@ -0,0 +1,6 @@
|
||||
package com.pablotj.portfolio.infrastructure.persistence.project.repo;
|
||||
|
||||
import com.pablotj.portfolio.infrastructure.persistence.project.entity.ProjectJpaEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SpringDataProjectRepository extends JpaRepository<ProjectJpaEntity, Long> {}
|
@ -1,6 +0,0 @@
|
||||
package com.pablotj.portfolio.infrastructure.persistence.repo;
|
||||
|
||||
import com.pablotj.portfolio.infrastructure.persistence.entity.ProjectJpaEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SpringDataProjectRepository extends JpaRepository<ProjectJpaEntity, Long> {}
|
@ -1,10 +1,10 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.controller;
|
||||
package com.pablotj.portfolio.infrastructure.rest.project.controller;
|
||||
|
||||
import com.pablotj.portfolio.application.project.CreateProjectUseCase;
|
||||
import com.pablotj.portfolio.application.project.GetProjectUseCase;
|
||||
import com.pablotj.portfolio.infrastructure.rest.dto.CreateProjectRequest;
|
||||
import com.pablotj.portfolio.infrastructure.rest.dto.ProjectDto;
|
||||
import com.pablotj.portfolio.infrastructure.rest.mapper.ProjectRestMapper;
|
||||
import com.pablotj.portfolio.infrastructure.rest.project.dto.CreateProjectRequest;
|
||||
import com.pablotj.portfolio.infrastructure.rest.project.dto.ProjectDto;
|
||||
import com.pablotj.portfolio.infrastructure.rest.project.mapper.ProjectRestMapper;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -13,7 +13,7 @@ import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/projects")
|
||||
@RequestMapping("/v1/projects")
|
||||
public class ProjectController {
|
||||
|
||||
private final CreateProjectUseCase createUC;
|
@ -1,4 +1,4 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.dto;
|
||||
package com.pablotj.portfolio.infrastructure.rest.project.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.dto;
|
||||
package com.pablotj.portfolio.infrastructure.rest.project.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.mapper;
|
||||
package com.pablotj.portfolio.infrastructure.rest.project.mapper;
|
||||
|
||||
import com.pablotj.portfolio.domain.project.Project;
|
||||
import com.pablotj.portfolio.infrastructure.rest.dto.ProjectDto;
|
||||
import com.pablotj.portfolio.infrastructure.rest.project.dto.ProjectDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
Loading…
x
Reference in New Issue
Block a user