-
Notifications
You must be signed in to change notification settings - Fork 0
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: company selection api #35
Changes from all commits
d542971
a8f4bb8
034fbe0
d1d0e7c
4e4e114
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.fullcar.member.application.member; | ||
|
||
import com.fullcar.member.domain.member.Company; | ||
import com.fullcar.member.presentation.member.dto.request.CompanyRequestDto; | ||
import lombok.AccessLevel; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CompanyMapper { | ||
public Company toEntity(CompanyRequestDto companyRequestDto) { | ||
return Company.builder() | ||
.companyName(companyRequestDto.getCompanyName()) | ||
.latitude(companyRequestDto.getLatitude()) | ||
.longitude(companyRequestDto.getLongitude()) | ||
.build(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.fullcar.member.domain.member; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embeddable; | ||
import lombok.*; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static lombok.AccessLevel.PROTECTED; | ||
|
||
@Embeddable | ||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = PROTECTED) | ||
@AllArgsConstructor(access = PROTECTED) | ||
public class Company { | ||
@Column(name = "company_name") | ||
private String companyName; | ||
|
||
private BigDecimal latitude; | ||
|
||
private BigDecimal longitude; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μν°ν°μ λ°Έλ₯ κ°μ²΄λ μ°Έμ‘° ν¬λͺ
μ±κ³Ό λ©ν°μ€λ λ νκ²½μμμ μμ μ±μ μν΄ Immutable μ¦, λΆλ³ κ°μ²΄λ‘ ꡬννλκ² μ’λ€κ³ μκ°ν©λλ€! |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.fullcar.member.presentation.member; | ||
|
||
import com.fullcar.core.annotation.CurrentMember; | ||
import com.fullcar.core.response.ApiResponse; | ||
import com.fullcar.core.response.SuccessCode; | ||
import com.fullcar.member.application.member.MemberService; | ||
import com.fullcar.member.domain.member.Member; | ||
import com.fullcar.member.presentation.member.dto.request.CompanyRequestDto; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/members") | ||
@Tag(name = "[Member] λ©€λ² κ΄λ ¨ API") | ||
public class MemberController { | ||
|
||
private final MemberService memberService; | ||
|
||
@Operation(summary = "νμ¬ μ ν API") | ||
@ApiResponses({ | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "201", description = "λ±λ‘ μ±κ³΅"), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "μλ² λ΄λΆ μ€λ₯", content = @Content) | ||
}) | ||
@PostMapping("/onboarding/company") | ||
public ApiResponse<Object> postCompany(@CurrentMember Member member, @RequestBody @Valid CompanyRequestDto companyRequestDto) { | ||
memberService.registerCompany(member, companyRequestDto); | ||
return ApiResponse.success(SuccessCode.REGISTER_SUCCESS); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.fullcar.member.presentation.member.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.*; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CompanyRequestDto { | ||
@Schema(description = "νμ¬ μ΄λ¦", example = "λ€μ΄λ²") | ||
@NotBlank | ||
private String companyName; | ||
|
||
@Schema(description = "μλ", example = "46.652719") | ||
private BigDecimal latitude; | ||
|
||
@Schema(description = "κ²½λ", example = "71.530045") | ||
private BigDecimal longitude; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double νμ μ λΆλμμμ νν λ°©μμ΄κΈ° λλ¬Έμ κ°μ μ€μ°¨κ° λ°μνκ² λλλ°μ! κ²½λμ μλλ μμΈν κ°μ μ μ₯νκ³ κ³μ°λμ΄μΌ νκΈ° λλ¬Έμ BigDecimal νμ μ μ¬μ©νλ κ²μ μΆμ²λ립λλ€!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λͺ¨λ λ°μμλ£νμ΄μ~!!