-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: XXX
- Loading branch information
Showing
9 changed files
with
101 additions
and
44 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/meowhub/backend/profiles/controllers/ProfileController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package meowhub.backend.profiles.controllers; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import meowhub.backend.profiles.dtos.ProfileDto; | ||
import meowhub.backend.profiles.services.ProfileService; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping(path ="/api/profiles") | ||
@RequiredArgsConstructor | ||
public class ProfileController { | ||
private final ProfileService profileService; | ||
|
||
@GetMapping("/{login}") | ||
public ProfileDto getProfile(@PathVariable String login, @AuthenticationPrincipal UserDetails userDetails) { | ||
return profileService.getProfile(login, userDetails.getUsername()); | ||
} | ||
|
||
@PostMapping("") | ||
public ProfileDto updateProfile(@RequestParam String content, @AuthenticationPrincipal UserDetails userDetails) { | ||
return profileService.updateProfile(content, userDetails.getUsername()); | ||
} | ||
|
||
@PostMapping("/pictures") | ||
public ProfileDto addPictures(@RequestPart List<MultipartFile> files, @AuthenticationPrincipal UserDetails userDetails) { | ||
return profileService.addPictures(files, userDetails.getUsername()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/meowhub/backend/profiles/dtos/ProfileDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package meowhub.backend.profiles.dtos; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class ProfileDto { | ||
private String profilePicture; | ||
private String content; | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...epositories/ProfilePictureRepository.java → ...epositories/ProfilePictureRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ckend/repositories/ProfileRepository.java → ...files/repositories/ProfileRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/meowhub/backend/profiles/services/ProfileService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package meowhub.backend.profiles.services; | ||
|
||
import meowhub.backend.profiles.dtos.ProfileDto; | ||
import meowhub.backend.security.requests.SignUpRequest; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
public interface ProfileService { | ||
void createProfile(SignUpRequest signUpRequest); | ||
ProfileDto updateProfile(String content, String login); | ||
ProfileDto getProfile(String login, String requesterLogin); | ||
ProfileDto addPictures(List<MultipartFile> file, String login); | ||
} |
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/meowhub/backend/profiles/services/impl/ProfileServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package meowhub.backend.profiles.services.impl; | ||
|
||
import meowhub.backend.profiles.dtos.ProfileDto; | ||
import meowhub.backend.profiles.services.ProfileService; | ||
import meowhub.backend.security.requests.SignUpRequest; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
public class ProfileServiceImpl implements ProfileService { | ||
@Override | ||
public void createProfile(SignUpRequest signUpRequest) { | ||
|
||
} | ||
|
||
@Override | ||
public ProfileDto updateProfile(String content, String login) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public ProfileDto getProfile(String login, String requesterLogin) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public ProfileDto addPictures(List<MultipartFile> file, String login) { | ||
return null; | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
backend/src/main/java/meowhub/backend/repositories/ProfileDataRepository.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
backend/src/main/java/meowhub/backend/repositories/ProfileUserDataRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters