Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#55 회원 소셜 타입 제공 API #56

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/main/java/com/pyro/yolog/domain/auth/controller/AuthApi.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.pyro.yolog.domain.auth.controller;

import com.pyro.yolog.domain.member.dto.request.SignUpRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
Expand All @@ -11,6 +11,20 @@
@Tag(name = "Auth")
public interface AuthApi {

@Operation(
summary = "회원가입",
description = "사용자의 닉네임을 입력받아 회원가입을 진행합니다. 중복된 닉네임이 입력되면 false를 반환합니다.",
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "201",
description = "회원가입이 성공적으로 완료되었습니다."
)
})
boolean signUp(@RequestBody SignUpRequest dto);


@Operation(
summary = "회원 탈퇴",
description = "회원을 탈퇴합니다. 연결된 소셜과의 연결이 끊깁니다.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package com.pyro.yolog.domain.auth.controller;

import com.pyro.yolog.domain.auth.service.AuthService;
import com.pyro.yolog.domain.auth.service.SignUpService;
import com.pyro.yolog.domain.member.dto.request.SignUpRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
public class AuthController implements AuthApi{
public class AuthController implements AuthApi {
private final AuthService authService;
private final SignUpService signUpService;

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/social-login")
public boolean signUp(@RequestBody SignUpRequest request) {
return signUpService.signUp(request);
}

@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/withdrawal")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.pyro.yolog.domain.member.service;
package com.pyro.yolog.domain.auth.service;

import com.pyro.yolog.domain.member.dto.SignUpRequest;
import com.pyro.yolog.domain.member.dto.request.SignUpRequest;
import com.pyro.yolog.domain.member.entity.Member;
import com.pyro.yolog.domain.auth.service.AuthService;
import com.pyro.yolog.domain.member.repository.MemberRepository;
import com.pyro.yolog.global.jwt.refresh.service.RefreshTokenService;
import com.pyro.yolog.global.jwt.service.JwtService;
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/com/pyro/yolog/domain/member/api/MemberApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.pyro.yolog.domain.member.api;

import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import com.pyro.yolog.domain.trip.dto.TripResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "Member")
public interface MemberApi {

@Operation(
summary = "회원 소셜 타입 조회",
description = "회원이 로그인한 소셜 타입을 조회합니다.",
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "OK"
)
}
)
SocialTypeResponse getSocialType();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.pyro.yolog.domain.member.api;

import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import com.pyro.yolog.domain.member.service.MemberService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("members")
public class MemberController {
private final MemberService memberService;

@ResponseStatus(HttpStatus.OK)
@GetMapping("social-type")
public SocialTypeResponse getSocialType() {
return memberService.getSocialType();
}
}
26 changes: 0 additions & 26 deletions src/main/java/com/pyro/yolog/domain/member/api/SignApi.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/main/java/com/pyro/yolog/domain/member/api/SignController.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pyro.yolog.domain.member.dto;
package com.pyro.yolog.domain.member.dto.request;

import lombok.Getter;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.pyro.yolog.domain.member.dto.response;

import com.pyro.yolog.domain.member.entity.SocialType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@AllArgsConstructor
@Setter
public class SocialTypeResponse {
private SocialType socialType;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pyro.yolog.domain.member.entity;

import com.pyro.yolog.domain.member.dto.SignUpRequest;
import com.pyro.yolog.domain.member.dto.request.SignUpRequest;
import com.pyro.yolog.global.config.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.pyro.yolog.domain.member.service;

import com.pyro.yolog.domain.auth.service.AuthService;
import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class MemberService {
private final AuthService authService;

public SocialTypeResponse getSocialType() {
return new SocialTypeResponse(authService.getLoginUser().getSocialType());
}
}
Loading