Skip to content

Commit

Permalink
feat: 장소 검수 기능 뼈대코드 설계 및 구현 (#373)
Browse files Browse the repository at this point in the history
* feat: 검수가 필요한 장소 엔티티 구현

* feat: 장소 검수 컨트롤러 구현

* feat: 장소 검수 Repository 구현

---------

Co-authored-by: kokodak <[email protected]>
  • Loading branch information
kokodak and kokodak committed Oct 5, 2023
1 parent 55fa186 commit ecc38f9
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package com.now.naaga.temporaryplace.domain;

import com.now.naaga.common.domain.BaseEntity;
import com.now.naaga.place.domain.Position;
import com.now.naaga.player.domain.Player;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.util.Objects;

@Entity
public class TemporaryPlace extends BaseEntity {

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

private String name;

private String description;

@Embedded
private Position position;

private String imageUrl;

@ManyToOne
@JoinColumn(name = "player_id")
private Player registeredPlayer;

protected TemporaryPlace() {
}

public TemporaryPlace(final String name,
final String description,
final Position position,
final String imageUrl,
final Player registeredPlayer) {
this(null, name, description, position, imageUrl, registeredPlayer);
}

public TemporaryPlace(final Long id,
final String name,
final String description,
final Position position,
final String imageUrl,
final Player registeredPlayer) {
this.id = id;
this.name = name;
this.description = description;
this.position = position;
this.imageUrl = imageUrl;
this.registeredPlayer = registeredPlayer;
}

public Long getId() {
return id;
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

public Position getPosition() {
return position;
}

public String getImageUrl() {
return imageUrl;
}

public Player getRegisteredPlayer() {
return registeredPlayer;
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final TemporaryPlace that = (TemporaryPlace) o;
return Objects.equals(id, that.id);
}

@Override
public int hashCode() {
return Objects.hash(id);
}

@Override
public String toString() {
return "TemporaryPlace{" +
"id=" + id +
", name='" + name + '\'' +
", description='" + description + '\'' +
", position=" + position +
", imageUrl='" + imageUrl + '\'' +
", registeredPlayerId=" + registeredPlayer.getId() +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.now.naaga.temporaryplace.presentation;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/temporary-places")
@RestController
public class TemporaryPlaceController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.now.naaga.temporaryplace.repository;


import com.now.naaga.temporaryplace.domain.TemporaryPlace;
import org.springframework.data.jpa.repository.JpaRepository;

public interface TemporaryPlaceRepository extends JpaRepository<TemporaryPlace, Long> {
}

0 comments on commit ecc38f9

Please sign in to comment.