This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
201 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
32 changes: 32 additions & 0 deletions
32
src/main/java/io/codechobo/member/domain/support/MemberDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.codechobo.member.domain.support; | ||
|
||
import io.codechobo.member.domain.PointPerLevel; | ||
import io.codechobo.member.domain.Social; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Loustler | ||
* @since 8/29/16 | ||
*/ | ||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
public class MemberDto { | ||
|
||
private Long sequence; | ||
private String id; | ||
private String password; | ||
private String email; | ||
private String nickName; | ||
private Date regiDate; | ||
private Integer point; | ||
private PointPerLevel level; | ||
private List<Social> socials; | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/io/codechobo/member/interfaces/api/MemberRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.codechobo.member.interfaces.api; | ||
|
||
import io.codechobo.member.domain.Member; | ||
import io.codechobo.member.domain.repository.MemberRepository; | ||
import io.codechobo.member.domain.support.MemberDto; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* @author Loustler | ||
* @since 8/29/16 | ||
*/ | ||
@RestController | ||
@RequestMapping("/api/member") | ||
public class MemberRestController { | ||
@Autowired private MemberRepository memberRepository; | ||
|
||
@RequestMapping(value = {"","/"}, method = RequestMethod.POST) | ||
public ResponseEntity save(@RequestBody MemberDto member) { | ||
return new ResponseEntity<>(this.memberRepository.save(new Member(member)), HttpStatus.CREATED); | ||
} | ||
|
||
@RequestMapping(value = "/{seq}", method = RequestMethod.POST) | ||
public ResponseEntity show(@PathVariable Long seq) { | ||
return new ResponseEntity<>(memberRepository.findOne(seq), HttpStatus.OK); | ||
} | ||
|
||
@RequestMapping(value = "/list", method = RequestMethod.GET) | ||
public ResponseEntity list() { | ||
return new ResponseEntity<>(this.memberRepository.findAll(), HttpStatus.OK); | ||
} | ||
|
||
@RequestMapping(value = "/{seq}", method = RequestMethod.PUT) | ||
public ResponseEntity update(@PathVariable Long seq, @RequestBody MemberDto memberDto) { | ||
return new ResponseEntity<>(this.memberRepository.save(new Member(memberDto)), HttpStatus.OK); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/java/io/codechobo/member/domain/intefaces/MemberRestControllerIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.codechobo.member.domain.intefaces; | ||
|
||
import io.codechobo.member.interfaces.api.MemberRestController; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
/** | ||
* @author Loustler | ||
* @since 8/29/16 | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@DataJpaTest | ||
@ActiveProfiles(value = "test") | ||
public class MemberRestControllerIntegrationTest { | ||
|
||
@Autowired | ||
MemberRestController memberRestController; | ||
|
||
@Test | ||
public void member_save_rest_controller_test() { | ||
|
||
} | ||
} |
Empty file.
34 changes: 34 additions & 0 deletions
34
src/test/java/io/codechobo/member/interfaces/api/MemberRestControllerIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.codechobo.member.interfaces.api; | ||
|
||
import io.codechobo.member.domain.repository.MemberRepository; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
import org.springframework.test.context.web.WebAppConfiguration; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
import org.springframework.web.context.WebApplicationContext; | ||
|
||
/** | ||
* @author Loustler | ||
* @since 8/29/16 | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@SpringBootTest | ||
@WebAppConfiguration | ||
@ActiveProfiles(value = "test") | ||
public class MemberRestControllerIntegrationTest { | ||
|
||
@Autowired private WebApplicationContext webApplicationContext; | ||
private MockMvc mockMvc; | ||
|
||
@Autowired private MemberRepository memberRepository; | ||
|
||
|
||
@Test | ||
public void member_save_rest_controller_test() { | ||
|
||
} | ||
} |