Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy #57

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package com.yedu.backend.admin.presentation;

import com.yedu.backend.admin.application.dto.req.RecommendTeacherRequest;
import com.yedu.backend.admin.domain.service.AdminGetService;
import com.yedu.backend.domain.matching.domain.repository.ClassMatchingRepository;
import com.yedu.backend.domain.matching.domain.service.ClassMatchingGetService;
import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;
import com.yedu.backend.domain.parents.domain.entity.Goal;
import com.yedu.backend.domain.parents.domain.entity.Parents;
import com.yedu.backend.domain.parents.domain.repository.ApplicationFormRepository;
import com.yedu.backend.domain.parents.domain.repository.GoalRepository;
import com.yedu.backend.domain.parents.domain.repository.ParentsRepository;
import com.yedu.backend.domain.parents.domain.service.ParentsGetService;
import com.yedu.backend.domain.parents.domain.service.ParentsSaveService;
import com.yedu.backend.domain.teacher.domain.entity.*;
import com.yedu.backend.domain.teacher.domain.entity.constant.Day;
import com.yedu.backend.domain.teacher.domain.entity.constant.District;
import com.yedu.backend.domain.teacher.domain.entity.constant.TeacherGender;
import com.yedu.backend.domain.teacher.domain.entity.constant.TeachingStyle;
import com.yedu.backend.domain.teacher.domain.repository.*;
import com.yedu.backend.domain.teacher.domain.service.TeacherGetService;
import com.yedu.backend.domain.teacher.domain.service.TeacherSaveService;
import com.yedu.backend.global.bizppurio.application.dto.req.MessageStatusRequest;
import com.yedu.backend.global.bizppurio.application.usecase.BizppurioParentsMessage;
import com.yedu.backend.global.bizppurio.application.usecase.BizppurioTeacherMessage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequiredArgsConstructor
@Tag(name = "ADMIN TEST Controller", description = "μ—¬λŸ¬κ°€μ§€ ν…ŒμŠ€νŠΈμš© APIμž…λ‹ˆλ‹€")
@Transactional
public class AdminTestController {
private final TeacherSaveService teacherSaveService;
private final BizppurioTeacherMessage teacherMessage;
private final TeacherGetService teacherGetService;
private final BizppurioParentsMessage parentsMessage;
private final ParentsGetService parentsGetService;
private final AdminGetService adminGetService;
private final ParentsSaveService parentsSaveService;
private final ApplicationFormRepository applicationFormRepository;
private final ParentsRepository parentsRepository;
private final GoalRepository goalRepository;
private final ClassMatchingRepository classMatchingRepository;
private final TeacherAvailableRepository teacherAvailableRepository;
private final TeacherDistrictRepository teacherDistrictRepository;
private final TeacherEnglishRepository teacherEnglishRepository;
private final TeacherMathRepository teacherMathRepository;
private final TeacherRepository teacherRepository;

@PostMapping("/test/teacher/signup/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜ κ°„νŽΈ κ°€μž… - μ „ν™”λ²ˆν˜Έλ₯Ό λ„£μ–΄μ£Όμ„Έμš” (κ°„νŽΈκ°€μž…μ΄λΌ λ‚΄μš©μ€ κΈ°λŒ€ν•˜μ§€ λ§ˆμ„Έμš”)")
public void signUpTeacher(@PathVariable String phoneNumber) {
Teacher teacher = Teacher.builder()
.teacherInfo(new TeacherInfo("μ±„μ˜λŒ€", "ν† λ§ˆμŠ€", "[email protected]", phoneNumber, "1998", TeacherGender.남, "", ""))
.teacherClassInfo(new TeacherClassInfo("λ‚˜λŠ” μ΄λŸ¬ν•œ μ„ μƒλ‹˜", TeachingStyle.CARING, TeachingStyle.FUN, "μ €λŸ° 방식", "μ €λŸ° 방식", "# 이런 학생", "μ΄λŸ¬μ΄λŸ¬ν•˜λ‹€", true, true))
.teacherSchoolInfo(new TeacherSchoolInfo("λŒ€ν•™κ΅", true, "ν•™κ³Ό", "고등학ꡐ", "μ™Έκ³ "))
.source("기타")
.build();
TeacherEnglish teacherEnglish = TeacherEnglish.builder()
.teacher(teacher)
.appealPoint("μ΄λŸ¬μ΄λŸ¬ν•œ λΆ€λΆ„")
.foreignExperience("# abc")
.managementStyle("abc")
.teachingExperience("# abc")
.teachingHistory(3)
.managementStyle("이러이러")
.teachingStyle("이러이러")
.build();
TeacherMath teacherMath = TeacherMath.builder()
.teacher(teacher)
.appealPoint("μ΄λŸ¬μ΄λŸ¬ν•œ λΆ€λΆ„")
.managementStyle("abc")
.teachingExperience("# abc")
.teachingHistory(3)
.managementStyle("이러이러")
.teachingStyle("이러이러")
.build();
teacherSaveService.saveTeacher(teacher, List.of(TeacherAvailable.builder()
.teacher(teacher)
.day(Day.byInt(2))
.availableTime(LocalTime.parse("12:00"))
.build()), List.of(TeacherDistrict.builder().teacher(teacher).district(District.강남ꡬ).build()), teacherEnglish, teacherMath);
}

@PostMapping("/test/parents/signup/{phoneNumber}")
@Operation(summary = "ν•™λΆ€λͺ¨ κ°„νŽΈ κ°€μž… - μ „ν™”λ²ˆν˜Έλ₯Ό λ„£μ–΄μ£Όμ„Έμš” (κ°„νŽΈκ°€μž…μ΄λΌ λ‚΄μš©μ€ κΈ°λŒ€ν•˜μ§€ λ§ˆμ„Έμš”)")
public void signUpParents(@PathVariable String phoneNumber) {
Parents parents = Parents.builder()
.phoneNumber(phoneNumber)
.marketingAgree(true)
.build();
parentsSaveService.saveParents(parents);
}

@DeleteMapping("/test/teacher/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜ κ°„νŽΈ μ‚­μ œ - μ „ν™”λ²ˆν˜Έλ₯Ό λ„£μ–΄μ£Όμ„Έμš”")
public void deleteTeacher(@PathVariable String phoneNumber) {
classMatchingRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherAvailableRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherDistrictRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherEnglishRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherEnglishRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherMathRepository.deleteAllByTeacher_TeacherInfo_PhoneNumber(phoneNumber);
teacherRepository.deleteAllByTeacherInfo_PhoneNumber(phoneNumber);
}

@DeleteMapping("/test/parents/{phoneNumber}")
@Operation(summary = "ν•™λΆ€λͺ¨ κ°„νŽΈ μ‚­μ œ - μ „ν™”λ²ˆν˜Έλ₯Ό λ„£μ–΄μ£Όμ„Έμš”")
public void deleteParents(@PathVariable String phoneNumber) {
classMatchingRepository.deleteAllByApplicationForm_Parents_PhoneNumber(phoneNumber);
goalRepository.deleteAllByApplicationForm_Parents_PhoneNumber(phoneNumber);
applicationFormRepository.deleteAllByParents_PhoneNumber(phoneNumber);
parentsRepository.deleteAllByPhoneNumber(phoneNumber);
}
@PostMapping("/test/teacher/profile/{phoneNumber}")
@Operation(summary = "ꡬ글폼 ν”„λ‘œν•„ μž‘μ„±μ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 κ°€μž…μ€ 이미 μ„ μƒλ‹˜μœΌλ‘œ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void finProfile(@PathVariable String phoneNumber) {
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.counselStartAndPhotoSubmit(teacher);
}

@PostMapping("/test/teacher/photo/{phoneNumber}")
@Operation(summary = "ꡬ글폼 사진 및 μ˜μƒ μ œμΆœμ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 이미 μ„ μƒλ‹˜μœΌλ‘œ κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void finPhoto(@PathVariable String phoneNumber) {
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.applyAgree(teacher);
}

@PostMapping("/test/teacher/agree/{phoneNumber}")
@Operation(summary = "κ³„μ•½μ„œ μ œμΆœμ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 이미 μ„ μƒλ‹˜μœΌλ‘œ κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void finApplyAgree(@PathVariable String phoneNumber) {
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.matchingChannel(teacher);
teacherMessage.applyChannel(teacher);
}

@PostMapping("/test/teacher/recommend/{applicationFormId}/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜μ—κ²Œ μˆ˜μ—… μΆ”μ²œν•΄μ£ΌλŠ” μ•Œλ¦Όν†‘ - κ΄€λ¦¬μž νŽ˜μ΄μ§€ 확인 ν›„ 신청건ID(EX. 온라인11a)와 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 이미 μ„ μƒλ‹˜μœΌλ‘œ κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void recommendClass(@PathVariable String applicationFormId, @PathVariable String phoneNumber) {
ApplicationForm applicationForm = adminGetService.applicationFormById(applicationFormId);
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.notifyClass(applicationForm, teacher);
}

@PostMapping("/test/teacher/accept/{applicationFormId}/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜μ΄ μˆ˜μ—… μ‹ μ²­μ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - κ΄€λ¦¬μž νŽ˜μ΄μ§€ 확인 ν›„ 신청건ID(EX. 온라인11a)와 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 μ„ μƒλ‹˜μœΌλ‘œ 이미 κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void acceptCase(@PathVariable String phoneNumber, @PathVariable String applicationFormId) {
ApplicationForm applicationForm = adminGetService.applicationFormById(applicationFormId);
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.notifyClass(applicationForm, teacher);
}

@PostMapping("/test/teacher/refuse/{applicationFormId}/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜μ΄ μˆ˜μ—… κ±°μ ˆμ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - κ΄€λ¦¬μž νŽ˜μ΄μ§€ 확인 ν›„ 신청건ID(EX. 온라인11a)와 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, 이미 μ„ μƒλ‹˜μœΌλ‘œ κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void refuseCase(@PathVariable String applicationFormId, @PathVariable String phoneNumber) {
ApplicationForm applicationForm = adminGetService.applicationFormById(applicationFormId);
Teacher teacher = teacherGetService.byPhoneNumber(phoneNumber);
teacherMessage.notifyClass(applicationForm, teacher);
}

@PostMapping("/test/parents/apply/{phoneNumber}")
@Operation(summary = "μ„ μƒλ‹˜μ΄ νƒˆλ¦¬ 폼 μž‘μ„±μ‹œ λ°›λŠ” μ•Œλ¦Όν†‘ - 받을 μ‚¬λžŒμ˜ μ „ν™”λ²ˆν˜Έλ₯Ό μ μ–΄μ£Όμ„Έμš”! 단, ν•™λΆ€λͺ¨λ‘œ 이미 κ°€μž…μ€ ν–ˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!")
public void finApplicationForm(@PathVariable String phoneNumber) {
Parents parents = parentsGetService.optionalParentsByPhoneNumber(phoneNumber)
.orElseThrow();
parentsMessage.notifyCalling(parents);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.Optional;

public interface ClassMatchingRepository extends JpaRepository<ClassMatching, Long> , ClassMatchingDslRepository{
List<ClassMatching> findAllByApplicationForm(ApplicationForm applicationForm);
Optional<ClassMatching> findByApplicationForm_ApplicationFormIdAndTeacher_TeacherIdAndTeacher_TeacherInfo_PhoneNumber(String applicationFormId, long teacherId, String phoneNumber);

void deleteAllByApplicationForm_Parents_PhoneNumber(String phoneNumber);
void deleteAllByTeacher_TeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ public class ApplicationForm extends BaseEntity {
private Gender favoriteGender;
@Column(columnDefinition = "TEXT")
private String favoriteDirection; //μˆ˜μ—… λ°©ν–₯μ„±
@Column(nullable = false, length = 300)
@Column(nullable = false, columnDefinition = "TEXT")
private String wantTime; //μˆ˜μ—… λ‚ μ§œ
@Column(nullable = false)
private String classCount; // λͺ‡νšŒ (1,2,3)
@Column(nullable = false)
private String classTime; // μˆ˜μ—… μ‹œκ°„(50, 75, 100...)
@Column(columnDefinition = "TEXT")
private String source; //μœ μž…κ²½λ‘œ
@Builder.Default
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class Goal {
private long goalId;
@ManyToOne(fetch = FetchType.LAZY)
private ApplicationForm applicationForm;
@Column(nullable = false, length = 100)
@Column(nullable = false, columnDefinition = "TEXT")
private String classGoal;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.yedu.backend.domain.parents.domain.repository;

import com.yedu.backend.domain.parents.domain.entity.ApplicationForm;
import com.yedu.backend.domain.parents.domain.entity.Parents;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface ApplicationFormRepository extends JpaRepository<ApplicationForm, String> {
void deleteAllByParents_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@

public interface GoalRepository extends JpaRepository<Goal, Long> {
List<Goal> findAllByApplicationForm(ApplicationForm applicationForm);

void deleteAllByApplicationForm_Parents_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

public interface ParentsRepository extends JpaRepository<Parents, Long> {
Optional<Parents> findByPhoneNumber(String phoneNumber);

void deleteAllByPhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@

public interface TeacherAvailableRepository extends JpaRepository<TeacherAvailable, Long>, TeacherAvailableDslRepository {
List<TeacherAvailable> findAllByTeacher(Teacher teacher);


void deleteAllByTeacher_TeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

public interface TeacherDistrictRepository extends JpaRepository<TeacherDistrict, Long> {
List<TeacherDistrict> findAllByTeacher(Teacher teacher);

void deleteAllByTeacher_TeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

public interface TeacherEnglishRepository extends JpaRepository<TeacherEnglish, Long> {
Optional<TeacherEnglish> findByTeacher(Teacher teacher);

void deleteAllByTeacher_TeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

public interface TeacherMathRepository extends JpaRepository<TeacherMath, Long> {
Optional<TeacherMath> findByTeacher(Teacher teacher);

void deleteAllByTeacher_TeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@

public interface TeacherRepository extends JpaRepository<Teacher, Long>, TeacherDslRepository {
Optional<Teacher> findByTeacherInfo_PhoneNumber(String PhoneNumber);

void deleteAllByTeacherInfo_PhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE goal MODIFY COLUMN class_goal text;
ALTER TABLE application_form MODIFY COLUMN want_time text;
ALTER TABLE application_form MODIFY COLUMN source text;