commit
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ spring:
|
||||
# value.serializer: com.amrut.prabhu.dto.coverters.MessageSerializer
|
||||
binder:
|
||||
brokers: mindol.synology.me:19092
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
path: /h2-console
|
||||
settings:
|
||||
web-allow-others: true
|
||||
# h2:
|
||||
# console:
|
||||
# enabled: true
|
||||
# path: /h2-console
|
||||
# settings:
|
||||
# web-allow-others: true
|
||||
datasource:
|
||||
url: jdbc:mariadb://mindol.synology.me:3307/kiz_space
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.8'
|
||||
id 'org.springframework.boot' version '2.7.9'
|
||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ dependencies {
|
||||
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth:3.1.6'
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
runtimeOnly 'com.h2database:h2'
|
||||
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.kiz;
|
||||
package com.kiz.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
import com.kiz.adapter.out.persistence.jpa.StoreJpaRepository;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
// @EnableJpaRepositories(basePackages = "com.kiz.adapter.out.persistence.jpa")
|
||||
@EnableJpaRepositories(basePackageClasses = StoreJpaRepository.class)
|
||||
// @EnableJpaRepositories(basePackageClasses = StoreJpaRepository.class)
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class ProductServiceApplication {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.in.web.api;
|
||||
package com.kiz.app.adapter.in.web.api;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@@ -7,21 +7,19 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.kiz.adapter.in.web.dto.StoreCreateRequest;
|
||||
import com.kiz.application.command.CreateStoreCommand;
|
||||
import com.kiz.application.port.in.CreateStoreUseCase;
|
||||
import com.kiz.app.adapter.in.web.dto.StoreCreateRequest;
|
||||
import com.kiz.app.application.command.CreateStoreCommand;
|
||||
import com.kiz.app.application.port.in.CreateStoreUseCase;
|
||||
import com.kiz.common.WebAdapter;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@WebAdapter
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/store")
|
||||
@WebAdapter
|
||||
public class StoreCreateController {
|
||||
|
||||
private final CreateStoreUseCase createStoreUseCase;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.in.web.dto;
|
||||
package com.kiz.app.adapter.in.web.dto;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.out.message;
|
||||
package com.kiz.app.adapter.out.message;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
package com.kiz.adapter.out.persistence;
|
||||
package com.kiz.app.adapter.out.persistence;
|
||||
|
||||
import org.springframework.cloud.sleuth.annotation.NewSpan;
|
||||
|
||||
import com.kiz.application.port.out.LoadStorePort;
|
||||
import com.kiz.application.port.out.SaveStorePort;
|
||||
import com.kiz.application.port.out.UpdateStorePort;
|
||||
import com.kiz.app.application.port.out.LoadStorePort;
|
||||
import com.kiz.app.application.port.out.SaveStorePort;
|
||||
import com.kiz.app.application.port.out.UpdateStorePort;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.common.PersistenceAdapter;
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.event.EventStoreDB;
|
||||
|
||||
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
|
||||
import io.github.resilience4j.retry.annotation.Retry;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@PersistenceAdapter
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@RequiredArgsConstructor
|
||||
@PersistenceAdapter
|
||||
public class StoreCommandAdapter implements SaveStorePort, UpdateStorePort, LoadStorePort {
|
||||
|
||||
private final EventStoreDB eventStoreDB;
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.kiz.adapter.out.persistence;
|
||||
package com.kiz.app.adapter.out.persistence;
|
||||
|
||||
import com.kiz.adapter.out.persistence.jpa.StoreJpaRepository;
|
||||
import com.kiz.application.port.out.GetStoreByIdPort;
|
||||
import com.kiz.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.app.adapter.out.persistence.jpa.StoreJpaRepository;
|
||||
import com.kiz.app.application.port.out.GetStoreByIdPort;
|
||||
import com.kiz.app.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.common.PersistenceAdapter;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@PersistenceAdapter
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@RequiredArgsConstructor
|
||||
@PersistenceAdapter
|
||||
public class StoreQueryAdapter implements GetStoreByIdPort {
|
||||
|
||||
private final StoreJpaRepository storeJpaRepository;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.out.persistence.jdbc;
|
||||
package com.kiz.app.adapter.out.persistence.jdbc;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -27,9 +27,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static com.kiz.event.Constants.*;
|
||||
|
||||
// @Repository
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Repository
|
||||
public class JdbcEventStore implements EventStoreDB {
|
||||
|
||||
public static final int SNAPSHOT_FREQUENCY = 3;
|
||||
@@ -40,7 +40,7 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
private static final String LOAD_SNAPSHOT_QUERY = "SELECT aggregate_id, aggregate_type, data, metadata, version, timestamp FROM snapshots s WHERE s.aggregate_id = :aggregate_id";
|
||||
private static final String EXISTS_QUERY = "SELECT aggregate_id FROM events WHERE e e.aggregate_id = :aggregate_id";
|
||||
|
||||
// private final NamedParameterJdbcTemplate jdbcTemplate;
|
||||
private final NamedParameterJdbcTemplate jdbcTemplate;
|
||||
private final EventBus eventBus;
|
||||
|
||||
@Override
|
||||
@@ -96,8 +96,8 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
}
|
||||
|
||||
final Event event = changes.get(0);
|
||||
// int result = jdbcTemplate.update(SAVE_EVENTS_QUERY, mapFromEvent(event));
|
||||
// log.info("(saveEvents) saved result: {}, event: {}", result, event);
|
||||
int result = jdbcTemplate.update(SAVE_EVENTS_QUERY, mapFromEvent(event));
|
||||
log.info("(saveEvents) saved result: {}, event: {}", result, event);
|
||||
}
|
||||
|
||||
private Map<String, Serializable> mapFromEvent(Event event) {
|
||||
@@ -116,24 +116,23 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
final var args = events.stream().map(this::mapFromEvent).toList();
|
||||
final Map<String, ?>[] maps = args.toArray(new Map[0]);
|
||||
|
||||
// int[] ints = jdbcTemplate.batchUpdate(SAVE_EVENTS_QUERY, maps);
|
||||
// log.info("(saveEvents) BATCH saved result: {}, event: {}", ints);
|
||||
int[] ints = jdbcTemplate.batchUpdate(SAVE_EVENTS_QUERY, maps);
|
||||
log.info("(saveEvents) BATCH saved result: {}, event: {}", ints);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NewSpan
|
||||
public List<Event> loadEvents(@SpanTag("aggregateId") String aggregateId, @SpanTag("version") long version) {
|
||||
// return jdbcTemplate.query(LOAD_EVENTS_QUERY, Map.of(AGGREGATE_ID, aggregateId, VERSION, version),
|
||||
// (rs, rowNum) -> Event.builder()
|
||||
// .aggregateId(rs.getString(AGGREGATE_ID))
|
||||
// .aggregateType(rs.getString(AGGREGATE_TYPE))
|
||||
// .eventType(rs.getString(EVENT_TYPE))
|
||||
// .data(rs.getBytes(DATA))
|
||||
// .metaData(rs.getBytes(METADATA))
|
||||
// .version(rs.getLong(VERSION))
|
||||
// .timeStamp(rs.getTimestamp(TIMESTAMP).toLocalDateTime())
|
||||
// .build());
|
||||
return null;
|
||||
return jdbcTemplate.query(LOAD_EVENTS_QUERY, Map.of(AGGREGATE_ID, aggregateId, VERSION, version),
|
||||
(rs, rowNum) -> Event.builder()
|
||||
.aggregateId(rs.getString(AGGREGATE_ID))
|
||||
.aggregateType(rs.getString(AGGREGATE_TYPE))
|
||||
.eventType(rs.getString(EVENT_TYPE))
|
||||
.data(rs.getBytes(DATA))
|
||||
.metaData(rs.getBytes(METADATA))
|
||||
.version(rs.getLong(VERSION))
|
||||
.timeStamp(rs.getTimestamp(TIMESTAMP).toLocalDateTime())
|
||||
.build());
|
||||
}
|
||||
|
||||
@NewSpan
|
||||
@@ -141,21 +140,21 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
aggregate.toSnapshot();
|
||||
final var snapshot = EventSourcingUtils.snapshotFromAggregate(aggregate);
|
||||
|
||||
// int updateResult = jdbcTemplate.update(SAVE_SNAPSHOT_QUERY,
|
||||
// Map.of(AGGREGATE_ID, snapshot.getAggregateId(),
|
||||
// AGGREGATE_TYPE, snapshot.getAggregateType(),
|
||||
// DATA, Objects.isNull(snapshot.getData()) ? new byte[]{} : snapshot.getData(),
|
||||
// METADATA, Objects.isNull(snapshot.getMetaData()) ? new byte[]{} : snapshot.getMetaData(),
|
||||
// VERSION, snapshot.getVersion()));
|
||||
int updateResult = jdbcTemplate.update(SAVE_SNAPSHOT_QUERY,
|
||||
Map.of(AGGREGATE_ID, snapshot.getAggregateId(),
|
||||
AGGREGATE_TYPE, snapshot.getAggregateType(),
|
||||
DATA, Objects.isNull(snapshot.getData()) ? new byte[]{} : snapshot.getData(),
|
||||
METADATA, Objects.isNull(snapshot.getMetaData()) ? new byte[]{} : snapshot.getMetaData(),
|
||||
VERSION, snapshot.getVersion()));
|
||||
|
||||
// log.info("(saveSnapshot) updateResult: {}", updateResult);
|
||||
log.info("(saveSnapshot) updateResult: {}", updateResult);
|
||||
}
|
||||
|
||||
@NewSpan
|
||||
private void handleConcurrency(@SpanTag("aggregateId") String aggregateId) {
|
||||
try {
|
||||
// String aggregateID = jdbcTemplate.queryForObject(HANDLE_CONCURRENCY_QUERY, Map.of(AGGREGATE_ID, aggregateId), String.class);
|
||||
// log.info("(handleConcurrency) aggregateID for lock: {}", aggregateID);
|
||||
String aggregateID = jdbcTemplate.queryForObject(HANDLE_CONCURRENCY_QUERY, Map.of(AGGREGATE_ID, aggregateId), String.class);
|
||||
log.info("(handleConcurrency) aggregateID for lock: {}", aggregateID);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
log.info("(handleConcurrency) EmptyResultDataAccessException: {}", e.getMessage());
|
||||
}
|
||||
@@ -164,15 +163,14 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
|
||||
@NewSpan
|
||||
private Optional<Snapshot> loadSnapshot(@SpanTag("aggregateId") String aggregateId) {
|
||||
// return jdbcTemplate.query(LOAD_SNAPSHOT_QUERY, Map.of(AGGREGATE_ID, aggregateId), (rs, rowNum) -> Snapshot.builder()
|
||||
// .aggregateId(rs.getString(AGGREGATE_ID))
|
||||
// .aggregateType(rs.getString(AGGREGATE_TYPE))
|
||||
// .data(rs.getBytes(DATA))
|
||||
// .metaData(rs.getBytes(METADATA))
|
||||
// .version(rs.getLong(VERSION))
|
||||
// .timeStamp(rs.getTimestamp(TIMESTAMP).toLocalDateTime())
|
||||
// .build()).stream().findFirst();
|
||||
return null;
|
||||
return jdbcTemplate.query(LOAD_SNAPSHOT_QUERY, Map.of(AGGREGATE_ID, aggregateId), (rs, rowNum) -> Snapshot.builder()
|
||||
.aggregateId(rs.getString(AGGREGATE_ID))
|
||||
.aggregateType(rs.getString(AGGREGATE_TYPE))
|
||||
.data(rs.getBytes(DATA))
|
||||
.metaData(rs.getBytes(METADATA))
|
||||
.version(rs.getLong(VERSION))
|
||||
.timeStamp(rs.getTimestamp(TIMESTAMP).toLocalDateTime())
|
||||
.build()).stream().findFirst();
|
||||
}
|
||||
|
||||
@NewSpan
|
||||
@@ -197,8 +195,8 @@ public class JdbcEventStore implements EventStoreDB {
|
||||
@NewSpan
|
||||
public Boolean exists(@SpanTag("aggregateId") String aggregateId) {
|
||||
try {
|
||||
// final var id = jdbcTemplate.queryForObject(EXISTS_QUERY, Map.of(AGGREGATE_ID, aggregateId), String.class);
|
||||
// log.info("aggregate exists id: {}", id);
|
||||
final var id = jdbcTemplate.queryForObject(EXISTS_QUERY, Map.of(AGGREGATE_ID, aggregateId), String.class);
|
||||
log.info("aggregate exists id: {}", id);
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
if (!(ex instanceof EmptyResultDataAccessException)) {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.out.persistence.jpa;
|
||||
package com.kiz.app.adapter.out.persistence.jpa;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.out.persistence.jpa;
|
||||
package com.kiz.app.adapter.out.persistence.jpa;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.adapter.out.persistence.projection;
|
||||
package com.kiz.app.adapter.out.persistence.projection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -9,10 +9,10 @@ import org.springframework.cloud.sleuth.annotation.SpanTag;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kiz.adapter.out.persistence.jpa.StoreEntity;
|
||||
import com.kiz.adapter.out.persistence.jpa.StoreJpaRepository;
|
||||
import com.kiz.domain.event.StoreCreateEvent;
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.app.adapter.out.persistence.jpa.StoreEntity;
|
||||
import com.kiz.app.adapter.out.persistence.jpa.StoreJpaRepository;
|
||||
import com.kiz.app.domain.event.StoreCreateEvent;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.event.Event;
|
||||
import com.kiz.event.EventStoreDB;
|
||||
import com.kiz.event.Projection;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.application.command;
|
||||
package com.kiz.app.application.command;
|
||||
|
||||
public record CreateStoreCommand(String storeName, String storeLocation, String storeDescription) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.application.command;
|
||||
package com.kiz.app.application.command;
|
||||
|
||||
public record UpdateStoreCommand(String aggregateId, String storeName, String storeLocation, String storeDescription) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.kiz.app.application.port.in;
|
||||
|
||||
import com.kiz.app.application.command.CreateStoreCommand;
|
||||
|
||||
public interface CreateStoreUseCase {
|
||||
String handle(CreateStoreCommand command);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.application.port.in;
|
||||
package com.kiz.app.application.port.in;
|
||||
|
||||
public interface FindAllStoreUseCase {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.application.port.in;
|
||||
package com.kiz.app.application.port.in;
|
||||
|
||||
public interface FindSearchStoreUseCase {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.kiz.app.application.port.in;
|
||||
|
||||
import com.kiz.app.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface GetStoreByIdUseCase {
|
||||
Store handle(GetStoreByIdQuery query);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.kiz.app.application.port.in;
|
||||
|
||||
import com.kiz.app.application.command.UpdateStoreCommand;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface UpdateStoreUseCase {
|
||||
Store handle(UpdateStoreCommand command);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.kiz.app.application.port.out;
|
||||
|
||||
import com.kiz.app.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface GetStoreByIdPort {
|
||||
Store getStoreById(GetStoreByIdQuery query);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.kiz.app.application.port.out;
|
||||
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface LoadStorePort {
|
||||
Store load(String aggregateId);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.kiz.app.application.port.out;
|
||||
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface SaveStorePort {
|
||||
String save(Store aggregate);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.kiz.app.application.port.out;
|
||||
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface UpdateStorePort {
|
||||
Store updateStore(Store aggregate);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.application.query;
|
||||
package com.kiz.app.application.query;
|
||||
|
||||
public record GetStoreByIdQuery(Long id) {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.kiz.application.service;
|
||||
package com.kiz.app.application.service;
|
||||
|
||||
import com.kiz.application.command.CreateStoreCommand;
|
||||
import com.kiz.application.port.in.CreateStoreUseCase;
|
||||
import com.kiz.application.port.out.SaveStorePort;
|
||||
import com.kiz.app.application.command.CreateStoreCommand;
|
||||
import com.kiz.app.application.port.in.CreateStoreUseCase;
|
||||
import com.kiz.app.application.port.out.SaveStorePort;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.common.UseCase;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@UseCase
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class CreateStoreService implements CreateStoreUseCase {
|
||||
|
||||
private final SaveStorePort saveStorePort;
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kiz.app.application.service;
|
||||
|
||||
import com.kiz.app.application.port.in.GetStoreByIdUseCase;
|
||||
import com.kiz.app.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.common.UseCase;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@UseCase
|
||||
public class GetStoreByIdService implements GetStoreByIdUseCase {
|
||||
|
||||
@Override
|
||||
public Store handle(GetStoreByIdQuery query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.kiz.application.service;
|
||||
package com.kiz.app.application.service;
|
||||
|
||||
import com.kiz.application.command.UpdateStoreCommand;
|
||||
import com.kiz.application.port.in.UpdateStoreUseCase;
|
||||
import com.kiz.application.port.out.LoadStorePort;
|
||||
import com.kiz.application.port.out.UpdateStorePort;
|
||||
import com.kiz.app.application.command.UpdateStoreCommand;
|
||||
import com.kiz.app.application.port.in.UpdateStoreUseCase;
|
||||
import com.kiz.app.application.port.out.LoadStorePort;
|
||||
import com.kiz.app.application.port.out.UpdateStorePort;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.common.UseCase;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@UseCase
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class UpdateStoreService implements UpdateStoreUseCase {
|
||||
|
||||
private final LoadStorePort storeLoadPort;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kiz.domain.event;
|
||||
package com.kiz.app.domain.event;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.event.BaseEvent;
|
||||
|
||||
import lombok.Builder;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kiz.domain.event;
|
||||
package com.kiz.app.domain.event;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.event.BaseEvent;
|
||||
|
||||
import lombok.Builder;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kiz.domain.event;
|
||||
package com.kiz.app.domain.event;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
import com.kiz.event.BaseEvent;
|
||||
|
||||
import lombok.Builder;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.domain.exception;
|
||||
package com.kiz.app.domain.exception;
|
||||
|
||||
public class InvalidCategoryNameException extends RuntimeException {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.domain.model;
|
||||
package com.kiz.app.domain.model;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.kiz.app.domain.model;
|
||||
|
||||
public class Product {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz.domain.model;
|
||||
package com.kiz.app.domain.model;
|
||||
|
||||
public class ProductImage {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.kiz.domain.model;
|
||||
package com.kiz.app.domain.model;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.kiz.domain.event.StoreCreateEvent;
|
||||
import com.kiz.domain.event.StoreUpdateEvent;
|
||||
import com.kiz.app.domain.event.StoreCreateEvent;
|
||||
import com.kiz.app.domain.event.StoreUpdateEvent;
|
||||
import com.kiz.event.AggregateRoot;
|
||||
import com.kiz.event.Event;
|
||||
import com.kiz.event.SerializerUtils;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.kiz.domain.repository;
|
||||
package com.kiz.app.domain.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
import com.kiz.app.domain.model.Store;
|
||||
|
||||
public interface StoreRepository {
|
||||
Store save(Store order);
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kiz.application.port.in;
|
||||
|
||||
import com.kiz.application.command.CreateStoreCommand;
|
||||
|
||||
public interface CreateStoreUseCase {
|
||||
String handle(CreateStoreCommand command);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.kiz.application.port.in;
|
||||
|
||||
import com.kiz.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface GetStoreByIdUseCase {
|
||||
Store handle(GetStoreByIdQuery query);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.kiz.application.port.in;
|
||||
|
||||
import com.kiz.application.command.UpdateStoreCommand;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface UpdateStoreUseCase {
|
||||
Store handle(UpdateStoreCommand command);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.kiz.application.port.out;
|
||||
|
||||
import com.kiz.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface GetStoreByIdPort {
|
||||
Store getStoreById(GetStoreByIdQuery query);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kiz.application.port.out;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface LoadStorePort {
|
||||
Store load(String aggregateId);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kiz.application.port.out;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface SaveStorePort {
|
||||
String save(Store aggregate);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kiz.application.port.out;
|
||||
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
public interface UpdateStorePort {
|
||||
Store updateStore(Store aggregate);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.kiz.application.service;
|
||||
|
||||
import com.kiz.application.port.in.GetStoreByIdUseCase;
|
||||
import com.kiz.application.query.GetStoreByIdQuery;
|
||||
import com.kiz.common.UseCase;
|
||||
import com.kiz.domain.model.Store;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@UseCase
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class GetStoreByIdService implements GetStoreByIdUseCase {
|
||||
|
||||
@Override
|
||||
public Store handle(GetStoreByIdQuery query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.kiz.common.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
|
||||
@Configuration
|
||||
public class JdbcConfig {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public NamedParameterJdbcTemplate namedParameterJdbcTemplate() {
|
||||
return new NamedParameterJdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.kiz.domain.model;
|
||||
|
||||
public class Product {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kiz;
|
||||
package com.kiz.app;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
Reference in New Issue
Block a user