fix : 회원목록, 회원상세정보, 내정보 보기 기능 수정 (with Swagger)
This commit is contained in:
@@ -139,42 +139,39 @@ public function store(Request $request)
|
|||||||
*
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="조회 성공",
|
* description="회원 상세조회 성공",
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="회원 상세조회 성공"),
|
* @OA\Property(property="message", type="string", example="회원 상세조회 성공"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="object",
|
* type="object",
|
||||||
* @OA\Property(property="mb_num", type="integer", example=1),
|
* @OA\Property(property="id", type="integer", example=1),
|
||||||
* @OA\Property(property="tn_num", type="string", example=null),
|
* @OA\Property(property="user_id", type="string", example="hamss"),
|
||||||
* @OA\Property(property="mb_id", type="string", example="admin"),
|
* @OA\Property(property="phone", type="string", example="010-4820-9104"),
|
||||||
* @OA\Property(property="mb_name", type="string", example="권혁성"),
|
* @OA\Property(property="options", type="string", nullable=true, example=null),
|
||||||
* @OA\Property(property="mb_phone", type="string", example="010-4820-9104"),
|
* @OA\Property(property="name", type="string", example="권혁성"),
|
||||||
* @OA\Property(property="mb_mail", type="string", example="shine1324@gmail.com"),
|
* @OA\Property(property="email", type="string", example="shine1324@gmail.com"),
|
||||||
* @OA\Property(property="email_verified_at", type="string", format="date-time", example=null),
|
* @OA\Property(property="email_verified_at", type="string", format="date-time", nullable=true, example=null),
|
||||||
* @OA\Property(property="mb_type", type="string", example=null),
|
* @OA\Property(property="last_login_at", type="string", format="date-time", nullable=true, example=null),
|
||||||
* @OA\Property(property="mb_level", type="integer", example=1),
|
* @OA\Property(property="current_team_id", type="integer", nullable=true, example=null),
|
||||||
* @OA\Property(property="last_login", type="string", format="date-time", example=null),
|
* @OA\Property(property="profile_photo_path", type="string", nullable=true, example=null),
|
||||||
* @OA\Property(property="reg_date", type="string", format="date-time", example="2025-07-16T09:28:41.000000Z"),
|
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-07-16 18:28:41"),
|
||||||
* @OA\Property(property="created_at", type="string", format="date-time", example=null),
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-25 23:13:06"),
|
||||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-16T09:30:56.000000Z")
|
* @OA\Property(property="deleted_at", type="string", format="date-time", nullable=true, example=null)
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* )
|
||||||
|
,
|
||||||
*
|
*
|
||||||
|
* @OA\Response(response=401, description="인증 실패"),
|
||||||
* @OA\Response(response=404, description="회원 정보 없음"),
|
* @OA\Response(response=404, description="회원 정보 없음"),
|
||||||
* @OA\Response(response=401, description="인증 실패")
|
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, $userNo)
|
public function show($userNo)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$result = MemberService::getMember($userNo);
|
||||||
$debug = $request->boolean('debug', false);
|
|
||||||
$result = MemberService::getMember($userNo, $debug);
|
|
||||||
|
|
||||||
return ApiResponse::success($result['data'], '회원 상세조회 성공',$result['query']);
|
return ApiResponse::success($result['data'], '회원 상세조회 성공',$result['query']);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return ApiResponse::error('회원 상세조회 실패', 500, [
|
return ApiResponse::error('회원 상세조회 실패', 500, [
|
||||||
@@ -196,38 +193,47 @@ public function show(Request $request, $userNo)
|
|||||||
* },
|
* },
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="성공: 회원/회사 정보 반환",
|
* description="나의 정보 조회 성공",
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="나의 정보 조회 성공"),
|
* @OA\Property(property="message", type="string", example="나의 정보 조회 성공"),
|
||||||
* @OA\Property(property="data", type="object",
|
* @OA\Property(
|
||||||
* @OA\Property(property="member", type="object",
|
* property="data",
|
||||||
* @OA\Property(property="mb_num", type="integer", example=1),
|
* type="object",
|
||||||
* @OA\Property(property="tn_num", type="integer", example=1),
|
* @OA\Property(
|
||||||
* @OA\Property(property="mb_id", type="string", example="hamss"),
|
* property="user",
|
||||||
* @OA\Property(property="mb_name", type="string", example="권혁성"),
|
* type="object",
|
||||||
* @OA\Property(property="mb_phone", type="string", example="010-4820-9104"),
|
* @OA\Property(property="id", type="integer", example=3),
|
||||||
* @OA\Property(property="mb_mail", type="string", example="shine1324@gmail.com"),
|
* @OA\Property(property="user_id", type="string", example="test"),
|
||||||
* @OA\Property(property="email_verified_at", type="string", example=null, nullable=true),
|
* @OA\Property(property="phone", type="string", example="010-1234-5678"),
|
||||||
* @OA\Property(property="mb_type", type="string", example=null, nullable=true),
|
* @OA\Property(property="options", type="string", nullable=true, example=null),
|
||||||
* @OA\Property(property="mb_level", type="integer", example=1),
|
* @OA\Property(property="name", type="string", example="테스트"),
|
||||||
* @OA\Property(property="last_login", type="string", example=null, nullable=true),
|
* @OA\Property(property="email", type="string", example="test@5130.co.kr"),
|
||||||
* @OA\Property(property="reg_date", type="string", format="date-time", example="2025-07-16T09:28:41.000000Z"),
|
* @OA\Property(property="email_verified_at", type="string", format="date-time", nullable=true, example=null),
|
||||||
* @OA\Property(property="created_at", type="string", example=null, nullable=true),
|
* @OA\Property(property="last_login_at", type="string", format="date-time", nullable=true, example=null),
|
||||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-22T07:16:16.000000Z")
|
* @OA\Property(property="current_team_id", type="integer", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="profile_photo_path", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-07-17 13:19:37"),
|
||||||
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-26 15:51:14"),
|
||||||
|
* @OA\Property(property="deleted_at", type="string", format="date-time", nullable=true, example=null)
|
||||||
* ),
|
* ),
|
||||||
* @OA\Property(property="company", type="object",
|
* @OA\Property(
|
||||||
* @OA\Property(property="mc_num", type="integer", example=1),
|
* property="tenant",
|
||||||
* @OA\Property(property="mc_name", type="string", example="(주)경동기업"),
|
* type="object",
|
||||||
* @OA\Property(property="mc_code", type="string", example="KDCOM"),
|
* @OA\Property(property="id", type="integer", example=1),
|
||||||
* @OA\Property(property="mc_business_num", type="string", example="1398700333"),
|
* @OA\Property(property="company_name", type="string", example="(주)경동기업"),
|
||||||
* @OA\Property(property="mc_owner_name", type="string", example="이경호"),
|
* @OA\Property(property="code", type="string", example="KDCOM"),
|
||||||
* @OA\Property(property="mc_phone", type="string", example="01083935130"),
|
* @OA\Property(property="email", type="string", example="kd5130@naver.com"),
|
||||||
* @OA\Property(property="mc_mail", type="string", example="kd5130@naver.com"),
|
* @OA\Property(property="phone", type="string", example="01083935130"),
|
||||||
* @OA\Property(property="mc_addr", type="string", example="경기도 김포시 통진읍 옹정로 45-22"),
|
* @OA\Property(property="address", type="string", example="경기도 김포시 통진읍 옹정로 45-22"),
|
||||||
* @OA\Property(property="use_yn", type="string", example="Y"),
|
* @OA\Property(property="business_num", type="string", example="1398700333"),
|
||||||
* @OA\Property(property="reg_date", type="string", example="2025-07-08 14:25:16")
|
* @OA\Property(property="corp_reg_no", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="ceo_name", type="string", example="이경호"),
|
||||||
|
* @OA\Property(property="homepage", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="fax", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="logo", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="admin_memo", type="string", nullable=true, example=null),
|
||||||
|
* @OA\Property(property="options", type="string", nullable=true, example=null),
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
|
|
||||||
class MemberService
|
class MemberService
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,7 @@ public static function getMembers($request)
|
|||||||
/**
|
/**
|
||||||
* 단일 회원 조회
|
* 단일 회원 조회
|
||||||
*/
|
*/
|
||||||
public static function getMember(int $userNo, bool $debug = false)
|
public static function getMember(int $userNo)
|
||||||
{
|
{
|
||||||
$query = User::whereHas('userTenants', function($q) {
|
$query = User::whereHas('userTenants', function($q) {
|
||||||
$q->active();
|
$q->active();
|
||||||
@@ -44,18 +45,22 @@ public static function getMember(int $userNo, bool $debug = false)
|
|||||||
/**
|
/**
|
||||||
* 내정보 확인
|
* 내정보 확인
|
||||||
*/
|
*/
|
||||||
public static function getMyInfo($request, bool $debug = false)
|
public static function getMyInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
$apiUser = app('api_user');
|
$apiUser = app('api_user');
|
||||||
|
|
||||||
$user = User::find($apiUser);
|
$user = User::with([
|
||||||
|
'userTenant.tenant' => function($q) {
|
||||||
|
$q->select('id', 'company_name', 'code', 'email', 'phone', 'address', 'business_num', 'corp_reg_no', 'ceo_name', 'homepage', 'fax', 'logo', 'admin_memo', 'options',); // 원하는 컬럼만
|
||||||
|
}
|
||||||
|
])->find($apiUser);
|
||||||
$data=[
|
$data=[
|
||||||
'member' => $member,
|
'user' => $user->userTenant->user,
|
||||||
'company' => $company
|
'tenant' => $user->userTenant->tenant,
|
||||||
];
|
];
|
||||||
|
|
||||||
return ApiResponse::response('result', $data, $debug);
|
return ApiResponse::response('result', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user