package com.goree.api.controller;

import com.goree.api.domain.Member;
import com.goree.api.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/member")
public class MemberController {
    @Autowired
    private MemberService memberService;

    /**
     *
     * @api {post} /member Register Member
     * @apiName Register Member
     * @apiGroup Member
     * @apiParam (Member) {json} User-info for to register
     * @apiParamExample {json} Request-Example:
     * {"email":"arstarst@nate.com","password":"qlalfqjsgh","fullName":"Wonyoung Ju","nickname":"nickname","job":"programmer","age":22,"gender":"M","phone":"010-1234-0173","tags": [ {"name":"memberTest"} ] }
     * @apiDescription 회원의 정보를 받아서 등록한다(회원가입)
     */
    @RequestMapping(value="", method=RequestMethod.POST)
    public Member registerMember(@RequestBody Member member) {
        return memberService.registerMember(member);
    }

    /**
     * @api {get} /member Find all of member
     * @apiName Find all of member
     * @apiGroup Member
     * @apiDescription 가입된 모든 멤버의 리스트를 가져온다.
     */
    @RequestMapping(value="", method=RequestMethod.GET)
    public List<Member> findMemberAll() {
        return memberService.findMemberAll();
    }

    /**
     * @api {post} /member/id/:id/updateImage Update profile image
     * @apiName Update profile image
     * @apiGroup Member
     * @apiParam {file} imageFile for member profile
     * @apiParam {number} member ID (sequence)
     * @apiDescription Member ID에 해당되는 회원의 이미지를 등록혹은 변경한다.
     */
    @RequestMapping(value="/id/{memberId}/updateImage", method=RequestMethod.POST, consumes="multipart/form-data")
    public Member updateImage(@RequestPart MultipartFile file, @PathVariable long memberId) {
        return memberService.updateImage(memberId, file);
    }

    /**
     * @api {delete} /member/id/:id Delete Member By ID
     * @apiName Delete Member By ID
     * @apiGroup Member
     * @apiParam {number} userId    User ID (sequence)
     * @apiDescription 멤버의 id(시퀀스)를 받아서 해당 멤버를 삭제한다.
     */
    @RequestMapping(value="/id/{id}", method=RequestMethod.DELETE)
    public void deleteMemberById(@PathVariable long id) {
        memberService.deleteMemberById(id);
    }

    /**
     * @api {get} /member/id/:id Get Member Info
     * @apiName Get Member Info
     * @apiGroup Member
     * @apiParam {number} User Id   User ID (sequence)
     * @apiDescription 해당 id(시퀀스)를 가진 회원의 정보를 가져온다.
     */
    @RequestMapping(value="/id/{id}", method=RequestMethod.GET)
    public Member findMemberById(@PathVariable long id) {
        return memberService.findMemberById(id);
    }


}

@@ -591,16 +591,26 @@
 er-info 
+User info 
 for to r
@@ -617,16 +617,16 @@
 egister%0A
-
      * @
@@ -676,17 +676,31 @@
   * 
-%7B
+  %7B%0A     *     
 %22email%22:
 %22ars
@@ -695,16 +695,17 @@
 %22email%22:
+ 
 %22arstars
@@ -716,16 +716,28 @@
 te.com%22,
+%0A     *     
 %22passwor
@@ -739,16 +739,17 @@
 ssword%22:
+ 
 %22qlalfqj
@@ -753,16 +753,28 @@
 fqjsgh%22,
+%0A     *     
 %22fullNam
@@ -776,16 +776,17 @@
 llName%22:
+ 
 %22Wonyoun
@@ -791,16 +791,28 @@
 ung Ju%22,
+%0A     *     
 %22nicknam
@@ -814,16 +814,17 @@
 ckname%22:
+ 
 %22nicknam
@@ -830,14 +830,27 @@
 me%22,
+%0A     *     
 %22job%22:
+ 
 %22pro
@@ -862,17 +862,42 @@
 er%22,
+%0A     *     
 %22age%22:
+ 
 22,
+%0A     *     
 %22gen
@@ -905,20 +905,33 @@
 er%22:
+ 
 %22M%22,
+%0A     *     
 %22phone%22:
 %22010
@@ -926,16 +926,17 @@
 %22phone%22:
+ 
 %22010-123
@@ -947,26 +947,68 @@
 73%22,
-%22tags%22: %5B %7B
+%0A     *     %22tags%22: %5B%0A     *       %7B%0A     *         
 %22name%22:
+ 
 %22mem
@@ -1019,11 +1019,45 @@
 est%22
-%7D %5D
+%0A     *       %7D%0A     *     %5D%0A     *  
  %7D%0A 

Update document (API ParamExample)