Skip to content

Commit

Permalink
Update:
Browse files Browse the repository at this point in the history
  • Loading branch information
BYEONGRYEOL committed May 21, 2024
1 parent fefd1cc commit b7a6add
Show file tree
Hide file tree
Showing 16 changed files with 305 additions and 183 deletions.
84 changes: 29 additions & 55 deletions sql/setup-dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,25 @@ use genti;

set @adminId := 1;
set @userId := 2;
set @emptyUserId := 3;
set @creatorUserId := 4;
set @emptyCreatorId := 5;
set @oauthFirstJoinUserId := 6;
set @deactivatedUserId := 7;
set @deactivatedCreatorId := 8;

set @creatorId := 1;

insert ignore into user (id, created_at, modified_at, deleted_at, email, email_verified, introduction,
last_login_social_platform, login_id, nickname, password, roles, user_status,
username, profile_picture_id)

VALUES (1, localtime, localtime, null, '[email protected]', true, null, 'GOOGLE', null, '어드민테스트1_닉네임', null,
'ROLE_ADMIN,ROLE_MANAGER,ROLE_CREATOR,ROLE_USER',
'ACTIVATED', '어드민이름', null),
(2, localtime, localtime, null, '[email protected]', true, '유저_소개1', 'GOOGLE', null, '유저테스트1_닉네임', null,
'ROLE_USER',
'ACTIVATED', '유저이름1', null),
(3, localtime, localtime, null, '[email protected]', true, '유저_소개2', 'GOOGLE', null, '유저테스트1_닉네임',
null,
'ROLE_USER', 'ACTIVATED', '유저이름2', null),
(4, localtime, localtime, null, '[email protected]', true, '공급자_소개', 'GOOGLE', null, '유저테스트2_닉네임',
null,
'ROLE_CREATOR', 'ACTIVATED', '공급자이름1', null),
(5, localtime, localtime, null, '[email protected]', true, '공급자_소개2', 'GOOGLE', null,
'공급자테스트2_닉네임', null, 'ROLE_CREATOR', 'ACTIVATED', '공급자이름2', null),
(6, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE', null,
'최초가입자_닉네임', null, 'ROLE_OAUTH_FIRST_JOIN,ROLE_USER', 'ACTIVATED', '최초가입자이름', null),
(7, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE', null,
'비활성화된유저_닉네임', null, 'ROLE_USER', 'DEACTIVATED', '비활성화된유저이름', null),
(8, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE',
null,
'비활성화된공급자_닉네임', null, 'ROLE_CREATOR', 'DEACTIVATED', '비활성화된공급자이름', null);
set @emptyUserId := 3; # 아무 사진 생성 요청하지 않은 유저의 UserId
set @creatorUserId := 4; # 공급자 UserId
set @emptyCreatorId := 5; # 사진 생성 요청 매칭되지 않은 공급자의 UserId
set @oauthFirstJoinUserId := 6; # 첫 회원가입 유저 - FE에서는 크게 신경쓸 일 없을 것 같긴 합니다.
set @deactivatedUserId := 7; # 비활성화된 유저의 UserId
set @deactivatedCreatorId := 8; # 비활성화된 공급자의 CreatorId

set @creatorId := 1; # 공급자의 CreatorId

insert ignore into user (id, created_at, modified_at, deleted_at, email, email_verified, introduction, last_login_social_platform, login_id, nickname, password, roles, user_status, username, profile_picture_id)

VALUES (1, localtime, localtime, null, '[email protected]', true, null, 'GOOGLE', null, '어드민테스트1_닉네임', null, 'ROLE_ADMIN,ROLE_MANAGER,ROLE_CREATOR,ROLE_USER','ACTIVATED', '어드민이름', null),
(2, localtime, localtime, null, '[email protected]', true, '유저_소개1', 'GOOGLE', null, '유저테스트1_닉네임', null, 'ROLE_USER', 'ACTIVATED', '유저이름1', null),
(3, localtime, localtime, null, '[email protected]', true, '유저_소개2', 'GOOGLE', null, '유저테스트1_닉네임', null, 'ROLE_USER', 'ACTIVATED', '유저이름2', null),
(4, localtime, localtime, null, '[email protected]', true, '공급자_소개', 'GOOGLE', null, '유저테스트2_닉네임', null, 'ROLE_CREATOR', 'ACTIVATED', '공급자이름1', null),
(5, localtime, localtime, null, '[email protected]', true, '공급자_소개2', 'GOOGLE', null, '공급자테스트2_닉네임', null, 'ROLE_CREATOR', 'ACTIVATED', '공급자이름2', null),
(6, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE', null, '최초가입자_닉네임', null, 'ROLE_OAUTH_FIRST_JOIN,ROLE_USER', 'ACTIVATED', '최초가입자이름', null),
(7, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE', null, '비활성화된유저_닉네임', null, 'ROLE_USER', 'DEACTIVATED', '비활성화된유저이름', null),
(8, localtime, localtime, null, '[email protected]', true, '최초가입자_소개', 'GOOGLE', null, '비활성화된공급자_닉네임', null, 'ROLE_CREATOR', 'DEACTIVATED', '비활성화된공급자이름', null);

insert ignore into creator (id, user_id, workable, created_at, modified_at)
values (1, 4, true, localtime, localtime),
Expand All @@ -60,19 +45,13 @@ values (1, LOCALTIME, LOCALTIME, 'user_face_picture_url1', 2),



insert ignore into picture_generate_request (id, creator_id, picture_pose_id, requester_id, prompt, camera_angle,
request_status, shot_coverage, created_at, modified_at)
VALUES (1, null, 4, 2, 'prompt_test_1', '위에서 촬영', 'BEFORE_WORK', '얼굴만 클로즈업', '2000-01-01 07:00:00', localtime),
(2, null, 3, 2, 'prompt_test_2', '같은 높이에서 촬영', 'CANCELED', '허리 위로 촬영', '2020-01-01 07:00:00',
localtime),
(3, 1, 2, 2, 'prompt_test_3', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', '2000-01-01 07:00:00',
localtime),
(4, 1, 2, 2, 'prompt_test_4', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', '2000-01-01 07:00:00',
localtime),
(5, 1, 2, 2, 'prompt_test_5', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', '2000-01-01 07:00:00',
localtime),
(6, 1, 2, 2, 'prompt_test_6', '아래에서 촬영', 'REPORTED', '무릎 위로 촬영', '2000-01-01 07:00:00',
localtime),
insert ignore into picture_generate_request (id, creator_id, picture_pose_id, requester_id, prompt, camera_angle, request_status, shot_coverage, created_at, modified_at)
VALUES (1, null, 4, 2, 'prompt_test_1', '위에서 촬영', 'CREATED', '얼굴만 클로즈업', '2000-01-01 07:00:00', localtime),
(2, null, 3, 2, 'prompt_test_2', '같은 높이에서 촬영', 'CANCELED', '허리 위로 촬영', '2020-01-01 07:00:00', localtime),
(3, 1, 2, 2, 'prompt_test_3', '아래에서 촬영', 'ASSIGNING', '무릎 위로 촬영', '2000-01-01 07:00:00', localtime),
(4, 1, 2, 2, 'prompt_test_4', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', '2000-01-01 07:00:00', localtime),
(5, 1, 2, 2, 'prompt_test_5', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', '2000-01-01 07:00:00', localtime),
(6, 1, 2, 2, 'prompt_test_6', '아래에서 촬영', 'REPORTED', '무릎 위로 촬영', '2000-01-01 07:00:00', localtime),
(7, 1, 1, 2, 'prompt_test_7', '위에서 촬영', 'COMPLETED', '전신 촬영', '2020-01-01 07:00:00', localtime),
(8, 1, 1, 2, 'prompt_test_7', '위에서 촬영', 'REPORTED', '전신 촬영', '2020-01-01 07:00:00', localtime);

Expand Down Expand Up @@ -103,8 +82,6 @@ values (1, 1),
(8, 8),
(8, 9);



insert ignore into picture_generate_response (id, created_at, modified_at, status, creator_id, request_id)
values (1, localtime, localtime, 'BEFORE_WORK', 1, 3),
(2, localtime, localtime, 'SUBMITTED_FIRST', 1, 4),
Expand All @@ -117,21 +94,18 @@ insert ignore into report (id, created_at, modified_at, content, report_status,
values (1, localtime, localtime, '변태자식이 본인 발가락 사진을 보낸 것 같습니다.', 'NOT_RESOLVED', 4),
(2, localtime, localtime, '모르는 사람 얼굴이에요', 'RESOLVED', 6);

insert ignore into picture_created_by_creator (id, created_at, modified_at, url, picture_generate_response_id,
uploaded_by)
insert ignore into picture_created_by_creator (id, created_at, modified_at, url, picture_generate_response_id, uploaded_by)
values (1, localtime, localtime, '얼굴 완성 전 url 1', 2, 4),
(2, localtime, localtime, '얼굴 완성 전 url 2', 3, 4),
(3, localtime, localtime, '얼굴 완성 전 url 3', 4, 4);

insert ignore into picture_completed (id, created_at, modified_at, url, picture_generate_response_id, user_id,
uploaded_by)
insert ignore into picture_completed (id, created_at, modified_at, url, picture_generate_response_id, user_id, uploaded_by)
values (1, localtime, localtime, '얼굴 완성 사진 url 1', 3, 2, 1),
(2, localtime, localtime, '얼굴 완성 사진 url 2', 4, 2, 1),
(3, localtime, localtime, '얼굴 완성 사진 url 3', 5, 2, 1),
(4, localtime, localtime, '얼굴 완성 사진 url 4', 6, 2, 1);

insert ignore into response_example (id, created_at, modified_at, example_picture_url, example_prompt, prompt_only,
uploaded_by)
insert ignore into response_example (id, created_at, modified_at, example_picture_url, example_prompt, prompt_only, uploaded_by)
values (1, localtime, localtime, '/EXAMPLE/벚꽃벤치여자.png', '벚꽃 벤치 여자', false, 1),
(2, localtime, localtime, '/EXAMPLE/한강잠수부.png', '한강잠수부', false, 1),
(3, localtime, localtime, null, '프롬프트만있음 사진은 없고', true, 1);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.gt.genti.adapter.in.web;

import static com.gt.genti.other.util.ApiUtils.*;

import java.util.List;

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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.application.service.PictureGenerateWorkService;
import com.gt.genti.dto.PictureGenerateResponseAdminSubmitDto;
import com.gt.genti.dto.UpdatePictureUrlRequestDto;
import com.gt.genti.other.auth.UserDetailsImpl;

import lombok.RequiredArgsConstructor;

@RestController
@RequestMapping("/api/admin/picture-generate-responses")
@RequiredArgsConstructor
public class AdminPictureGenerateController {
private final PictureGenerateWorkService pictureGenerateWorkService;

@PostMapping("/{pictureGenerateResponseId}/submit")
public ResponseEntity<ApiResult<PictureGenerateResponseAdminSubmitDto>> submit(
@PathVariable Long pictureGenerateResponseId) {
return success(pictureGenerateWorkService.submitFinal(pictureGenerateResponseId));
}

@PostMapping("/{pictureGenerateResponseId}/pictures")
public ResponseEntity<ApiResult<Boolean>> updatePictureList(
@AuthenticationPrincipal UserDetailsImpl userDetails,
@RequestBody List<UpdatePictureUrlRequestDto> reuqestDtoList,
@PathVariable Long pictureGenerateResponseId) {
return success(pictureGenerateWorkService.updatePictureListCreatedByAdmin(userDetails.getId(), reuqestDtoList,
pictureGenerateResponseId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@RestController
@RequestMapping("/api/creators")
@RequiredArgsConstructor
public class PictureGenerateWorkController {
public class CreatorPictureGenerateController {
private final PictureGenerateWorkService pictureGenerateWorkService;

@GetMapping("/picture-generate-requests/assigned")
Expand Down Expand Up @@ -83,7 +83,7 @@ public ResponseEntity<ApiResult<Boolean>> updatePictureUrl(
public ResponseEntity<ApiResult<PictureGenerateResponseSubmitDto>> submitPictureGenerateResponse(
@AuthenticationPrincipal UserDetailsImpl userDetails,
@PathVariable Long pictureGenerateResponseId) {
return success(pictureGenerateWorkService.submit(userDetails.getId(), pictureGenerateResponseId));
return success(pictureGenerateWorkService.submitToAdmin(userDetails.getId(), pictureGenerateResponseId));
}

@PostMapping("/picture-generate-responses/{pictureGenerateResponseId}/memo")
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/gt/genti/adapter/in/web/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static com.gt.genti.other.util.ApiUtils.*;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -11,13 +13,15 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.dto.CommonPictureResponseDto;
import com.gt.genti.other.annotation.ToBeUpdated;
import com.gt.genti.other.aop.annotation.CheckUserIsQuit;
import com.gt.genti.other.auth.UserDetailsImpl;
import com.gt.genti.dto.UserInfoResponseDto;
import com.gt.genti.dto.UserInfoUpdateRequestDto;
import com.gt.genti.application.service.UserService;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RestController
Expand Down Expand Up @@ -56,4 +60,11 @@ public ResponseEntity<ApiResult<Boolean>> restoreSoftDeletedUser(
@AuthenticationPrincipal UserDetailsImpl userDetails) {
return success(userService.restoreSoftDeletedUser(userDetails.getId()));
}

@GetMapping("/pictures/my")
public ResponseEntity<ApiResult<List<CommonPictureResponseDto>>> getAllMyGeneratedPicture(
@AuthenticationPrincipal UserDetailsImpl userDetails
){
return success(userService.getAllMyGeneratedPicture(userDetails.getId()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@RestController
@RequestMapping("/api/users/picture-generate-requests")
@RequiredArgsConstructor
public class PictureGenerateRequestController {
public class UserPictureGenerateRequestController {
private final PictureGenerateRequestUseCase pictureGenerateRequestUseCase;

@CheckUserIsQuit
Expand Down
Loading

0 comments on commit b7a6add

Please sign in to comment.