Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dhslrl321 committed Aug 1, 2022
1 parent 73be178 commit 29e1a60
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 79 deletions.
Binary file modified .gradle/7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.layer.application;

import com.example.layer.core.Order;
import com.example.layer.model.SavedUser;
import com.example.layer.repository.OrderRepository;
import com.example.layer.model.SavedOrder;
import com.example.layer.core.OrderRepository;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -13,9 +13,9 @@ public class OrderSaver {

private final OrderRepository repository;

public SavedUser save() {
public SavedOrder save() {
Order order = Order.builder().address(UUID.randomUUID().toString()).build();
Order saved = repository.save(order);
return SavedUser.of(saved.getId(), saved.getAddress());
return SavedOrder.of(saved.getId(), saved.getAddress());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.example.layer.core.Order;
import com.example.layer.model.UpdatedUser;
import com.example.layer.repository.OrderRepository;
import com.example.layer.core.OrderRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@Value(staticConstructor = "of")
@ToString
public class SavedUser {
public class SavedOrder {
Long userId;
String address;
}
4 changes: 4 additions & 0 deletions layer/domain/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id "io.freefair.lombok" version "6.5.0.3"
}

Expand All @@ -8,6 +10,8 @@ repositories {
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
Expand Down
8 changes: 8 additions & 0 deletions layer/domain/src/main/java/com/example/layer/core/Order.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package com.example.layer.core;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Entity(name = "orders")
@Getter
@Builder
@AllArgsConstructor
public class Order {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String address;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.layer.repository;
package com.example.layer.core;

import com.example.layer.core.Order;
import java.util.Optional;
Expand Down
2 changes: 1 addition & 1 deletion layer/infrastructure/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
id "io.freefair.lombok" version "6.5.0.3"
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.layer.repository;

import com.example.layer.core.Order;
import com.example.layer.core.OrderRepository;
import org.springframework.data.repository.Repository;

public interface SpringDataJpaOrderRepository extends Repository<Order, Long>, OrderRepository {
}
2 changes: 1 addition & 1 deletion layer/web/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
dependencies {

implementation project(':layer:application')
// implementation project(':layer:infrastructure')
implementation project(':layer:infrastructure')

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.example.layer.application.OrderSaver;
import com.example.layer.application.OrderUpdater;
import com.example.layer.model.SavedUser;
import com.example.layer.model.SavedOrder;
import com.example.layer.model.UpdatedUser;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -20,7 +20,7 @@ public class OrderController {

@GetMapping("/")
public String create() {
SavedUser result = saver.save();
SavedOrder result = saver.save();

return result.toString();
}
Expand Down

0 comments on commit 29e1a60

Please sign in to comment.