-
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.
- Loading branch information
1 parent
7404bc8
commit ef91d47
Showing
28 changed files
with
389 additions
and
41 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/main/java/com/gt/genti/adapter/in/web/AdminPictureController.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,46 @@ | ||
package com.gt.genti.adapter.in.web; | ||
|
||
import static com.gt.genti.other.util.ApiUtils.*; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
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.RestController; | ||
|
||
import com.gt.genti.command.CreatePictureCompletedCommand; | ||
import com.gt.genti.domain.PictureGenerateResponse; | ||
import com.gt.genti.dto.UpdatePictureUrlRequestDto; | ||
import com.gt.genti.error.ErrorCode; | ||
import com.gt.genti.error.ExpectedException; | ||
import com.gt.genti.other.auth.UserDetailsImpl; | ||
import com.gt.genti.repository.PictureGenerateResponseRepository; | ||
import com.gt.genti.service.PictureService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequestMapping("/api/admin/picture-generate-responses") | ||
@RequiredArgsConstructor | ||
public class AdminPictureController { | ||
private final PictureService pictureService; | ||
private final PictureGenerateResponseRepository pictureGenerateResponseRepository; | ||
|
||
@PostMapping("/{responseId}") | ||
public ResponseEntity<ApiResult<Boolean>> updatePicture( | ||
@AuthenticationPrincipal UserDetailsImpl userDetails, | ||
UpdatePictureUrlRequestDto requestDto, | ||
@PathVariable Long responseId) { | ||
PictureGenerateResponse foundPictureGenerateResponse = pictureGenerateResponseRepository.findById(responseId) | ||
.orElseThrow(() -> new ExpectedException( | ||
ErrorCode.PictureGenerateResponseNotFound)); | ||
|
||
CreatePictureCompletedCommand command = CreatePictureCompletedCommand.builder() | ||
.pictureGenerateResponse(foundPictureGenerateResponse) | ||
.url(requestDto.getUrl()) | ||
.uploadedBy(userDetails.getId()).build(); | ||
pictureService.uploadPicture(command); | ||
return success(true); | ||
} | ||
} |
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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
src/main/java/com/gt/genti/command/CreatePictureCompletedCommand.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,23 @@ | ||
package com.gt.genti.command; | ||
|
||
import com.gt.genti.domain.PictureGenerateResponse; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class CreatePictureCompletedCommand { | ||
String url; | ||
PictureGenerateResponse pictureGenerateResponse; | ||
Long uploadedBy; | ||
|
||
@Builder | ||
public CreatePictureCompletedCommand(String url, PictureGenerateResponse pictureGenerateResponse, Long uploadedBy) { | ||
this.url = url; | ||
this.pictureGenerateResponse = pictureGenerateResponse; | ||
this.uploadedBy = uploadedBy; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/gt/genti/command/CreatePictureCreatedByCreatorCommand.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 com.gt.genti.command; | ||
|
||
import com.gt.genti.domain.PictureGenerateResponse; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreatePictureCreatedByCreatorCommand { | ||
String url; | ||
PictureGenerateResponse pictureGenerateResponse; | ||
Long uploadedBy; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/gt/genti/command/CreatePicturePoseCommand.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,19 @@ | ||
package com.gt.genti.command; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class CreatePicturePoseCommand { | ||
String url; | ||
Long uploadedBy; | ||
|
||
@Builder | ||
public CreatePicturePoseCommand(String url, Long uploadedBy) { | ||
this.url = url; | ||
this.uploadedBy = uploadedBy; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/gt/genti/command/CreatePicturePostCommand.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,10 @@ | ||
package com.gt.genti.command; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreatePicturePostCommand { | ||
String url; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/gt/genti/command/CreatePictureProfileCommand.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,13 @@ | ||
package com.gt.genti.command; | ||
|
||
import com.gt.genti.domain.User; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreatePictureProfileCommand { | ||
String url; | ||
User user; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/gt/genti/command/CreatePictureUserFaceCommand.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,13 @@ | ||
package com.gt.genti.command; | ||
|
||
import com.gt.genti.domain.User; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreatePictureUserFaceCommand { | ||
String url; | ||
User user; | ||
} |
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
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
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
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
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
Oops, something went wrong.