20
20
import com .sponus .coredomain .domain .organization .Organization ;
21
21
import com .sponus .coredomain .domain .organization .enums .OrganizationType ;
22
22
import com .sponus .coreinfrasecurity .annotation .AuthOrganization ;
23
+ import com .sponus .sponusbe .domain .organization .club .service .ClubService ;
23
24
import com .sponus .sponusbe .domain .organization .company .dto .OrganizationGetResponse ;
25
+ import com .sponus .sponusbe .domain .organization .company .service .CompanyService ;
24
26
import com .sponus .sponusbe .domain .organization .dto .request .OrganizationCreateRequest ;
25
27
import com .sponus .sponusbe .domain .organization .dto .request .OrganizationSearchRequest ;
26
28
import com .sponus .sponusbe .domain .organization .dto .request .PageCondition ;
37
39
@ RequiredArgsConstructor
38
40
public class OrganizationController {
39
41
private final OrganizationService organizationService ;
42
+ private final ClubService clubService ;
43
+ private final CompanyService companyService ;
40
44
41
45
@ PostMapping ("/join" )
42
46
public ApiResponse <Long > join (@ RequestBody OrganizationCreateRequest request ) {
@@ -52,11 +56,21 @@ public ApiResponse<PageResponse<OrganizationGetResponse>> getOrganizations(
52
56
organizationService .getOrganizations (authOrganization , pageCondition , organizationType ));
53
57
}
54
58
55
- @ PostMapping (value = "/{organizationId}/profileImage" , consumes = "multipart/form-data" )
59
+ @ GetMapping ("/me" )
60
+ public ApiResponse <?> getMyProfile (
61
+ @ AuthOrganization Organization authOrganization ) {
62
+ if (authOrganization .isClub ()) {
63
+ return ApiResponse .onSuccess (clubService .getClub (authOrganization .getId ()));
64
+ } else {
65
+ return ApiResponse .onSuccess (companyService .getCompany (authOrganization .getId ()));
66
+ }
67
+ }
68
+
69
+ @ PostMapping (value = "/me/profileImage" , consumes = "multipart/form-data" )
56
70
public ApiResponse <OrganizationImageUploadResponse > uploadProfileImage (
57
- @ PathVariable Long organizationId ,
71
+ @ AuthOrganization Organization organization ,
58
72
@ RequestPart (name = "profileImage" ) MultipartFile file ) {
59
- return ApiResponse .onSuccess (organizationService .uploadProfileImage (organizationId , file ));
73
+ return ApiResponse .onSuccess (organizationService .uploadProfileImage (organization . getId () , file ));
60
74
}
61
75
62
76
@ GetMapping ("/exists" )
0 commit comments