From 547cb63c894b072eaca34aa580876da1a75d7ccc Mon Sep 17 00:00:00 2001 From: SBSun Date: Sat, 18 Jan 2025 10:29:18 +0900 Subject: [PATCH 001/107] [feat] default setting --- .gitignore | 1 + build.gradle | 15 ++- docker-compose-db.yml | 15 +++ .../com/writely/HealthCheckController.java | 18 ++++ .../common/audit/CustomAuditorAware.java | 13 +++ .../com/writely/common/config/WebConfig.java | 24 +++++ .../converter/AbstractEnumCodeConverter.java | 26 ++++++ .../common/domain/BaseAuditTimeEntity.java | 42 +++++++++ .../writely/common/domain/BaseTimeEntity.java | 32 +++++++ .../com/writely/common/enums/Codable.java | 20 ++++ .../writely/common/enums/code/CodeInfo.java | 10 ++ .../common/enums/code/ResultCodeInfo.java | 17 ++++ .../enums/exception/ParameterException.java | 18 ++++ .../common/exception/BaseException.java | 22 +++++ .../exception/GlobalExceptionHandler.java | 34 +++++++ .../writely/common/response/BaseResponse.java | 69 ++++++++++++++ .../com/writely/common/util/DateTimeUtil.java | 92 +++++++++++++++++++ .../java/com/writely/common/util/LogUtil.java | 33 +++++++ src/main/resources/application-local.yml | 19 ++++ src/main/resources/application.yml | 26 +++++- 20 files changed, 541 insertions(+), 5 deletions(-) create mode 100644 docker-compose-db.yml create mode 100644 src/main/java/com/writely/HealthCheckController.java create mode 100644 src/main/java/com/writely/common/audit/CustomAuditorAware.java create mode 100644 src/main/java/com/writely/common/config/WebConfig.java create mode 100644 src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java create mode 100644 src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java create mode 100644 src/main/java/com/writely/common/domain/BaseTimeEntity.java create mode 100644 src/main/java/com/writely/common/enums/Codable.java create mode 100644 src/main/java/com/writely/common/enums/code/CodeInfo.java create mode 100644 src/main/java/com/writely/common/enums/code/ResultCodeInfo.java create mode 100644 src/main/java/com/writely/common/enums/exception/ParameterException.java create mode 100644 src/main/java/com/writely/common/exception/BaseException.java create mode 100644 src/main/java/com/writely/common/exception/GlobalExceptionHandler.java create mode 100644 src/main/java/com/writely/common/response/BaseResponse.java create mode 100644 src/main/java/com/writely/common/util/DateTimeUtil.java create mode 100644 src/main/java/com/writely/common/util/LogUtil.java create mode 100644 src/main/resources/application-local.yml diff --git a/.gitignore b/.gitignore index 41719c5..6c4c4bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ HELP.md .gradle build/ +db/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ diff --git a/build.gradle b/build.gradle index 0877da2..aecdfbd 100644 --- a/build.gradle +++ b/build.gradle @@ -26,11 +26,20 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' - compileOnly 'org.projectlombok:lombok' + + /* DB */ runtimeOnly 'org.postgresql:postgresql' + + /* Lombok */ + compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + /* Common Util */ + implementation 'org.apache.commons:commons-lang3:3.12.0' + implementation 'commons-io:commons-io:2.13.0' + + /* Swagger */ + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' } tasks.named('test') { diff --git a/docker-compose-db.yml b/docker-compose-db.yml new file mode 100644 index 0000000..e26f4a6 --- /dev/null +++ b/docker-compose-db.yml @@ -0,0 +1,15 @@ +version: '3.1' + +services: + postgres: + image: postgres + container_name: postgres + restart: always + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: 1234 + POSTGRES_DB: writely + ports: + - "5432:5432" + volumes: + - ./db:/var/lib/postgresql/data \ No newline at end of file diff --git a/src/main/java/com/writely/HealthCheckController.java b/src/main/java/com/writely/HealthCheckController.java new file mode 100644 index 0000000..15acd33 --- /dev/null +++ b/src/main/java/com/writely/HealthCheckController.java @@ -0,0 +1,18 @@ +package com.writely; + +import com.writely.common.response.BaseResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/health-check") +@Tag(name = "health-check") +public class HealthCheckController { + + @GetMapping + public BaseResponse healthCheck() { + return BaseResponse.success(); + } +} diff --git a/src/main/java/com/writely/common/audit/CustomAuditorAware.java b/src/main/java/com/writely/common/audit/CustomAuditorAware.java new file mode 100644 index 0000000..91f61f3 --- /dev/null +++ b/src/main/java/com/writely/common/audit/CustomAuditorAware.java @@ -0,0 +1,13 @@ +package com.writely.common.audit; + +import org.springframework.data.domain.AuditorAware; + +import java.util.Optional; + +public class CustomAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(0L); + } +} diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java new file mode 100644 index 0000000..163ca3d --- /dev/null +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -0,0 +1,24 @@ +package com.writely.common.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Value("${service.cors.origins}") + private List origins; + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins(origins.toArray(new String[0])) + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true); + } +} diff --git a/src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java b/src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java new file mode 100644 index 0000000..d51fab1 --- /dev/null +++ b/src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java @@ -0,0 +1,26 @@ +package com.writely.common.converter; + +import com.writely.common.enums.Codable; +import jakarta.persistence.AttributeConverter; +import org.apache.commons.lang3.StringUtils; + +public abstract class AbstractEnumCodeConverter & Codable> implements AttributeConverter { + + @Override + public String convertToDatabaseColumn(E attribute) { + return this.toDatabaseColumn(attribute); + } + + @Override + public E convertToEntityAttribute(String dbData) { + return null; + } + + public E toEntityAttribute(Class cls, String code) { + return StringUtils.isBlank(code) ? null : Codable.fromCode(cls, code); + } + + private String toDatabaseColumn(E attr) { + return (attr == null) ? null : attr.getCode(); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java b/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java new file mode 100644 index 0000000..d3a9a7f --- /dev/null +++ b/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java @@ -0,0 +1,42 @@ +package com.writely.common.domain; + +import com.writely.common.util.DateTimeUtil; +import jakarta.persistence.*; +import lombok.Getter; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public class BaseAuditTimeEntity implements Serializable { + + @CreatedBy + @Column(name = "created_by", updatable = false, nullable = false) + protected Long createdBy; + + @LastModifiedBy + @Column(name = "updated_by", nullable = false) + protected Long updatedBy; + + @Column(name = "created_at", updatable = false, nullable = false) + protected LocalDateTime createdAt; + + @Column(name = "updated_at", nullable = false) + protected LocalDateTime updatedAt; + + @PrePersist + protected void onPrePersist() { + this.createdAt = DateTimeUtil.getDateTime(); + this.updatedAt = this.createdAt; + } + + @PreUpdate + protected void onPreUpdate() { + this.updatedAt = DateTimeUtil.getDateTime(); + } +} diff --git a/src/main/java/com/writely/common/domain/BaseTimeEntity.java b/src/main/java/com/writely/common/domain/BaseTimeEntity.java new file mode 100644 index 0000000..345b047 --- /dev/null +++ b/src/main/java/com/writely/common/domain/BaseTimeEntity.java @@ -0,0 +1,32 @@ +package com.writely.common.domain; + +import com.writely.common.util.DateTimeUtil; +import jakarta.persistence.*; +import lombok.Getter; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public class BaseTimeEntity implements Serializable { + + @Column(name = "created_at", updatable = false, nullable = false) + protected LocalDateTime createdAt; + + @Column(name = "updated_at", nullable = false) + protected LocalDateTime updatedAt; + + @PrePersist + protected void onPrePersist() { + this.createdAt = DateTimeUtil.getDateTime(); + this.updatedAt = this.createdAt; + } + + @PreUpdate + protected void onPreUpdate() { + this.updatedAt = DateTimeUtil.getDateTime(); + } +} diff --git a/src/main/java/com/writely/common/enums/Codable.java b/src/main/java/com/writely/common/enums/Codable.java new file mode 100644 index 0000000..8a1da58 --- /dev/null +++ b/src/main/java/com/writely/common/enums/Codable.java @@ -0,0 +1,20 @@ +package com.writely.common.enums; + +import java.util.stream.Stream; + +public interface Codable { + + static & Codable> E fromCode(Class cls, String code) { + if (code == null) { + return null; + } + final String t = code.trim(); + return Stream.of(cls.getEnumConstants()) + .filter(e -> e.getCode().equalsIgnoreCase(t)) + .findAny() + .orElseThrow( + () -> new IllegalArgumentException(String.format("%s에 %s가 존재하지 않습니다.", cls.getName(), code))); + } + + String getCode(); +} diff --git a/src/main/java/com/writely/common/enums/code/CodeInfo.java b/src/main/java/com/writely/common/enums/code/CodeInfo.java new file mode 100644 index 0000000..5a71050 --- /dev/null +++ b/src/main/java/com/writely/common/enums/code/CodeInfo.java @@ -0,0 +1,10 @@ +package com.writely.common.enums.code; + +import org.springframework.http.HttpStatus; + +public interface CodeInfo { + + HttpStatus getStatus(); + String getCode(); + String getMessage(); +} diff --git a/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java b/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java new file mode 100644 index 0000000..de29d9b --- /dev/null +++ b/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java @@ -0,0 +1,17 @@ +package com.writely.common.enums.code; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum ResultCodeInfo implements CodeInfo { + + SUCCESS(HttpStatus.OK, "RESULT-001", "성공적으로 수행하였습니다."), + FAILURE(HttpStatus.INTERNAL_SERVER_ERROR, "RESULT-002", "알 수 없는 오류가 발생했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/common/enums/exception/ParameterException.java b/src/main/java/com/writely/common/enums/exception/ParameterException.java new file mode 100644 index 0000000..408046f --- /dev/null +++ b/src/main/java/com/writely/common/enums/exception/ParameterException.java @@ -0,0 +1,18 @@ +package com.writely.common.enums.exception; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum ParameterException implements CodeInfo { + + PARAMETER_NOT_EXIST(HttpStatus.BAD_REQUEST, "PARAM-001", "파라미터가 존재하지 않습니다."), + PARAMETER_INVALID(HttpStatus.BAD_REQUEST, "PARAM-002", "유효하지 않은 파라미터입니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/common/exception/BaseException.java b/src/main/java/com/writely/common/exception/BaseException.java new file mode 100644 index 0000000..1adffa0 --- /dev/null +++ b/src/main/java/com/writely/common/exception/BaseException.java @@ -0,0 +1,22 @@ +package com.writely.common.exception; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; + +@Getter +public class BaseException extends RuntimeException { + + private CodeInfo codeInfo; + + public BaseException() { + } + + public BaseException(CodeInfo codeInfo) { + this.codeInfo = codeInfo; + } + + @Override + public String toString() { + return "BaseException [status=" + codeInfo.getStatus().value() + ", code=" + codeInfo.getCode() + ", message=" + codeInfo.getMessage() + "]"; + } +} diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..77b0ae1 --- /dev/null +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -0,0 +1,34 @@ +package com.writely.common.exception; + +import com.writely.common.response.BaseResponse; +import com.writely.common.util.LogUtil; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.io.PrintWriter; +import java.io.StringWriter; + +@RestControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler({Exception.class}) + public BaseResponse handle(Exception e) { + if(!(e instanceof BaseException) || ((BaseException)e).getCodeInfo() == null) { + String message = getStackTrace(e); + LogUtil.error(message); + return BaseResponse.failure(message); + } + + return BaseResponse.failure(((BaseException) e).getCodeInfo()); + } + + private String getStackTrace(Throwable throwable) { + if (throwable == null) { + return "No exception provided."; + } + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + throwable.printStackTrace(printWriter); + return stringWriter.toString(); + } +} diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/src/main/java/com/writely/common/response/BaseResponse.java new file mode 100644 index 0000000..95456d4 --- /dev/null +++ b/src/main/java/com/writely/common/response/BaseResponse.java @@ -0,0 +1,69 @@ +package com.writely.common.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.writely.common.enums.code.CodeInfo; +import com.writely.common.enums.code.ResultCodeInfo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +@JsonInclude(JsonInclude.Include.NON_NULL) +public class BaseResponse { + + @Schema(title = "상태 코드", description = "상태 코드", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") + private Integer status; + + @Schema(title = "코드", description = "API 처리 결과 코드", requiredMode = Schema.RequiredMode.REQUIRED, example = "RESULT-001") + private String code; + + @Schema(title = "결과 데이터", description = "API 처리 결과 데이터", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private T result; + + @Schema(title = "메시지", description = "API 처리 결과 메시지", requiredMode = Schema.RequiredMode.REQUIRED, example = "성공적으로 수행하였습니다.") + private String message; + + protected BaseResponse() {} + + public static BaseResponse success() { + BaseResponse res = new BaseResponse<>(); + res.status = ResultCodeInfo.SUCCESS.getStatus().value(); + res.code = ResultCodeInfo.SUCCESS.getCode(); + res.message = ResultCodeInfo.SUCCESS.getMessage(); + return res; + } + + public static BaseResponse success(T data) { + BaseResponse res = new BaseResponse<>(); + res.status = ResultCodeInfo.SUCCESS.getStatus().value(); + res.code = ResultCodeInfo.SUCCESS.getCode(); + res.result = data; + res.message = ResultCodeInfo.SUCCESS.getMessage(); + return res; + } + + public static BaseResponse failure() { + BaseResponse res = new BaseResponse<>(); + res.status = ResultCodeInfo.FAILURE.getStatus().value(); + res.message = ResultCodeInfo.FAILURE.getMessage(); + return res; + } + + public static BaseResponse failure(String message) { + BaseResponse res = new BaseResponse<>(); + res.status = ResultCodeInfo.FAILURE.getStatus().value(); + res.message = message; + return res; + } + + public static BaseResponse failure(CodeInfo codeInfo) { + BaseResponse res = new BaseResponse<>(); + res.status = codeInfo.getStatus().value(); + res.code = codeInfo.getCode(); + res.message = codeInfo.getMessage(); + return res; + } +} + + diff --git a/src/main/java/com/writely/common/util/DateTimeUtil.java b/src/main/java/com/writely/common/util/DateTimeUtil.java new file mode 100644 index 0000000..c6eda52 --- /dev/null +++ b/src/main/java/com/writely/common/util/DateTimeUtil.java @@ -0,0 +1,92 @@ +package com.writely.common.util; + +import com.writely.common.enums.exception.ParameterException; +import com.writely.common.exception.BaseException; +import lombok.experimental.UtilityClass; +import org.apache.commons.lang3.StringUtils; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Locale; +import java.util.TimeZone; + +@UtilityClass +public class DateTimeUtil { + + public final String DATE_DEFAULT_PATTERN = "yyyy-MM-dd"; + public final String DATE_NORMAL_PATTERN = "yyyyMMdd"; + public final String DATE_DOT_PATTERN = "yyyy.MM.dd"; + + public final String DATETIME_DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss"; + + public final TimeZone KOREA_TIME_ZONE = TimeZone.getTimeZone(ZoneId.of("Asia/Seoul")); + + public LocalDateTime convertToDateTime(String dateString, String pattern) { + verifyValidPattern(dateString, pattern); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + return LocalDateTime.parse(dateString, formatter); + } + + public LocalDateTime convertToDateTime(String dateString) { + return convertToDateTime(dateString, DATETIME_DEFAULT_PATTERN); + } + + public LocalDate convertToDate(String dateString, String pattern) { + verifyValidPattern(dateString, DATE_DEFAULT_PATTERN); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + return LocalDate.parse(dateString, formatter); + } + + public LocalDate convertToDate(String dateString) { + return convertToDate(dateString, DATE_DEFAULT_PATTERN); + } + + public String convertToString(LocalDateTime dateTime, String pattern) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, Locale.KOREA); + return dateTime.format(formatter); + } + + public String convertToString(LocalDateTime dateTime) { + return convertToString(dateTime, DATETIME_DEFAULT_PATTERN); + } + + public String convertToString(LocalDate date, String pattern) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, Locale.KOREA); + return date.format(formatter); + } + + public String convertToString(LocalDate date) { + return convertToString(date, DATE_DEFAULT_PATTERN); + } + + public LocalDate getDate() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_DEFAULT_PATTERN); + return LocalDate.parse(LocalDate.now().format(formatter), formatter); + } + + public LocalDateTime getDateTime() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATETIME_DEFAULT_PATTERN); + return LocalDateTime.parse(LocalDateTime.now().format(formatter), formatter); + } + + private void verifyValidPattern(String dateString, String pattern) { + if (StringUtils.isBlank(dateString)) { + throw new BaseException(ParameterException.PARAMETER_INVALID); + } + + final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + try { + if (StringUtils.containsAny(pattern, "H", "m", "s")) { + LocalDateTime.parse(dateString, formatter); + } else { + LocalDate.parse(dateString, formatter); + } + } catch (Exception e) { + throw new BaseException(ParameterException.PARAMETER_INVALID); + } + } +} diff --git a/src/main/java/com/writely/common/util/LogUtil.java b/src/main/java/com/writely/common/util/LogUtil.java new file mode 100644 index 0000000..df64954 --- /dev/null +++ b/src/main/java/com/writely/common/util/LogUtil.java @@ -0,0 +1,33 @@ +package com.writely.common.util; + +import lombok.experimental.UtilityClass; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Slf4j +@UtilityClass +public class LogUtil { + + private static final Logger LOG = LoggerFactory.getLogger(LogUtil.class); + + public void debug(String msg) { + LOG.info(msg); + } + + public void trace(String msg) { + LOG.trace(msg); + } + + public void info(String msg) { + LOG.info(msg); + } + + public void warn(String msg) { + LOG.warn(msg); + } + + public void error(String msg) { + LOG.error(msg); + } +} diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 0000000..dd98cb3 --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,19 @@ +spring: + config: + activate: + on-profile: local + + datasource: + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://localhost:5432/writely?useUnicode=true&characterEncoding=UTF-8 + username: postgres + password: 1234 + +server: + port: 8080 + +service: + server: + url: http://localhost:8080 + cors: + origins: http://localhost:8080, http://localhost:3000 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 926ba1b..e0626ea 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,25 @@ spring: - application: - name: writely + profiles: + active: local + servlet: + multipart: + max-file-size: 20MB + max-request-size: 20MB + enabled: true + jpa: + properties: + hibernate: + format_sql: true + use_sql_comments: true + +logging: + level: + org.hibernate.SQL: debug + +springdoc: + swagger-ui: + path: /doc + tags-sorter: alpha + operations-sorter: alpha + doc-expansion: none + default-models-expand-depth: -1 \ No newline at end of file From e0ccd8b22adf95d87c3ee802837f1deda4bca016 Mon Sep 17 00:00:00 2001 From: SBSun Date: Sat, 18 Jan 2025 17:34:12 +0900 Subject: [PATCH 002/107] [feat] cicd pipeline --- .github/workflows/gradle.yml | 62 +++++++++++++++++++ Dockerfile | 9 +++ build.gradle | 4 ++ src/main/resources/application-dev.yml | 19 ++++++ .../com/writely/WritelyApplicationTests.java | 13 ---- 5 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/gradle.yml create mode 100644 Dockerfile create mode 100644 src/main/resources/application-dev.yml delete mode 100644 src/test/java/com/writely/WritelyApplicationTests.java diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..92e9d2a --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,62 @@ +name: Deploy + +on: + push: + branches: [ "develop" ] + +permissions: + contents: read + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + + - name: Gradle Caching + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build with Gradle + run: chmod +x gradlew && ./gradlew build -x test + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Login to Amazon ECR + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }} + + - name: Docker build & push to ECR + run: docker build -t ${{ secrets.ECR_REGISTRY_URI }}:latest -f Dockerfile --push . + + - name: Server Deploy + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ + --parameters commands='[ + "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }}", + "cd /root", + "[ $(docker ps -q | wc -l) -gt 0 ] && docker stop $(docker ps -q)", + "[ $(docker images -q | wc -l) -gt 0 ] && docker rmi $(docker images -q)", + "docker pull ${{ secrets.ECR_REGISTRY_URI }}:latest", + "docker run --rm -d -p 8080:8080 --name writely-api -v /writely/logs:/writely/logs ${{ secrets.ECR_REGISTRY_URI }}:latest" + ]' \ + --comment "Deploying Docker container" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a0011cc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM openjdk:21-jdk-slim + +WORKDIR /writely + +ENV TZ=Asiz/Seoul + +COPY build/libs/*.jar writely.jar + +ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "writely.jar"] \ No newline at end of file diff --git a/build.gradle b/build.gradle index aecdfbd..0bc3635 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,10 @@ repositories { mavenCentral() } +jar { + enabled = false +} + dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..e7570d6 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,19 @@ +spring: + config: + activate: + on-profile: dev + + datasource: + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service?useUnicode=true&characterEncoding=UTF-8 + username: postgres + password: Writely0101% + +server: + port: 8080 + +service: + server: + url: http://54.180.242.10:8080 + cors: + origins: http://54.180.242.10:8080, http://localhost:8080, http://localhost:3000 \ No newline at end of file diff --git a/src/test/java/com/writely/WritelyApplicationTests.java b/src/test/java/com/writely/WritelyApplicationTests.java deleted file mode 100644 index 71ea883..0000000 --- a/src/test/java/com/writely/WritelyApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.writely; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class WritelyApplicationTests { - - @Test - void contextLoads() { - } - -} From 0d647b459780b4892c6b1ceeb3cceea371d270b3 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 19 Jan 2025 00:42:16 +0900 Subject: [PATCH 003/107] feat: jooq & product domain default setting (#1) --- .gitignore | 1 + build.gradle | 44 ++++++++++++++++ docker-compose-db.yml | 2 +- sql/init.sql | 51 +++++++++++++++++++ .../common/audit/CustomAuditorAware.java | 7 +-- .../writely/common/config/AuditConfig.java | 19 +++++++ .../common/domain/BaseAuditTimeEntity.java | 5 +- .../exception/GlobalExceptionHandler.java | 13 +++-- .../writely/common/response/BaseResponse.java | 8 --- .../product/controller/ProductController.java | 45 ++++++++++++++++ .../com/writely/product/domain/Product.java | 34 +++++++++++++ .../writely/product/domain/ProductMemo.java | 32 ++++++++++++ .../domain/enums/ProductException.java | 17 +++++++ .../repository/ProductMemoRepository.java | 9 ++++ .../product/repository/ProductRepository.java | 9 ++++ .../product/request/ProductCreateRequest.java | 13 +++++ .../request/ProductMemoCreateRequest.java | 13 +++++ .../product/response/ProductResponse.java | 23 +++++++++ .../service/ProductCommandService.java | 38 ++++++++++++++ .../product/service/ProductQueryService.java | 30 +++++++++++ src/main/resources/application-local.yml | 2 +- 21 files changed, 397 insertions(+), 18 deletions(-) create mode 100644 sql/init.sql create mode 100644 src/main/java/com/writely/common/config/AuditConfig.java create mode 100644 src/main/java/com/writely/product/controller/ProductController.java create mode 100644 src/main/java/com/writely/product/domain/Product.java create mode 100644 src/main/java/com/writely/product/domain/ProductMemo.java create mode 100644 src/main/java/com/writely/product/domain/enums/ProductException.java create mode 100644 src/main/java/com/writely/product/repository/ProductMemoRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductRepository.java create mode 100644 src/main/java/com/writely/product/request/ProductCreateRequest.java create mode 100644 src/main/java/com/writely/product/request/ProductMemoCreateRequest.java create mode 100644 src/main/java/com/writely/product/response/ProductResponse.java create mode 100644 src/main/java/com/writely/product/service/ProductCommandService.java create mode 100644 src/main/java/com/writely/product/service/ProductQueryService.java diff --git a/.gitignore b/.gitignore index 6c4c4bc..c69ca32 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ HELP.md .gradle build/ db/ +src/main/generated/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ diff --git a/build.gradle b/build.gradle index 0bc3635..8fa01fa 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.3.7' id 'io.spring.dependency-management' version '1.1.7' + id 'nu.studer.jooq' version '9.0' } group = 'com' @@ -34,6 +35,10 @@ dependencies { /* DB */ runtimeOnly 'org.postgresql:postgresql' + /* jooq */ + implementation 'org.springframework.boot:spring-boot-starter-jooq' + jooqGenerator 'org.postgresql:postgresql' + /* Lombok */ compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' @@ -49,3 +54,42 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +jooq { + version = dependencyManagement.importedProperties['jooq.version'] + edition = nu.studer.gradle.jooq.JooqEdition.OSS + + configurations { + main { + generateSchemaSourceOnCompilation = false + + generationTool { + logging = org.jooq.meta.jaxb.Logging.DEBUG + jdbc { + driver = 'org.postgresql.Driver' + url = 'jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service' + user = 'postgres' + password = 'Writely0101%' + } + generator { + name = 'org.jooq.codegen.DefaultGenerator' + database { + name = 'org.jooq.meta.postgres.PostgresDatabase' + inputSchema = 'public' + } + generate { + deprecated = false + records = true + immutablePojos = true + fluentSetters = true + } + target { + packageName = 'writely' + directory = 'src/main/generated' + } + strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy' + } + } + } + } +} \ No newline at end of file diff --git a/docker-compose-db.yml b/docker-compose-db.yml index e26f4a6..3d4ba4e 100644 --- a/docker-compose-db.yml +++ b/docker-compose-db.yml @@ -8,7 +8,7 @@ services: environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: 1234 - POSTGRES_DB: writely + POSTGRES_DB: service ports: - "5432:5432" volumes: diff --git a/sql/init.sql b/sql/init.sql new file mode 100644 index 0000000..ae70d44 --- /dev/null +++ b/sql/init.sql @@ -0,0 +1,51 @@ +-- DDL + +-- product +create table product +( + id uuid default gen_random_uuid() not null + constraint product_pk + primary key, + content text, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product is '작품'; +comment on column product.id is '작품 ID'; +comment on column product.content is '내용'; +comment on column product.created_at is '생성일시'; +comment on column product.created_by is '생성자 ID'; +comment on column product.updated_at is '수정일시'; +comment on column product.updated_by is '수정자 ID'; + +alter table product + owner to postgres; + +-- product_memo +create table product_memo +( + id uuid default gen_random_uuid() not null + constraint product_memo_pk + primary key, + product_id uuid not null, + content text not null, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_memo is '작품 메모'; +comment on column product_memo.id is '메모 ID'; +comment on column product_memo.product_id is '작품 ID'; +comment on column product_memo.content is '내용'; +comment on column product_memo.created_at is '생성일시'; +comment on column product_memo.created_by is '생성자 ID'; +comment on column product_memo.updated_at is '수정일시'; +comment on column product_memo.updated_by is '수정일시'; + +alter table product_memo + owner to postgres; diff --git a/src/main/java/com/writely/common/audit/CustomAuditorAware.java b/src/main/java/com/writely/common/audit/CustomAuditorAware.java index 91f61f3..207d527 100644 --- a/src/main/java/com/writely/common/audit/CustomAuditorAware.java +++ b/src/main/java/com/writely/common/audit/CustomAuditorAware.java @@ -3,11 +3,12 @@ import org.springframework.data.domain.AuditorAware; import java.util.Optional; +import java.util.UUID; -public class CustomAuditorAware implements AuditorAware { +public class CustomAuditorAware implements AuditorAware { @Override - public Optional getCurrentAuditor() { - return Optional.of(0L); + public Optional getCurrentAuditor() { + return Optional.of(UUID.randomUUID()); } } diff --git a/src/main/java/com/writely/common/config/AuditConfig.java b/src/main/java/com/writely/common/config/AuditConfig.java new file mode 100644 index 0000000..8fd8f0c --- /dev/null +++ b/src/main/java/com/writely/common/config/AuditConfig.java @@ -0,0 +1,19 @@ +package com.writely.common.config; + +import com.writely.common.audit.CustomAuditorAware; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.domain.AuditorAware; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +import java.util.UUID; + +@Configuration +@EnableJpaAuditing(auditorAwareRef = "auditorProvider") +public class AuditConfig { + + @Bean + public AuditorAware auditorProvider() { + return new CustomAuditorAware(); + } +} diff --git a/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java b/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java index d3a9a7f..cd7ee6c 100644 --- a/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java +++ b/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java @@ -9,6 +9,7 @@ import java.io.Serializable; import java.time.LocalDateTime; +import java.util.UUID; @Getter @MappedSuperclass @@ -17,11 +18,11 @@ public class BaseAuditTimeEntity implements Serializable { @CreatedBy @Column(name = "created_by", updatable = false, nullable = false) - protected Long createdBy; + protected UUID createdBy; @LastModifiedBy @Column(name = "updated_by", nullable = false) - protected Long updatedBy; + protected UUID updatedBy; @Column(name = "created_at", updatable = false, nullable = false) protected LocalDateTime createdAt; diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 77b0ae1..5e48315 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -1,7 +1,10 @@ package com.writely.common.exception; +import com.writely.common.enums.code.CodeInfo; import com.writely.common.response.BaseResponse; import com.writely.common.util.LogUtil; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -12,14 +15,18 @@ public class GlobalExceptionHandler { @ExceptionHandler({Exception.class}) - public BaseResponse handle(Exception e) { + public ResponseEntity> handle(Exception e) { if(!(e instanceof BaseException) || ((BaseException)e).getCodeInfo() == null) { String message = getStackTrace(e); LogUtil.error(message); - return BaseResponse.failure(message); + + BaseResponse response = BaseResponse.failure(message); + return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); } - return BaseResponse.failure(((BaseException) e).getCodeInfo()); + CodeInfo codeInfo = ((BaseException) e).getCodeInfo(); + BaseResponse response = BaseResponse.failure(codeInfo); + return new ResponseEntity<>(response, codeInfo.getStatus()); } private String getStackTrace(Throwable throwable) { diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/src/main/java/com/writely/common/response/BaseResponse.java index 95456d4..766772b 100644 --- a/src/main/java/com/writely/common/response/BaseResponse.java +++ b/src/main/java/com/writely/common/response/BaseResponse.java @@ -12,9 +12,6 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public class BaseResponse { - @Schema(title = "상태 코드", description = "상태 코드", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") - private Integer status; - @Schema(title = "코드", description = "API 처리 결과 코드", requiredMode = Schema.RequiredMode.REQUIRED, example = "RESULT-001") private String code; @@ -28,7 +25,6 @@ protected BaseResponse() {} public static BaseResponse success() { BaseResponse res = new BaseResponse<>(); - res.status = ResultCodeInfo.SUCCESS.getStatus().value(); res.code = ResultCodeInfo.SUCCESS.getCode(); res.message = ResultCodeInfo.SUCCESS.getMessage(); return res; @@ -36,7 +32,6 @@ public static BaseResponse success() { public static BaseResponse success(T data) { BaseResponse res = new BaseResponse<>(); - res.status = ResultCodeInfo.SUCCESS.getStatus().value(); res.code = ResultCodeInfo.SUCCESS.getCode(); res.result = data; res.message = ResultCodeInfo.SUCCESS.getMessage(); @@ -45,21 +40,18 @@ public static BaseResponse success(T data) { public static BaseResponse failure() { BaseResponse res = new BaseResponse<>(); - res.status = ResultCodeInfo.FAILURE.getStatus().value(); res.message = ResultCodeInfo.FAILURE.getMessage(); return res; } public static BaseResponse failure(String message) { BaseResponse res = new BaseResponse<>(); - res.status = ResultCodeInfo.FAILURE.getStatus().value(); res.message = message; return res; } public static BaseResponse failure(CodeInfo codeInfo) { BaseResponse res = new BaseResponse<>(); - res.status = codeInfo.getStatus().value(); res.code = codeInfo.getCode(); res.message = codeInfo.getMessage(); return res; diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/src/main/java/com/writely/product/controller/ProductController.java new file mode 100644 index 0000000..440a59d --- /dev/null +++ b/src/main/java/com/writely/product/controller/ProductController.java @@ -0,0 +1,45 @@ +package com.writely.product.controller; + +import com.writely.common.response.BaseResponse; +import com.writely.product.request.ProductCreateRequest; +import com.writely.product.request.ProductMemoCreateRequest; +import com.writely.product.response.ProductResponse; +import com.writely.product.service.ProductCommandService; +import com.writely.product.service.ProductQueryService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.UUID; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/products") +@Tag(name = "작품") +public class ProductController { + + private final ProductCommandService productCommandService; + private final ProductQueryService productQueryService; + + @Operation(summary = "작품 생성") + @PostMapping + public BaseResponse create(@RequestBody ProductCreateRequest request) { + productCommandService.create(request); + return BaseResponse.success(); + } + + @Operation(summary = "메모 생성") + @PostMapping("/{productId}/memos") + public BaseResponse createMemo(@PathVariable UUID productId, @RequestBody ProductMemoCreateRequest request) { + productCommandService.createMemo(productId, request); + return BaseResponse.success(); + } + + @Operation(summary = "작품 목록 조회") + @GetMapping + public BaseResponse> getProducts() { + return BaseResponse.success(productQueryService.getAll()); + } +} diff --git a/src/main/java/com/writely/product/domain/Product.java b/src/main/java/com/writely/product/domain/Product.java new file mode 100644 index 0000000..556490e --- /dev/null +++ b/src/main/java/com/writely/product/domain/Product.java @@ -0,0 +1,34 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product") +public class Product extends BaseAuditTimeEntity { + + @Id + @Column(columnDefinition = "UUID", updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(nullable = false) + private String content; + + @Getter + @OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) + private final List memos = new ArrayList<>(); + + public Product(String content) { + this.content = content; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductMemo.java b/src/main/java/com/writely/product/domain/ProductMemo.java new file mode 100644 index 0000000..2369d9c --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductMemo.java @@ -0,0 +1,32 @@ +package com.writely.product.domain; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_memo") +public class ProductMemo { + + @Id + @Column(columnDefinition = "UUID", updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(nullable = false) + private String content; + + @ManyToOne + @JoinColumn(name = "product_id", nullable = false) + private Product product; + + public ProductMemo(String content, Product product) { + this.content = content; + this.product = product; + } +} diff --git a/src/main/java/com/writely/product/domain/enums/ProductException.java b/src/main/java/com/writely/product/domain/enums/ProductException.java new file mode 100644 index 0000000..b971437 --- /dev/null +++ b/src/main/java/com/writely/product/domain/enums/ProductException.java @@ -0,0 +1,17 @@ +package com.writely.product.domain.enums; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum ProductException implements CodeInfo { + + NOT_EXIST(HttpStatus.NOT_FOUND, "PRD-001", "존재하지 않는 작품입니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/product/repository/ProductMemoRepository.java b/src/main/java/com/writely/product/repository/ProductMemoRepository.java new file mode 100644 index 0000000..75029db --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductMemoRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductMemo; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductMemoRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductRepository.java b/src/main/java/com/writely/product/repository/ProductRepository.java new file mode 100644 index 0000000..d09e0bb --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.Product; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/request/ProductCreateRequest.java b/src/main/java/com/writely/product/request/ProductCreateRequest.java new file mode 100644 index 0000000..3df6e89 --- /dev/null +++ b/src/main/java/com/writely/product/request/ProductCreateRequest.java @@ -0,0 +1,13 @@ +package com.writely.product.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ProductCreateRequest { + + @Schema(title = "내용") + private String name; +} diff --git a/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java b/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java new file mode 100644 index 0000000..6ec9d15 --- /dev/null +++ b/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java @@ -0,0 +1,13 @@ +package com.writely.product.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ProductMemoCreateRequest { + + @Schema(title = "내용") + private String name; +} diff --git a/src/main/java/com/writely/product/response/ProductResponse.java b/src/main/java/com/writely/product/response/ProductResponse.java new file mode 100644 index 0000000..6351228 --- /dev/null +++ b/src/main/java/com/writely/product/response/ProductResponse.java @@ -0,0 +1,23 @@ +package com.writely.product.response; + +import com.writely.product.domain.Product; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +public class ProductResponse { + + @Schema(title = "내용") + private final String content; + @Schema(title = "생성일시") + private final LocalDateTime createdAt; + + public ProductResponse(Product product) { + this.content = product.getContent(); + this.createdAt = product.getCreatedAt(); + } +} diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java new file mode 100644 index 0000000..13049e1 --- /dev/null +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -0,0 +1,38 @@ +package com.writely.product.service; + +import com.writely.product.domain.Product; +import com.writely.product.domain.ProductMemo; +import com.writely.product.repository.ProductMemoRepository; +import com.writely.product.repository.ProductRepository; +import com.writely.product.request.ProductCreateRequest; +import com.writely.product.request.ProductMemoCreateRequest; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class ProductCommandService { + + private final ProductQueryService productQueryService; + private final ProductRepository productRepository; + private final ProductMemoRepository productMemoRepository; + + @Transactional + public void create(ProductCreateRequest request) { + Product product = new Product(request.getName()); + + productRepository.save(product); + } + + @Transactional + public void createMemo(UUID productId, ProductMemoCreateRequest request) { + Product product = productQueryService.getById(productId); + + ProductMemo memo = new ProductMemo(request.getName(), product); + + productMemoRepository.save(memo); + } +} diff --git a/src/main/java/com/writely/product/service/ProductQueryService.java b/src/main/java/com/writely/product/service/ProductQueryService.java new file mode 100644 index 0000000..d29e300 --- /dev/null +++ b/src/main/java/com/writely/product/service/ProductQueryService.java @@ -0,0 +1,30 @@ +package com.writely.product.service; + +import com.writely.common.exception.BaseException; +import com.writely.product.domain.Product; +import com.writely.product.domain.enums.ProductException; +import com.writely.product.repository.ProductRepository; +import com.writely.product.response.ProductResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class ProductQueryService { + + private final ProductRepository productRepository; + + public List getAll() { + return productRepository.findAll().stream().map(ProductResponse::new).toList(); + } + + public Product getById(UUID id) { + return productRepository.findById(id) + .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST)); + } +} diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index dd98cb3..690e74c 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -5,7 +5,7 @@ spring: datasource: driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://localhost:5432/writely?useUnicode=true&characterEncoding=UTF-8 + url: jdbc:postgresql://localhost:5432/service?useUnicode=true&characterEncoding=UTF-8 username: postgres password: 1234 From 30677d5fd4397b84370219f3ea8918edd0a9b982 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:11:42 +0900 Subject: [PATCH 004/107] =?UTF-8?q?feat:=20=EC=9D=91=EB=8B=B5=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EA=B0=9C=EC=84=A0=20(=EA=B3=B5=ED=86=B5=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC)=20(#2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/GlobalResponseBodyHandler.java | 38 +++++++++++++++++++ .../product/controller/ProductController.java | 10 ++--- 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java diff --git a/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java b/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java new file mode 100644 index 0000000..ea95310 --- /dev/null +++ b/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java @@ -0,0 +1,38 @@ +package com.writely.common.response; + +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +@RestControllerAdvice +public class GlobalResponseBodyHandler implements ResponseBodyAdvice { + + @Override + public boolean supports( + MethodParameter returnType, + Class> converterType + ) { + return true; + } + + @Override + public Object beforeBodyWrite( + Object body, + MethodParameter returnType, + MediaType selectedContentType, + Class> selectedConverterType, + ServerHttpRequest request, + ServerHttpResponse response + ) { + if (body instanceof BaseResponse || body instanceof ResponseEntity) { + return body; + } + + return BaseResponse.success(body); + } +} diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/src/main/java/com/writely/product/controller/ProductController.java index 440a59d..75e665d 100644 --- a/src/main/java/com/writely/product/controller/ProductController.java +++ b/src/main/java/com/writely/product/controller/ProductController.java @@ -25,21 +25,19 @@ public class ProductController { @Operation(summary = "작품 생성") @PostMapping - public BaseResponse create(@RequestBody ProductCreateRequest request) { + public void create(@RequestBody ProductCreateRequest request) { productCommandService.create(request); - return BaseResponse.success(); } @Operation(summary = "메모 생성") @PostMapping("/{productId}/memos") - public BaseResponse createMemo(@PathVariable UUID productId, @RequestBody ProductMemoCreateRequest request) { + public void createMemo(@PathVariable UUID productId, @RequestBody ProductMemoCreateRequest request) { productCommandService.createMemo(productId, request); - return BaseResponse.success(); } @Operation(summary = "작품 목록 조회") @GetMapping - public BaseResponse> getProducts() { - return BaseResponse.success(productQueryService.getAll()); + public List getProducts() { + return productQueryService.getAll(); } } From 08b8f69d3400f90716a3f2f0db63ba381706ce23 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 19 Jan 2025 17:36:22 +0900 Subject: [PATCH 005/107] =?UTF-8?q?feat:=20product=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?entity=20=EC=B6=94=EA=B0=80=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 211 ++++++++++++++++++ .../com/writely/product/domain/Product.java | 15 +- .../product/domain/ProductCharacter.java | 66 ++++++ .../product/domain/ProductCustomField.java | 46 ++++ .../product/domain/ProductIdeaNote.java | 33 +++ .../writely/product/domain/ProductMemo.java | 18 +- .../writely/product/domain/ProductPlot.java | 39 ++++ .../product/domain/ProductSynopsis.java | 47 ++++ .../product/domain/ProductWorldview.java | 79 +++++++ .../service/ProductCommandService.java | 12 +- 10 files changed, 545 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/writely/product/domain/ProductCharacter.java create mode 100644 src/main/java/com/writely/product/domain/ProductCustomField.java create mode 100644 src/main/java/com/writely/product/domain/ProductIdeaNote.java create mode 100644 src/main/java/com/writely/product/domain/ProductPlot.java create mode 100644 src/main/java/com/writely/product/domain/ProductSynopsis.java create mode 100644 src/main/java/com/writely/product/domain/ProductWorldview.java diff --git a/sql/init.sql b/sql/init.sql index ae70d44..7537ae4 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -24,6 +24,106 @@ comment on column product.updated_by is '수정자 ID'; alter table product owner to postgres; +--product_character +create table product_character +( + id uuid default gen_random_uuid() not null + constraint product_character_pk + primary key, + product_id uuid not null, + intro text, + name varchar(50), + age integer, + gender varchar(10), + occupation text, + appearance text, + personality text, + characteristic text, + relationship text, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_character is '작품 등장인물'; +comment on column product_character.id is '등장인물 ID'; +comment on column product_character.product_id is '작품 ID'; +comment on column product_character.intro is '소개'; +comment on column product_character.name is '이름'; +comment on column product_character.age is '나이'; +comment on column product_character.gender is '성별'; +comment on column product_character.occupation is '직업'; +comment on column product_character.appearance is '외모'; +comment on column product_character.personality is '성격'; +comment on column product_character.characteristic is '특징'; +comment on column product_character.relationship is '주요 관계'; +comment on column product_character.created_at is '생성일시'; +comment on column product_character.created_by is '생성자 ID'; +comment on column product_character.updated_at is '수정일시'; +comment on column product_character.updated_by is '수정자 ID'; + +alter table product_character + owner to postgres; + +--product_custom_field +create table product_custom_field +( + id uuid default gen_random_uuid() not null + constraint product_custom_field_pk + primary key, + product_id uuid not null, + section_code varchar(20) not null, + name varchar(30) not null, + content text not null, + seq smallint not null, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_custom_field is '작품 커스텀 필드'; +comment on column product_custom_field.id is '커스텀 필드 ID'; +comment on column product_custom_field.product_id is '작품 ID'; +comment on column product_custom_field.section_code is '섹션 코드'; +comment on column product_custom_field.name is '이름'; +comment on column product_custom_field.content is '내용'; +comment on column product_custom_field.seq is '순서'; +comment on column product_custom_field.created_at is '생성일시'; +comment on column product_custom_field.created_by is '생성자 ID'; +comment on column product_custom_field.updated_at is '수정일시'; +comment on column product_custom_field.updated_by is '수정자 ID'; + +alter table product_custom_field + owner to postgres; + +--product_ideanote +create table product_ideanote +( + id uuid not null + constraint product_ideanote_pk + primary key, + title varchar(100) not null, + content text not null, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_ideanote is '작품 아이디어 노트'; +comment on column product_ideanote.id is '아이디어 노트 ID'; +comment on column product_ideanote.title is '제목'; +comment on column product_ideanote.content is '내용'; +comment on column product_ideanote.created_at is '생성일시'; +comment on column product_ideanote.created_by is '생성자 ID'; +comment on column product_ideanote.updated_at is '수정일시'; +comment on column product_ideanote.updated_by is '수정자 ID'; + +alter table product_ideanote + owner to postgres; + -- product_memo create table product_memo ( @@ -49,3 +149,114 @@ comment on column product_memo.updated_by is '수정일시'; alter table product_memo owner to postgres; + +--product_plot +create table product_plot +( + id uuid not null + constraint product_plot_pk + primary key, + exposition text, + complication text, + climax text, + resolution text, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_plot is '작품 줄거리'; +comment on column product_plot.id is '줄거리 ID'; +comment on column product_plot.exposition is '발단'; +comment on column product_plot.complication is '전개'; +comment on column product_plot.climax is '위기'; +comment on column product_plot.climax is '결말'; +comment on column product_plot.created_at is '생성일시'; +comment on column product_plot.created_by is '생성자 ID'; +comment on column product_plot.updated_at is '수정일시'; +comment on column product_plot.updated_by is '수정자 ID'; + +alter table product_plot + owner to postgres; + +-- product_synopsis +create table product_synopsis +( + id uuid not null + constraint product_synopsis_pk + primary key, + genre varchar(30) not null, + length varchar(100), + purpose text, + logline text not null, + example text, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_synopsis is '작품 시놉시스'; +comment on column product_synopsis.id is '시놉시스 ID'; +comment on column product_synopsis.genre is '장르'; +comment on column product_synopsis.length is '분량'; +comment on column product_synopsis.purpose is '기획 의도'; +comment on column product_synopsis.logline is '로그라인'; +comment on column product_synopsis.example is '예시 문장'; +comment on column product_synopsis.created_at is '생성일시'; +comment on column product_synopsis.created_by is '생성자 ID'; +comment on column product_synopsis.updated_at is '수정일시'; +comment on column product_synopsis.updated_by is '수정자 ID'; + +alter table product_synopsis + owner to postgres; + +--product_worldview +create table product_worldview +( + id uuid not null + constraint product_worldview_pk + primary key, + geography text, + history text, + politics text, + society text, + religion text, + economy text, + technology text, + lifestyle text, + language text, + culture text, + species text, + occupation text, + conflict text, + created_at timestamp with time zone not null, + created_by uuid not null, + updated_at timestamp with time zone not null, + updated_by uuid not null +); + +comment on table product_worldview is '작품 세계관'; +comment on column product_worldview.id is '세계관 ID'; +comment on column product_worldview.geography is '지리'; +comment on column product_worldview.history is '역사'; +comment on column product_worldview.politics is '정치'; +comment on column product_worldview.society is '사회'; +comment on column product_worldview.religion is '종교'; +comment on column product_worldview.economy is '경제'; +comment on column product_worldview.technology is '기술'; +comment on column product_worldview.lifestyle is '생활'; +comment on column product_worldview.language is '언어'; +comment on column product_worldview.culture is '문화'; +comment on column product_worldview.species is '종족'; +comment on column product_worldview.occupation is '직업'; +comment on column product_worldview.conflict is '갈등 관계'; +comment on column product_worldview.created_at is '생성일시'; +comment on column product_worldview.created_by is '생성자 ID'; +comment on column product_worldview.updated_at is '수정일시'; +comment on column product_worldview.updated_by is '수정자 ID'; + +alter table product_worldview + owner to postgres; + diff --git a/src/main/java/com/writely/product/domain/Product.java b/src/main/java/com/writely/product/domain/Product.java index 556490e..0b56e41 100644 --- a/src/main/java/com/writely/product/domain/Product.java +++ b/src/main/java/com/writely/product/domain/Product.java @@ -1,13 +1,14 @@ package com.writely.product.domain; import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import java.util.ArrayList; -import java.util.List; import java.util.UUID; @Getter @@ -18,16 +19,12 @@ public class Product extends BaseAuditTimeEntity { @Id - @Column(columnDefinition = "UUID", updatable = false, nullable = false) + @Column(updatable = false, nullable = false) private UUID id = UUID.randomUUID(); - @Column(nullable = false) + @Column(name = "content", nullable = false) private String content; - @Getter - @OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) - private final List memos = new ArrayList<>(); - public Product(String content) { this.content = content; } diff --git a/src/main/java/com/writely/product/domain/ProductCharacter.java b/src/main/java/com/writely/product/domain/ProductCharacter.java new file mode 100644 index 0000000..02cf0a6 --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductCharacter.java @@ -0,0 +1,66 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_character") +public class ProductCharacter extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Column(name = "intro") + private String intro; + + @Column(name = "name") + private String name; + + @Column(name = "age") + private Short age; + + @Column(name = "gender") + private String gender; + + @Column(name = "occupation") + private String occupation; + + @Column(name = "appearance") + private String appearance; + + @Column(name = "personality") + private String personality; + + @Column(name = "characteristic") + private String characteristic; + + @Column(name = "relationship") + private String relationship; + + @Builder + public ProductCharacter(UUID productId, String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship) { + this.productId = productId; + this.intro = intro; + this.name = name; + this.age = age; + this.gender = gender; + this.occupation = occupation; + this.appearance = appearance; + this.personality = personality; + this.characteristic = characteristic; + this.relationship = relationship; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductCustomField.java b/src/main/java/com/writely/product/domain/ProductCustomField.java new file mode 100644 index 0000000..e0c9b02 --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductCustomField.java @@ -0,0 +1,46 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_custom_field") +public class ProductCustomField extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Column(name = "section_code", nullable = false) + private String sectionCode; + + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "content", nullable = false) + private String content; + + @Column(name = "seq", nullable = false) + private Short seq; + + @Builder + public ProductCustomField(UUID productId, String sectionCode, String name, String content, Short seq) { + this.productId = productId; + this.sectionCode = sectionCode; + this.name = name; + this.content = content; + this.seq = seq; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductIdeaNote.java b/src/main/java/com/writely/product/domain/ProductIdeaNote.java new file mode 100644 index 0000000..bbfecbe --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductIdeaNote.java @@ -0,0 +1,33 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_ideanote") +public class ProductIdeaNote extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id; + + @Column(nullable = false) + private String title; + + @Column(nullable = false) + private String content; + + public ProductIdeaNote(UUID id, String title, String content) { + this.id = id; + this.title = title; + this.content = content; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductMemo.java b/src/main/java/com/writely/product/domain/ProductMemo.java index 2369d9c..3e60af2 100644 --- a/src/main/java/com/writely/product/domain/ProductMemo.java +++ b/src/main/java/com/writely/product/domain/ProductMemo.java @@ -1,5 +1,6 @@ package com.writely.product.domain; +import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; @@ -12,21 +13,20 @@ @Entity @NoArgsConstructor @Table(name = "product_memo") -public class ProductMemo { +public class ProductMemo extends BaseAuditTimeEntity { @Id - @Column(columnDefinition = "UUID", updatable = false, nullable = false) + @Column(updatable = false, nullable = false) private UUID id = UUID.randomUUID(); - @Column(nullable = false) - private String content; + @Column(name = "product_id", nullable = false) + private UUID productId; - @ManyToOne - @JoinColumn(name = "product_id", nullable = false) - private Product product; + @Column(name = "content", nullable = false) + private String content; - public ProductMemo(String content, Product product) { + public ProductMemo(UUID productId, String content) { + this.productId = productId; this.content = content; - this.product = product; } } diff --git a/src/main/java/com/writely/product/domain/ProductPlot.java b/src/main/java/com/writely/product/domain/ProductPlot.java new file mode 100644 index 0000000..b869ac4 --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductPlot.java @@ -0,0 +1,39 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_plot") +public class ProductPlot extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id; + @Column + private String exposition; + @Column + private String complication; + @Column + private String climax; + @Column + private String resolution; + + @Builder + public ProductPlot(UUID id, String exposition, String complication, String climax, String resolution) { + this.id = id; + this.exposition = exposition; + this.complication = complication; + this.climax = climax; + this.resolution = resolution; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductSynopsis.java b/src/main/java/com/writely/product/domain/ProductSynopsis.java new file mode 100644 index 0000000..ff485f5 --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductSynopsis.java @@ -0,0 +1,47 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_synopsis") +public class ProductSynopsis extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id; + + @Column(name = "genre", nullable = false) + private String genre; + + @Column(name = "length") + private String length; + + @Column(name = "purpose") + private String purpose; + + @Column(name = "logline") + private String logline; + + @Column(name = "example") + private String example; + + @Builder + public ProductSynopsis(UUID id, String genre, String length, String purpose, String logline, String example) { + this.id = id; + this.genre = genre; + this.length = length; + this.purpose = purpose; + this.logline = logline; + this.example = example; + } +} diff --git a/src/main/java/com/writely/product/domain/ProductWorldview.java b/src/main/java/com/writely/product/domain/ProductWorldview.java new file mode 100644 index 0000000..3d93883 --- /dev/null +++ b/src/main/java/com/writely/product/domain/ProductWorldview.java @@ -0,0 +1,79 @@ +package com.writely.product.domain; + +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_worldview") +public class ProductWorldview extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id; + + @Column(name = "geography") + private String geography; + + @Column(name = "history") + private String history; + + @Column(name = "politics") + private String politics; + + @Column(name = "society") + private String society; + + @Column(name = "religion") + private String religion; + + @Column(name = "economy") + private String economy; + + @Column(name = "technology") + private String technology; + + @Column(name = "lifestyle") + private String lifestyle; + + @Column(name = "language") + private String language; + + @Column(name = "culture") + private String culture; + + @Column(name = "species") + private String species; + + @Column(name = "occupation") + private String occupation; + + @Column(name = "conflict") + private String conflict; + + @Builder + public ProductWorldview(UUID id, String geography, String history, String politics, String society, String religion, String economy, String technology, String lifestyle, String language, String culture, String species, String occupation, String conflict) { + this.id = id; + this.geography = geography; + this.history = history; + this.politics = politics; + this.society = society; + this.religion = religion; + this.economy = economy; + this.technology = technology; + this.lifestyle = lifestyle; + this.language = language; + this.culture = culture; + this.species = species; + this.occupation = occupation; + this.conflict = conflict; + } +} diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index 13049e1..9731d1c 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -1,7 +1,9 @@ package com.writely.product.service; +import com.writely.common.exception.BaseException; import com.writely.product.domain.Product; import com.writely.product.domain.ProductMemo; +import com.writely.product.domain.enums.ProductException; import com.writely.product.repository.ProductMemoRepository; import com.writely.product.repository.ProductRepository; import com.writely.product.request.ProductCreateRequest; @@ -29,10 +31,14 @@ public void create(ProductCreateRequest request) { @Transactional public void createMemo(UUID productId, ProductMemoCreateRequest request) { - Product product = productQueryService.getById(productId); + verifyExistProduct(productId); - ProductMemo memo = new ProductMemo(request.getName(), product); + productMemoRepository.save(new ProductMemo(productId, request.getName())); + } - productMemoRepository.save(memo); + private void verifyExistProduct(UUID productId) { + if (!productRepository.existsById(productId)) { + throw new BaseException(ProductException.NOT_EXIST); + } } } From deaa875374332879069f7837a1e4da336e689f62 Mon Sep 17 00:00:00 2001 From: wichan Date: Sun, 19 Jan 2025 22:38:29 +0900 Subject: [PATCH 006/107] =?UTF-8?q?fix:=20swagger-ui=EA=B0=80=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=20=EC=B2=98=EB=A6=AC=EB=90=98=EB=8A=94=20=ED=98=84?= =?UTF-8?q?=EC=83=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/writely/common/response/GlobalResponseBodyHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java b/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java index ea95310..d69aa23 100644 --- a/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java +++ b/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; -@RestControllerAdvice +@RestControllerAdvice(basePackages = "com.writely") public class GlobalResponseBodyHandler implements ResponseBodyAdvice { @Override From 56838c3ff5333b85fe0a77d9b8812dbad83107af Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 25 Jan 2025 22:32:49 +0900 Subject: [PATCH 007/107] feat: add product api (#5) --- build.gradle | 10 + sql/init.sql | 66 +++--- .../product/controller/ProductController.java | 70 +++++- .../com/writely/product/domain/Product.java | 92 +++++++- .../product/domain/ProductCharacter.java | 12 + .../product/domain/ProductCustomField.java | 7 + .../product/domain/ProductIdeaNote.java | 5 + .../writely/product/domain/ProductMemo.java | 4 + .../writely/product/domain/ProductPlot.java | 7 + .../product/domain/ProductSynopsis.java | 8 + .../product/domain/ProductWorldview.java | 16 ++ .../domain/enums/ProductException.java | 5 +- .../ProductCharacterRepository.java | 9 + .../ProductCustomFieldRepository.java | 9 + .../product/repository/ProductDao.java | 25 ++ .../repository/ProductIdeaNoteRepository.java | 9 + .../repository/ProductPlotRepository.java | 9 + .../repository/ProductSynopsisRepository.java | 9 + .../ProductWorldviewRepository.java | 9 + .../request/ProductMemoCreateRequest.java | 2 +- ...Request.java => ProductModifyRequest.java} | 6 +- .../request/ProductTemplateCreateRequest.java | 200 ++++++++++++++++ .../response/ProductDetailResponse.java | 46 ++++ .../product/response/ProductMemoResponse.java | 20 ++ .../product/response/ProductResponse.java | 19 +- .../response/ProductTemplateResponse.java | 212 +++++++++++++++++ .../service/ProductCommandService.java | 214 +++++++++++++++++- .../product/service/ProductQueryService.java | 29 ++- 28 files changed, 1057 insertions(+), 72 deletions(-) create mode 100644 src/main/java/com/writely/product/repository/ProductCharacterRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductDao.java create mode 100644 src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductPlotRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductSynopsisRepository.java create mode 100644 src/main/java/com/writely/product/repository/ProductWorldviewRepository.java rename src/main/java/com/writely/product/request/{ProductCreateRequest.java => ProductModifyRequest.java} (60%) create mode 100644 src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java create mode 100644 src/main/java/com/writely/product/response/ProductDetailResponse.java create mode 100644 src/main/java/com/writely/product/response/ProductMemoResponse.java create mode 100644 src/main/java/com/writely/product/response/ProductTemplateResponse.java diff --git a/build.gradle b/build.gradle index 8fa01fa..0705244 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,16 @@ tasks.named('test') { useJUnitPlatform() } +def jooqDir = "src/main/generated" + +sourceSets { + main.java.srcDirs += [ jooqDir ] +} + +tasks.withType(JavaCompile).configureEach { + options.getGeneratedSourceOutputDirectory().set(file(jooqDir)) +} + jooq { version = dependencyManagement.importedProperties['jooq.version'] edition = nu.studer.gradle.jooq.JooqEdition.OSS diff --git a/sql/init.sql b/sql/init.sql index 7537ae4..cb77a8e 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -6,15 +6,17 @@ create table product id uuid default gen_random_uuid() not null constraint product_pk primary key, + title varchar(50), content text, - created_at timestamp with time zone not null, + created_at timestamp not null, created_by uuid not null, - updated_at timestamp with time zone not null, + updated_at timestamp not null, updated_by uuid not null ); comment on table product is '작품'; comment on column product.id is '작품 ID'; +comment on column product.title is '제목'; comment on column product.content is '내용'; comment on column product.created_at is '생성일시'; comment on column product.created_by is '생성자 ID'; @@ -40,9 +42,9 @@ create table product_character personality text, characteristic text, relationship text, - created_at timestamp with time zone not null, + created_at timestamp not null, created_by uuid not null, - updated_at timestamp with time zone not null, + updated_at timestamp not null, updated_by uuid not null ); @@ -77,9 +79,9 @@ create table product_custom_field name varchar(30) not null, content text not null, seq smallint not null, - created_at timestamp with time zone not null, + created_at timestamp not null, created_by uuid not null, - updated_at timestamp with time zone not null, + updated_at timestamp not null, updated_by uuid not null ); @@ -101,15 +103,15 @@ alter table product_custom_field --product_ideanote create table product_ideanote ( - id uuid not null + id uuid not null constraint product_ideanote_pk primary key, - title varchar(100) not null, - content text not null, - created_at timestamp with time zone not null, - created_by uuid not null, - updated_at timestamp with time zone not null, - updated_by uuid not null + title varchar(100) not null, + content text not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_ideanote is '작품 아이디어 노트'; @@ -132,9 +134,9 @@ create table product_memo primary key, product_id uuid not null, content text not null, - created_at timestamp with time zone not null, + created_at timestamp not null, created_by uuid not null, - updated_at timestamp with time zone not null, + updated_at timestamp not null, updated_by uuid not null ); @@ -153,17 +155,17 @@ alter table product_memo --product_plot create table product_plot ( - id uuid not null + id uuid not null constraint product_plot_pk primary key, exposition text, complication text, climax text, resolution text, - created_at timestamp with time zone not null, - created_by uuid not null, - updated_at timestamp with time zone not null, - updated_by uuid not null + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_plot is '작품 줄거리'; @@ -183,18 +185,18 @@ alter table product_plot -- product_synopsis create table product_synopsis ( - id uuid not null + id uuid not null constraint product_synopsis_pk primary key, - genre varchar(30) not null, + genre varchar(30) not null, length varchar(100), purpose text, - logline text not null, + logline text not null, example text, - created_at timestamp with time zone not null, - created_by uuid not null, - updated_at timestamp with time zone not null, - updated_by uuid not null + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_synopsis is '작품 시놉시스'; @@ -215,7 +217,7 @@ alter table product_synopsis --product_worldview create table product_worldview ( - id uuid not null + id uuid not null constraint product_worldview_pk primary key, geography text, @@ -231,10 +233,10 @@ create table product_worldview species text, occupation text, conflict text, - created_at timestamp with time zone not null, - created_by uuid not null, - updated_at timestamp with time zone not null, - updated_by uuid not null + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_worldview is '작품 세계관'; diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/src/main/java/com/writely/product/controller/ProductController.java index 75e665d..ddc3a08 100644 --- a/src/main/java/com/writely/product/controller/ProductController.java +++ b/src/main/java/com/writely/product/controller/ProductController.java @@ -1,9 +1,12 @@ package com.writely.product.controller; -import com.writely.common.response.BaseResponse; -import com.writely.product.request.ProductCreateRequest; import com.writely.product.request.ProductMemoCreateRequest; +import com.writely.product.request.ProductModifyRequest; +import com.writely.product.request.ProductTemplateCreateRequest; +import com.writely.product.response.ProductDetailResponse; +import com.writely.product.response.ProductMemoResponse; import com.writely.product.response.ProductResponse; +import com.writely.product.response.ProductTemplateResponse; import com.writely.product.service.ProductCommandService; import com.writely.product.service.ProductQueryService; import io.swagger.v3.oas.annotations.Operation; @@ -25,19 +28,72 @@ public class ProductController { @Operation(summary = "작품 생성") @PostMapping - public void create(@RequestBody ProductCreateRequest request) { - productCommandService.create(request); + public UUID create() { + return productCommandService.create(); + } + + @Operation(summary = "작품 저장") + @PostMapping("/{productId}") + public UUID modify( + @PathVariable UUID productId, + @RequestBody ProductModifyRequest request) { + return productCommandService.modify(productId, request); + } + + @Operation(summary = "템플릿 저장") + @PostMapping("/{productId}/templates") + public void createTemplate( + @PathVariable UUID productId, + @RequestBody ProductTemplateCreateRequest request) { + productCommandService.saveTemplate(productId, request); } @Operation(summary = "메모 생성") @PostMapping("/{productId}/memos") - public void createMemo(@PathVariable UUID productId, @RequestBody ProductMemoCreateRequest request) { + public void createMemo( + @PathVariable UUID productId, + @RequestBody ProductMemoCreateRequest request) { productCommandService.createMemo(productId, request); } @Operation(summary = "작품 목록 조회") @GetMapping - public List getProducts() { - return productQueryService.getAll(); + public List getList() { + return productQueryService.getList(); + } + + @Operation(summary = "작품 상세 조회") + @GetMapping("/{productId}") + public ProductDetailResponse getDetail(@PathVariable UUID productId) { + return productQueryService.getDetail(productId); + } + + @Operation(summary = "템플릿 조회") + @GetMapping("/{productId}/templates") + public ProductTemplateResponse getTemplate(@PathVariable UUID productId) { + return productQueryService.getTemplate(productId); + } + + @Operation(summary = "메모 목록 조회") + @GetMapping("/{productId}/memos") + public List getMemos(@PathVariable UUID productId) { + return productQueryService.getMemos(productId); + } + + @Operation(summary = "메모 수정") + @PutMapping("/{productId}/memos/{memoId}") + public void modifyMemo( + @PathVariable UUID productId, + @PathVariable UUID memoId, + @RequestBody ProductMemoCreateRequest request) { + productCommandService.modifyMemo(productId, memoId, request); + } + + @Operation(summary = "메모 삭제") + @DeleteMapping("/{productId}/memos/{memoId}") + public void deleteMemo( + @PathVariable UUID productId, + @PathVariable UUID memoId) { + productCommandService.deleteMemo(productId, memoId); } } diff --git a/src/main/java/com/writely/product/domain/Product.java b/src/main/java/com/writely/product/domain/Product.java index 0b56e41..2afaaca 100644 --- a/src/main/java/com/writely/product/domain/Product.java +++ b/src/main/java/com/writely/product/domain/Product.java @@ -1,14 +1,13 @@ package com.writely.product.domain; import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; @Getter @@ -22,10 +21,91 @@ public class Product extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private UUID id = UUID.randomUUID(); - @Column(name = "content", nullable = false) + @Column(name = "title") + private String title; + + @Column(name = "content") private String content; - public Product(String content) { + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id") + private List characters = new ArrayList<>(); + + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id") + private List customFields = new ArrayList<>(); + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id") + private ProductIdeaNote ideaNote; + + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id") + private List memos = new ArrayList<>(); + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id") + private ProductPlot plot; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id") + private ProductSynopsis synopsis; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "id") + private ProductWorldview worldview; + + public void update(String title, String content) { + this.title = title; this.content = content; } + + public void addCharacters(List addCharacters) { + if (addCharacters == null || addCharacters.isEmpty()) { + return; + } + this.characters.addAll(addCharacters); + } + + public void addCustomFields(List addCustomFields) { + if (addCustomFields == null || addCustomFields.isEmpty()) { + return; + } + this.customFields.addAll(addCustomFields); + } + + public void addIdeaNote(ProductIdeaNote addIdeaNote) { + if (addIdeaNote == null) { + return; + } + this.ideaNote = addIdeaNote; + } + + public void addMemo(ProductMemo addMemo) { + if (addMemo == null) { + return; + } + this.memos.add(addMemo); + } + + public void addPlot(ProductPlot addPlot) { + if (addPlot == null) { + return; + } + this.plot = addPlot; + } + + public void addSynopsis(ProductSynopsis addSynopsis) { + if (addSynopsis == null) { + return; + } + this.synopsis = addSynopsis; + } + + public void addWorldview(ProductWorldview addWorldview) { + if (addWorldview == null) { + return; + } + this.worldview = addWorldview; + } } diff --git a/src/main/java/com/writely/product/domain/ProductCharacter.java b/src/main/java/com/writely/product/domain/ProductCharacter.java index 02cf0a6..cce63b1 100644 --- a/src/main/java/com/writely/product/domain/ProductCharacter.java +++ b/src/main/java/com/writely/product/domain/ProductCharacter.java @@ -63,4 +63,16 @@ public ProductCharacter(UUID productId, String intro, String name, Short age, St this.characteristic = characteristic; this.relationship = relationship; } + + public void update(String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship) { + this.intro = intro; + this.name = name; + this.age = age; + this.gender = gender; + this.occupation = occupation; + this.appearance = appearance; + this.personality = personality; + this.characteristic = characteristic; + this.relationship = relationship; + } } diff --git a/src/main/java/com/writely/product/domain/ProductCustomField.java b/src/main/java/com/writely/product/domain/ProductCustomField.java index e0c9b02..673661f 100644 --- a/src/main/java/com/writely/product/domain/ProductCustomField.java +++ b/src/main/java/com/writely/product/domain/ProductCustomField.java @@ -43,4 +43,11 @@ public ProductCustomField(UUID productId, String sectionCode, String name, Strin this.content = content; this.seq = seq; } + + public void update(String sectionCode, String name, String content, Short seq) { + this.sectionCode = sectionCode; + this.name = name; + this.content = content; + this.seq = seq; + } } diff --git a/src/main/java/com/writely/product/domain/ProductIdeaNote.java b/src/main/java/com/writely/product/domain/ProductIdeaNote.java index bbfecbe..04b692d 100644 --- a/src/main/java/com/writely/product/domain/ProductIdeaNote.java +++ b/src/main/java/com/writely/product/domain/ProductIdeaNote.java @@ -30,4 +30,9 @@ public ProductIdeaNote(UUID id, String title, String content) { this.title = title; this.content = content; } + + public void update(String title, String content) { + this.title = title; + this.content = content; + } } diff --git a/src/main/java/com/writely/product/domain/ProductMemo.java b/src/main/java/com/writely/product/domain/ProductMemo.java index 3e60af2..e41ebca 100644 --- a/src/main/java/com/writely/product/domain/ProductMemo.java +++ b/src/main/java/com/writely/product/domain/ProductMemo.java @@ -29,4 +29,8 @@ public ProductMemo(UUID productId, String content) { this.productId = productId; this.content = content; } + + public void update(String content) { + this.content = content; + } } diff --git a/src/main/java/com/writely/product/domain/ProductPlot.java b/src/main/java/com/writely/product/domain/ProductPlot.java index b869ac4..fa013d7 100644 --- a/src/main/java/com/writely/product/domain/ProductPlot.java +++ b/src/main/java/com/writely/product/domain/ProductPlot.java @@ -36,4 +36,11 @@ public ProductPlot(UUID id, String exposition, String complication, String clima this.climax = climax; this.resolution = resolution; } + + public void update(String exposition, String complication, String climax, String resolution) { + this.exposition = exposition; + this.complication = complication; + this.climax = climax; + this.resolution = resolution; + } } diff --git a/src/main/java/com/writely/product/domain/ProductSynopsis.java b/src/main/java/com/writely/product/domain/ProductSynopsis.java index ff485f5..45909fc 100644 --- a/src/main/java/com/writely/product/domain/ProductSynopsis.java +++ b/src/main/java/com/writely/product/domain/ProductSynopsis.java @@ -44,4 +44,12 @@ public ProductSynopsis(UUID id, String genre, String length, String purpose, Str this.logline = logline; this.example = example; } + + public void update(String genre, String length, String purpose, String logline, String example) { + this.genre = genre; + this.length = length; + this.purpose = purpose; + this.logline = logline; + this.example = example; + } } diff --git a/src/main/java/com/writely/product/domain/ProductWorldview.java b/src/main/java/com/writely/product/domain/ProductWorldview.java index 3d93883..361fd7f 100644 --- a/src/main/java/com/writely/product/domain/ProductWorldview.java +++ b/src/main/java/com/writely/product/domain/ProductWorldview.java @@ -76,4 +76,20 @@ public ProductWorldview(UUID id, String geography, String history, String politi this.occupation = occupation; this.conflict = conflict; } + + public void update(String geography, String history, String politics, String society, String religion, String economy, String technology, String lifestyle, String language, String culture, String species, String occupation, String conflict) { + this.geography = geography; + this.history = history; + this.politics = politics; + this.society = society; + this.religion = religion; + this.economy = economy; + this.technology = technology; + this.lifestyle = lifestyle; + this.language = language; + this.culture = culture; + this.species = species; + this.occupation = occupation; + this.conflict = conflict; + } } diff --git a/src/main/java/com/writely/product/domain/enums/ProductException.java b/src/main/java/com/writely/product/domain/enums/ProductException.java index b971437..ca95128 100644 --- a/src/main/java/com/writely/product/domain/enums/ProductException.java +++ b/src/main/java/com/writely/product/domain/enums/ProductException.java @@ -9,7 +9,10 @@ @RequiredArgsConstructor public enum ProductException implements CodeInfo { - NOT_EXIST(HttpStatus.NOT_FOUND, "PRD-001", "존재하지 않는 작품입니다."); + NOT_EXIST(HttpStatus.NOT_FOUND, "PRD-001", "존재하지 않는 작품입니다."), + NOT_EXIST_CHARACTER(HttpStatus.NOT_FOUND, "PRD-002", "존재하지 않는 등장인물 입니다."), + NOT_EXIST_CUSTOM_FIELD(HttpStatus.NOT_FOUND, "PRD-003", "존재하지 않는 커스텀 필드입니다."), + NOT_EXIST_MEMO(HttpStatus.NOT_FOUND, "PRD-004", "존재하지 않는 메모입니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/product/repository/ProductCharacterRepository.java b/src/main/java/com/writely/product/repository/ProductCharacterRepository.java new file mode 100644 index 0000000..eb0e15f --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductCharacterRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductCharacter; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductCharacterRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java b/src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java new file mode 100644 index 0000000..4c5a6ff --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductCustomField; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductCustomFieldRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductDao.java b/src/main/java/com/writely/product/repository/ProductDao.java new file mode 100644 index 0000000..41e3246 --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductDao.java @@ -0,0 +1,25 @@ +package com.writely.product.repository; + +import com.writely.product.response.ProductResponse; +import lombok.RequiredArgsConstructor; +import org.jooq.DSLContext; +import org.springframework.stereotype.Repository; + +import java.util.List; + +import static writely.tables.Product.PRODUCT; + +@Repository +@RequiredArgsConstructor +public class ProductDao { + + private final DSLContext dsl; + + public List select() { + return dsl + .selectFrom(PRODUCT) + .orderBy(PRODUCT.UPDATED_AT.desc()) + .fetch() + .map(ProductResponse::new); + } +} diff --git a/src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java b/src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java new file mode 100644 index 0000000..20b45f4 --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductIdeaNote; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductIdeaNoteRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductPlotRepository.java b/src/main/java/com/writely/product/repository/ProductPlotRepository.java new file mode 100644 index 0000000..ef92617 --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductPlotRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductPlot; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductPlotRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductSynopsisRepository.java b/src/main/java/com/writely/product/repository/ProductSynopsisRepository.java new file mode 100644 index 0000000..47f059b --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductSynopsisRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductSynopsis; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductSynopsisRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/repository/ProductWorldviewRepository.java b/src/main/java/com/writely/product/repository/ProductWorldviewRepository.java new file mode 100644 index 0000000..9ead019 --- /dev/null +++ b/src/main/java/com/writely/product/repository/ProductWorldviewRepository.java @@ -0,0 +1,9 @@ +package com.writely.product.repository; + +import com.writely.product.domain.ProductWorldview; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ProductWorldviewRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java b/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java index 6ec9d15..8d99ea5 100644 --- a/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java +++ b/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java @@ -9,5 +9,5 @@ public class ProductMemoCreateRequest { @Schema(title = "내용") - private String name; + private String content; } diff --git a/src/main/java/com/writely/product/request/ProductCreateRequest.java b/src/main/java/com/writely/product/request/ProductModifyRequest.java similarity index 60% rename from src/main/java/com/writely/product/request/ProductCreateRequest.java rename to src/main/java/com/writely/product/request/ProductModifyRequest.java index 3df6e89..69b0a47 100644 --- a/src/main/java/com/writely/product/request/ProductCreateRequest.java +++ b/src/main/java/com/writely/product/request/ProductModifyRequest.java @@ -6,8 +6,10 @@ @Getter @Setter -public class ProductCreateRequest { +public class ProductModifyRequest { + @Schema(title = "제목") + private String title; @Schema(title = "내용") - private String name; + private String content; } diff --git a/src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java b/src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java new file mode 100644 index 0000000..13e1e77 --- /dev/null +++ b/src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java @@ -0,0 +1,200 @@ +package com.writely.product.request; + +import com.writely.product.domain.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; +import java.util.UUID; + +@Getter +@Setter +public class ProductTemplateCreateRequest { + + private List characters; + private List customFields; + private IdeaNote ideaNote; + private Plot plot; + private Synopsis synopsis; + private Worldview worldview; + + @Getter + @Setter + public static class Character { + + @Schema(nullable = true) + private UUID id; + @Schema(title = "소개", nullable = true) + private String intro; + @Schema(title = "이름", nullable = true) + private String name; + @Schema(title = "나이", nullable = true) + private Short age; + @Schema(title = "성별", nullable = true) + private String gender; + @Schema(title = "직업", nullable = true) + private String occupation; + @Schema(title = "외모", nullable = true) + private String appearance; + @Schema(title = "성격", nullable = true) + private String personality; + @Schema(title = "특징", nullable = true) + private String characteristic; + @Schema(title = "주요관계", nullable = true) + private String relationship; + + public ProductCharacter toEntity(UUID productId) { + return ProductCharacter.builder() + .productId(productId) + .intro(intro) + .name(name) + .age(age) + .gender(gender) + .occupation(occupation) + .appearance(appearance) + .personality(personality) + .characteristic(characteristic) + .relationship(relationship) + .build(); + } + } + + @Getter + @Setter + public static class CustomField { + + @Schema(nullable = true) + private UUID id; + @Schema(title = "섹션 코드") + private String sectionCode; + @Schema(title = "필드 이름") + private String name; + @Schema(title = "필드 내용") + private String content; + @Schema(title = "필드 순서") + private Short seq; + + public ProductCustomField toEntity(UUID productId) { + return ProductCustomField.builder() + .productId(productId) + .sectionCode(sectionCode) + .name(name) + .content(content) + .seq(seq) + .build(); + } + } + + @Getter + @Setter + public static class IdeaNote { + + @Schema(title = "제목") + private String title; + @Schema(title = "내용", nullable = true) + private String content; + } + + @Getter + @Setter + public static class Plot { + + @Schema(title = "발단", nullable = true) + private String exposition; + @Schema(title = "전개", nullable = true) + private String complication; + @Schema(title = "위기", nullable = true) + private String climax; + @Schema(title = "결말", nullable = true) + private String resolution; + + public ProductPlot toEntity(UUID productId) { + return ProductPlot.builder() + .id(productId) + .exposition(exposition) + .complication(complication) + .climax(climax) + .resolution(resolution) + .build(); + } + } + + @Getter + @Setter + public static class Synopsis { + + @Schema(title = "장르") + private String genre; + @Schema(title = "분량", nullable = true) + private String length; + @Schema(title = "기획 의도", nullable = true) + private String purpose; + @Schema(title = "로그라인", nullable = true) + private String logline; + @Schema(title = "예시 문장", nullable = true) + private String example; + + public ProductSynopsis toEntity(UUID productId) { + return ProductSynopsis.builder() + .id(productId) + .genre(genre) + .length(length) + .purpose(purpose) + .logline(logline) + .example(example) + .build(); + } + } + + @Getter + @Setter + public static class Worldview { + + @Schema(title = "지리", nullable = true) + private String geography; + @Schema(title = "역사", nullable = true) + private String history; + @Schema(title = "정치", nullable = true) + private String politics; + @Schema(title = "사회", nullable = true) + private String society; + @Schema(title = "종교", nullable = true) + private String religion; + @Schema(title = "경제", nullable = true) + private String economy; + @Schema(title = "기술", nullable = true) + private String technology; + @Schema(title = "생활", nullable = true) + private String lifestyle; + @Schema(title = "언어", nullable = true) + private String language; + @Schema(title = "문화", nullable = true) + private String culture; + @Schema(title = "종족", nullable = true) + private String species; + @Schema(title = "직업", nullable = true) + private String occupation; + @Schema(title = "갈등 관계", nullable = true) + private String conflict; + + public ProductWorldview toEntity(UUID productId) { + return ProductWorldview.builder() + .id(productId) + .geography(geography) + .history(history) + .politics(politics) + .society(society) + .religion(religion) + .economy(economy) + .technology(technology) + .lifestyle(lifestyle) + .language(language) + .culture(culture) + .species(species) + .occupation(occupation) + .conflict(conflict) + .build(); + } + } +} diff --git a/src/main/java/com/writely/product/response/ProductDetailResponse.java b/src/main/java/com/writely/product/response/ProductDetailResponse.java new file mode 100644 index 0000000..17d1b95 --- /dev/null +++ b/src/main/java/com/writely/product/response/ProductDetailResponse.java @@ -0,0 +1,46 @@ +package com.writely.product.response; + +import com.writely.product.domain.Product; +import com.writely.product.domain.ProductMemo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; + +@Getter +@Setter +public class ProductDetailResponse { + + private final UUID id; + @Schema(title = "내용") + private final String content; + @Schema(title = "수정일시") + private final LocalDateTime updatedAt; + private final List memos; + + public ProductDetailResponse(Product product) { + this.id = product.getId(); + this.content = product.getContent(); + this.updatedAt = product.getUpdatedAt(); + this.memos = product.getMemos().stream() + .map(Memo::new) + .toList(); + } + + @Getter + @Setter + public static class Memo { + + private final UUID id; + @Schema(title = "내용") + private final String content; + + public Memo(ProductMemo memo) { + this.id = memo.getId(); + this.content = memo.getContent(); + } + } +} diff --git a/src/main/java/com/writely/product/response/ProductMemoResponse.java b/src/main/java/com/writely/product/response/ProductMemoResponse.java new file mode 100644 index 0000000..71a73b7 --- /dev/null +++ b/src/main/java/com/writely/product/response/ProductMemoResponse.java @@ -0,0 +1,20 @@ +package com.writely.product.response; + +import com.writely.product.domain.ProductMemo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +import java.util.UUID; + +@Getter +public class ProductMemoResponse { + + private final UUID id; + @Schema(title = "내용") + private final String content; + + public ProductMemoResponse(ProductMemo memo) { + this.id = memo.getId(); + this.content = memo.getContent(); + } +} diff --git a/src/main/java/com/writely/product/response/ProductResponse.java b/src/main/java/com/writely/product/response/ProductResponse.java index 6351228..c96859a 100644 --- a/src/main/java/com/writely/product/response/ProductResponse.java +++ b/src/main/java/com/writely/product/response/ProductResponse.java @@ -1,23 +1,26 @@ package com.writely.product.response; -import com.writely.product.domain.Product; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; +import writely.tables.records.ProductRecord; import java.time.LocalDateTime; +import java.util.UUID; @Getter @Setter public class ProductResponse { - @Schema(title = "내용") - private final String content; - @Schema(title = "생성일시") - private final LocalDateTime createdAt; + private final UUID id; + @Schema(title = "제목") + private final String title; + @Schema(title = "수정일시") + private final LocalDateTime updatedAt; - public ProductResponse(Product product) { - this.content = product.getContent(); - this.createdAt = product.getCreatedAt(); + public ProductResponse(ProductRecord product) { + this.id = product.getId(); + this.title = product.getContent(); + this.updatedAt = product.getUpdatedAt(); } } diff --git a/src/main/java/com/writely/product/response/ProductTemplateResponse.java b/src/main/java/com/writely/product/response/ProductTemplateResponse.java new file mode 100644 index 0000000..5eae045 --- /dev/null +++ b/src/main/java/com/writely/product/response/ProductTemplateResponse.java @@ -0,0 +1,212 @@ +package com.writely.product.response; + +import com.writely.product.domain.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; +import java.util.UUID; + +@Getter +public class ProductTemplateResponse { + + private final UUID id; + private final List characters; + private final List customFields; + private final IdeaNote ideaNote; + private final Plot plot; + private final Synopsis synopsis; + private final Worldview worldview; + + public ProductTemplateResponse(Product product) { + this.id = product.getId(); + this.characters = product.getCharacters().stream() + .map(Character::new) + .toList(); + this.customFields = product.getCustomFields().stream() + .map(CustomField::new) + .toList(); + this.ideaNote = product.getIdeaNote() != null ? new IdeaNote(product.getIdeaNote()) : null; + this.plot = product.getPlot() != null ? new Plot(product.getPlot()) : null; + this.synopsis = product.getSynopsis() != null ? new Synopsis(product.getSynopsis()) : null; + this.worldview = product.getWorldview() != null ? new Worldview(product.getWorldview()) : null; + } + + @Getter + @Setter + public static class Character { + + private final UUID id; + @Schema(title = "소개", nullable = true) + private final String intro; + @Schema(name = "이름", nullable = true) + private final String name; + @Schema(name = "나이", nullable = true) + private final Short age; + @Schema(name = "성별", nullable = true) + private final String gender; + @Schema(name = "직업", nullable = true) + private final String occupation; + @Schema(name = "외모", nullable = true) + private final String appearance; + @Schema(name = "성격", nullable = true) + private final String personality; + @Schema(name = "특징", nullable = true) + private final String characteristic; + @Schema(name = "주요관계", nullable = true) + private final String relationship; + + public Character(ProductCharacter character) { + this.id = character.getId(); + this.intro = character.getIntro(); + this.name = character.getName(); + this.age = character.getAge(); + this.gender = character.getGender(); + this.occupation = character.getOccupation(); + this.appearance = character.getAppearance(); + this.personality = character.getPersonality(); + this.characteristic = character.getCharacteristic(); + this.relationship = character.getRelationship(); + } + } + + @Getter + @Setter + public static class CustomField { + + private final UUID id; + @Schema(title = "섹션 코드") + private final String sectionCode; + @Schema(title = "필드 이름") + private final String name; + @Schema(title = "필드 내용") + private final String content; + @Schema(title = "필드 순서") + private final Short seq; + + public CustomField(ProductCustomField customField) { + this.id = customField.getId(); + this.sectionCode = customField.getSectionCode(); + this.name = customField.getName(); + this.content = customField.getContent(); + this.seq = customField.getSeq(); + } + } + + @Getter + @Setter + public static class IdeaNote { + + private final UUID id; + @Schema(title = "제목", nullable = true) + private final String title; + @Schema(title = "내용", nullable = true) + private final String content; + + public IdeaNote(ProductIdeaNote ideaNote) { + this.id = ideaNote.getId(); + this.title = ideaNote.getTitle(); + this.content = ideaNote.getContent(); + } + } + + @Getter + @Setter + public static class Plot { + + private final UUID id; + @Schema(title = "발단", nullable = true) + private final String exposition; + @Schema(title = "전개", nullable = true) + private final String complication; + @Schema(title = "위기", nullable = true) + private final String climax; + @Schema(title = "결말", nullable = true) + private final String resolution; + + public Plot(ProductPlot plot) { + this.id = plot.getId(); + this.exposition = plot.getExposition(); + this.complication = plot.getComplication(); + this.climax = plot.getClimax(); + this.resolution = plot.getResolution(); + } + } + + @Getter + @Setter + public static class Synopsis { + + private final UUID id; + @Schema(title = "장르") + private final String genre; + @Schema(title = "분량", nullable = true) + private final String length; + @Schema(title = "기획 의도", nullable = true) + private final String purpose; + @Schema(title = "로그라인", nullable = true) + private final String logline; + @Schema(title = "예시 문장", nullable = true) + private final String example; + + public Synopsis(ProductSynopsis synopsis) { + this.id = synopsis.getId(); + this.genre = synopsis.getGenre(); + this.length = synopsis.getLength(); + this.purpose = synopsis.getPurpose(); + this.logline = synopsis.getLogline(); + this.example = synopsis.getExample(); + } + } + + @Getter + @Setter + public static class Worldview { + + private final UUID id; + @Schema(title = "지리", nullable = true) + private final String geography; + @Schema(title = "역사", nullable = true) + private final String history; + @Schema(title = "정치", nullable = true) + private final String politics; + @Schema(title = "사회", nullable = true) + private final String society; + @Schema(title = "종교", nullable = true) + private final String religion; + @Schema(title = "경제", nullable = true) + private final String economy; + @Schema(title = "기술", nullable = true) + private final String technology; + @Schema(title = "생활", nullable = true) + private final String lifestyle; + @Schema(title = "언어", nullable = true) + private final String language; + @Schema(title = "문화", nullable = true) + private final String culture; + @Schema(title = "종족", nullable = true) + private final String species; + @Schema(title = "직업", nullable = true) + private final String occupation; + @Schema(title = "갈등 관계", nullable = true) + private final String conflict; + + public Worldview(ProductWorldview worldview) { + this.id = worldview.getId(); + this.geography = worldview.getGeography(); + this.history = worldview.getHistory(); + this.politics = worldview.getPolitics(); + this.society = worldview.getSociety(); + this.religion = worldview.getReligion(); + this.economy = worldview.getEconomy(); + this.technology = worldview.getTechnology(); + this.lifestyle = worldview.getLifestyle(); + this.language = worldview.getLanguage(); + this.culture = worldview.getCulture(); + this.species = worldview.getSpecies(); + this.occupation = worldview.getOccupation(); + this.conflict = worldview.getConflict(); + } + } +} diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index 9731d1c..38def8b 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -1,18 +1,19 @@ package com.writely.product.service; import com.writely.common.exception.BaseException; -import com.writely.product.domain.Product; -import com.writely.product.domain.ProductMemo; +import com.writely.product.domain.*; import com.writely.product.domain.enums.ProductException; -import com.writely.product.repository.ProductMemoRepository; -import com.writely.product.repository.ProductRepository; -import com.writely.product.request.ProductCreateRequest; +import com.writely.product.repository.*; import com.writely.product.request.ProductMemoCreateRequest; +import com.writely.product.request.ProductModifyRequest; +import com.writely.product.request.ProductTemplateCreateRequest; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.UUID; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -20,20 +21,211 @@ public class ProductCommandService { private final ProductQueryService productQueryService; private final ProductRepository productRepository; + private final ProductCharacterRepository productCharacterRepository; + private final ProductCustomFieldRepository productCustomFieldRepository; + private final ProductIdeaNoteRepository productIdeaNoteRepository; private final ProductMemoRepository productMemoRepository; + private final ProductPlotRepository productPlotRepository; + private final ProductSynopsisRepository productSynopsisRepository; + private final ProductWorldviewRepository productWorldviewRepository; @Transactional - public void create(ProductCreateRequest request) { - Product product = new Product(request.getName()); - - productRepository.save(product); + public UUID create() { + return productRepository.save(new Product()).getId(); } @Transactional public void createMemo(UUID productId, ProductMemoCreateRequest request) { verifyExistProduct(productId); - productMemoRepository.save(new ProductMemo(productId, request.getName())); + productMemoRepository.save(new ProductMemo(productId, request.getContent())); + } + + @Transactional + public void saveTemplate(UUID productId, ProductTemplateCreateRequest request) { + Product product = productQueryService.getById(productId); + + modifyCharacters(product, request.getCharacters()); + modifyCustomFields(product, request.getCustomFields()); + modifyIdeaNote(product, request.getIdeaNote()); + modifyPlot(product, request.getPlot()); + modifySynopsis(product, request.getSynopsis()); + modifyWorldview(product, request.getWorldview()); + } + + @Transactional + public UUID modify(UUID productId, ProductModifyRequest request) { + Product product = productQueryService.getById(productId); + + product.update(request.getTitle(), request.getContent()); + return product.getId(); + } + + @Transactional + public void modifyMemo(UUID productId, UUID memoId, ProductMemoCreateRequest request) { + verifyExistProduct(productId); + + ProductMemo memo = getMemoById(memoId); + + memo.update(request.getContent()); + } + + @Transactional + public void deleteMemo(UUID productId, UUID memoId) { + verifyExistProduct(productId); + + ProductMemo memo = getMemoById(memoId); + + productMemoRepository.delete(memo); + } + + private ProductMemo getMemoById(UUID memoId) { + return productMemoRepository.findById(memoId) + .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); + } + + private void modifyCharacters(Product product, List characters) { + Map savedCharacterMap = product.getCharacters().stream() + .collect(Collectors.toMap(ProductCharacter::getId, Function.identity())); + if (characters.isEmpty()) { + productCharacterRepository.deleteAll(savedCharacterMap.values()); + return; + } + + Set modifyIds = characters.stream() + .map(ProductTemplateCreateRequest.Character::getId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + List deleteCharacters = savedCharacterMap.values().stream() + .filter(e -> !modifyIds.contains(e.getId())) + .toList(); + + productCharacterRepository.deleteAll(deleteCharacters); + + List addCharacters = new ArrayList<>(); + characters.forEach(e -> { + if (e.getId() == null) { + addCharacters.add(e.toEntity(product.getId())); + } else { + ProductCharacter savedCharacter = savedCharacterMap.get(e.getId()); + if (savedCharacter == null) { + throw new BaseException(ProductException.NOT_EXIST_CHARACTER); + } + + savedCharacter.update(e.getIntro(), e.getName(), e.getAge(), e.getGender(), e.getOccupation(), + e.getAppearance(), e.getPersonality(), e.getCharacteristic(), e.getRelationship()); + } + }); + + productCharacterRepository.saveAll(addCharacters); + } + + private void modifyCustomFields(Product product, List customFields) { + Map savedCustomFieldMap = product.getCustomFields().stream() + .collect(Collectors.toMap(ProductCustomField::getId, Function.identity())); + if (customFields.isEmpty()) { + productCustomFieldRepository.deleteAll(savedCustomFieldMap.values()); + return; + } + + Set modifyIds = customFields.stream() + .map(ProductTemplateCreateRequest.CustomField::getId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + List deleteCharacters = savedCustomFieldMap.values().stream() + .filter(e -> !modifyIds.contains(e.getId())) + .toList(); + + productCustomFieldRepository.deleteAll(deleteCharacters); + + List addCustomFields = new ArrayList<>(); + customFields.forEach(e -> { + if (e.getId() == null) { + addCustomFields.add(e.toEntity(product.getId())); + } else { + ProductCustomField savedCustomField = savedCustomFieldMap.get(e.getId()); + if (savedCustomField == null) { + throw new BaseException(ProductException.NOT_EXIST_CUSTOM_FIELD); + } + + savedCustomField.update(e.getSectionCode(), e.getName(), e.getContent(), e.getSeq()); + } + }); + + productCustomFieldRepository.saveAll(addCustomFields); + } + + private void modifyIdeaNote(Product product, ProductTemplateCreateRequest.IdeaNote ideaNote) { + ProductIdeaNote savedIdeaNote = product.getIdeaNote(); + + if (ideaNote == null && savedIdeaNote != null) { + productIdeaNoteRepository.delete(savedIdeaNote); + return; + } + + if (ideaNote != null) { + if (savedIdeaNote == null) { + ProductIdeaNote newIdeaNote = new ProductIdeaNote(product.getId(), ideaNote.getTitle(), ideaNote.getContent()); + productIdeaNoteRepository.save(newIdeaNote); + } else { + savedIdeaNote.update(ideaNote.getTitle(), ideaNote.getContent()); + } + } + } + + private void modifyPlot(Product product, ProductTemplateCreateRequest.Plot plot) { + ProductPlot savedPlot = product.getPlot(); + + if (plot == null && savedPlot != null) { + productPlotRepository.delete(savedPlot); + return; + } + + if (plot != null) { + if (savedPlot == null) { + productPlotRepository.save(plot.toEntity(product.getId())); + } else { + savedPlot.update(plot.getExposition(), plot.getComplication(), plot.getComplication(), plot.getComplication()); + } + } + } + + private void modifySynopsis(Product product, ProductTemplateCreateRequest.Synopsis synopsis) { + ProductSynopsis savedSynopsis = product.getSynopsis(); + + if (synopsis == null && savedSynopsis != null) { + productSynopsisRepository.delete(savedSynopsis); + return; + } + + if (synopsis != null) { + if (savedSynopsis == null) { + productSynopsisRepository.save(synopsis.toEntity(product.getId())); + } else { + savedSynopsis.update(synopsis.getGenre(), synopsis.getLength(), synopsis.getPurpose(), synopsis.getLogline(), synopsis.getExample()); + } + } + } + + private void modifyWorldview(Product product, ProductTemplateCreateRequest.Worldview worldview) { + ProductWorldview savedWorldview = product.getWorldview(); + + if (worldview == null && savedWorldview != null) { + productWorldviewRepository.delete(savedWorldview); + return; + } + + if (worldview != null) { + if (savedWorldview == null) { + productWorldviewRepository.save(worldview.toEntity(product.getId())); + } else { + savedWorldview.update(worldview.getGeography(), worldview.getHistory(), worldview.getPolitics(), + worldview.getSociety(), worldview.getReligion(), worldview.getEconomy(), worldview.getTechnology(), worldview.getLifestyle(), + worldview.getLanguage(), worldview.getCulture(), worldview.getSpecies(), worldview.getOccupation(), worldview.getConflict()); + } + } } private void verifyExistProduct(UUID productId) { diff --git a/src/main/java/com/writely/product/service/ProductQueryService.java b/src/main/java/com/writely/product/service/ProductQueryService.java index d29e300..4eb089d 100644 --- a/src/main/java/com/writely/product/service/ProductQueryService.java +++ b/src/main/java/com/writely/product/service/ProductQueryService.java @@ -3,8 +3,12 @@ import com.writely.common.exception.BaseException; import com.writely.product.domain.Product; import com.writely.product.domain.enums.ProductException; +import com.writely.product.repository.ProductDao; import com.writely.product.repository.ProductRepository; +import com.writely.product.response.ProductDetailResponse; +import com.writely.product.response.ProductMemoResponse; import com.writely.product.response.ProductResponse; +import com.writely.product.response.ProductTemplateResponse; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -17,14 +21,31 @@ @Transactional(readOnly = true) public class ProductQueryService { + private final ProductDao productDao; private final ProductRepository productRepository; - public List getAll() { - return productRepository.findAll().stream().map(ProductResponse::new).toList(); + public ProductDetailResponse getDetail(UUID productId) { + return new ProductDetailResponse(getById(productId)); } - public Product getById(UUID id) { - return productRepository.findById(id) + public List getList() { + return productDao.select(); + } + + public Product getById(UUID productId) { + return productRepository.findById(productId) .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST)); } + + public ProductTemplateResponse getTemplate(UUID productId) { + return new ProductTemplateResponse(getById(productId)); + } + + public List getMemos(UUID productId) { + Product product = getById(productId); + + return product.getMemos().stream() + .map(ProductMemoResponse::new) + .toList(); + } } From 2fbbc8298174b1626c4a5e4b84c9f637aeca6450 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:08:47 +0900 Subject: [PATCH 008/107] fix: resolve jooq build error (#6) --- .github/workflows/build-test.yml | 31 + .github/workflows/{gradle.yml => deploy.yml} | 0 .gitignore | 1 - .../generated/writely/DefaultCatalog.java | 54 + src/main/generated/writely/Keys.java | 55 + src/main/generated/writely/Public.java | 162 ++ src/main/generated/writely/Routines.java | 1704 +++++++++++++++++ src/main/generated/writely/Tables.java | 119 ++ .../generated/writely/routines/Armor1.java | 60 + .../generated/writely/routines/Armor2.java | 104 + .../generated/writely/routines/Crypt.java | 81 + .../generated/writely/routines/Dearmor.java | 59 + .../generated/writely/routines/Decrypt.java | 103 + .../generated/writely/routines/DecryptIv.java | 125 ++ .../generated/writely/routines/Digest1.java | 82 + .../generated/writely/routines/Digest2.java | 82 + .../generated/writely/routines/Encrypt.java | 103 + .../generated/writely/routines/EncryptIv.java | 125 ++ .../writely/routines/GenRandomBytes.java | 59 + .../writely/routines/GenRandomUuid.java | 38 + .../generated/writely/routines/GenSalt1.java | 60 + .../generated/writely/routines/GenSalt2.java | 82 + .../generated/writely/routines/Hmac1.java | 104 + .../generated/writely/routines/Hmac2.java | 104 + .../generated/writely/routines/PgpKeyId.java | 59 + .../writely/routines/PgpPubDecrypt1.java | 82 + .../writely/routines/PgpPubDecrypt2.java | 104 + .../writely/routines/PgpPubDecrypt3.java | 126 ++ .../writely/routines/PgpPubDecryptBytea1.java | 82 + .../writely/routines/PgpPubDecryptBytea2.java | 104 + .../writely/routines/PgpPubDecryptBytea3.java | 126 ++ .../writely/routines/PgpPubEncrypt1.java | 82 + .../writely/routines/PgpPubEncrypt2.java | 104 + .../writely/routines/PgpPubEncryptBytea1.java | 82 + .../writely/routines/PgpPubEncryptBytea2.java | 104 + .../writely/routines/PgpSymDecrypt1.java | 82 + .../writely/routines/PgpSymDecrypt2.java | 104 + .../writely/routines/PgpSymDecryptBytea1.java | 82 + .../writely/routines/PgpSymDecryptBytea2.java | 104 + .../writely/routines/PgpSymEncrypt1.java | 82 + .../writely/routines/PgpSymEncrypt2.java | 104 + .../writely/routines/PgpSymEncryptBytea1.java | 82 + .../writely/routines/PgpSymEncryptBytea2.java | 104 + src/main/generated/writely/tables/Member.java | 250 +++ .../writely/tables/MemberPassword.java | 235 +++ .../writely/tables/PgpArmorHeaders.java | 157 ++ .../generated/writely/tables/Product.java | 250 +++ .../writely/tables/ProductCharacter.java | 290 +++ .../writely/tables/ProductCustomField.java | 267 +++ .../writely/tables/ProductIdeanote.java | 250 +++ .../generated/writely/tables/ProductMemo.java | 250 +++ .../generated/writely/tables/ProductPlot.java | 260 +++ .../writely/tables/ProductSynopsis.java | 265 +++ .../writely/tables/ProductWorldview.java | 305 +++ .../writely/tables/pojos/Member.java | 188 ++ .../writely/tables/pojos/MemberPassword.java | 131 ++ .../writely/tables/pojos/PgpArmorHeaders.java | 91 + .../writely/tables/pojos/Product.java | 188 ++ .../tables/pojos/ProductCharacter.java | 340 ++++ .../tables/pojos/ProductCustomField.java | 245 +++ .../writely/tables/pojos/ProductIdeanote.java | 188 ++ .../writely/tables/pojos/ProductMemo.java | 188 ++ .../writely/tables/pojos/ProductPlot.java | 226 +++ .../writely/tables/pojos/ProductSynopsis.java | 245 +++ .../tables/pojos/ProductWorldview.java | 397 ++++ .../tables/records/MemberPasswordRecord.java | 131 ++ .../writely/tables/records/MemberRecord.java | 182 ++ .../tables/records/PgpArmorHeadersRecord.java | 84 + .../records/ProductCharacterRecord.java | 318 +++ .../records/ProductCustomFieldRecord.java | 233 +++ .../tables/records/ProductIdeanoteRecord.java | 182 ++ .../tables/records/ProductMemoRecord.java | 182 ++ .../tables/records/ProductPlotRecord.java | 216 +++ .../writely/tables/records/ProductRecord.java | 182 ++ .../tables/records/ProductSynopsisRecord.java | 233 +++ .../records/ProductWorldviewRecord.java | 369 ++++ 76 files changed, 12813 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test.yml rename .github/workflows/{gradle.yml => deploy.yml} (100%) create mode 100644 src/main/generated/writely/DefaultCatalog.java create mode 100644 src/main/generated/writely/Keys.java create mode 100644 src/main/generated/writely/Public.java create mode 100644 src/main/generated/writely/Routines.java create mode 100644 src/main/generated/writely/Tables.java create mode 100644 src/main/generated/writely/routines/Armor1.java create mode 100644 src/main/generated/writely/routines/Armor2.java create mode 100644 src/main/generated/writely/routines/Crypt.java create mode 100644 src/main/generated/writely/routines/Dearmor.java create mode 100644 src/main/generated/writely/routines/Decrypt.java create mode 100644 src/main/generated/writely/routines/DecryptIv.java create mode 100644 src/main/generated/writely/routines/Digest1.java create mode 100644 src/main/generated/writely/routines/Digest2.java create mode 100644 src/main/generated/writely/routines/Encrypt.java create mode 100644 src/main/generated/writely/routines/EncryptIv.java create mode 100644 src/main/generated/writely/routines/GenRandomBytes.java create mode 100644 src/main/generated/writely/routines/GenRandomUuid.java create mode 100644 src/main/generated/writely/routines/GenSalt1.java create mode 100644 src/main/generated/writely/routines/GenSalt2.java create mode 100644 src/main/generated/writely/routines/Hmac1.java create mode 100644 src/main/generated/writely/routines/Hmac2.java create mode 100644 src/main/generated/writely/routines/PgpKeyId.java create mode 100644 src/main/generated/writely/routines/PgpPubDecrypt1.java create mode 100644 src/main/generated/writely/routines/PgpPubDecrypt2.java create mode 100644 src/main/generated/writely/routines/PgpPubDecrypt3.java create mode 100644 src/main/generated/writely/routines/PgpPubDecryptBytea1.java create mode 100644 src/main/generated/writely/routines/PgpPubDecryptBytea2.java create mode 100644 src/main/generated/writely/routines/PgpPubDecryptBytea3.java create mode 100644 src/main/generated/writely/routines/PgpPubEncrypt1.java create mode 100644 src/main/generated/writely/routines/PgpPubEncrypt2.java create mode 100644 src/main/generated/writely/routines/PgpPubEncryptBytea1.java create mode 100644 src/main/generated/writely/routines/PgpPubEncryptBytea2.java create mode 100644 src/main/generated/writely/routines/PgpSymDecrypt1.java create mode 100644 src/main/generated/writely/routines/PgpSymDecrypt2.java create mode 100644 src/main/generated/writely/routines/PgpSymDecryptBytea1.java create mode 100644 src/main/generated/writely/routines/PgpSymDecryptBytea2.java create mode 100644 src/main/generated/writely/routines/PgpSymEncrypt1.java create mode 100644 src/main/generated/writely/routines/PgpSymEncrypt2.java create mode 100644 src/main/generated/writely/routines/PgpSymEncryptBytea1.java create mode 100644 src/main/generated/writely/routines/PgpSymEncryptBytea2.java create mode 100644 src/main/generated/writely/tables/Member.java create mode 100644 src/main/generated/writely/tables/MemberPassword.java create mode 100644 src/main/generated/writely/tables/PgpArmorHeaders.java create mode 100644 src/main/generated/writely/tables/Product.java create mode 100644 src/main/generated/writely/tables/ProductCharacter.java create mode 100644 src/main/generated/writely/tables/ProductCustomField.java create mode 100644 src/main/generated/writely/tables/ProductIdeanote.java create mode 100644 src/main/generated/writely/tables/ProductMemo.java create mode 100644 src/main/generated/writely/tables/ProductPlot.java create mode 100644 src/main/generated/writely/tables/ProductSynopsis.java create mode 100644 src/main/generated/writely/tables/ProductWorldview.java create mode 100644 src/main/generated/writely/tables/pojos/Member.java create mode 100644 src/main/generated/writely/tables/pojos/MemberPassword.java create mode 100644 src/main/generated/writely/tables/pojos/PgpArmorHeaders.java create mode 100644 src/main/generated/writely/tables/pojos/Product.java create mode 100644 src/main/generated/writely/tables/pojos/ProductCharacter.java create mode 100644 src/main/generated/writely/tables/pojos/ProductCustomField.java create mode 100644 src/main/generated/writely/tables/pojos/ProductIdeanote.java create mode 100644 src/main/generated/writely/tables/pojos/ProductMemo.java create mode 100644 src/main/generated/writely/tables/pojos/ProductPlot.java create mode 100644 src/main/generated/writely/tables/pojos/ProductSynopsis.java create mode 100644 src/main/generated/writely/tables/pojos/ProductWorldview.java create mode 100644 src/main/generated/writely/tables/records/MemberPasswordRecord.java create mode 100644 src/main/generated/writely/tables/records/MemberRecord.java create mode 100644 src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductCharacterRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductCustomFieldRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductIdeanoteRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductMemoRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductPlotRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductSynopsisRecord.java create mode 100644 src/main/generated/writely/tables/records/ProductWorldviewRecord.java diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..0f123f7 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,31 @@ +name: Build Test + +on: + pull_request: + branches: [ "develop", "stage", "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + + - name: Gradle Caching + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build with Gradle + run: chmod +x gradlew && ./gradlew build -x test \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/deploy.yml similarity index 100% rename from .github/workflows/gradle.yml rename to .github/workflows/deploy.yml diff --git a/.gitignore b/.gitignore index c69ca32..6c4c4bc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ HELP.md .gradle build/ db/ -src/main/generated/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ diff --git a/src/main/generated/writely/DefaultCatalog.java b/src/main/generated/writely/DefaultCatalog.java new file mode 100644 index 0000000..a453609 --- /dev/null +++ b/src/main/generated/writely/DefaultCatalog.java @@ -0,0 +1,54 @@ +/* + * This file is generated by jOOQ. + */ +package writely; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Constants; +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class DefaultCatalog extends CatalogImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of DEFAULT_CATALOG + */ + public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); + + /** + * The schema public. + */ + public final Public PUBLIC = Public.PUBLIC; + + /** + * No further instances allowed + */ + private DefaultCatalog() { + super(""); + } + + @Override + public final List getSchemas() { + return Arrays.asList( + Public.PUBLIC + ); + } + + /** + * A reference to the 3.19 minor release of the code generator. If this + * doesn't compile, it's because the runtime library uses an older minor + * release, namely: 3.19. You can turn off the generation of this reference + * by specifying /configuration/generator/generate/jooqVersionReference + */ + private static final String REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_19; +} diff --git a/src/main/generated/writely/Keys.java b/src/main/generated/writely/Keys.java new file mode 100644 index 0000000..327ec53 --- /dev/null +++ b/src/main/generated/writely/Keys.java @@ -0,0 +1,55 @@ +/* + * This file is generated by jOOQ. + */ +package writely; + + +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.Internal; + +import writely.tables.Member; +import writely.tables.MemberPassword; +import writely.tables.Product; +import writely.tables.ProductCharacter; +import writely.tables.ProductCustomField; +import writely.tables.ProductIdeanote; +import writely.tables.ProductMemo; +import writely.tables.ProductPlot; +import writely.tables.ProductSynopsis; +import writely.tables.ProductWorldview; +import writely.tables.records.MemberPasswordRecord; +import writely.tables.records.MemberRecord; +import writely.tables.records.ProductCharacterRecord; +import writely.tables.records.ProductCustomFieldRecord; +import writely.tables.records.ProductIdeanoteRecord; +import writely.tables.records.ProductMemoRecord; +import writely.tables.records.ProductPlotRecord; +import writely.tables.records.ProductRecord; +import writely.tables.records.ProductSynopsisRecord; +import writely.tables.records.ProductWorldviewRecord; + + +/** + * A class modelling foreign key relationships and constraints of tables in + * public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Keys { + + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- + + public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); + public static final UniqueKey MEMBER_PASSWORD_PK = Internal.createUniqueKey(MemberPassword.MEMBER_PASSWORD, DSL.name("member_password_pk"), new TableField[] { MemberPassword.MEMBER_PASSWORD.MEMBER_ID }, true); + public static final UniqueKey PRODUCT_PK = Internal.createUniqueKey(Product.PRODUCT, DSL.name("product_pk"), new TableField[] { Product.PRODUCT.ID }, true); + public static final UniqueKey PRODUCT_CHARACTER_PK = Internal.createUniqueKey(ProductCharacter.PRODUCT_CHARACTER, DSL.name("product_character_pk"), new TableField[] { ProductCharacter.PRODUCT_CHARACTER.ID }, true); + public static final UniqueKey PRODUCT_CUSTOM_FIELD_PK = Internal.createUniqueKey(ProductCustomField.PRODUCT_CUSTOM_FIELD, DSL.name("product_custom_field_pk"), new TableField[] { ProductCustomField.PRODUCT_CUSTOM_FIELD.ID }, true); + public static final UniqueKey PRODUCT_IDEANOTE_PK = Internal.createUniqueKey(ProductIdeanote.PRODUCT_IDEANOTE, DSL.name("product_ideanote_pk"), new TableField[] { ProductIdeanote.PRODUCT_IDEANOTE.ID }, true); + public static final UniqueKey PRODUCT_MEMO_PK = Internal.createUniqueKey(ProductMemo.PRODUCT_MEMO, DSL.name("product_memo_pk"), new TableField[] { ProductMemo.PRODUCT_MEMO.ID }, true); + public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); + public static final UniqueKey PRODUCT_SYNOPSIS_PK = Internal.createUniqueKey(ProductSynopsis.PRODUCT_SYNOPSIS, DSL.name("product_synopsis_pk"), new TableField[] { ProductSynopsis.PRODUCT_SYNOPSIS.ID }, true); + public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); +} diff --git a/src/main/generated/writely/Public.java b/src/main/generated/writely/Public.java new file mode 100644 index 0000000..fbda896 --- /dev/null +++ b/src/main/generated/writely/Public.java @@ -0,0 +1,162 @@ +/* + * This file is generated by jOOQ. + */ +package writely; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Catalog; +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; + +import writely.tables.Member; +import writely.tables.MemberPassword; +import writely.tables.PgpArmorHeaders; +import writely.tables.Product; +import writely.tables.ProductCharacter; +import writely.tables.ProductCustomField; +import writely.tables.ProductIdeanote; +import writely.tables.ProductMemo; +import writely.tables.ProductPlot; +import writely.tables.ProductSynopsis; +import writely.tables.ProductWorldview; +import writely.tables.records.PgpArmorHeadersRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Public extends SchemaImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public + */ + public static final Public PUBLIC = new Public(); + + /** + * 회원 + */ + public final Member MEMBER = Member.MEMBER; + + /** + * 회원_비밀번호 + */ + public final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + + /** + * The table public.pgp_armor_headers. + */ + public final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * 작품 + */ + public final Product PRODUCT = Product.PRODUCT; + + /** + * 작품 등장인물 + */ + public final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; + + /** + * 작품 커스텀 필드 + */ + public final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; + + /** + * 작품 아이디어 노트 + */ + public final ProductIdeanote PRODUCT_IDEANOTE = ProductIdeanote.PRODUCT_IDEANOTE; + + /** + * 작품 메모 + */ + public final ProductMemo PRODUCT_MEMO = ProductMemo.PRODUCT_MEMO; + + /** + * 작품 줄거리 + */ + public final ProductPlot PRODUCT_PLOT = ProductPlot.PRODUCT_PLOT; + + /** + * 작품 시놉시스 + */ + public final ProductSynopsis PRODUCT_SYNOPSIS = ProductSynopsis.PRODUCT_SYNOPSIS; + + /** + * 작품 세계관 + */ + public final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + + /** + * No further instances allowed + */ + private Public() { + super("public", null); + } + + + @Override + public Catalog getCatalog() { + return DefaultCatalog.DEFAULT_CATALOG; + } + + @Override + public final List> getTables() { + return Arrays.asList( + Member.MEMBER, + MemberPassword.MEMBER_PASSWORD, + PgpArmorHeaders.PGP_ARMOR_HEADERS, + Product.PRODUCT, + ProductCharacter.PRODUCT_CHARACTER, + ProductCustomField.PRODUCT_CUSTOM_FIELD, + ProductIdeanote.PRODUCT_IDEANOTE, + ProductMemo.PRODUCT_MEMO, + ProductPlot.PRODUCT_PLOT, + ProductSynopsis.PRODUCT_SYNOPSIS, + ProductWorldview.PRODUCT_WORLDVIEW + ); + } +} diff --git a/src/main/generated/writely/Routines.java b/src/main/generated/writely/Routines.java new file mode 100644 index 0000000..b647465 --- /dev/null +++ b/src/main/generated/writely/Routines.java @@ -0,0 +1,1704 @@ +/* + * This file is generated by jOOQ. + */ +package writely; + + +import java.util.UUID; + +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + +import writely.routines.Armor1; +import writely.routines.Armor2; +import writely.routines.Crypt; +import writely.routines.Dearmor; +import writely.routines.Decrypt; +import writely.routines.DecryptIv; +import writely.routines.Digest1; +import writely.routines.Digest2; +import writely.routines.Encrypt; +import writely.routines.EncryptIv; +import writely.routines.GenRandomBytes; +import writely.routines.GenRandomUuid; +import writely.routines.GenSalt1; +import writely.routines.GenSalt2; +import writely.routines.Hmac1; +import writely.routines.Hmac2; +import writely.routines.PgpKeyId; +import writely.routines.PgpPubDecrypt1; +import writely.routines.PgpPubDecrypt2; +import writely.routines.PgpPubDecrypt3; +import writely.routines.PgpPubDecryptBytea1; +import writely.routines.PgpPubDecryptBytea2; +import writely.routines.PgpPubDecryptBytea3; +import writely.routines.PgpPubEncrypt1; +import writely.routines.PgpPubEncrypt2; +import writely.routines.PgpPubEncryptBytea1; +import writely.routines.PgpPubEncryptBytea2; +import writely.routines.PgpSymDecrypt1; +import writely.routines.PgpSymDecrypt2; +import writely.routines.PgpSymDecryptBytea1; +import writely.routines.PgpSymDecryptBytea2; +import writely.routines.PgpSymEncrypt1; +import writely.routines.PgpSymEncrypt2; +import writely.routines.PgpSymEncryptBytea1; +import writely.routines.PgpSymEncryptBytea2; +import writely.tables.PgpArmorHeaders; +import writely.tables.records.PgpArmorHeadersRecord; + + +/** + * Convenience access to all stored procedures and functions in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Routines { + + /** + * Call public.armor + */ + public static String armor1( + Configuration configuration + , byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + Field __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.armor + */ + public static String armor2( + Configuration configuration + , byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + Field __1 + , Field __2 + , Field __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.crypt + */ + public static String crypt( + Configuration configuration + , String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + Field __1 + , Field __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.dearmor + */ + public static byte[] dearmor( + Configuration configuration + , String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + Field __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.decrypt + */ + public static byte[] decrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.decrypt_iv + */ + public static byte[] decryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest1( + Configuration configuration + , String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + Field __1 + , Field __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest2( + Configuration configuration + , byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + Field __1 + , Field __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.encrypt + */ + public static byte[] encrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.encrypt_iv + */ + public static byte[] encryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.gen_random_bytes + */ + public static byte[] genRandomBytes( + Configuration configuration + , Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Field __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_random_uuid + */ + public static UUID genRandomUuid( + Configuration configuration + ) { + GenRandomUuid f = new GenRandomUuid(); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_uuid as a field. + */ + public static Field genRandomUuid() { + GenRandomUuid f = new GenRandomUuid(); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt1( + Configuration configuration + , String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + Field __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt2( + Configuration configuration + , String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + Field __1 + , Field __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac1( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_key_id + */ + public static String pgpKeyId( + Configuration configuration + , byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + Field __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + Field __1 + , Field __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt1( + Configuration configuration + , String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + Field __1 + , Field __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt2( + Configuration configuration + , String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + Field __1 + , Field __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt1( + Configuration configuration + , String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + Field __1 + , Field __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt2( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_armor_headers. + */ + public static Result pgpArmorHeaders( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + String __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + Field __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } +} diff --git a/src/main/generated/writely/Tables.java b/src/main/generated/writely/Tables.java new file mode 100644 index 0000000..752a0a9 --- /dev/null +++ b/src/main/generated/writely/Tables.java @@ -0,0 +1,119 @@ +/* + * This file is generated by jOOQ. + */ +package writely; + + +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + +import writely.tables.Member; +import writely.tables.MemberPassword; +import writely.tables.PgpArmorHeaders; +import writely.tables.Product; +import writely.tables.ProductCharacter; +import writely.tables.ProductCustomField; +import writely.tables.ProductIdeanote; +import writely.tables.ProductMemo; +import writely.tables.ProductPlot; +import writely.tables.ProductSynopsis; +import writely.tables.ProductWorldview; +import writely.tables.records.PgpArmorHeadersRecord; + + +/** + * Convenience access to all tables in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Tables { + + /** + * 회원 + */ + public static final Member MEMBER = Member.MEMBER; + + /** + * 회원_비밀번호 + */ + public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + + /** + * The table public.pgp_armor_headers. + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * 작품 + */ + public static final Product PRODUCT = Product.PRODUCT; + + /** + * 작품 등장인물 + */ + public static final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; + + /** + * 작품 커스텀 필드 + */ + public static final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; + + /** + * 작품 아이디어 노트 + */ + public static final ProductIdeanote PRODUCT_IDEANOTE = ProductIdeanote.PRODUCT_IDEANOTE; + + /** + * 작품 메모 + */ + public static final ProductMemo PRODUCT_MEMO = ProductMemo.PRODUCT_MEMO; + + /** + * 작품 줄거리 + */ + public static final ProductPlot PRODUCT_PLOT = ProductPlot.PRODUCT_PLOT; + + /** + * 작품 시놉시스 + */ + public static final ProductSynopsis PRODUCT_SYNOPSIS = ProductSynopsis.PRODUCT_SYNOPSIS; + + /** + * 작품 세계관 + */ + public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; +} diff --git a/src/main/generated/writely/routines/Armor1.java b/src/main/generated/writely/routines/Armor1.java new file mode 100644 index 0000000..c835b2a --- /dev/null +++ b/src/main/generated/writely/routines/Armor1.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Armor1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.armor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.armor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public Armor1() { + super("armor", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor1 set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Armor2.java b/src/main/generated/writely/routines/Armor2.java new file mode 100644 index 0000000..0e648b9 --- /dev/null +++ b/src/main/generated/writely/routines/Armor2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Armor2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.armor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.armor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.armor._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB.array(), false, true); + + /** + * The parameter public.armor._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB.array(), false, true); + + /** + * Create a new routine call instance + */ + public Armor2() { + super("armor", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Crypt.java b/src/main/generated/writely/routines/Crypt.java new file mode 100644 index 0000000..18d21d7 --- /dev/null +++ b/src/main/generated/writely/routines/Crypt.java @@ -0,0 +1,81 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Crypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.crypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.crypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.crypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Crypt() { + super("crypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Crypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Crypt set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Dearmor.java b/src/main/generated/writely/routines/Dearmor.java new file mode 100644 index 0000000..3f82bc9 --- /dev/null +++ b/src/main/generated/writely/routines/Dearmor.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Dearmor extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.dearmor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.dearmor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Dearmor() { + super("dearmor", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Dearmor set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Decrypt.java b/src/main/generated/writely/routines/Decrypt.java new file mode 100644 index 0000000..6ff1e17 --- /dev/null +++ b/src/main/generated/writely/routines/Decrypt.java @@ -0,0 +1,103 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Decrypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Decrypt() { + super("decrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/DecryptIv.java b/src/main/generated/writely/routines/DecryptIv.java new file mode 100644 index 0000000..c0e6e96 --- /dev/null +++ b/src/main/generated/writely/routines/DecryptIv.java @@ -0,0 +1,125 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class DecryptIv extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.decrypt_iv.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.decrypt_iv._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public DecryptIv() { + super("decrypt_iv", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(byte[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Digest1.java b/src/main/generated/writely/routines/Digest1.java new file mode 100644 index 0000000..1863aca --- /dev/null +++ b/src/main/generated/writely/routines/Digest1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Digest1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.digest.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.digest._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.digest._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Digest1() { + super("digest", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Digest2.java b/src/main/generated/writely/routines/Digest2.java new file mode 100644 index 0000000..bcd7e6c --- /dev/null +++ b/src/main/generated/writely/routines/Digest2.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Digest2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.digest.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.digest._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.digest._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Digest2() { + super("digest", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest2 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Encrypt.java b/src/main/generated/writely/routines/Encrypt.java new file mode 100644 index 0000000..ffbb445 --- /dev/null +++ b/src/main/generated/writely/routines/Encrypt.java @@ -0,0 +1,103 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Encrypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Encrypt() { + super("encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/EncryptIv.java b/src/main/generated/writely/routines/EncryptIv.java new file mode 100644 index 0000000..64b06cc --- /dev/null +++ b/src/main/generated/writely/routines/EncryptIv.java @@ -0,0 +1,125 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class EncryptIv extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.encrypt_iv.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.encrypt_iv._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public EncryptIv() { + super("encrypt_iv", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(byte[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/GenRandomBytes.java b/src/main/generated/writely/routines/GenRandomBytes.java new file mode 100644 index 0000000..2219479 --- /dev/null +++ b/src/main/generated/writely/routines/GenRandomBytes.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenRandomBytes extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_random_bytes.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.gen_random_bytes._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.INTEGER, false, true); + + /** + * Create a new routine call instance + */ + public GenRandomBytes() { + super("gen_random_bytes", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(Integer value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenRandomBytes set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/GenRandomUuid.java b/src/main/generated/writely/routines/GenRandomUuid.java new file mode 100644 index 0000000..0553fb1 --- /dev/null +++ b/src/main/generated/writely/routines/GenRandomUuid.java @@ -0,0 +1,38 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import java.util.UUID; + +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenRandomUuid extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_random_uuid.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.UUID, false, false); + + /** + * Create a new routine call instance + */ + public GenRandomUuid() { + super("gen_random_uuid", Public.PUBLIC, SQLDataType.UUID); + + setReturnParameter(RETURN_VALUE); + } +} diff --git a/src/main/generated/writely/routines/GenSalt1.java b/src/main/generated/writely/routines/GenSalt1.java new file mode 100644 index 0000000..b6b325f --- /dev/null +++ b/src/main/generated/writely/routines/GenSalt1.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenSalt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_salt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.gen_salt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public GenSalt1() { + super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt1 set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/GenSalt2.java b/src/main/generated/writely/routines/GenSalt2.java new file mode 100644 index 0000000..603c9d6 --- /dev/null +++ b/src/main/generated/writely/routines/GenSalt2.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenSalt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_salt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.gen_salt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.gen_salt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.INTEGER, false, true); + + /** + * Create a new routine call instance + */ + public GenSalt2() { + super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(Integer value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt2 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Hmac1.java b/src/main/generated/writely/routines/Hmac1.java new file mode 100644 index 0000000..b3082a2 --- /dev/null +++ b/src/main/generated/writely/routines/Hmac1.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Hmac1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.hmac.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.hmac._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.hmac._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.hmac._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Hmac1() { + super("hmac", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/Hmac2.java b/src/main/generated/writely/routines/Hmac2.java new file mode 100644 index 0000000..21e1a1d --- /dev/null +++ b/src/main/generated/writely/routines/Hmac2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Hmac2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.hmac.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.hmac._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.hmac._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.hmac._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Hmac2() { + super("hmac", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpKeyId.java b/src/main/generated/writely/routines/PgpKeyId.java new file mode 100644 index 0000000..3e9fac6 --- /dev/null +++ b/src/main/generated/writely/routines/PgpKeyId.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpKeyId extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_key_id.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_key_id._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpKeyId() { + super("pgp_key_id", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpKeyId set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecrypt1.java b/src/main/generated/writely/routines/PgpPubDecrypt1.java new file mode 100644 index 0000000..c1b67f2 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt1() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecrypt2.java b/src/main/generated/writely/routines/PgpPubDecrypt2.java new file mode 100644 index 0000000..477b5e1 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt2() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecrypt3.java b/src/main/generated/writely/routines/PgpPubDecrypt3.java new file mode 100644 index 0000000..523f1f2 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecrypt3.java @@ -0,0 +1,126 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt3 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt3() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea1.java b/src/main/generated/writely/routines/PgpPubDecryptBytea1.java new file mode 100644 index 0000000..05f3e53 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea1() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea2.java b/src/main/generated/writely/routines/PgpPubDecryptBytea2.java new file mode 100644 index 0000000..43eeeb2 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea2() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea3.java b/src/main/generated/writely/routines/PgpPubDecryptBytea3.java new file mode 100644 index 0000000..02c24ff --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubDecryptBytea3.java @@ -0,0 +1,126 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea3 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea3() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubEncrypt1.java b/src/main/generated/writely/routines/PgpPubEncrypt1.java new file mode 100644 index 0000000..4ea7505 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubEncrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncrypt1() { + super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubEncrypt2.java b/src/main/generated/writely/routines/PgpPubEncrypt2.java new file mode 100644 index 0000000..4dfa568 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubEncrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncrypt2() { + super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubEncryptBytea1.java b/src/main/generated/writely/routines/PgpPubEncryptBytea1.java new file mode 100644 index 0000000..df86a32 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubEncryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncryptBytea1() { + super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpPubEncryptBytea2.java b/src/main/generated/writely/routines/PgpPubEncryptBytea2.java new file mode 100644 index 0000000..717acd3 --- /dev/null +++ b/src/main/generated/writely/routines/PgpPubEncryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncryptBytea2() { + super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymDecrypt1.java b/src/main/generated/writely/routines/PgpSymDecrypt1.java new file mode 100644 index 0000000..080e3e1 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymDecrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecrypt1() { + super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymDecrypt2.java b/src/main/generated/writely/routines/PgpSymDecrypt2.java new file mode 100644 index 0000000..57346f8 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymDecrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecrypt2() { + super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymDecryptBytea1.java b/src/main/generated/writely/routines/PgpSymDecryptBytea1.java new file mode 100644 index 0000000..71f60b5 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymDecryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecryptBytea1() { + super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymDecryptBytea2.java b/src/main/generated/writely/routines/PgpSymDecryptBytea2.java new file mode 100644 index 0000000..4463c50 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymDecryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecryptBytea2() { + super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymEncrypt1.java b/src/main/generated/writely/routines/PgpSymEncrypt1.java new file mode 100644 index 0000000..b0080eb --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymEncrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncrypt1() { + super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymEncrypt2.java b/src/main/generated/writely/routines/PgpSymEncrypt2.java new file mode 100644 index 0000000..7f08ec5 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymEncrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncrypt2() { + super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymEncryptBytea1.java b/src/main/generated/writely/routines/PgpSymEncryptBytea1.java new file mode 100644 index 0000000..e6b0469 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymEncryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncryptBytea1() { + super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/src/main/generated/writely/routines/PgpSymEncryptBytea2.java b/src/main/generated/writely/routines/PgpSymEncryptBytea2.java new file mode 100644 index 0000000..0070cc0 --- /dev/null +++ b/src/main/generated/writely/routines/PgpSymEncryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writely.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writely.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncryptBytea2() { + super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/src/main/generated/writely/tables/Member.java b/src/main/generated/writely/tables/Member.java new file mode 100644 index 0000000..3c3cb79 --- /dev/null +++ b/src/main/generated/writely/tables/Member.java @@ -0,0 +1,250 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.MemberRecord; + + +/** + * 회원 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Member extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.member + */ + public static final Member MEMBER = new Member(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return MemberRecord.class; + } + + /** + * The column public.member.id. 회원 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "회원 ID"); + + /** + * The column public.member.email. 회원 이메일 + */ + public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255).nullable(false), this, "회원 이메일"); + + /** + * The column public.member.realname. 회원 실명 + */ + public final TableField REALNAME = createField(DSL.name("realname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 실명"); + + /** + * The column public.member.nickname. 회원 닉네임 + */ + public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(50).nullable(false), this, "회원 닉네임"); + + /** + * The column public.member.profile_image. 회원 프로필 이미지 경로 + */ + public final TableField PROFILE_IMAGE = createField(DSL.name("profile_image"), SQLDataType.VARCHAR(255), this, "회원 프로필 이미지 경로"); + + /** + * The column public.member.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.member.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private Member(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private Member(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("회원"), TableOptions.table(), where); + } + + /** + * Create an aliased public.member table reference + */ + public Member(String alias) { + this(DSL.name(alias), MEMBER); + } + + /** + * Create an aliased public.member table reference + */ + public Member(Name alias) { + this(alias, MEMBER); + } + + /** + * Create a public.member table reference + */ + public Member() { + this(DSL.name("member"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.MEMBER_PK; + } + + @Override + public Member as(String alias) { + return new Member(DSL.name(alias), this); + } + + @Override + public Member as(Name alias) { + return new Member(alias, this); + } + + @Override + public Member as(Table alias) { + return new Member(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Member rename(String name) { + return new Member(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Member rename(Name name) { + return new Member(name, null); + } + + /** + * Rename this table + */ + @Override + public Member rename(Table name) { + return new Member(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member where(Condition condition) { + return new Member(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Member where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Member where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Member where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Member where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Member whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/MemberPassword.java b/src/main/generated/writely/tables/MemberPassword.java new file mode 100644 index 0000000..2e71966 --- /dev/null +++ b/src/main/generated/writely/tables/MemberPassword.java @@ -0,0 +1,235 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.MemberPasswordRecord; + + +/** + * 회원_비밀번호 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class MemberPassword extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.member_password + */ + public static final MemberPassword MEMBER_PASSWORD = new MemberPassword(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return MemberPasswordRecord.class; + } + + /** + * The column public.member_password.member_id. 회원 ID + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), SQLDataType.UUID.nullable(false), this, "회원 ID"); + + /** + * The column public.member_password.password. 회원 비밀번호 + */ + public final TableField PASSWORD = createField(DSL.name("password"), SQLDataType.VARCHAR(128).nullable(false), this, "회원 비밀번호"); + + /** + * The column public.member_password.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.member_password.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private MemberPassword(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private MemberPassword(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("회원_비밀번호"), TableOptions.table(), where); + } + + /** + * Create an aliased public.member_password table reference + */ + public MemberPassword(String alias) { + this(DSL.name(alias), MEMBER_PASSWORD); + } + + /** + * Create an aliased public.member_password table reference + */ + public MemberPassword(Name alias) { + this(alias, MEMBER_PASSWORD); + } + + /** + * Create a public.member_password table reference + */ + public MemberPassword() { + this(DSL.name("member_password"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.MEMBER_PASSWORD_PK; + } + + @Override + public MemberPassword as(String alias) { + return new MemberPassword(DSL.name(alias), this); + } + + @Override + public MemberPassword as(Name alias) { + return new MemberPassword(alias, this); + } + + @Override + public MemberPassword as(Table alias) { + return new MemberPassword(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public MemberPassword rename(String name) { + return new MemberPassword(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public MemberPassword rename(Name name) { + return new MemberPassword(name, null); + } + + /** + * Rename this table + */ + @Override + public MemberPassword rename(Table name) { + return new MemberPassword(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword where(Condition condition) { + return new MemberPassword(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public MemberPassword where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public MemberPassword where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public MemberPassword where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public MemberPassword where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public MemberPassword whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/PgpArmorHeaders.java b/src/main/generated/writely/tables/PgpArmorHeaders.java new file mode 100644 index 0000000..f23ab08 --- /dev/null +++ b/src/main/generated/writely/tables/PgpArmorHeaders.java @@ -0,0 +1,157 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Public; +import writely.tables.records.PgpArmorHeadersRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.pgp_armor_headers + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = new PgpArmorHeaders(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return PgpArmorHeadersRecord.class; + } + + /** + * The column public.pgp_armor_headers.key. + */ + public final TableField KEY = createField(DSL.name("key"), SQLDataType.CLOB, this, ""); + + /** + * The column public.pgp_armor_headers.value. + */ + public final TableField VALUE = createField(DSL.name("value"), SQLDataType.CLOB, this, ""); + + private PgpArmorHeaders(Name alias, Table aliased) { + this(alias, aliased, new Field[] { + DSL.val(null, SQLDataType.CLOB) + }); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters) { + this(alias, aliased, parameters, null); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.function(), where); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(String alias) { + this(DSL.name(alias), PGP_ARMOR_HEADERS); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(Name alias) { + this(alias, PGP_ARMOR_HEADERS); + } + + /** + * Create a public.pgp_armor_headers table reference + */ + public PgpArmorHeaders() { + this(DSL.name("pgp_armor_headers"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public PgpArmorHeaders as(String alias) { + return new PgpArmorHeaders(DSL.name(alias), this, parameters); + } + + @Override + public PgpArmorHeaders as(Name alias) { + return new PgpArmorHeaders(alias, this, parameters); + } + + @Override + public PgpArmorHeaders as(Table alias) { + return new PgpArmorHeaders(alias.getQualifiedName(), this, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(String name) { + return new PgpArmorHeaders(DSL.name(name), null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Name name) { + return new PgpArmorHeaders(name, null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Table name) { + return new PgpArmorHeaders(name.getQualifiedName(), null, parameters); + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + String __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + DSL.val(__1, SQLDataType.CLOB) + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + Field __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + __1 + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } +} diff --git a/src/main/generated/writely/tables/Product.java b/src/main/generated/writely/tables/Product.java new file mode 100644 index 0000000..9ddb9cb --- /dev/null +++ b/src/main/generated/writely/tables/Product.java @@ -0,0 +1,250 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductRecord; + + +/** + * 작품 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Product extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product + */ + public static final Product PRODUCT = new Product(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductRecord.class; + } + + /** + * The column public.product.id. 작품 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "작품 ID"); + + /** + * The column public.product.title. 제목 + */ + public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(50), this, "제목"); + + /** + * The column public.product.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); + + /** + * The column public.product.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private Product(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private Product(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product table reference + */ + public Product(String alias) { + this(DSL.name(alias), PRODUCT); + } + + /** + * Create an aliased public.product table reference + */ + public Product(Name alias) { + this(alias, PRODUCT); + } + + /** + * Create a public.product table reference + */ + public Product() { + this(DSL.name("product"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_PK; + } + + @Override + public Product as(String alias) { + return new Product(DSL.name(alias), this); + } + + @Override + public Product as(Name alias) { + return new Product(alias, this); + } + + @Override + public Product as(Table alias) { + return new Product(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Product rename(String name) { + return new Product(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Product rename(Name name) { + return new Product(name, null); + } + + /** + * Rename this table + */ + @Override + public Product rename(Table name) { + return new Product(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product where(Condition condition) { + return new Product(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Product where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Product where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Product where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Product where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Product whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductCharacter.java b/src/main/generated/writely/tables/ProductCharacter.java new file mode 100644 index 0000000..a0078a8 --- /dev/null +++ b/src/main/generated/writely/tables/ProductCharacter.java @@ -0,0 +1,290 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductCharacterRecord; + + +/** + * 작품 등장인물 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCharacter extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_character + */ + public static final ProductCharacter PRODUCT_CHARACTER = new ProductCharacter(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductCharacterRecord.class; + } + + /** + * The column public.product_character.id. 등장인물 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "등장인물 ID"); + + /** + * The column public.product_character.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.product_character.intro. 소개 + */ + public final TableField INTRO = createField(DSL.name("intro"), SQLDataType.CLOB, this, "소개"); + + /** + * The column public.product_character.name. 이름 + */ + public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(50), this, "이름"); + + /** + * The column public.product_character.age. 나이 + */ + public final TableField AGE = createField(DSL.name("age"), SQLDataType.INTEGER, this, "나이"); + + /** + * The column public.product_character.gender. 성별 + */ + public final TableField GENDER = createField(DSL.name("gender"), SQLDataType.VARCHAR(10), this, "성별"); + + /** + * The column public.product_character.occupation. 직업 + */ + public final TableField OCCUPATION = createField(DSL.name("occupation"), SQLDataType.CLOB, this, "직업"); + + /** + * The column public.product_character.appearance. 외모 + */ + public final TableField APPEARANCE = createField(DSL.name("appearance"), SQLDataType.CLOB, this, "외모"); + + /** + * The column public.product_character.personality. 성격 + */ + public final TableField PERSONALITY = createField(DSL.name("personality"), SQLDataType.CLOB, this, "성격"); + + /** + * The column public.product_character.characteristic. 특징 + */ + public final TableField CHARACTERISTIC = createField(DSL.name("characteristic"), SQLDataType.CLOB, this, "특징"); + + /** + * The column public.product_character.relationship. 주요 관계 + */ + public final TableField RELATIONSHIP = createField(DSL.name("relationship"), SQLDataType.CLOB, this, "주요 관계"); + + /** + * The column public.product_character.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_character.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_character.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_character.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductCharacter(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductCharacter(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 등장인물"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_character table reference + */ + public ProductCharacter(String alias) { + this(DSL.name(alias), PRODUCT_CHARACTER); + } + + /** + * Create an aliased public.product_character table reference + */ + public ProductCharacter(Name alias) { + this(alias, PRODUCT_CHARACTER); + } + + /** + * Create a public.product_character table reference + */ + public ProductCharacter() { + this(DSL.name("product_character"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_CHARACTER_PK; + } + + @Override + public ProductCharacter as(String alias) { + return new ProductCharacter(DSL.name(alias), this); + } + + @Override + public ProductCharacter as(Name alias) { + return new ProductCharacter(alias, this); + } + + @Override + public ProductCharacter as(Table alias) { + return new ProductCharacter(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductCharacter rename(String name) { + return new ProductCharacter(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductCharacter rename(Name name) { + return new ProductCharacter(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductCharacter rename(Table name) { + return new ProductCharacter(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter where(Condition condition) { + return new ProductCharacter(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCharacter where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCharacter where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCharacter where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCharacter where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCharacter whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductCustomField.java b/src/main/generated/writely/tables/ProductCustomField.java new file mode 100644 index 0000000..8e7b18b --- /dev/null +++ b/src/main/generated/writely/tables/ProductCustomField.java @@ -0,0 +1,267 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductCustomFieldRecord; + + +/** + * 작품 커스텀 필드 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCustomField extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_custom_field + */ + public static final ProductCustomField PRODUCT_CUSTOM_FIELD = new ProductCustomField(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductCustomFieldRecord.class; + } + + /** + * The column public.product_custom_field.id. 커스텀 필드 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "커스텀 필드 ID"); + + /** + * The column public.product_custom_field.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.product_custom_field.section_code. 섹션 코드 + */ + public final TableField SECTION_CODE = createField(DSL.name("section_code"), SQLDataType.VARCHAR(20).nullable(false), this, "섹션 코드"); + + /** + * The column public.product_custom_field.name. 이름 + */ + public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(30).nullable(false), this, "이름"); + + /** + * The column public.product_custom_field.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); + + /** + * The column public.product_custom_field.seq. 순서 + */ + public final TableField SEQ = createField(DSL.name("seq"), SQLDataType.SMALLINT.nullable(false), this, "순서"); + + /** + * The column public.product_custom_field.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_custom_field.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_custom_field.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_custom_field.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductCustomField(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductCustomField(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 커스텀 필드"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_custom_field table + * reference + */ + public ProductCustomField(String alias) { + this(DSL.name(alias), PRODUCT_CUSTOM_FIELD); + } + + /** + * Create an aliased public.product_custom_field table + * reference + */ + public ProductCustomField(Name alias) { + this(alias, PRODUCT_CUSTOM_FIELD); + } + + /** + * Create a public.product_custom_field table reference + */ + public ProductCustomField() { + this(DSL.name("product_custom_field"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_CUSTOM_FIELD_PK; + } + + @Override + public ProductCustomField as(String alias) { + return new ProductCustomField(DSL.name(alias), this); + } + + @Override + public ProductCustomField as(Name alias) { + return new ProductCustomField(alias, this); + } + + @Override + public ProductCustomField as(Table alias) { + return new ProductCustomField(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductCustomField rename(String name) { + return new ProductCustomField(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductCustomField rename(Name name) { + return new ProductCustomField(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductCustomField rename(Table name) { + return new ProductCustomField(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField where(Condition condition) { + return new ProductCustomField(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCustomField where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCustomField where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCustomField where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductCustomField where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductCustomField whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductIdeanote.java b/src/main/generated/writely/tables/ProductIdeanote.java new file mode 100644 index 0000000..45643fc --- /dev/null +++ b/src/main/generated/writely/tables/ProductIdeanote.java @@ -0,0 +1,250 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductIdeanoteRecord; + + +/** + * 작품 아이디어 노트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductIdeanote extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_ideanote + */ + public static final ProductIdeanote PRODUCT_IDEANOTE = new ProductIdeanote(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductIdeanoteRecord.class; + } + + /** + * The column public.product_ideanote.id. 아이디어 노트 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "아이디어 노트 ID"); + + /** + * The column public.product_ideanote.title. 제목 + */ + public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(100).nullable(false), this, "제목"); + + /** + * The column public.product_ideanote.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); + + /** + * The column public.product_ideanote.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_ideanote.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_ideanote.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_ideanote.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductIdeanote(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductIdeanote(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 아이디어 노트"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_ideanote table reference + */ + public ProductIdeanote(String alias) { + this(DSL.name(alias), PRODUCT_IDEANOTE); + } + + /** + * Create an aliased public.product_ideanote table reference + */ + public ProductIdeanote(Name alias) { + this(alias, PRODUCT_IDEANOTE); + } + + /** + * Create a public.product_ideanote table reference + */ + public ProductIdeanote() { + this(DSL.name("product_ideanote"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_IDEANOTE_PK; + } + + @Override + public ProductIdeanote as(String alias) { + return new ProductIdeanote(DSL.name(alias), this); + } + + @Override + public ProductIdeanote as(Name alias) { + return new ProductIdeanote(alias, this); + } + + @Override + public ProductIdeanote as(Table alias) { + return new ProductIdeanote(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductIdeanote rename(String name) { + return new ProductIdeanote(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductIdeanote rename(Name name) { + return new ProductIdeanote(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductIdeanote rename(Table name) { + return new ProductIdeanote(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote where(Condition condition) { + return new ProductIdeanote(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductIdeanote where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductIdeanote where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductIdeanote where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductIdeanote where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductIdeanote whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductMemo.java b/src/main/generated/writely/tables/ProductMemo.java new file mode 100644 index 0000000..97f233d --- /dev/null +++ b/src/main/generated/writely/tables/ProductMemo.java @@ -0,0 +1,250 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductMemoRecord; + + +/** + * 작품 메모 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductMemo extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_memo + */ + public static final ProductMemo PRODUCT_MEMO = new ProductMemo(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductMemoRecord.class; + } + + /** + * The column public.product_memo.id. 메모 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "메모 ID"); + + /** + * The column public.product_memo.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.product_memo.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); + + /** + * The column public.product_memo.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_memo.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_memo.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_memo.updated_by. 수정일시 + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정일시"); + + private ProductMemo(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductMemo(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 메모"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_memo table reference + */ + public ProductMemo(String alias) { + this(DSL.name(alias), PRODUCT_MEMO); + } + + /** + * Create an aliased public.product_memo table reference + */ + public ProductMemo(Name alias) { + this(alias, PRODUCT_MEMO); + } + + /** + * Create a public.product_memo table reference + */ + public ProductMemo() { + this(DSL.name("product_memo"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_MEMO_PK; + } + + @Override + public ProductMemo as(String alias) { + return new ProductMemo(DSL.name(alias), this); + } + + @Override + public ProductMemo as(Name alias) { + return new ProductMemo(alias, this); + } + + @Override + public ProductMemo as(Table alias) { + return new ProductMemo(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductMemo rename(String name) { + return new ProductMemo(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductMemo rename(Name name) { + return new ProductMemo(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductMemo rename(Table name) { + return new ProductMemo(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo where(Condition condition) { + return new ProductMemo(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductMemo where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductMemo where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductMemo where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductMemo where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductMemo whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductPlot.java b/src/main/generated/writely/tables/ProductPlot.java new file mode 100644 index 0000000..ddd27fa --- /dev/null +++ b/src/main/generated/writely/tables/ProductPlot.java @@ -0,0 +1,260 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductPlotRecord; + + +/** + * 작품 줄거리 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductPlot extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_plot + */ + public static final ProductPlot PRODUCT_PLOT = new ProductPlot(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductPlotRecord.class; + } + + /** + * The column public.product_plot.id. 줄거리 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "줄거리 ID"); + + /** + * The column public.product_plot.exposition. 발단 + */ + public final TableField EXPOSITION = createField(DSL.name("exposition"), SQLDataType.CLOB, this, "발단"); + + /** + * The column public.product_plot.complication. 전개 + */ + public final TableField COMPLICATION = createField(DSL.name("complication"), SQLDataType.CLOB, this, "전개"); + + /** + * The column public.product_plot.climax. 결말 + */ + public final TableField CLIMAX = createField(DSL.name("climax"), SQLDataType.CLOB, this, "결말"); + + /** + * The column public.product_plot.resolution. + */ + public final TableField RESOLUTION = createField(DSL.name("resolution"), SQLDataType.CLOB, this, ""); + + /** + * The column public.product_plot.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_plot.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_plot.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_plot.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductPlot(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductPlot(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 줄거리"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_plot table reference + */ + public ProductPlot(String alias) { + this(DSL.name(alias), PRODUCT_PLOT); + } + + /** + * Create an aliased public.product_plot table reference + */ + public ProductPlot(Name alias) { + this(alias, PRODUCT_PLOT); + } + + /** + * Create a public.product_plot table reference + */ + public ProductPlot() { + this(DSL.name("product_plot"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_PLOT_PK; + } + + @Override + public ProductPlot as(String alias) { + return new ProductPlot(DSL.name(alias), this); + } + + @Override + public ProductPlot as(Name alias) { + return new ProductPlot(alias, this); + } + + @Override + public ProductPlot as(Table alias) { + return new ProductPlot(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductPlot rename(String name) { + return new ProductPlot(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductPlot rename(Name name) { + return new ProductPlot(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductPlot rename(Table name) { + return new ProductPlot(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot where(Condition condition) { + return new ProductPlot(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductPlot where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductPlot where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductPlot where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductPlot where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductPlot whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductSynopsis.java b/src/main/generated/writely/tables/ProductSynopsis.java new file mode 100644 index 0000000..93195de --- /dev/null +++ b/src/main/generated/writely/tables/ProductSynopsis.java @@ -0,0 +1,265 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductSynopsisRecord; + + +/** + * 작품 시놉시스 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductSynopsis extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_synopsis + */ + public static final ProductSynopsis PRODUCT_SYNOPSIS = new ProductSynopsis(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductSynopsisRecord.class; + } + + /** + * The column public.product_synopsis.id. 시놉시스 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "시놉시스 ID"); + + /** + * The column public.product_synopsis.genre. 장르 + */ + public final TableField GENRE = createField(DSL.name("genre"), SQLDataType.VARCHAR(30).nullable(false), this, "장르"); + + /** + * The column public.product_synopsis.length. 분량 + */ + public final TableField LENGTH = createField(DSL.name("length"), SQLDataType.VARCHAR(100), this, "분량"); + + /** + * The column public.product_synopsis.purpose. 기획 의도 + */ + public final TableField PURPOSE = createField(DSL.name("purpose"), SQLDataType.CLOB, this, "기획 의도"); + + /** + * The column public.product_synopsis.logline. 로그라인 + */ + public final TableField LOGLINE = createField(DSL.name("logline"), SQLDataType.CLOB.nullable(false), this, "로그라인"); + + /** + * The column public.product_synopsis.example. 예시 문장 + */ + public final TableField EXAMPLE = createField(DSL.name("example"), SQLDataType.CLOB, this, "예시 문장"); + + /** + * The column public.product_synopsis.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_synopsis.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_synopsis.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_synopsis.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductSynopsis(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductSynopsis(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 시놉시스"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_synopsis table reference + */ + public ProductSynopsis(String alias) { + this(DSL.name(alias), PRODUCT_SYNOPSIS); + } + + /** + * Create an aliased public.product_synopsis table reference + */ + public ProductSynopsis(Name alias) { + this(alias, PRODUCT_SYNOPSIS); + } + + /** + * Create a public.product_synopsis table reference + */ + public ProductSynopsis() { + this(DSL.name("product_synopsis"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_SYNOPSIS_PK; + } + + @Override + public ProductSynopsis as(String alias) { + return new ProductSynopsis(DSL.name(alias), this); + } + + @Override + public ProductSynopsis as(Name alias) { + return new ProductSynopsis(alias, this); + } + + @Override + public ProductSynopsis as(Table alias) { + return new ProductSynopsis(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductSynopsis rename(String name) { + return new ProductSynopsis(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductSynopsis rename(Name name) { + return new ProductSynopsis(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductSynopsis rename(Table name) { + return new ProductSynopsis(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis where(Condition condition) { + return new ProductSynopsis(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductSynopsis where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductSynopsis where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductSynopsis where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductSynopsis where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductSynopsis whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductWorldview.java b/src/main/generated/writely/tables/ProductWorldview.java new file mode 100644 index 0000000..17f2729 --- /dev/null +++ b/src/main/generated/writely/tables/ProductWorldview.java @@ -0,0 +1,305 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ProductWorldviewRecord; + + +/** + * 작품 세계관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductWorldview extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_worldview + */ + public static final ProductWorldview PRODUCT_WORLDVIEW = new ProductWorldview(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductWorldviewRecord.class; + } + + /** + * The column public.product_worldview.id. 세계관 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "세계관 ID"); + + /** + * The column public.product_worldview.geography. 지리 + */ + public final TableField GEOGRAPHY = createField(DSL.name("geography"), SQLDataType.CLOB, this, "지리"); + + /** + * The column public.product_worldview.history. 역사 + */ + public final TableField HISTORY = createField(DSL.name("history"), SQLDataType.CLOB, this, "역사"); + + /** + * The column public.product_worldview.politics. 정치 + */ + public final TableField POLITICS = createField(DSL.name("politics"), SQLDataType.CLOB, this, "정치"); + + /** + * The column public.product_worldview.society. 사회 + */ + public final TableField SOCIETY = createField(DSL.name("society"), SQLDataType.CLOB, this, "사회"); + + /** + * The column public.product_worldview.religion. 종교 + */ + public final TableField RELIGION = createField(DSL.name("religion"), SQLDataType.CLOB, this, "종교"); + + /** + * The column public.product_worldview.economy. 경제 + */ + public final TableField ECONOMY = createField(DSL.name("economy"), SQLDataType.CLOB, this, "경제"); + + /** + * The column public.product_worldview.technology. 기술 + */ + public final TableField TECHNOLOGY = createField(DSL.name("technology"), SQLDataType.CLOB, this, "기술"); + + /** + * The column public.product_worldview.lifestyle. 생활 + */ + public final TableField LIFESTYLE = createField(DSL.name("lifestyle"), SQLDataType.CLOB, this, "생활"); + + /** + * The column public.product_worldview.language. 언어 + */ + public final TableField LANGUAGE = createField(DSL.name("language"), SQLDataType.CLOB, this, "언어"); + + /** + * The column public.product_worldview.culture. 문화 + */ + public final TableField CULTURE = createField(DSL.name("culture"), SQLDataType.CLOB, this, "문화"); + + /** + * The column public.product_worldview.species. 종족 + */ + public final TableField SPECIES = createField(DSL.name("species"), SQLDataType.CLOB, this, "종족"); + + /** + * The column public.product_worldview.occupation. 직업 + */ + public final TableField OCCUPATION = createField(DSL.name("occupation"), SQLDataType.CLOB, this, "직업"); + + /** + * The column public.product_worldview.conflict. 갈등 관계 + */ + public final TableField CONFLICT = createField(DSL.name("conflict"), SQLDataType.CLOB, this, "갈등 관계"); + + /** + * The column public.product_worldview.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.product_worldview.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.product_worldview.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.product_worldview.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ProductWorldview(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductWorldview(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("작품 세계관"), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_worldview table reference + */ + public ProductWorldview(String alias) { + this(DSL.name(alias), PRODUCT_WORLDVIEW); + } + + /** + * Create an aliased public.product_worldview table reference + */ + public ProductWorldview(Name alias) { + this(alias, PRODUCT_WORLDVIEW); + } + + /** + * Create a public.product_worldview table reference + */ + public ProductWorldview() { + this(DSL.name("product_worldview"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_WORLDVIEW_PK; + } + + @Override + public ProductWorldview as(String alias) { + return new ProductWorldview(DSL.name(alias), this); + } + + @Override + public ProductWorldview as(Name alias) { + return new ProductWorldview(alias, this); + } + + @Override + public ProductWorldview as(Table alias) { + return new ProductWorldview(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductWorldview rename(String name) { + return new ProductWorldview(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductWorldview rename(Name name) { + return new ProductWorldview(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductWorldview rename(Table name) { + return new ProductWorldview(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview where(Condition condition) { + return new ProductWorldview(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductWorldview where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductWorldview where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductWorldview where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductWorldview where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductWorldview whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/pojos/Member.java b/src/main/generated/writely/tables/pojos/Member.java new file mode 100644 index 0000000..c745c91 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/Member.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.OffsetDateTime; +import java.util.UUID; + + +/** + * 회원 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Member implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String email; + private final String realname; + private final String nickname; + private final String profileImage; + private final OffsetDateTime createdAt; + private final OffsetDateTime updatedAt; + + public Member(Member value) { + this.id = value.id; + this.email = value.email; + this.realname = value.realname; + this.nickname = value.nickname; + this.profileImage = value.profileImage; + this.createdAt = value.createdAt; + this.updatedAt = value.updatedAt; + } + + public Member( + UUID id, + String email, + String realname, + String nickname, + String profileImage, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.id = id; + this.email = email; + this.realname = realname; + this.nickname = nickname; + this.profileImage = profileImage; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Getter for public.member.id. 회원 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.member.email. 회원 이메일 + */ + public String getEmail() { + return this.email; + } + + /** + * Getter for public.member.realname. 회원 실명 + */ + public String getRealname() { + return this.realname; + } + + /** + * Getter for public.member.nickname. 회원 닉네임 + */ + public String getNickname() { + return this.nickname; + } + + /** + * Getter for public.member.profile_image. 회원 프로필 이미지 경로 + */ + public String getProfileImage() { + return this.profileImage; + } + + /** + * Getter for public.member.created_at. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.member.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Member other = (Member) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.email == null) { + if (other.email != null) + return false; + } + else if (!this.email.equals(other.email)) + return false; + if (this.realname == null) { + if (other.realname != null) + return false; + } + else if (!this.realname.equals(other.realname)) + return false; + if (this.nickname == null) { + if (other.nickname != null) + return false; + } + else if (!this.nickname.equals(other.nickname)) + return false; + if (this.profileImage == null) { + if (other.profileImage != null) + return false; + } + else if (!this.profileImage.equals(other.profileImage)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.email == null) ? 0 : this.email.hashCode()); + result = prime * result + ((this.realname == null) ? 0 : this.realname.hashCode()); + result = prime * result + ((this.nickname == null) ? 0 : this.nickname.hashCode()); + result = prime * result + ((this.profileImage == null) ? 0 : this.profileImage.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Member ("); + + sb.append(id); + sb.append(", ").append(email); + sb.append(", ").append(realname); + sb.append(", ").append(nickname); + sb.append(", ").append(profileImage); + sb.append(", ").append(createdAt); + sb.append(", ").append(updatedAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/MemberPassword.java b/src/main/generated/writely/tables/pojos/MemberPassword.java new file mode 100644 index 0000000..200356c --- /dev/null +++ b/src/main/generated/writely/tables/pojos/MemberPassword.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.OffsetDateTime; +import java.util.UUID; + + +/** + * 회원_비밀번호 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class MemberPassword implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID memberId; + private final String password; + private final OffsetDateTime createdAt; + private final OffsetDateTime updatedAt; + + public MemberPassword(MemberPassword value) { + this.memberId = value.memberId; + this.password = value.password; + this.createdAt = value.createdAt; + this.updatedAt = value.updatedAt; + } + + public MemberPassword( + UUID memberId, + String password, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.memberId = memberId; + this.password = password; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Getter for public.member_password.member_id. 회원 ID + */ + public UUID getMemberId() { + return this.memberId; + } + + /** + * Getter for public.member_password.password. 회원 비밀번호 + */ + public String getPassword() { + return this.password; + } + + /** + * Getter for public.member_password.created_at. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.member_password.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final MemberPassword other = (MemberPassword) obj; + if (this.memberId == null) { + if (other.memberId != null) + return false; + } + else if (!this.memberId.equals(other.memberId)) + return false; + if (this.password == null) { + if (other.password != null) + return false; + } + else if (!this.password.equals(other.password)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.memberId == null) ? 0 : this.memberId.hashCode()); + result = prime * result + ((this.password == null) ? 0 : this.password.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("MemberPassword ("); + + sb.append(memberId); + sb.append(", ").append(password); + sb.append(", ").append(createdAt); + sb.append(", ").append(updatedAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java b/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java new file mode 100644 index 0000000..f38b12e --- /dev/null +++ b/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java @@ -0,0 +1,91 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String key; + private final String value; + + public PgpArmorHeaders(PgpArmorHeaders value) { + this.key = value.key; + this.value = value.value; + } + + public PgpArmorHeaders( + String key, + String value + ) { + this.key = key; + this.value = value; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return this.key; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return this.value; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final PgpArmorHeaders other = (PgpArmorHeaders) obj; + if (this.key == null) { + if (other.key != null) + return false; + } + else if (!this.key.equals(other.key)) + return false; + if (this.value == null) { + if (other.value != null) + return false; + } + else if (!this.value.equals(other.value)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); + result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PgpArmorHeaders ("); + + sb.append(key); + sb.append(", ").append(value); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/Product.java b/src/main/generated/writely/tables/pojos/Product.java new file mode 100644 index 0000000..a3c9520 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/Product.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Product implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String title; + private final String content; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public Product(Product value) { + this.id = value.id; + this.title = value.title; + this.content = value.content; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public Product( + UUID id, + String title, + String content, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.title = title; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product.id. 작품 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product.title. 제목 + */ + public String getTitle() { + return this.title; + } + + /** + * Getter for public.product.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.product.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Product other = (Product) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.title == null) { + if (other.title != null) + return false; + } + else if (!this.title.equals(other.title)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Product ("); + + sb.append(id); + sb.append(", ").append(title); + sb.append(", ").append(content); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductCharacter.java b/src/main/generated/writely/tables/pojos/ProductCharacter.java new file mode 100644 index 0000000..dca8979 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductCharacter.java @@ -0,0 +1,340 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 등장인물 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCharacter implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String intro; + private final String name; + private final Integer age; + private final String gender; + private final String occupation; + private final String appearance; + private final String personality; + private final String characteristic; + private final String relationship; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductCharacter(ProductCharacter value) { + this.id = value.id; + this.productId = value.productId; + this.intro = value.intro; + this.name = value.name; + this.age = value.age; + this.gender = value.gender; + this.occupation = value.occupation; + this.appearance = value.appearance; + this.personality = value.personality; + this.characteristic = value.characteristic; + this.relationship = value.relationship; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductCharacter( + UUID id, + UUID productId, + String intro, + String name, + Integer age, + String gender, + String occupation, + String appearance, + String personality, + String characteristic, + String relationship, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.intro = intro; + this.name = name; + this.age = age; + this.gender = gender; + this.occupation = occupation; + this.appearance = appearance; + this.personality = personality; + this.characteristic = characteristic; + this.relationship = relationship; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_character.id. 등장인물 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_character.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.product_character.intro. 소개 + */ + public String getIntro() { + return this.intro; + } + + /** + * Getter for public.product_character.name. 이름 + */ + public String getName() { + return this.name; + } + + /** + * Getter for public.product_character.age. 나이 + */ + public Integer getAge() { + return this.age; + } + + /** + * Getter for public.product_character.gender. 성별 + */ + public String getGender() { + return this.gender; + } + + /** + * Getter for public.product_character.occupation. 직업 + */ + public String getOccupation() { + return this.occupation; + } + + /** + * Getter for public.product_character.appearance. 외모 + */ + public String getAppearance() { + return this.appearance; + } + + /** + * Getter for public.product_character.personality. 성격 + */ + public String getPersonality() { + return this.personality; + } + + /** + * Getter for public.product_character.characteristic. 특징 + */ + public String getCharacteristic() { + return this.characteristic; + } + + /** + * Getter for public.product_character.relationship. 주요 관계 + */ + public String getRelationship() { + return this.relationship; + } + + /** + * Getter for public.product_character.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_character.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_character.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_character.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductCharacter other = (ProductCharacter) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.intro == null) { + if (other.intro != null) + return false; + } + else if (!this.intro.equals(other.intro)) + return false; + if (this.name == null) { + if (other.name != null) + return false; + } + else if (!this.name.equals(other.name)) + return false; + if (this.age == null) { + if (other.age != null) + return false; + } + else if (!this.age.equals(other.age)) + return false; + if (this.gender == null) { + if (other.gender != null) + return false; + } + else if (!this.gender.equals(other.gender)) + return false; + if (this.occupation == null) { + if (other.occupation != null) + return false; + } + else if (!this.occupation.equals(other.occupation)) + return false; + if (this.appearance == null) { + if (other.appearance != null) + return false; + } + else if (!this.appearance.equals(other.appearance)) + return false; + if (this.personality == null) { + if (other.personality != null) + return false; + } + else if (!this.personality.equals(other.personality)) + return false; + if (this.characteristic == null) { + if (other.characteristic != null) + return false; + } + else if (!this.characteristic.equals(other.characteristic)) + return false; + if (this.relationship == null) { + if (other.relationship != null) + return false; + } + else if (!this.relationship.equals(other.relationship)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.intro == null) ? 0 : this.intro.hashCode()); + result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.age == null) ? 0 : this.age.hashCode()); + result = prime * result + ((this.gender == null) ? 0 : this.gender.hashCode()); + result = prime * result + ((this.occupation == null) ? 0 : this.occupation.hashCode()); + result = prime * result + ((this.appearance == null) ? 0 : this.appearance.hashCode()); + result = prime * result + ((this.personality == null) ? 0 : this.personality.hashCode()); + result = prime * result + ((this.characteristic == null) ? 0 : this.characteristic.hashCode()); + result = prime * result + ((this.relationship == null) ? 0 : this.relationship.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductCharacter ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(intro); + sb.append(", ").append(name); + sb.append(", ").append(age); + sb.append(", ").append(gender); + sb.append(", ").append(occupation); + sb.append(", ").append(appearance); + sb.append(", ").append(personality); + sb.append(", ").append(characteristic); + sb.append(", ").append(relationship); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductCustomField.java b/src/main/generated/writely/tables/pojos/ProductCustomField.java new file mode 100644 index 0000000..a749a04 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductCustomField.java @@ -0,0 +1,245 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 커스텀 필드 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCustomField implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String sectionCode; + private final String name; + private final String content; + private final Short seq; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductCustomField(ProductCustomField value) { + this.id = value.id; + this.productId = value.productId; + this.sectionCode = value.sectionCode; + this.name = value.name; + this.content = value.content; + this.seq = value.seq; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductCustomField( + UUID id, + UUID productId, + String sectionCode, + String name, + String content, + Short seq, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.sectionCode = sectionCode; + this.name = name; + this.content = content; + this.seq = seq; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_custom_field.id. 커스텀 필드 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_custom_field.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.product_custom_field.section_code. 섹션 코드 + */ + public String getSectionCode() { + return this.sectionCode; + } + + /** + * Getter for public.product_custom_field.name. 이름 + */ + public String getName() { + return this.name; + } + + /** + * Getter for public.product_custom_field.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.product_custom_field.seq. 순서 + */ + public Short getSeq() { + return this.seq; + } + + /** + * Getter for public.product_custom_field.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_custom_field.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_custom_field.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_custom_field.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductCustomField other = (ProductCustomField) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.sectionCode == null) { + if (other.sectionCode != null) + return false; + } + else if (!this.sectionCode.equals(other.sectionCode)) + return false; + if (this.name == null) { + if (other.name != null) + return false; + } + else if (!this.name.equals(other.name)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.seq == null) { + if (other.seq != null) + return false; + } + else if (!this.seq.equals(other.seq)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.sectionCode == null) ? 0 : this.sectionCode.hashCode()); + result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.seq == null) ? 0 : this.seq.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductCustomField ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(sectionCode); + sb.append(", ").append(name); + sb.append(", ").append(content); + sb.append(", ").append(seq); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductIdeanote.java b/src/main/generated/writely/tables/pojos/ProductIdeanote.java new file mode 100644 index 0000000..063eaa1 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductIdeanote.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 아이디어 노트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductIdeanote implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String title; + private final String content; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductIdeanote(ProductIdeanote value) { + this.id = value.id; + this.title = value.title; + this.content = value.content; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductIdeanote( + UUID id, + String title, + String content, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.title = title; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_ideanote.id. 아이디어 노트 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_ideanote.title. 제목 + */ + public String getTitle() { + return this.title; + } + + /** + * Getter for public.product_ideanote.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.product_ideanote.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_ideanote.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_ideanote.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_ideanote.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductIdeanote other = (ProductIdeanote) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.title == null) { + if (other.title != null) + return false; + } + else if (!this.title.equals(other.title)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductIdeanote ("); + + sb.append(id); + sb.append(", ").append(title); + sb.append(", ").append(content); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductMemo.java b/src/main/generated/writely/tables/pojos/ProductMemo.java new file mode 100644 index 0000000..2e750f5 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductMemo.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 메모 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductMemo implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String content; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductMemo(ProductMemo value) { + this.id = value.id; + this.productId = value.productId; + this.content = value.content; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductMemo( + UUID id, + UUID productId, + String content, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_memo.id. 메모 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_memo.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.product_memo.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.product_memo.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_memo.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_memo.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_memo.updated_by. 수정일시 + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductMemo other = (ProductMemo) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductMemo ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(content); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductPlot.java b/src/main/generated/writely/tables/pojos/ProductPlot.java new file mode 100644 index 0000000..d2455f3 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductPlot.java @@ -0,0 +1,226 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 줄거리 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductPlot implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String exposition; + private final String complication; + private final String climax; + private final String resolution; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductPlot(ProductPlot value) { + this.id = value.id; + this.exposition = value.exposition; + this.complication = value.complication; + this.climax = value.climax; + this.resolution = value.resolution; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductPlot( + UUID id, + String exposition, + String complication, + String climax, + String resolution, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.exposition = exposition; + this.complication = complication; + this.climax = climax; + this.resolution = resolution; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_plot.id. 줄거리 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_plot.exposition. 발단 + */ + public String getExposition() { + return this.exposition; + } + + /** + * Getter for public.product_plot.complication. 전개 + */ + public String getComplication() { + return this.complication; + } + + /** + * Getter for public.product_plot.climax. 결말 + */ + public String getClimax() { + return this.climax; + } + + /** + * Getter for public.product_plot.resolution. + */ + public String getResolution() { + return this.resolution; + } + + /** + * Getter for public.product_plot.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_plot.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_plot.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_plot.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductPlot other = (ProductPlot) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.exposition == null) { + if (other.exposition != null) + return false; + } + else if (!this.exposition.equals(other.exposition)) + return false; + if (this.complication == null) { + if (other.complication != null) + return false; + } + else if (!this.complication.equals(other.complication)) + return false; + if (this.climax == null) { + if (other.climax != null) + return false; + } + else if (!this.climax.equals(other.climax)) + return false; + if (this.resolution == null) { + if (other.resolution != null) + return false; + } + else if (!this.resolution.equals(other.resolution)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.exposition == null) ? 0 : this.exposition.hashCode()); + result = prime * result + ((this.complication == null) ? 0 : this.complication.hashCode()); + result = prime * result + ((this.climax == null) ? 0 : this.climax.hashCode()); + result = prime * result + ((this.resolution == null) ? 0 : this.resolution.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductPlot ("); + + sb.append(id); + sb.append(", ").append(exposition); + sb.append(", ").append(complication); + sb.append(", ").append(climax); + sb.append(", ").append(resolution); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductSynopsis.java b/src/main/generated/writely/tables/pojos/ProductSynopsis.java new file mode 100644 index 0000000..2d6e5b8 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductSynopsis.java @@ -0,0 +1,245 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 시놉시스 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductSynopsis implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String genre; + private final String length; + private final String purpose; + private final String logline; + private final String example; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductSynopsis(ProductSynopsis value) { + this.id = value.id; + this.genre = value.genre; + this.length = value.length; + this.purpose = value.purpose; + this.logline = value.logline; + this.example = value.example; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductSynopsis( + UUID id, + String genre, + String length, + String purpose, + String logline, + String example, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.genre = genre; + this.length = length; + this.purpose = purpose; + this.logline = logline; + this.example = example; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_synopsis.id. 시놉시스 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_synopsis.genre. 장르 + */ + public String getGenre() { + return this.genre; + } + + /** + * Getter for public.product_synopsis.length. 분량 + */ + public String getLength() { + return this.length; + } + + /** + * Getter for public.product_synopsis.purpose. 기획 의도 + */ + public String getPurpose() { + return this.purpose; + } + + /** + * Getter for public.product_synopsis.logline. 로그라인 + */ + public String getLogline() { + return this.logline; + } + + /** + * Getter for public.product_synopsis.example. 예시 문장 + */ + public String getExample() { + return this.example; + } + + /** + * Getter for public.product_synopsis.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_synopsis.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_synopsis.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_synopsis.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductSynopsis other = (ProductSynopsis) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.genre == null) { + if (other.genre != null) + return false; + } + else if (!this.genre.equals(other.genre)) + return false; + if (this.length == null) { + if (other.length != null) + return false; + } + else if (!this.length.equals(other.length)) + return false; + if (this.purpose == null) { + if (other.purpose != null) + return false; + } + else if (!this.purpose.equals(other.purpose)) + return false; + if (this.logline == null) { + if (other.logline != null) + return false; + } + else if (!this.logline.equals(other.logline)) + return false; + if (this.example == null) { + if (other.example != null) + return false; + } + else if (!this.example.equals(other.example)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.genre == null) ? 0 : this.genre.hashCode()); + result = prime * result + ((this.length == null) ? 0 : this.length.hashCode()); + result = prime * result + ((this.purpose == null) ? 0 : this.purpose.hashCode()); + result = prime * result + ((this.logline == null) ? 0 : this.logline.hashCode()); + result = prime * result + ((this.example == null) ? 0 : this.example.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductSynopsis ("); + + sb.append(id); + sb.append(", ").append(genre); + sb.append(", ").append(length); + sb.append(", ").append(purpose); + sb.append(", ").append(logline); + sb.append(", ").append(example); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductWorldview.java b/src/main/generated/writely/tables/pojos/ProductWorldview.java new file mode 100644 index 0000000..bd07800 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/ProductWorldview.java @@ -0,0 +1,397 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 작품 세계관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductWorldview implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String geography; + private final String history; + private final String politics; + private final String society; + private final String religion; + private final String economy; + private final String technology; + private final String lifestyle; + private final String language; + private final String culture; + private final String species; + private final String occupation; + private final String conflict; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ProductWorldview(ProductWorldview value) { + this.id = value.id; + this.geography = value.geography; + this.history = value.history; + this.politics = value.politics; + this.society = value.society; + this.religion = value.religion; + this.economy = value.economy; + this.technology = value.technology; + this.lifestyle = value.lifestyle; + this.language = value.language; + this.culture = value.culture; + this.species = value.species; + this.occupation = value.occupation; + this.conflict = value.conflict; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ProductWorldview( + UUID id, + String geography, + String history, + String politics, + String society, + String religion, + String economy, + String technology, + String lifestyle, + String language, + String culture, + String species, + String occupation, + String conflict, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.geography = geography; + this.history = history; + this.politics = politics; + this.society = society; + this.religion = religion; + this.economy = economy; + this.technology = technology; + this.lifestyle = lifestyle; + this.language = language; + this.culture = culture; + this.species = species; + this.occupation = occupation; + this.conflict = conflict; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.product_worldview.id. 세계관 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_worldview.geography. 지리 + */ + public String getGeography() { + return this.geography; + } + + /** + * Getter for public.product_worldview.history. 역사 + */ + public String getHistory() { + return this.history; + } + + /** + * Getter for public.product_worldview.politics. 정치 + */ + public String getPolitics() { + return this.politics; + } + + /** + * Getter for public.product_worldview.society. 사회 + */ + public String getSociety() { + return this.society; + } + + /** + * Getter for public.product_worldview.religion. 종교 + */ + public String getReligion() { + return this.religion; + } + + /** + * Getter for public.product_worldview.economy. 경제 + */ + public String getEconomy() { + return this.economy; + } + + /** + * Getter for public.product_worldview.technology. 기술 + */ + public String getTechnology() { + return this.technology; + } + + /** + * Getter for public.product_worldview.lifestyle. 생활 + */ + public String getLifestyle() { + return this.lifestyle; + } + + /** + * Getter for public.product_worldview.language. 언어 + */ + public String getLanguage() { + return this.language; + } + + /** + * Getter for public.product_worldview.culture. 문화 + */ + public String getCulture() { + return this.culture; + } + + /** + * Getter for public.product_worldview.species. 종족 + */ + public String getSpecies() { + return this.species; + } + + /** + * Getter for public.product_worldview.occupation. 직업 + */ + public String getOccupation() { + return this.occupation; + } + + /** + * Getter for public.product_worldview.conflict. 갈등 관계 + */ + public String getConflict() { + return this.conflict; + } + + /** + * Getter for public.product_worldview.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.product_worldview.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.product_worldview.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.product_worldview.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductWorldview other = (ProductWorldview) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.geography == null) { + if (other.geography != null) + return false; + } + else if (!this.geography.equals(other.geography)) + return false; + if (this.history == null) { + if (other.history != null) + return false; + } + else if (!this.history.equals(other.history)) + return false; + if (this.politics == null) { + if (other.politics != null) + return false; + } + else if (!this.politics.equals(other.politics)) + return false; + if (this.society == null) { + if (other.society != null) + return false; + } + else if (!this.society.equals(other.society)) + return false; + if (this.religion == null) { + if (other.religion != null) + return false; + } + else if (!this.religion.equals(other.religion)) + return false; + if (this.economy == null) { + if (other.economy != null) + return false; + } + else if (!this.economy.equals(other.economy)) + return false; + if (this.technology == null) { + if (other.technology != null) + return false; + } + else if (!this.technology.equals(other.technology)) + return false; + if (this.lifestyle == null) { + if (other.lifestyle != null) + return false; + } + else if (!this.lifestyle.equals(other.lifestyle)) + return false; + if (this.language == null) { + if (other.language != null) + return false; + } + else if (!this.language.equals(other.language)) + return false; + if (this.culture == null) { + if (other.culture != null) + return false; + } + else if (!this.culture.equals(other.culture)) + return false; + if (this.species == null) { + if (other.species != null) + return false; + } + else if (!this.species.equals(other.species)) + return false; + if (this.occupation == null) { + if (other.occupation != null) + return false; + } + else if (!this.occupation.equals(other.occupation)) + return false; + if (this.conflict == null) { + if (other.conflict != null) + return false; + } + else if (!this.conflict.equals(other.conflict)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.geography == null) ? 0 : this.geography.hashCode()); + result = prime * result + ((this.history == null) ? 0 : this.history.hashCode()); + result = prime * result + ((this.politics == null) ? 0 : this.politics.hashCode()); + result = prime * result + ((this.society == null) ? 0 : this.society.hashCode()); + result = prime * result + ((this.religion == null) ? 0 : this.religion.hashCode()); + result = prime * result + ((this.economy == null) ? 0 : this.economy.hashCode()); + result = prime * result + ((this.technology == null) ? 0 : this.technology.hashCode()); + result = prime * result + ((this.lifestyle == null) ? 0 : this.lifestyle.hashCode()); + result = prime * result + ((this.language == null) ? 0 : this.language.hashCode()); + result = prime * result + ((this.culture == null) ? 0 : this.culture.hashCode()); + result = prime * result + ((this.species == null) ? 0 : this.species.hashCode()); + result = prime * result + ((this.occupation == null) ? 0 : this.occupation.hashCode()); + result = prime * result + ((this.conflict == null) ? 0 : this.conflict.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductWorldview ("); + + sb.append(id); + sb.append(", ").append(geography); + sb.append(", ").append(history); + sb.append(", ").append(politics); + sb.append(", ").append(society); + sb.append(", ").append(religion); + sb.append(", ").append(economy); + sb.append(", ").append(technology); + sb.append(", ").append(lifestyle); + sb.append(", ").append(language); + sb.append(", ").append(culture); + sb.append(", ").append(species); + sb.append(", ").append(occupation); + sb.append(", ").append(conflict); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/records/MemberPasswordRecord.java b/src/main/generated/writely/tables/records/MemberPasswordRecord.java new file mode 100644 index 0000000..c325674 --- /dev/null +++ b/src/main/generated/writely/tables/records/MemberPasswordRecord.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.MemberPassword; + + +/** + * 회원_비밀번호 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class MemberPasswordRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.member_password.member_id. 회원 ID + */ + public MemberPasswordRecord setMemberId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.member_password.member_id. 회원 ID + */ + public UUID getMemberId() { + return (UUID) get(0); + } + + /** + * Setter for public.member_password.password. 회원 비밀번호 + */ + public MemberPasswordRecord setPassword(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.member_password.password. 회원 비밀번호 + */ + public String getPassword() { + return (String) get(1); + } + + /** + * Setter for public.member_password.created_at. + */ + public MemberPasswordRecord setCreatedAt(OffsetDateTime value) { + set(2, value); + return this; + } + + /** + * Getter for public.member_password.created_at. + */ + public OffsetDateTime getCreatedAt() { + return (OffsetDateTime) get(2); + } + + /** + * Setter for public.member_password.updated_at. + */ + public MemberPasswordRecord setUpdatedAt(OffsetDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.member_password.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return (OffsetDateTime) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached MemberPasswordRecord + */ + public MemberPasswordRecord() { + super(MemberPassword.MEMBER_PASSWORD); + } + + /** + * Create a detached, initialised MemberPasswordRecord + */ + public MemberPasswordRecord(UUID memberId, String password, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(MemberPassword.MEMBER_PASSWORD); + + setMemberId(memberId); + setPassword(password); + setCreatedAt(createdAt); + setUpdatedAt(updatedAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised MemberPasswordRecord + */ + public MemberPasswordRecord(writely.tables.pojos.MemberPassword value) { + super(MemberPassword.MEMBER_PASSWORD); + + if (value != null) { + setMemberId(value.getMemberId()); + setPassword(value.getPassword()); + setCreatedAt(value.getCreatedAt()); + setUpdatedAt(value.getUpdatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/MemberRecord.java b/src/main/generated/writely/tables/records/MemberRecord.java new file mode 100644 index 0000000..a44f76b --- /dev/null +++ b/src/main/generated/writely/tables/records/MemberRecord.java @@ -0,0 +1,182 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.Member; + + +/** + * 회원 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class MemberRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.member.id. 회원 ID + */ + public MemberRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.member.id. 회원 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.member.email. 회원 이메일 + */ + public MemberRecord setEmail(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.member.email. 회원 이메일 + */ + public String getEmail() { + return (String) get(1); + } + + /** + * Setter for public.member.realname. 회원 실명 + */ + public MemberRecord setRealname(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.member.realname. 회원 실명 + */ + public String getRealname() { + return (String) get(2); + } + + /** + * Setter for public.member.nickname. 회원 닉네임 + */ + public MemberRecord setNickname(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.member.nickname. 회원 닉네임 + */ + public String getNickname() { + return (String) get(3); + } + + /** + * Setter for public.member.profile_image. 회원 프로필 이미지 경로 + */ + public MemberRecord setProfileImage(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.member.profile_image. 회원 프로필 이미지 경로 + */ + public String getProfileImage() { + return (String) get(4); + } + + /** + * Setter for public.member.created_at. + */ + public MemberRecord setCreatedAt(OffsetDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.member.created_at. + */ + public OffsetDateTime getCreatedAt() { + return (OffsetDateTime) get(5); + } + + /** + * Setter for public.member.updated_at. + */ + public MemberRecord setUpdatedAt(OffsetDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.member.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return (OffsetDateTime) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached MemberRecord + */ + public MemberRecord() { + super(Member.MEMBER); + } + + /** + * Create a detached, initialised MemberRecord + */ + public MemberRecord(UUID id, String email, String realname, String nickname, String profileImage, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(Member.MEMBER); + + setId(id); + setEmail(email); + setRealname(realname); + setNickname(nickname); + setProfileImage(profileImage); + setCreatedAt(createdAt); + setUpdatedAt(updatedAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised MemberRecord + */ + public MemberRecord(writely.tables.pojos.Member value) { + super(Member.MEMBER); + + if (value != null) { + setId(value.getId()); + setEmail(value.getEmail()); + setRealname(value.getRealname()); + setNickname(value.getNickname()); + setProfileImage(value.getProfileImage()); + setCreatedAt(value.getCreatedAt()); + setUpdatedAt(value.getUpdatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java b/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java new file mode 100644 index 0000000..6a75a21 --- /dev/null +++ b/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java @@ -0,0 +1,84 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import org.jooq.impl.TableRecordImpl; + +import writely.tables.PgpArmorHeaders; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeadersRecord extends TableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.pgp_armor_headers.key. + */ + public PgpArmorHeadersRecord setKey(String value) { + set(0, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return (String) get(0); + } + + /** + * Setter for public.pgp_armor_headers.value. + */ + public PgpArmorHeadersRecord setValue(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return (String) get(1); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord() { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(String key, String value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + setKey(key); + setValue(value); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(writely.tables.pojos.PgpArmorHeaders value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + if (value != null) { + setKey(value.getKey()); + setValue(value.getValue()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductCharacterRecord.java b/src/main/generated/writely/tables/records/ProductCharacterRecord.java new file mode 100644 index 0000000..ec36318 --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductCharacterRecord.java @@ -0,0 +1,318 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductCharacter; + + +/** + * 작품 등장인물 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCharacterRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_character.id. 등장인물 ID + */ + public ProductCharacterRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_character.id. 등장인물 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_character.product_id. 작품 ID + */ + public ProductCharacterRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_character.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.product_character.intro. 소개 + */ + public ProductCharacterRecord setIntro(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_character.intro. 소개 + */ + public String getIntro() { + return (String) get(2); + } + + /** + * Setter for public.product_character.name. 이름 + */ + public ProductCharacterRecord setName(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_character.name. 이름 + */ + public String getName() { + return (String) get(3); + } + + /** + * Setter for public.product_character.age. 나이 + */ + public ProductCharacterRecord setAge(Integer value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_character.age. 나이 + */ + public Integer getAge() { + return (Integer) get(4); + } + + /** + * Setter for public.product_character.gender. 성별 + */ + public ProductCharacterRecord setGender(String value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_character.gender. 성별 + */ + public String getGender() { + return (String) get(5); + } + + /** + * Setter for public.product_character.occupation. 직업 + */ + public ProductCharacterRecord setOccupation(String value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_character.occupation. 직업 + */ + public String getOccupation() { + return (String) get(6); + } + + /** + * Setter for public.product_character.appearance. 외모 + */ + public ProductCharacterRecord setAppearance(String value) { + set(7, value); + return this; + } + + /** + * Getter for public.product_character.appearance. 외모 + */ + public String getAppearance() { + return (String) get(7); + } + + /** + * Setter for public.product_character.personality. 성격 + */ + public ProductCharacterRecord setPersonality(String value) { + set(8, value); + return this; + } + + /** + * Getter for public.product_character.personality. 성격 + */ + public String getPersonality() { + return (String) get(8); + } + + /** + * Setter for public.product_character.characteristic. 특징 + */ + public ProductCharacterRecord setCharacteristic(String value) { + set(9, value); + return this; + } + + /** + * Getter for public.product_character.characteristic. 특징 + */ + public String getCharacteristic() { + return (String) get(9); + } + + /** + * Setter for public.product_character.relationship. 주요 관계 + */ + public ProductCharacterRecord setRelationship(String value) { + set(10, value); + return this; + } + + /** + * Getter for public.product_character.relationship. 주요 관계 + */ + public String getRelationship() { + return (String) get(10); + } + + /** + * Setter for public.product_character.created_at. 생성일시 + */ + public ProductCharacterRecord setCreatedAt(LocalDateTime value) { + set(11, value); + return this; + } + + /** + * Getter for public.product_character.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(11); + } + + /** + * Setter for public.product_character.created_by. 생성자 ID + */ + public ProductCharacterRecord setCreatedBy(UUID value) { + set(12, value); + return this; + } + + /** + * Getter for public.product_character.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(12); + } + + /** + * Setter for public.product_character.updated_at. 수정일시 + */ + public ProductCharacterRecord setUpdatedAt(LocalDateTime value) { + set(13, value); + return this; + } + + /** + * Getter for public.product_character.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(13); + } + + /** + * Setter for public.product_character.updated_by. 수정자 ID + */ + public ProductCharacterRecord setUpdatedBy(UUID value) { + set(14, value); + return this; + } + + /** + * Getter for public.product_character.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(14); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductCharacterRecord + */ + public ProductCharacterRecord() { + super(ProductCharacter.PRODUCT_CHARACTER); + } + + /** + * Create a detached, initialised ProductCharacterRecord + */ + public ProductCharacterRecord(UUID id, UUID productId, String intro, String name, Integer age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductCharacter.PRODUCT_CHARACTER); + + setId(id); + setProductId(productId); + setIntro(intro); + setName(name); + setAge(age); + setGender(gender); + setOccupation(occupation); + setAppearance(appearance); + setPersonality(personality); + setCharacteristic(characteristic); + setRelationship(relationship); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductCharacterRecord + */ + public ProductCharacterRecord(writely.tables.pojos.ProductCharacter value) { + super(ProductCharacter.PRODUCT_CHARACTER); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setIntro(value.getIntro()); + setName(value.getName()); + setAge(value.getAge()); + setGender(value.getGender()); + setOccupation(value.getOccupation()); + setAppearance(value.getAppearance()); + setPersonality(value.getPersonality()); + setCharacteristic(value.getCharacteristic()); + setRelationship(value.getRelationship()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java new file mode 100644 index 0000000..563f1cd --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java @@ -0,0 +1,233 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductCustomField; + + +/** + * 작품 커스텀 필드 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductCustomFieldRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_custom_field.id. 커스텀 필드 ID + */ + public ProductCustomFieldRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_custom_field.id. 커스텀 필드 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_custom_field.product_id. 작품 ID + */ + public ProductCustomFieldRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_custom_field.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.product_custom_field.section_code. 섹션 코드 + */ + public ProductCustomFieldRecord setSectionCode(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_custom_field.section_code. 섹션 코드 + */ + public String getSectionCode() { + return (String) get(2); + } + + /** + * Setter for public.product_custom_field.name. 이름 + */ + public ProductCustomFieldRecord setName(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_custom_field.name. 이름 + */ + public String getName() { + return (String) get(3); + } + + /** + * Setter for public.product_custom_field.content. 내용 + */ + public ProductCustomFieldRecord setContent(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_custom_field.content. 내용 + */ + public String getContent() { + return (String) get(4); + } + + /** + * Setter for public.product_custom_field.seq. 순서 + */ + public ProductCustomFieldRecord setSeq(Short value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_custom_field.seq. 순서 + */ + public Short getSeq() { + return (Short) get(5); + } + + /** + * Setter for public.product_custom_field.created_at. 생성일시 + */ + public ProductCustomFieldRecord setCreatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_custom_field.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.product_custom_field.created_by. 생성자 ID + */ + public ProductCustomFieldRecord setCreatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.product_custom_field.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(7); + } + + /** + * Setter for public.product_custom_field.updated_at. 수정일시 + */ + public ProductCustomFieldRecord setUpdatedAt(LocalDateTime value) { + set(8, value); + return this; + } + + /** + * Getter for public.product_custom_field.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(8); + } + + /** + * Setter for public.product_custom_field.updated_by. 수정자 ID + */ + public ProductCustomFieldRecord setUpdatedBy(UUID value) { + set(9, value); + return this; + } + + /** + * Getter for public.product_custom_field.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductCustomFieldRecord + */ + public ProductCustomFieldRecord() { + super(ProductCustomField.PRODUCT_CUSTOM_FIELD); + } + + /** + * Create a detached, initialised ProductCustomFieldRecord + */ + public ProductCustomFieldRecord(UUID id, UUID productId, String sectionCode, String name, String content, Short seq, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductCustomField.PRODUCT_CUSTOM_FIELD); + + setId(id); + setProductId(productId); + setSectionCode(sectionCode); + setName(name); + setContent(content); + setSeq(seq); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductCustomFieldRecord + */ + public ProductCustomFieldRecord(writely.tables.pojos.ProductCustomField value) { + super(ProductCustomField.PRODUCT_CUSTOM_FIELD); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setSectionCode(value.getSectionCode()); + setName(value.getName()); + setContent(value.getContent()); + setSeq(value.getSeq()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java b/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java new file mode 100644 index 0000000..0891a2c --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java @@ -0,0 +1,182 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductIdeanote; + + +/** + * 작품 아이디어 노트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductIdeanoteRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_ideanote.id. 아이디어 노트 ID + */ + public ProductIdeanoteRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_ideanote.id. 아이디어 노트 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_ideanote.title. 제목 + */ + public ProductIdeanoteRecord setTitle(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_ideanote.title. 제목 + */ + public String getTitle() { + return (String) get(1); + } + + /** + * Setter for public.product_ideanote.content. 내용 + */ + public ProductIdeanoteRecord setContent(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_ideanote.content. 내용 + */ + public String getContent() { + return (String) get(2); + } + + /** + * Setter for public.product_ideanote.created_at. 생성일시 + */ + public ProductIdeanoteRecord setCreatedAt(LocalDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_ideanote.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(3); + } + + /** + * Setter for public.product_ideanote.created_by. 생성자 ID + */ + public ProductIdeanoteRecord setCreatedBy(UUID value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_ideanote.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(4); + } + + /** + * Setter for public.product_ideanote.updated_at. 수정일시 + */ + public ProductIdeanoteRecord setUpdatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_ideanote.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.product_ideanote.updated_by. 수정자 ID + */ + public ProductIdeanoteRecord setUpdatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_ideanote.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductIdeanoteRecord + */ + public ProductIdeanoteRecord() { + super(ProductIdeanote.PRODUCT_IDEANOTE); + } + + /** + * Create a detached, initialised ProductIdeanoteRecord + */ + public ProductIdeanoteRecord(UUID id, String title, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductIdeanote.PRODUCT_IDEANOTE); + + setId(id); + setTitle(title); + setContent(content); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductIdeanoteRecord + */ + public ProductIdeanoteRecord(writely.tables.pojos.ProductIdeanote value) { + super(ProductIdeanote.PRODUCT_IDEANOTE); + + if (value != null) { + setId(value.getId()); + setTitle(value.getTitle()); + setContent(value.getContent()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductMemoRecord.java b/src/main/generated/writely/tables/records/ProductMemoRecord.java new file mode 100644 index 0000000..380bfbf --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductMemoRecord.java @@ -0,0 +1,182 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductMemo; + + +/** + * 작품 메모 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductMemoRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_memo.id. 메모 ID + */ + public ProductMemoRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_memo.id. 메모 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_memo.product_id. 작품 ID + */ + public ProductMemoRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_memo.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.product_memo.content. 내용 + */ + public ProductMemoRecord setContent(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_memo.content. 내용 + */ + public String getContent() { + return (String) get(2); + } + + /** + * Setter for public.product_memo.created_at. 생성일시 + */ + public ProductMemoRecord setCreatedAt(LocalDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_memo.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(3); + } + + /** + * Setter for public.product_memo.created_by. 생성자 ID + */ + public ProductMemoRecord setCreatedBy(UUID value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_memo.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(4); + } + + /** + * Setter for public.product_memo.updated_at. 수정일시 + */ + public ProductMemoRecord setUpdatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_memo.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.product_memo.updated_by. 수정일시 + */ + public ProductMemoRecord setUpdatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_memo.updated_by. 수정일시 + */ + public UUID getUpdatedBy() { + return (UUID) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductMemoRecord + */ + public ProductMemoRecord() { + super(ProductMemo.PRODUCT_MEMO); + } + + /** + * Create a detached, initialised ProductMemoRecord + */ + public ProductMemoRecord(UUID id, UUID productId, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductMemo.PRODUCT_MEMO); + + setId(id); + setProductId(productId); + setContent(content); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductMemoRecord + */ + public ProductMemoRecord(writely.tables.pojos.ProductMemo value) { + super(ProductMemo.PRODUCT_MEMO); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setContent(value.getContent()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductPlotRecord.java b/src/main/generated/writely/tables/records/ProductPlotRecord.java new file mode 100644 index 0000000..165afed --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductPlotRecord.java @@ -0,0 +1,216 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductPlot; + + +/** + * 작품 줄거리 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductPlotRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_plot.id. 줄거리 ID + */ + public ProductPlotRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_plot.id. 줄거리 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_plot.exposition. 발단 + */ + public ProductPlotRecord setExposition(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_plot.exposition. 발단 + */ + public String getExposition() { + return (String) get(1); + } + + /** + * Setter for public.product_plot.complication. 전개 + */ + public ProductPlotRecord setComplication(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_plot.complication. 전개 + */ + public String getComplication() { + return (String) get(2); + } + + /** + * Setter for public.product_plot.climax. 결말 + */ + public ProductPlotRecord setClimax(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_plot.climax. 결말 + */ + public String getClimax() { + return (String) get(3); + } + + /** + * Setter for public.product_plot.resolution. + */ + public ProductPlotRecord setResolution(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_plot.resolution. + */ + public String getResolution() { + return (String) get(4); + } + + /** + * Setter for public.product_plot.created_at. 생성일시 + */ + public ProductPlotRecord setCreatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_plot.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.product_plot.created_by. 생성자 ID + */ + public ProductPlotRecord setCreatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_plot.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(6); + } + + /** + * Setter for public.product_plot.updated_at. 수정일시 + */ + public ProductPlotRecord setUpdatedAt(LocalDateTime value) { + set(7, value); + return this; + } + + /** + * Getter for public.product_plot.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(7); + } + + /** + * Setter for public.product_plot.updated_by. 수정자 ID + */ + public ProductPlotRecord setUpdatedBy(UUID value) { + set(8, value); + return this; + } + + /** + * Getter for public.product_plot.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductPlotRecord + */ + public ProductPlotRecord() { + super(ProductPlot.PRODUCT_PLOT); + } + + /** + * Create a detached, initialised ProductPlotRecord + */ + public ProductPlotRecord(UUID id, String exposition, String complication, String climax, String resolution, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductPlot.PRODUCT_PLOT); + + setId(id); + setExposition(exposition); + setComplication(complication); + setClimax(climax); + setResolution(resolution); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductPlotRecord + */ + public ProductPlotRecord(writely.tables.pojos.ProductPlot value) { + super(ProductPlot.PRODUCT_PLOT); + + if (value != null) { + setId(value.getId()); + setExposition(value.getExposition()); + setComplication(value.getComplication()); + setClimax(value.getClimax()); + setResolution(value.getResolution()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductRecord.java b/src/main/generated/writely/tables/records/ProductRecord.java new file mode 100644 index 0000000..f24f81c --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductRecord.java @@ -0,0 +1,182 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.Product; + + +/** + * 작품 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product.id. 작품 ID + */ + public ProductRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product.id. 작품 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product.title. 제목 + */ + public ProductRecord setTitle(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.product.title. 제목 + */ + public String getTitle() { + return (String) get(1); + } + + /** + * Setter for public.product.content. 내용 + */ + public ProductRecord setContent(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product.content. 내용 + */ + public String getContent() { + return (String) get(2); + } + + /** + * Setter for public.product.created_at. 생성일시 + */ + public ProductRecord setCreatedAt(LocalDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.product.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(3); + } + + /** + * Setter for public.product.created_by. 생성자 ID + */ + public ProductRecord setCreatedBy(UUID value) { + set(4, value); + return this; + } + + /** + * Getter for public.product.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(4); + } + + /** + * Setter for public.product.updated_at. 수정일시 + */ + public ProductRecord setUpdatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.product.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.product.updated_by. 수정자 ID + */ + public ProductRecord setUpdatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.product.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductRecord + */ + public ProductRecord() { + super(Product.PRODUCT); + } + + /** + * Create a detached, initialised ProductRecord + */ + public ProductRecord(UUID id, String title, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(Product.PRODUCT); + + setId(id); + setTitle(title); + setContent(content); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductRecord + */ + public ProductRecord(writely.tables.pojos.Product value) { + super(Product.PRODUCT); + + if (value != null) { + setId(value.getId()); + setTitle(value.getTitle()); + setContent(value.getContent()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductSynopsisRecord.java b/src/main/generated/writely/tables/records/ProductSynopsisRecord.java new file mode 100644 index 0000000..4cbf74a --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductSynopsisRecord.java @@ -0,0 +1,233 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductSynopsis; + + +/** + * 작품 시놉시스 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductSynopsisRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_synopsis.id. 시놉시스 ID + */ + public ProductSynopsisRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_synopsis.id. 시놉시스 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_synopsis.genre. 장르 + */ + public ProductSynopsisRecord setGenre(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_synopsis.genre. 장르 + */ + public String getGenre() { + return (String) get(1); + } + + /** + * Setter for public.product_synopsis.length. 분량 + */ + public ProductSynopsisRecord setLength(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_synopsis.length. 분량 + */ + public String getLength() { + return (String) get(2); + } + + /** + * Setter for public.product_synopsis.purpose. 기획 의도 + */ + public ProductSynopsisRecord setPurpose(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_synopsis.purpose. 기획 의도 + */ + public String getPurpose() { + return (String) get(3); + } + + /** + * Setter for public.product_synopsis.logline. 로그라인 + */ + public ProductSynopsisRecord setLogline(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_synopsis.logline. 로그라인 + */ + public String getLogline() { + return (String) get(4); + } + + /** + * Setter for public.product_synopsis.example. 예시 문장 + */ + public ProductSynopsisRecord setExample(String value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_synopsis.example. 예시 문장 + */ + public String getExample() { + return (String) get(5); + } + + /** + * Setter for public.product_synopsis.created_at. 생성일시 + */ + public ProductSynopsisRecord setCreatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_synopsis.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.product_synopsis.created_by. 생성자 ID + */ + public ProductSynopsisRecord setCreatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.product_synopsis.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(7); + } + + /** + * Setter for public.product_synopsis.updated_at. 수정일시 + */ + public ProductSynopsisRecord setUpdatedAt(LocalDateTime value) { + set(8, value); + return this; + } + + /** + * Getter for public.product_synopsis.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(8); + } + + /** + * Setter for public.product_synopsis.updated_by. 수정자 ID + */ + public ProductSynopsisRecord setUpdatedBy(UUID value) { + set(9, value); + return this; + } + + /** + * Getter for public.product_synopsis.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductSynopsisRecord + */ + public ProductSynopsisRecord() { + super(ProductSynopsis.PRODUCT_SYNOPSIS); + } + + /** + * Create a detached, initialised ProductSynopsisRecord + */ + public ProductSynopsisRecord(UUID id, String genre, String length, String purpose, String logline, String example, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductSynopsis.PRODUCT_SYNOPSIS); + + setId(id); + setGenre(genre); + setLength(length); + setPurpose(purpose); + setLogline(logline); + setExample(example); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductSynopsisRecord + */ + public ProductSynopsisRecord(writely.tables.pojos.ProductSynopsis value) { + super(ProductSynopsis.PRODUCT_SYNOPSIS); + + if (value != null) { + setId(value.getId()); + setGenre(value.getGenre()); + setLength(value.getLength()); + setPurpose(value.getPurpose()); + setLogline(value.getLogline()); + setExample(value.getExample()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductWorldviewRecord.java b/src/main/generated/writely/tables/records/ProductWorldviewRecord.java new file mode 100644 index 0000000..8209fa3 --- /dev/null +++ b/src/main/generated/writely/tables/records/ProductWorldviewRecord.java @@ -0,0 +1,369 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ProductWorldview; + + +/** + * 작품 세계관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductWorldviewRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_worldview.id. 세계관 ID + */ + public ProductWorldviewRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_worldview.id. 세계관 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_worldview.geography. 지리 + */ + public ProductWorldviewRecord setGeography(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_worldview.geography. 지리 + */ + public String getGeography() { + return (String) get(1); + } + + /** + * Setter for public.product_worldview.history. 역사 + */ + public ProductWorldviewRecord setHistory(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_worldview.history. 역사 + */ + public String getHistory() { + return (String) get(2); + } + + /** + * Setter for public.product_worldview.politics. 정치 + */ + public ProductWorldviewRecord setPolitics(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_worldview.politics. 정치 + */ + public String getPolitics() { + return (String) get(3); + } + + /** + * Setter for public.product_worldview.society. 사회 + */ + public ProductWorldviewRecord setSociety(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_worldview.society. 사회 + */ + public String getSociety() { + return (String) get(4); + } + + /** + * Setter for public.product_worldview.religion. 종교 + */ + public ProductWorldviewRecord setReligion(String value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_worldview.religion. 종교 + */ + public String getReligion() { + return (String) get(5); + } + + /** + * Setter for public.product_worldview.economy. 경제 + */ + public ProductWorldviewRecord setEconomy(String value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_worldview.economy. 경제 + */ + public String getEconomy() { + return (String) get(6); + } + + /** + * Setter for public.product_worldview.technology. 기술 + */ + public ProductWorldviewRecord setTechnology(String value) { + set(7, value); + return this; + } + + /** + * Getter for public.product_worldview.technology. 기술 + */ + public String getTechnology() { + return (String) get(7); + } + + /** + * Setter for public.product_worldview.lifestyle. 생활 + */ + public ProductWorldviewRecord setLifestyle(String value) { + set(8, value); + return this; + } + + /** + * Getter for public.product_worldview.lifestyle. 생활 + */ + public String getLifestyle() { + return (String) get(8); + } + + /** + * Setter for public.product_worldview.language. 언어 + */ + public ProductWorldviewRecord setLanguage(String value) { + set(9, value); + return this; + } + + /** + * Getter for public.product_worldview.language. 언어 + */ + public String getLanguage() { + return (String) get(9); + } + + /** + * Setter for public.product_worldview.culture. 문화 + */ + public ProductWorldviewRecord setCulture(String value) { + set(10, value); + return this; + } + + /** + * Getter for public.product_worldview.culture. 문화 + */ + public String getCulture() { + return (String) get(10); + } + + /** + * Setter for public.product_worldview.species. 종족 + */ + public ProductWorldviewRecord setSpecies(String value) { + set(11, value); + return this; + } + + /** + * Getter for public.product_worldview.species. 종족 + */ + public String getSpecies() { + return (String) get(11); + } + + /** + * Setter for public.product_worldview.occupation. 직업 + */ + public ProductWorldviewRecord setOccupation(String value) { + set(12, value); + return this; + } + + /** + * Getter for public.product_worldview.occupation. 직업 + */ + public String getOccupation() { + return (String) get(12); + } + + /** + * Setter for public.product_worldview.conflict. 갈등 관계 + */ + public ProductWorldviewRecord setConflict(String value) { + set(13, value); + return this; + } + + /** + * Getter for public.product_worldview.conflict. 갈등 관계 + */ + public String getConflict() { + return (String) get(13); + } + + /** + * Setter for public.product_worldview.created_at. 생성일시 + */ + public ProductWorldviewRecord setCreatedAt(LocalDateTime value) { + set(14, value); + return this; + } + + /** + * Getter for public.product_worldview.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(14); + } + + /** + * Setter for public.product_worldview.created_by. 생성자 ID + */ + public ProductWorldviewRecord setCreatedBy(UUID value) { + set(15, value); + return this; + } + + /** + * Getter for public.product_worldview.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(15); + } + + /** + * Setter for public.product_worldview.updated_at. 수정일시 + */ + public ProductWorldviewRecord setUpdatedAt(LocalDateTime value) { + set(16, value); + return this; + } + + /** + * Getter for public.product_worldview.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(16); + } + + /** + * Setter for public.product_worldview.updated_by. 수정자 ID + */ + public ProductWorldviewRecord setUpdatedBy(UUID value) { + set(17, value); + return this; + } + + /** + * Getter for public.product_worldview.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(17); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductWorldviewRecord + */ + public ProductWorldviewRecord() { + super(ProductWorldview.PRODUCT_WORLDVIEW); + } + + /** + * Create a detached, initialised ProductWorldviewRecord + */ + public ProductWorldviewRecord(UUID id, String geography, String history, String politics, String society, String religion, String economy, String technology, String lifestyle, String language, String culture, String species, String occupation, String conflict, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ProductWorldview.PRODUCT_WORLDVIEW); + + setId(id); + setGeography(geography); + setHistory(history); + setPolitics(politics); + setSociety(society); + setReligion(religion); + setEconomy(economy); + setTechnology(technology); + setLifestyle(lifestyle); + setLanguage(language); + setCulture(culture); + setSpecies(species); + setOccupation(occupation); + setConflict(conflict); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductWorldviewRecord + */ + public ProductWorldviewRecord(writely.tables.pojos.ProductWorldview value) { + super(ProductWorldview.PRODUCT_WORLDVIEW); + + if (value != null) { + setId(value.getId()); + setGeography(value.getGeography()); + setHistory(value.getHistory()); + setPolitics(value.getPolitics()); + setSociety(value.getSociety()); + setReligion(value.getReligion()); + setEconomy(value.getEconomy()); + setTechnology(value.getTechnology()); + setLifestyle(value.getLifestyle()); + setLanguage(value.getLanguage()); + setCulture(value.getCulture()); + setSpecies(value.getSpecies()); + setOccupation(value.getOccupation()); + setConflict(value.getConflict()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} From 6262bf28c58bf58181a809ab2638b011ef2b46a5 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Sun, 26 Jan 2025 01:35:48 +0900 Subject: [PATCH 009/107] Feat/submodule (#7) --- .github/workflows/deploy.yml | 3 +++ .gitignore | 3 +++ .gitmodules | 3 +++ BE-secret | 1 + build.gradle | 8 ++++++++ src/main/resources/application-dev.yml | 19 ------------------ src/main/resources/application-local.yml | 19 ------------------ src/main/resources/application.yml | 25 ------------------------ 8 files changed, 18 insertions(+), 63 deletions(-) create mode 100644 .gitmodules create mode 160000 BE-secret delete mode 100644 src/main/resources/application-dev.yml delete mode 100644 src/main/resources/application-local.yml delete mode 100644 src/main/resources/application.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 92e9d2a..cd63187 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,9 @@ jobs: steps: - name: checkout uses: actions/checkout@v3 + with: + submodules: true + token: ${{ secrets.GH_PAT }} - name: Set up JDK 21 uses: actions/setup-java@v3 diff --git a/.gitignore b/.gitignore index 6c4c4bc..47ee6f5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ out/ .vscode/ *.log *.pid + +### secrets ### +**/src/main/resources/**/application*.yml \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..52e35c6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "BE-secret"] + path = BE-secret + url = https://github.com/WritelyForWriters/BE-secret.git diff --git a/BE-secret b/BE-secret new file mode 160000 index 0000000..e07ba16 --- /dev/null +++ b/BE-secret @@ -0,0 +1 @@ +Subproject commit e07ba165b2027a5cefd4100a2bec36ff290fd095 diff --git a/build.gradle b/build.gradle index 0705244..aca9f1d 100644 --- a/build.gradle +++ b/build.gradle @@ -51,6 +51,14 @@ dependencies { implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' } +task copySecret(type: Copy) { + copy { + from './BE-secret' + include "*.yml" + into 'src/main/resources' + } +} + tasks.named('test') { useJUnitPlatform() } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml deleted file mode 100644 index e7570d6..0000000 --- a/src/main/resources/application-dev.yml +++ /dev/null @@ -1,19 +0,0 @@ -spring: - config: - activate: - on-profile: dev - - datasource: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service?useUnicode=true&characterEncoding=UTF-8 - username: postgres - password: Writely0101% - -server: - port: 8080 - -service: - server: - url: http://54.180.242.10:8080 - cors: - origins: http://54.180.242.10:8080, http://localhost:8080, http://localhost:3000 \ No newline at end of file diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml deleted file mode 100644 index 690e74c..0000000 --- a/src/main/resources/application-local.yml +++ /dev/null @@ -1,19 +0,0 @@ -spring: - config: - activate: - on-profile: local - - datasource: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://localhost:5432/service?useUnicode=true&characterEncoding=UTF-8 - username: postgres - password: 1234 - -server: - port: 8080 - -service: - server: - url: http://localhost:8080 - cors: - origins: http://localhost:8080, http://localhost:3000 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index e0626ea..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -spring: - profiles: - active: local - servlet: - multipart: - max-file-size: 20MB - max-request-size: 20MB - enabled: true - jpa: - properties: - hibernate: - format_sql: true - use_sql_comments: true - -logging: - level: - org.hibernate.SQL: debug - -springdoc: - swagger-ui: - path: /doc - tags-sorter: alpha - operations-sorter: alpha - doc-expansion: none - default-models-expand-depth: -1 \ No newline at end of file From cc30a58978cae5fddb0f9b7b84a449188ad95e37 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Sun, 26 Jan 2025 01:58:58 +0900 Subject: [PATCH 010/107] feat: update submodule (#8) --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index e07ba16..8176828 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit e07ba165b2027a5cefd4100a2bec36ff290fd095 +Subproject commit 817682855f3444f7f022668d05ef578e938cb297 From 5656c62ba6584c409fd77a0a2e5f6a4a9c5cc870 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 26 Jan 2025 10:28:36 +0900 Subject: [PATCH 011/107] feat: logback (#9) --- BE-secret | 2 +- src/main/resources/logback-spring.xml | 78 +++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/BE-secret b/BE-secret index 8176828..a68505d 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 817682855f3444f7f022668d05ef578e938cb297 +Subproject commit a68505daf6c8f54ec9e6b113db469a6e937c5ecb diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..f6a3cb1 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + ${LOG_PATTERN} + + + + + + + + + + + + + + + + + + + + ${INFO_PATH}/info.log + + ${INFO_PATH}/info_%d{yyyy-MM-dd}_%i.log + + 10MB + + 30 + + + + INFO + ACCEPT + DENY + + + ${LOG_PATTERN} + + + + + + ${ERR_PATH}/err.log + + ${ERR_PATH}/err_%d{yyyy-MM-dd}_%i.log + + 10MB + + 30 + + + + ERROR + ACCEPT + DENY + + + ${LOG_PATTERN} + + + + + + + + + + + From 448334c4625d4d2c7f01b528f4967dec722c4974 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Sun, 26 Jan 2025 23:49:18 +0900 Subject: [PATCH 012/107] feat: auth (#10) --- BE-secret | 2 +- build.gradle | 9 ++ sql/init.sql | 29 ++++ .../java/com/writely/WritelyApplication.java | 10 ++ .../auth/controller/AuthController.java | 50 ++++++ .../com/writely/auth/domain/BaseToken.java | 16 ++ .../com/writely/auth/domain/JoinToken.java | 22 +++ .../com/writely/auth/domain/JwtPayload.java | 16 ++ .../com/writely/auth/domain/RefreshToken.java | 13 ++ .../auth/domain/enums/AuthException.java | 21 +++ .../com/writely/auth/helper/JwtHelper.java | 87 ++++++++++ .../com/writely/auth/helper/MailHelper.java | 29 ++++ .../repository/JoinTokenRedisRepository.java | 8 + .../RefreshTokenRedisRepository.java | 8 + .../com/writely/auth/request/JoinRequest.java | 24 +++ .../auth/request/JoinTokenRequest.java | 13 ++ .../writely/auth/request/LoginRequest.java | 15 ++ .../writely/auth/request/ReissueRequest.java | 13 ++ .../auth/response/AuthTokenResponse.java | 20 +++ .../auth/service/AuthCommandService.java | 151 ++++++++++++++++++ .../auth/service/AuthQueryService.java | 8 + .../com/writely/common/util/CryptoUtil.java | 89 +++++++++++ .../com/writely/member/domain/Member.java | 36 +++++ .../writely/member/domain/MemberPassword.java | 24 +++ .../repository/MemberJpaRepository.java | 11 ++ .../MemberPasswordJpaRepository.java | 11 ++ ...ava => ProductCharacterJpaRepository.java} | 2 +- ...a => ProductCustomFieldJpaRepository.java} | 2 +- ...java => ProductIdeaNoteJpaRepository.java} | 2 +- ...ository.java => ProductJpaRepository.java} | 2 +- ...ory.java => ProductMemoJpaRepository.java} | 2 +- ...ory.java => ProductPlotJpaRepository.java} | 2 +- ...java => ProductSynopsisJpaRepository.java} | 2 +- ...ava => ProductWorldviewJpaRepository.java} | 2 +- .../service/ProductCommandService.java | 28 ++-- .../product/service/ProductQueryService.java | 4 +- src/main/resources/templates/mail/chpw.html | 13 ++ src/main/resources/templates/mail/join.html | 13 ++ 38 files changed, 784 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/writely/auth/controller/AuthController.java create mode 100644 src/main/java/com/writely/auth/domain/BaseToken.java create mode 100644 src/main/java/com/writely/auth/domain/JoinToken.java create mode 100644 src/main/java/com/writely/auth/domain/JwtPayload.java create mode 100644 src/main/java/com/writely/auth/domain/RefreshToken.java create mode 100644 src/main/java/com/writely/auth/domain/enums/AuthException.java create mode 100644 src/main/java/com/writely/auth/helper/JwtHelper.java create mode 100644 src/main/java/com/writely/auth/helper/MailHelper.java create mode 100644 src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java create mode 100644 src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java create mode 100644 src/main/java/com/writely/auth/request/JoinRequest.java create mode 100644 src/main/java/com/writely/auth/request/JoinTokenRequest.java create mode 100644 src/main/java/com/writely/auth/request/LoginRequest.java create mode 100644 src/main/java/com/writely/auth/request/ReissueRequest.java create mode 100644 src/main/java/com/writely/auth/response/AuthTokenResponse.java create mode 100644 src/main/java/com/writely/auth/service/AuthCommandService.java create mode 100644 src/main/java/com/writely/auth/service/AuthQueryService.java create mode 100644 src/main/java/com/writely/common/util/CryptoUtil.java create mode 100644 src/main/java/com/writely/member/domain/Member.java create mode 100644 src/main/java/com/writely/member/domain/MemberPassword.java create mode 100644 src/main/java/com/writely/member/repository/MemberJpaRepository.java create mode 100644 src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java rename src/main/java/com/writely/product/repository/{ProductCharacterRepository.java => ProductCharacterJpaRepository.java} (65%) rename src/main/java/com/writely/product/repository/{ProductCustomFieldRepository.java => ProductCustomFieldJpaRepository.java} (65%) rename src/main/java/com/writely/product/repository/{ProductIdeaNoteRepository.java => ProductIdeaNoteJpaRepository.java} (66%) rename src/main/java/com/writely/product/repository/{ProductRepository.java => ProductJpaRepository.java} (69%) rename src/main/java/com/writely/product/repository/{ProductMemoRepository.java => ProductMemoJpaRepository.java} (67%) rename src/main/java/com/writely/product/repository/{ProductPlotRepository.java => ProductPlotJpaRepository.java} (67%) rename src/main/java/com/writely/product/repository/{ProductSynopsisRepository.java => ProductSynopsisJpaRepository.java} (66%) rename src/main/java/com/writely/product/repository/{ProductWorldviewRepository.java => ProductWorldviewJpaRepository.java} (65%) create mode 100644 src/main/resources/templates/mail/chpw.html create mode 100644 src/main/resources/templates/mail/join.html diff --git a/BE-secret b/BE-secret index a68505d..aa7b52d 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit a68505daf6c8f54ec9e6b113db469a6e937c5ecb +Subproject commit aa7b52d15a5f8d2aba829bdc8296c1e8d41eb94c diff --git a/build.gradle b/build.gradle index aca9f1d..1eb95f9 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ dependencies { /* DB */ runtimeOnly 'org.postgresql:postgresql' + implementation 'org.springframework.boot:spring-boot-starter-data-redis' /* jooq */ implementation 'org.springframework.boot:spring-boot-starter-jooq' @@ -43,9 +44,17 @@ dependencies { compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + /* Mail */ + implementation 'org.springframework.boot:spring-boot-starter-mail' + + /* Template engine */ + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' + /* Common Util */ implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'commons-io:commons-io:2.13.0' + implementation 'com.auth0:java-jwt:4.4.0' /* Swagger */ implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' diff --git a/sql/init.sql b/sql/init.sql index cb77a8e..56de4e2 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -1,5 +1,34 @@ -- DDL +--- 회원 +create table member +( + id uuid default gen_random_uuid() constraint member_pk primary key, + email varchar(255) constraint email_uk unique not null, + realname varchar(10) not null, + nickname varchar(50) not null, + profile_image varchar(255), + created_at timestamp with time zone not null, + updated_at timestamp with time zone not null +); +comment on table member is '회원'; +comment on column member.id is '회원 ID'; +comment on column member.email is '회원 이메일'; +comment on column member.realname is '회원 실명'; +comment on column member.nickname is '회원 닉네임'; +comment on column member.profile_image is '회원 프로필 이미지 경로'; + +create table member_password +( + member_id uuid constraint member_password_pk primary key, + password varchar(128) not null, + created_at timestamp with time zone not null, + updated_at timestamp with time zone not null +); +comment on table member_password is '회원_비밀번호'; +comment on column member_password.member_id is '회원 ID'; +comment on column member_password.password is '회원 비밀번호'; + -- product create table product ( diff --git a/src/main/java/com/writely/WritelyApplication.java b/src/main/java/com/writely/WritelyApplication.java index 03bd712..2590cef 100644 --- a/src/main/java/com/writely/WritelyApplication.java +++ b/src/main/java/com/writely/WritelyApplication.java @@ -2,8 +2,18 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; @SpringBootApplication +@EnableJpaRepositories( + includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*JpaRepository") +) +@EnableRedisRepositories( + includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*RedisRepository") +) public class WritelyApplication { public static void main(String[] args) { diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java new file mode 100644 index 0000000..442b29d --- /dev/null +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -0,0 +1,50 @@ +package com.writely.auth.controller; + +import com.writely.auth.request.JoinRequest; +import com.writely.auth.request.JoinTokenRequest; +import com.writely.auth.request.LoginRequest; +import com.writely.auth.request.ReissueRequest; +import com.writely.auth.response.AuthTokenResponse; +import com.writely.auth.service.AuthCommandService; +import com.writely.auth.service.AuthQueryService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/auth") +@Tag(name = "인증") +public class AuthController { + private final AuthQueryService authQueryService; + private final AuthCommandService authCommandService; + + @Operation(summary = "토큰 재발급") + @PostMapping("/token/reissue") + public AuthTokenResponse reissueToken(ReissueRequest request) { + + return authCommandService.reissueToken(request); + } + + @Operation(summary = "로그인") + @PostMapping("/login") + public AuthTokenResponse login(@RequestBody LoginRequest request) { + + return authCommandService.login(request); + } + + @Operation(summary = "회원가입") + @PostMapping("/join") + public void join(@RequestBody JoinRequest request) { + + authCommandService.join(request); + } + + @Operation(summary = "회원가입 완료") + @PostMapping("/join/complete") + public AuthTokenResponse join(@RequestBody JoinTokenRequest request) { + + return authCommandService.completeJoin(request); + } +} diff --git a/src/main/java/com/writely/auth/domain/BaseToken.java b/src/main/java/com/writely/auth/domain/BaseToken.java new file mode 100644 index 0000000..35084e8 --- /dev/null +++ b/src/main/java/com/writely/auth/domain/BaseToken.java @@ -0,0 +1,16 @@ +package com.writely.auth.domain; + +import jakarta.persistence.MappedSuperclass; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@MappedSuperclass +public class BaseToken { + @Id + protected String tokenString; + +} diff --git a/src/main/java/com/writely/auth/domain/JoinToken.java b/src/main/java/com/writely/auth/domain/JoinToken.java new file mode 100644 index 0000000..2e71fb1 --- /dev/null +++ b/src/main/java/com/writely/auth/domain/JoinToken.java @@ -0,0 +1,22 @@ +package com.writely.auth.domain; + +import com.writely.member.domain.Member; +import com.writely.member.domain.MemberPassword; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.redis.core.RedisHash; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@RedisHash(value = "joinToken", timeToLive = 60 * 60) +public class JoinToken extends BaseToken { + private Member member; + private MemberPassword memberPassword; + + public JoinToken(String tokenString, Member member, MemberPassword memberPassword) { + this.tokenString = tokenString; + this.member = member; + this.memberPassword = memberPassword; + } +} diff --git a/src/main/java/com/writely/auth/domain/JwtPayload.java b/src/main/java/com/writely/auth/domain/JwtPayload.java new file mode 100644 index 0000000..0ab5d16 --- /dev/null +++ b/src/main/java/com/writely/auth/domain/JwtPayload.java @@ -0,0 +1,16 @@ +package com.writely.auth.domain; + +import lombok.*; + +import java.util.UUID; + +@Getter +@Setter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class JwtPayload { + private Long iat; + private Long exp; + private UUID memberId; +} diff --git a/src/main/java/com/writely/auth/domain/RefreshToken.java b/src/main/java/com/writely/auth/domain/RefreshToken.java new file mode 100644 index 0000000..a6194b8 --- /dev/null +++ b/src/main/java/com/writely/auth/domain/RefreshToken.java @@ -0,0 +1,13 @@ +package com.writely.auth.domain; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.redis.core.RedisHash; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@RedisHash(value = "refreshToken", timeToLive = 60 * 60 * 24 * 90) +public class RefreshToken extends BaseToken { + +} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/src/main/java/com/writely/auth/domain/enums/AuthException.java new file mode 100644 index 0000000..797a0be --- /dev/null +++ b/src/main/java/com/writely/auth/domain/enums/AuthException.java @@ -0,0 +1,21 @@ +package com.writely.auth.domain.enums; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum AuthException implements CodeInfo { + ACCESS_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-001", "액세스 토큰이 유효하지 않습니다."), + REFRESH_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-002", "리프레시 토큰이 유효하지 않습니다."), + JOIN_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-101", "가입 토큰이 유효하지 않습니다."), + JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), + LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "로그인에 실패하였습니다."), + MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/auth/helper/JwtHelper.java b/src/main/java/com/writely/auth/helper/JwtHelper.java new file mode 100644 index 0000000..3e85c4b --- /dev/null +++ b/src/main/java/com/writely/auth/helper/JwtHelper.java @@ -0,0 +1,87 @@ +package com.writely.auth.helper; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.writely.auth.domain.JwtPayload; +import com.writely.common.util.CryptoUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.auth0.jwt.exceptions.JWTVerificationException; + +import java.io.IOException; +import java.time.Instant; + +@Component +public class JwtHelper { + private final Algorithm algorithm; + private final Long accessTokenExpirationPeriod; + private final Long refreshTokenExpirationPeriod; + private final Long joinTokenExpirationPeriod; + private final CryptoUtil cryptoUtil; + + public JwtHelper ( + @Value("${jwt.secret}") String secret, + @Value("${jwt.access-token-expiration-period}") Long accessTokenExpirationPeriod, + @Value("${jwt.refresh-token-expiration-period}") Long refreshTokenExpirationPeriod, + @Value("${jwt.join-token-expiration-period}") Long joinTokenExpirationPeriod, + @Autowired CryptoUtil cryptoUtil + ) { + this.algorithm = Algorithm.HMAC256(secret); + this.accessTokenExpirationPeriod = accessTokenExpirationPeriod; + this.refreshTokenExpirationPeriod = refreshTokenExpirationPeriod; + this.joinTokenExpirationPeriod = joinTokenExpirationPeriod; + this.cryptoUtil = cryptoUtil; + } + + public String generateAccessToken(JwtPayload payload) throws JsonProcessingException { + return generateJwt(this.accessTokenExpirationPeriod, payload); + } + + public String generateRefreshToken(JwtPayload payload) throws JsonProcessingException { + + return generateJwt(this.refreshTokenExpirationPeriod, payload); + } + + public String generateJoinToken(JwtPayload payload) throws JsonProcessingException { + + return generateJwt(this.joinTokenExpirationPeriod, payload); + } + + public JwtPayload getPayload(String token) throws JWTVerificationException { + try { + JWTVerifier verifier = JWT.require(algorithm).build(); + String payloadEncoded = verifier.verify(token).getPayload(); + byte[] payloadDecoded = cryptoUtil.decodeBase64(payloadEncoded); + + return new ObjectMapper().readValue(payloadDecoded, JwtPayload.class); + } catch (IOException ex) { + throw new JWTVerificationException("JwtPayload object mapping has failed."); + } + } + + public boolean isTokenValid(String token) { + try { + JWTVerifier verifier = JWT.require(algorithm).build(); + verifier.verify(token); + + return true; + } catch (JWTVerificationException ex) { + + return false; + } + } + + private String generateJwt(Long expPeriod, JwtPayload payload) throws JsonProcessingException { + String jsonPayload = new ObjectMapper().writeValueAsString(payload); + + return JWT.create() + .withPayload(jsonPayload) + .withExpiresAt(Instant.ofEpochSecond(Instant.now().getEpochSecond() + expPeriod)) + .withIssuedAt(Instant.now()) + .sign(algorithm); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/helper/MailHelper.java b/src/main/java/com/writely/auth/helper/MailHelper.java new file mode 100644 index 0000000..2fbb6e2 --- /dev/null +++ b/src/main/java/com/writely/auth/helper/MailHelper.java @@ -0,0 +1,29 @@ +package com.writely.auth.helper; + +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; +import lombok.RequiredArgsConstructor; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Component; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring6.SpringTemplateEngine; + +@Component +@RequiredArgsConstructor +public class MailHelper { + private final JavaMailSender javaMailSender; + private final SpringTemplateEngine templateEngine; + + public void send ( + String mailTo, String subject, String templatePath, Context variables + ) throws MessagingException { + MimeMessage mimeMessage = javaMailSender.createMimeMessage(); + MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, false, "UTF-8"); + mimeMessageHelper.setTo(mailTo); + mimeMessageHelper.setSubject(subject); + mimeMessageHelper.setText(templateEngine.process(templatePath, variables), true); + + javaMailSender.send(mimeMessage); + } +} diff --git a/src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java new file mode 100644 index 0000000..5cfc442 --- /dev/null +++ b/src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java @@ -0,0 +1,8 @@ +package com.writely.auth.repository; + +import com.writely.auth.domain.JoinToken; +import org.springframework.data.repository.CrudRepository; + +public interface JoinTokenRedisRepository extends CrudRepository { + +} diff --git a/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java new file mode 100644 index 0000000..da944aa --- /dev/null +++ b/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java @@ -0,0 +1,8 @@ +package com.writely.auth.repository; + +import com.writely.auth.domain.RefreshToken; +import org.springframework.data.repository.CrudRepository; + +public interface RefreshTokenRedisRepository extends CrudRepository { + +} diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/src/main/java/com/writely/auth/request/JoinRequest.java new file mode 100644 index 0000000..ea0bcf6 --- /dev/null +++ b/src/main/java/com/writely/auth/request/JoinRequest.java @@ -0,0 +1,24 @@ +package com.writely.auth.request; + +import com.writely.member.domain.Member; +import com.writely.member.domain.MemberPassword; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class JoinRequest { + @Schema(title = "이메일") + private String email; + + @Schema(title = "비밀번호") + private String password; + + @Schema(title = "실명") + private String realname; + + @Schema(title = "닉네임") + private String nickname; + +} diff --git a/src/main/java/com/writely/auth/request/JoinTokenRequest.java b/src/main/java/com/writely/auth/request/JoinTokenRequest.java new file mode 100644 index 0000000..f37719a --- /dev/null +++ b/src/main/java/com/writely/auth/request/JoinTokenRequest.java @@ -0,0 +1,13 @@ +package com.writely.auth.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Getter +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Builder +public class JoinTokenRequest { + @Schema(title = "회원가입 토큰") + private String joinToken; +} diff --git a/src/main/java/com/writely/auth/request/LoginRequest.java b/src/main/java/com/writely/auth/request/LoginRequest.java new file mode 100644 index 0000000..85f660c --- /dev/null +++ b/src/main/java/com/writely/auth/request/LoginRequest.java @@ -0,0 +1,15 @@ +package com.writely.auth.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class LoginRequest { + @Schema(title = "이메일") + private String email; + + @Schema(title = "비밀번호") + private String password; +} diff --git a/src/main/java/com/writely/auth/request/ReissueRequest.java b/src/main/java/com/writely/auth/request/ReissueRequest.java new file mode 100644 index 0000000..b281703 --- /dev/null +++ b/src/main/java/com/writely/auth/request/ReissueRequest.java @@ -0,0 +1,13 @@ +package com.writely.auth.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ReissueRequest { + @Schema(title = "리프래시 토큰") + private String refreshToken; + +} diff --git a/src/main/java/com/writely/auth/response/AuthTokenResponse.java b/src/main/java/com/writely/auth/response/AuthTokenResponse.java new file mode 100644 index 0000000..828334b --- /dev/null +++ b/src/main/java/com/writely/auth/response/AuthTokenResponse.java @@ -0,0 +1,20 @@ +package com.writely.auth.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + + +@Getter +@Setter +public class AuthTokenResponse { + @Schema(title = "액세스 토큰") + private final String accessToken; + @Schema(title = "리프레시 토큰") + private final String refreshToken; + + public AuthTokenResponse(String accessToken, String refreshToken) { + this.accessToken = accessToken; + this.refreshToken = refreshToken; + } +} diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java new file mode 100644 index 0000000..d4cfde4 --- /dev/null +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -0,0 +1,151 @@ +package com.writely.auth.service; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.writely.auth.domain.JoinToken; +import com.writely.auth.domain.JwtPayload; +import com.writely.auth.domain.enums.AuthException; +import com.writely.auth.helper.JwtHelper; +import com.writely.auth.helper.MailHelper; +import com.writely.auth.repository.JoinTokenRedisRepository; +import com.writely.auth.request.JoinRequest; +import com.writely.auth.request.JoinTokenRequest; +import com.writely.auth.request.LoginRequest; +import com.writely.auth.request.ReissueRequest; +import com.writely.auth.response.AuthTokenResponse; +import com.writely.common.enums.code.ResultCodeInfo; +import com.writely.common.exception.BaseException; +import com.writely.common.util.CryptoUtil; +import com.writely.member.domain.Member; +import com.writely.member.domain.MemberPassword; +import com.writely.member.repository.MemberPasswordJpaRepository; +import com.writely.member.repository.MemberJpaRepository; +import jakarta.mail.MessagingException; +import jakarta.transaction.Transactional; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; + +import java.security.GeneralSecurityException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +@Transactional +@Slf4j +public class AuthCommandService { + private final MemberJpaRepository memberJpaRepository; + private final MemberPasswordJpaRepository memberPasswordJpaRepository; + private final JoinTokenRedisRepository joinTokenRedisRepository; + private final JwtHelper jwtHelper; + private final MailHelper mailHelper; + private final CryptoUtil cryptoUtil; + private final String salt = "test"; // todo: salt 처리 + + // 토큰 재발급 + public AuthTokenResponse reissueToken(ReissueRequest request) { + // 토큰이 비유효하면 + if (!jwtHelper.isTokenValid(request.getRefreshToken())) { + throw new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID); + } + + JwtPayload payload = jwtHelper.getPayload(request.getRefreshToken()); + return generateAuthTokens(payload.getMemberId()); + } + + // 로그인 + public AuthTokenResponse login(LoginRequest request) { + String passwordHash; + try { + passwordHash = cryptoUtil.hash(request.getPassword(), this.salt); + } catch (Exception ex) { + throw new BaseException(ResultCodeInfo.FAILURE); + } + + MemberPassword memberPassword = memberPasswordJpaRepository.findByPassword(passwordHash) + .orElseThrow(() -> new BaseException(AuthException.LOGIN_FAILED)); + + return generateAuthTokens(memberPassword.getMemberId()); + } + + // 회원가입 + public void join(JoinRequest request) { + + // 이미 있는 회원인지 검사 + if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { + throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); + } + + try { + String passwordHash = cryptoUtil.hash(request.getPassword(), this.salt); + Member member = Member.builder() + .email(request.getEmail()) + .realname(request.getRealname()) + .nickname(request.getNickname()) + .build(); + MemberPassword memberPassword = MemberPassword.builder() + .memberId(member.getId()) + .password(passwordHash) + .build(); + String jwtString = jwtHelper.generateJoinToken( + JwtPayload.builder().memberId(member.getId()).build() + ); + // joinToken redis 저장 + JoinToken joinToken = new JoinToken(jwtString, member, memberPassword); + joinTokenRedisRepository.save(joinToken); + + // 이메일 전송 + Context emailCtx = new Context(); + emailCtx.setVariable("joinToken", joinToken.getTokenString()); + + mailHelper.send( + request.getEmail(), + "[WritelyForWriters] 회원가입 안내입니다.", + "mail/join", + emailCtx + ); // todo: 메일 디자인 + } catch (JsonProcessingException | GeneralSecurityException ex) { + throw new BaseException(ResultCodeInfo.FAILURE); + } catch (MessagingException e) { + throw new BaseException(AuthException.MAIL_SEND_FAILED); + } + + } + + // 회원가입 완료 + public AuthTokenResponse completeJoin(JoinTokenRequest request) { + final String joinTokenString = request.getJoinToken(); + + // 토큰이 비유효한 경우 + if (!jwtHelper.isTokenValid(joinTokenString)) { + throw new BaseException(AuthException.JOIN_TOKEN_NOT_VALID); + } + + // 토큰 조회 + JoinToken joinToken = joinTokenRedisRepository.findById(joinTokenString) + .orElseThrow(() -> new BaseException(AuthException.JOIN_TOKEN_NOT_VALID)); + + // 가입 완료 처리 + memberJpaRepository.save(joinToken.getMember()); + memberPasswordJpaRepository.save(joinToken.getMemberPassword()); + + return generateAuthTokens(joinToken.getMember().getId()); + } + + // 인증 토큰 생성 + public AuthTokenResponse generateAuthTokens(UUID memberId) { + try { + JwtPayload jwtPayload = JwtPayload.builder() + .memberId(memberId) + .build(); + String accessToken = jwtHelper.generateAccessToken(jwtPayload); + String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); + + return new AuthTokenResponse(accessToken, refreshToken); + } catch (JsonProcessingException ex) { + ex.printStackTrace(); + + throw new BaseException(ResultCodeInfo.FAILURE); + } + } +} diff --git a/src/main/java/com/writely/auth/service/AuthQueryService.java b/src/main/java/com/writely/auth/service/AuthQueryService.java new file mode 100644 index 0000000..d8a31ee --- /dev/null +++ b/src/main/java/com/writely/auth/service/AuthQueryService.java @@ -0,0 +1,8 @@ +package com.writely.auth.service; + +import org.springframework.stereotype.Service; + +@Service +public class AuthQueryService { + +} diff --git a/src/main/java/com/writely/common/util/CryptoUtil.java b/src/main/java/com/writely/common/util/CryptoUtil.java new file mode 100644 index 0000000..50fd99f --- /dev/null +++ b/src/main/java/com/writely/common/util/CryptoUtil.java @@ -0,0 +1,89 @@ +package com.writely.common.util; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.GeneralSecurityException; +import java.security.MessageDigest; +import java.util.Base64; + +@Component +public class CryptoUtil { + /** + * Encrypt / Decrypt + */ + private static final String CRYPT_ALGO = "AES"; + private static final String CRYPT_MODE = "CBC"; + private static final String CRYPT_PADDING = "PKCS5Padding"; + + @Value("${crypto.secret}") + private String SECRET; + @Value("${crypto.iv}") + private String IV; + + public String encrypt(String plainText) throws GeneralSecurityException { + SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET.getBytes(), CRYPT_ALGO); + IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes()); + + Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivSpec); + + byte[] cipherText = cipher.doFinal(plainText.getBytes()); + + return encodeBase64(cipherText); + } + + public String decrypt(String cipherText) throws GeneralSecurityException { + SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET.getBytes(), CRYPT_ALGO); + IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes()); + + Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivSpec); + + byte[] decoded = decodeBase64(cipherText); + byte[] plainText = cipher.doFinal(decoded); + + return new String(plainText); + } + + /** + * Hashing + */ + private static final String HASH_ALGO = "SHA-256"; + private static final Integer HASH_ROUND = 3; + + public String hash(String plainText, String salt) throws GeneralSecurityException { + return hash(plainText + salt, HASH_ROUND); + } + + private String hash(String hashText, Integer rounds) throws GeneralSecurityException { + if (rounds == 0) return hashText; + + MessageDigest md = MessageDigest.getInstance(HASH_ALGO); + md.update((hashText).getBytes()); + + return hash(bytesToHex(md.digest()), --rounds); + } + + private String bytesToHex(byte[] bytes) { + StringBuilder builder = new StringBuilder(); + for (byte b : bytes) { + builder.append(String.format("%02x", b)); + } + return builder.toString(); + } + + /** + * encode / decode + */ + public String encodeBase64(byte[] bytes) { + return Base64.getEncoder().encodeToString(bytes); + } + + public byte[] decodeBase64(String encodedStr) { + return Base64.getDecoder().decode(encodedStr.getBytes()); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/member/domain/Member.java b/src/main/java/com/writely/member/domain/Member.java new file mode 100644 index 0000000..6390a76 --- /dev/null +++ b/src/main/java/com/writely/member/domain/Member.java @@ -0,0 +1,36 @@ +package com.writely.member.domain; + +import com.writely.common.domain.BaseTimeEntity; +import jakarta.persistence.*; +import lombok.*; +import org.springframework.data.redis.core.RedisHash; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Builder +@AllArgsConstructor +@Table(name = "member") +public class Member extends BaseTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + @Builder.Default + private UUID id = UUID.randomUUID(); + + @Column(nullable = false) + private String email; + + @Column(nullable = false) + private String realname; + + @Column(nullable = false) + private String nickname; + + @Column(name = "profile_image") + private String profileImage; + +} diff --git a/src/main/java/com/writely/member/domain/MemberPassword.java b/src/main/java/com/writely/member/domain/MemberPassword.java new file mode 100644 index 0000000..bc05f0d --- /dev/null +++ b/src/main/java/com/writely/member/domain/MemberPassword.java @@ -0,0 +1,24 @@ +package com.writely.member.domain; + +import com.writely.common.domain.BaseTimeEntity; +import jakarta.persistence.*; +import lombok.*; +import org.springframework.data.redis.core.RedisHash; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +@Table(name = "member_password") +public class MemberPassword extends BaseTimeEntity { + @Id + @Column(name = "member_id") + private UUID memberId; + + @Column(nullable = false) + private String password; +} diff --git a/src/main/java/com/writely/member/repository/MemberJpaRepository.java b/src/main/java/com/writely/member/repository/MemberJpaRepository.java new file mode 100644 index 0000000..4da3732 --- /dev/null +++ b/src/main/java/com/writely/member/repository/MemberJpaRepository.java @@ -0,0 +1,11 @@ +package com.writely.member.repository; + +import com.writely.member.domain.Member; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; +import java.util.UUID; + +public interface MemberJpaRepository extends JpaRepository { + Optional findByEmail(String email); +} diff --git a/src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java b/src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java new file mode 100644 index 0000000..8249b62 --- /dev/null +++ b/src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java @@ -0,0 +1,11 @@ +package com.writely.member.repository; + +import com.writely.member.domain.MemberPassword; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; +import java.util.UUID; + +public interface MemberPasswordJpaRepository extends JpaRepository { + Optional findByPassword(String password); +} diff --git a/src/main/java/com/writely/product/repository/ProductCharacterRepository.java b/src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java similarity index 65% rename from src/main/java/com/writely/product/repository/ProductCharacterRepository.java rename to src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java index eb0e15f..2d7f120 100644 --- a/src/main/java/com/writely/product/repository/ProductCharacterRepository.java +++ b/src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductCharacterRepository extends JpaRepository { +public interface ProductCharacterJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java b/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java similarity index 65% rename from src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java rename to src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java index 4c5a6ff..45888c1 100644 --- a/src/main/java/com/writely/product/repository/ProductCustomFieldRepository.java +++ b/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductCustomFieldRepository extends JpaRepository { +public interface ProductCustomFieldJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java b/src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java rename to src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java index 20b45f4..ee0d145 100644 --- a/src/main/java/com/writely/product/repository/ProductIdeaNoteRepository.java +++ b/src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductIdeaNoteRepository extends JpaRepository { +public interface ProductIdeaNoteJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductRepository.java b/src/main/java/com/writely/product/repository/ProductJpaRepository.java similarity index 69% rename from src/main/java/com/writely/product/repository/ProductRepository.java rename to src/main/java/com/writely/product/repository/ProductJpaRepository.java index d09e0bb..7807d35 100644 --- a/src/main/java/com/writely/product/repository/ProductRepository.java +++ b/src/main/java/com/writely/product/repository/ProductJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductRepository extends JpaRepository { +public interface ProductJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductMemoRepository.java b/src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java similarity index 67% rename from src/main/java/com/writely/product/repository/ProductMemoRepository.java rename to src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java index 75029db..c4e24f3 100644 --- a/src/main/java/com/writely/product/repository/ProductMemoRepository.java +++ b/src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductMemoRepository extends JpaRepository { +public interface ProductMemoJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductPlotRepository.java b/src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java similarity index 67% rename from src/main/java/com/writely/product/repository/ProductPlotRepository.java rename to src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java index ef92617..aa75dbc 100644 --- a/src/main/java/com/writely/product/repository/ProductPlotRepository.java +++ b/src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductPlotRepository extends JpaRepository { +public interface ProductPlotJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductSynopsisRepository.java b/src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductSynopsisRepository.java rename to src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java index 47f059b..ddba930 100644 --- a/src/main/java/com/writely/product/repository/ProductSynopsisRepository.java +++ b/src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductSynopsisRepository extends JpaRepository { +public interface ProductSynopsisJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/repository/ProductWorldviewRepository.java b/src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java similarity index 65% rename from src/main/java/com/writely/product/repository/ProductWorldviewRepository.java rename to src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java index 9ead019..141d374 100644 --- a/src/main/java/com/writely/product/repository/ProductWorldviewRepository.java +++ b/src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java @@ -5,5 +5,5 @@ import java.util.UUID; -public interface ProductWorldviewRepository extends JpaRepository { +public interface ProductWorldviewJpaRepository extends JpaRepository { } diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index 38def8b..0929654 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -20,14 +20,14 @@ public class ProductCommandService { private final ProductQueryService productQueryService; - private final ProductRepository productRepository; - private final ProductCharacterRepository productCharacterRepository; - private final ProductCustomFieldRepository productCustomFieldRepository; - private final ProductIdeaNoteRepository productIdeaNoteRepository; - private final ProductMemoRepository productMemoRepository; - private final ProductPlotRepository productPlotRepository; - private final ProductSynopsisRepository productSynopsisRepository; - private final ProductWorldviewRepository productWorldviewRepository; + private final ProductJpaRepository productRepository; + private final ProductCharacterJpaRepository productCharacterJpaRepository; + private final ProductCustomFieldJpaRepository productCustomFieldJpaRepository; + private final ProductIdeaNoteJpaRepository productIdeaNoteRepository; + private final ProductMemoJpaRepository productMemoRepository; + private final ProductPlotJpaRepository productPlotRepository; + private final ProductSynopsisJpaRepository productSynopsisRepository; + private final ProductWorldviewJpaRepository productWorldviewRepository; @Transactional public UUID create() { @@ -88,7 +88,7 @@ private void modifyCharacters(Product product, List savedCharacterMap = product.getCharacters().stream() .collect(Collectors.toMap(ProductCharacter::getId, Function.identity())); if (characters.isEmpty()) { - productCharacterRepository.deleteAll(savedCharacterMap.values()); + productCharacterJpaRepository.deleteAll(savedCharacterMap.values()); return; } @@ -101,7 +101,7 @@ private void modifyCharacters(Product product, List !modifyIds.contains(e.getId())) .toList(); - productCharacterRepository.deleteAll(deleteCharacters); + productCharacterJpaRepository.deleteAll(deleteCharacters); List addCharacters = new ArrayList<>(); characters.forEach(e -> { @@ -118,14 +118,14 @@ private void modifyCharacters(Product product, List customFields) { Map savedCustomFieldMap = product.getCustomFields().stream() .collect(Collectors.toMap(ProductCustomField::getId, Function.identity())); if (customFields.isEmpty()) { - productCustomFieldRepository.deleteAll(savedCustomFieldMap.values()); + productCustomFieldJpaRepository.deleteAll(savedCustomFieldMap.values()); return; } @@ -138,7 +138,7 @@ private void modifyCustomFields(Product product, List !modifyIds.contains(e.getId())) .toList(); - productCustomFieldRepository.deleteAll(deleteCharacters); + productCustomFieldJpaRepository.deleteAll(deleteCharacters); List addCustomFields = new ArrayList<>(); customFields.forEach(e -> { @@ -154,7 +154,7 @@ private void modifyCustomFields(Product product, List + + +
+

Hello

+
+

ch pw us

+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/mail/join.html b/src/main/resources/templates/mail/join.html new file mode 100644 index 0000000..de66ff0 --- /dev/null +++ b/src/main/resources/templates/mail/join.html @@ -0,0 +1,13 @@ + + + +
+

Hello

+
+

join us

+
+
+
+
+ + \ No newline at end of file From cf38d773f6001d6ff796e3e8346d8d83827b9f1b Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 27 Jan 2025 00:21:42 +0900 Subject: [PATCH 013/107] feat: discord error log appender (#11) --- BE-secret | 2 +- build.gradle | 3 + .../com/writely/HealthCheckController.java | 12 +- .../common/config/WebClientConfig.java | 14 ++ .../com/writely/common/config/WebConfig.java | 2 +- .../common/discord/DiscordLogAppender.java | 119 +++++++++++++++++ .../common/discord/DiscordWebHook.java | 120 ++++++++++++++++++ .../common/discord/model/EmbedObject.java | 42 ++++++ .../writely/common/discord/model/Field.java | 17 +++ .../common/discord/model/JsonObject.java | 55 ++++++++ .../exception/InternalServerException.java | 17 +++ .../exception/GlobalExceptionHandler.java | 1 + .../com/writely/common/filter/MDCFilter.java | 30 +++++ .../writely/common/util/HttpRequestUtil.java | 61 +++++++++ .../java/com/writely/common/util/MDCUtil.java | 43 +++++++ .../com/writely/common/util/StringUtil.java | 84 ++++++++++++ src/main/resources/logback-spring.xml | 7 + 17 files changed, 624 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/writely/common/config/WebClientConfig.java create mode 100644 src/main/java/com/writely/common/discord/DiscordLogAppender.java create mode 100644 src/main/java/com/writely/common/discord/DiscordWebHook.java create mode 100644 src/main/java/com/writely/common/discord/model/EmbedObject.java create mode 100644 src/main/java/com/writely/common/discord/model/Field.java create mode 100644 src/main/java/com/writely/common/discord/model/JsonObject.java create mode 100644 src/main/java/com/writely/common/enums/exception/InternalServerException.java create mode 100644 src/main/java/com/writely/common/filter/MDCFilter.java create mode 100644 src/main/java/com/writely/common/util/HttpRequestUtil.java create mode 100644 src/main/java/com/writely/common/util/MDCUtil.java create mode 100644 src/main/java/com/writely/common/util/StringUtil.java diff --git a/BE-secret b/BE-secret index aa7b52d..d2a6d51 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit aa7b52d15a5f8d2aba829bdc8296c1e8d41eb94c +Subproject commit d2a6d513f1cf90bcbb3002985c4d2b0a8d0f9a17 diff --git a/build.gradle b/build.gradle index 1eb95f9..5f7c190 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ jar { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-webflux' /* DB */ runtimeOnly 'org.postgresql:postgresql' @@ -58,6 +59,8 @@ dependencies { /* Swagger */ implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' + + implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64' } task copySecret(type: Copy) { diff --git a/src/main/java/com/writely/HealthCheckController.java b/src/main/java/com/writely/HealthCheckController.java index 15acd33..543f087 100644 --- a/src/main/java/com/writely/HealthCheckController.java +++ b/src/main/java/com/writely/HealthCheckController.java @@ -1,9 +1,11 @@ package com.writely; -import com.writely.common.response.BaseResponse; +import com.writely.common.enums.exception.ParameterException; +import com.writely.common.exception.BaseException; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController @@ -12,7 +14,11 @@ public class HealthCheckController { @GetMapping - public BaseResponse healthCheck() { - return BaseResponse.success(); + public void healthCheck() { + } + + @GetMapping("/error") + public void error(@RequestParam String id) { + throw new BaseException(ParameterException.PARAMETER_INVALID); } } diff --git a/src/main/java/com/writely/common/config/WebClientConfig.java b/src/main/java/com/writely/common/config/WebClientConfig.java new file mode 100644 index 0000000..e65827c --- /dev/null +++ b/src/main/java/com/writely/common/config/WebClientConfig.java @@ -0,0 +1,14 @@ +package com.writely.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.function.client.WebClient; + +@Configuration +public class WebClientConfig { + + @Bean + public WebClient.Builder webClientBuilder() { + return WebClient.builder(); + } +} diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java index 163ca3d..1e42490 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -1,4 +1,4 @@ -package com.writely.common.config; + package com.writely.common.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/writely/common/discord/DiscordLogAppender.java b/src/main/java/com/writely/common/discord/DiscordLogAppender.java new file mode 100644 index 0000000..3bfa9d9 --- /dev/null +++ b/src/main/java/com/writely/common/discord/DiscordLogAppender.java @@ -0,0 +1,119 @@ +package com.writely.common.discord; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.IThrowableProxy; +import ch.qos.logback.classic.spi.ThrowableProxyUtil; +import ch.qos.logback.core.UnsynchronizedAppenderBase; +import com.writely.common.discord.model.EmbedObject; +import com.writely.common.enums.exception.InternalServerException; +import com.writely.common.exception.BaseException; +import com.writely.common.util.MDCUtil; +import lombok.Setter; +import org.springframework.context.annotation.Profile; + +import java.awt.*; +import java.time.LocalDateTime; +import java.util.Map; + +@Setter +@Profile("!local") +public class DiscordLogAppender extends UnsynchronizedAppenderBase { + + private String webhookUrl; + + @Override + protected void append(ILoggingEvent event) { + if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { + sendErrorLog(event); + } + } + + public void sendErrorLog(ILoggingEvent event) { + DiscordWebHook discordWebhook = new DiscordWebHook(webhookUrl); + Map mdcPropertyMap = event.getMDCPropertyMap(); + Color messageColor = Color.red; + + String message = event.getMessage(); + + int newlineIndex = message.indexOf("\n"); + if (newlineIndex != -1) { + message = message.substring(0, newlineIndex).trim(); + } else { + message = "EXCEPTION 정보가 남지 않았습니다."; + } + + discordWebhook.addEmbed(new EmbedObject() + .setTitle("[에러 내용]") + .setColor(messageColor) + .setDescription(message) + .addField(MDCUtil.REQUEST_URI_MDC, mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC), true) + .addField("[오류 발생 시간]", LocalDateTime.now().toString(), true) + .addField(MDCUtil.REQUEST_IP_MDC, mdcPropertyMap.get(MDCUtil.REQUEST_IP_MDC), false) + .addField(MDCUtil.HEADER_MAP_MDC, + escapeJsonInternal(mdcPropertyMap.get(MDCUtil.HEADER_MAP_MDC)), + false) + .addField(MDCUtil.PARAMETER_MAP_MDC, + escapeJsonInternal(mdcPropertyMap.get(MDCUtil.PARAMETER_MAP_MDC)), + false)); + + IThrowableProxy throwable = event.getThrowableProxy(); + if (throwable != null) { + String exception = ThrowableProxyUtil.asString(throwable).substring(0, 3000); + discordWebhook.addEmbed(new EmbedObject() + .setTitle("[Exception 상세 내용]") + .setColor(messageColor) + .setDescription(escapeJsonInternal(exception)) + ); + } + + try { + discordWebhook.execute(); + } catch (Exception e) { + throw new BaseException(InternalServerException.DISCORD_APPENDER_FAIL); + } + } + + private String escapeJsonInternal(final String input) { + // 입력이 null이거나 빈 문자열인 경우 그대로 반환 + if (input == null || input.trim().isEmpty()) { + return ""; + } + + final StringBuilder builder = new StringBuilder(input.length() * 2); + for (int i = 0; i < input.length(); i++) { + final char ch = input.charAt(i); + switch (ch) { + case '"': + builder.append("\\\""); + break; + case '\\': + builder.append("\\\\"); + break; + case '\b': + builder.append("\\b"); + break; + case '\f': + builder.append("\\f"); + break; + case '\n': + builder.append("\\n"); + break; + case '\r': + builder.append("\\r"); + break; + case '\t': + builder.append("\\t"); + break; + default: + if (ch < ' ' || (ch >= '\u0080' && ch < '\u00a0') + || (ch >= '\u2000' && ch < '\u2100')) { + builder.append("\\u").append(Integer.toHexString(ch | 0x10000).substring(1)); + } else { + builder.append(ch); + } + } + } + return builder.toString(); + } +} diff --git a/src/main/java/com/writely/common/discord/DiscordWebHook.java b/src/main/java/com/writely/common/discord/DiscordWebHook.java new file mode 100644 index 0000000..51bf174 --- /dev/null +++ b/src/main/java/com/writely/common/discord/DiscordWebHook.java @@ -0,0 +1,120 @@ +package com.writely.common.discord; + +import com.writely.common.discord.model.EmbedObject; +import com.writely.common.discord.model.Field; +import com.writely.common.discord.model.JsonObject; +import com.writely.common.enums.exception.InternalServerException; +import com.writely.common.exception.BaseException; +import com.writely.common.util.LogUtil; +import org.springframework.web.reactive.function.client.WebClient; + +import java.awt.*; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +public class DiscordWebHook { + + private final String urlString; + private final List embeds = new ArrayList<>(); + private String username; + private String avatarUrl; + private boolean tts; + + public DiscordWebHook(String webhookUrl) { + this.urlString = webhookUrl; + } + + public void addEmbed(EmbedObject embed) { + this.embeds.add(embed); + } + + /** + * Discrod LogBack 메세지 전송 + */ + public void execute() { + if (this.embeds.isEmpty()) { + throw new BaseException(InternalServerException.DISCORD_APPENDER_FAIL); + } + + try { + WebClient.create(urlString) + .post() + .header("Content-Type", "application/json") + .header("User-Agent", "Java-DiscordWebhook-BY-Gelox_") + .bodyValue(createDiscordEmbedObject(this.embeds, initializerDiscordSendForJsonObject(new JsonObject())).toString().getBytes( + StandardCharsets.UTF_8)) + .retrieve() + .toBodilessEntity() + .subscribe((e) -> { + }, (error) -> { + LogUtil.info("Discord Appender Fail: " + error.getLocalizedMessage()); + }); + } catch (Exception e) { + LogUtil.info("Discord Appender Fail: " + e.getLocalizedMessage()); + } + } + + private JsonObject initializerDiscordSendForJsonObject(JsonObject json) { + json.put("username", this.username); + json.put("avatar_url", this.avatarUrl); + json.put("tts", this.tts); + return json; + } + + private JsonObject createDiscordEmbedObject(List embeds, JsonObject json) { + if (embeds.isEmpty()) { + throw new BaseException(InternalServerException.DISCORD_APPENDER_FAIL); + } + + List embedObjects = new ArrayList<>(); + + for (EmbedObject embed : embeds) { + JsonObject jsonEmbed = new JsonObject(); + + jsonEmbed.put("title", embed.getTitle()); + jsonEmbed.put("description", embed.getDescription()); + jsonEmbed.put("url", embed.getUrl()); + + setEmbedColor(embed, jsonEmbed); + setEmbedMessageFields(embed.getFields(), jsonEmbed); + + embedObjects.add(jsonEmbed); + } + json.put("embeds", embedObjects.toArray()); + return json; + } + + /** + * Embed 메세지 테두리 색상 설정 + */ + private void setEmbedColor(EmbedObject embed, JsonObject jsonEmbed) { + if (embed.getColor() != null) { + Color color = embed.getColor(); + int rgb = color.getRed(); + rgb = (rgb << 8) + color.getGreen(); + rgb = (rgb << 8) + color.getBlue(); + + jsonEmbed.put("color", rgb); + } + } + + /** + * 텍스트 필드 목록 설정 + */ + private void setEmbedMessageFields(List fields, JsonObject jsonEmbed) { + List jsonFields = new ArrayList<>(); + + for (Field field : fields) { + JsonObject jsonField = new JsonObject(); + + jsonField.put("name", field.getName()); + jsonField.put("value", field.getValue()); + jsonField.put("inline", field.isInline()); + + jsonFields.add(jsonField); + } + + jsonEmbed.put("fields", jsonFields.toArray()); + } +} diff --git a/src/main/java/com/writely/common/discord/model/EmbedObject.java b/src/main/java/com/writely/common/discord/model/EmbedObject.java new file mode 100644 index 0000000..ac2178d --- /dev/null +++ b/src/main/java/com/writely/common/discord/model/EmbedObject.java @@ -0,0 +1,42 @@ +package com.writely.common.discord.model; + +import lombok.Getter; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +@Getter +public class EmbedObject { + + private final List fields = new ArrayList<>(); + private String title; + private String description; + private String url; + private Color color; + + public EmbedObject setTitle(String title) { + this.title = title; + return this; + } + + public EmbedObject setDescription(String description) { + this.description = description; + return this; + } + + public EmbedObject setUrl(String url) { + this.url = url; + return this; + } + + public EmbedObject setColor(Color color) { + this.color = color; + return this; + } + + public EmbedObject addField(String name, String value, boolean inline) { + this.fields.add(new Field(name, value, inline)); + return this; + } +} diff --git a/src/main/java/com/writely/common/discord/model/Field.java b/src/main/java/com/writely/common/discord/model/Field.java new file mode 100644 index 0000000..8fafb6e --- /dev/null +++ b/src/main/java/com/writely/common/discord/model/Field.java @@ -0,0 +1,17 @@ +package com.writely.common.discord.model; + +import lombok.Getter; + +@Getter +public class Field { + + private final String name; + private final String value; + private final boolean inline; + + public Field(String name, String value, boolean inline) { + this.name = name; + this.value = value; + this.inline = inline; + } +} diff --git a/src/main/java/com/writely/common/discord/model/JsonObject.java b/src/main/java/com/writely/common/discord/model/JsonObject.java new file mode 100644 index 0000000..72f4ffe --- /dev/null +++ b/src/main/java/com/writely/common/discord/model/JsonObject.java @@ -0,0 +1,55 @@ +package com.writely.common.discord.model; + +import java.lang.reflect.Array; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class JsonObject { + + private final HashMap discordMessageMap = new HashMap<>(); + + public void put(String key, Object value) { + if (value != null) { + discordMessageMap.put(key, value); + } + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + Set> entrySet = discordMessageMap.entrySet(); + builder.append("{"); + + int iter = 0; + for (Map.Entry entry : entrySet) { + Object val = entry.getValue(); + builder.append(quote(entry.getKey())).append(":"); + + if (val instanceof String) { + builder.append(quote(String.valueOf(val))); + } else if (val instanceof Integer) { + builder.append(Integer.valueOf(String.valueOf(val))); + } else if (val instanceof Boolean) { + builder.append(val); + } else if (val instanceof JsonObject) { + builder.append(val); + } else if (val.getClass().isArray()) { + builder.append("["); + int len = Array.getLength(val); + for (int j = 0; j < len; j++) { + builder.append(Array.get(val, j).toString()).append(j != len - 1 ? "," : ""); + } + builder.append("]"); + } + + builder.append(++iter == entrySet.size() ? "}" : ","); + } + + return builder.toString(); + } + + private String quote(String string) { + return "\"" + string + "\""; + } +} diff --git a/src/main/java/com/writely/common/enums/exception/InternalServerException.java b/src/main/java/com/writely/common/enums/exception/InternalServerException.java new file mode 100644 index 0000000..1d8d8cb --- /dev/null +++ b/src/main/java/com/writely/common/enums/exception/InternalServerException.java @@ -0,0 +1,17 @@ +package com.writely.common.enums.exception; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum InternalServerException implements CodeInfo { + + DISCORD_APPENDER_FAIL(HttpStatus.INTERNAL_SERVER_ERROR, "SERVER-001", "Discord WebHook에 실패했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 5e48315..371c4c2 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -24,6 +24,7 @@ public ResponseEntity> handle(Exception e) { return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); } + LogUtil.error(getStackTrace(e)); CodeInfo codeInfo = ((BaseException) e).getCodeInfo(); BaseResponse response = BaseResponse.failure(codeInfo); return new ResponseEntity<>(response, codeInfo.getStatus()); diff --git a/src/main/java/com/writely/common/filter/MDCFilter.java b/src/main/java/com/writely/common/filter/MDCFilter.java new file mode 100644 index 0000000..97ceaf6 --- /dev/null +++ b/src/main/java/com/writely/common/filter/MDCFilter.java @@ -0,0 +1,30 @@ +package com.writely.common.filter; + +import com.writely.common.util.HttpRequestUtil; +import com.writely.common.util.MDCUtil; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import java.io.IOException; +import java.util.Objects; + +@Profile("!local") +@Component +public class MDCFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { + MDCUtil.set(MDCUtil.REQUEST_URI_MDC, + HttpRequestUtil.getRequestMethod(request) + " " + HttpRequestUtil.getRequestUri(request)); + MDCUtil.set(MDCUtil.REQUEST_IP_MDC, HttpRequestUtil.getUserIP(Objects.requireNonNull(request))); + MDCUtil.setJsonValue(MDCUtil.HEADER_MAP_MDC, HttpRequestUtil.getHeaderMap(request)); + MDCUtil.setJsonValue(MDCUtil.PARAMETER_MAP_MDC, HttpRequestUtil.getParamMap(request)); + + chain.doFilter(request, response); + } +} diff --git a/src/main/java/com/writely/common/util/HttpRequestUtil.java b/src/main/java/com/writely/common/util/HttpRequestUtil.java new file mode 100644 index 0000000..d3d8b17 --- /dev/null +++ b/src/main/java/com/writely/common/util/HttpRequestUtil.java @@ -0,0 +1,61 @@ +package com.writely.common.util; + +import jakarta.servlet.http.HttpServletRequest; +import lombok.experimental.UtilityClass; +import org.springframework.util.StringUtils; + +import java.util.HashMap; +import java.util.Map; + +@UtilityClass +public class HttpRequestUtil { + + public String getRequestUri(HttpServletRequest request) { + return request.getRequestURI(); + } + + public String getRequestMethod(HttpServletRequest request) { + return request.getMethod(); + } + + public static Map getParamMap(HttpServletRequest request) { + Map paramMap = new HashMap<>(); + request.getParameterNames().asIterator() + .forEachRemaining(name -> paramMap.put(name, request.getParameter(name))); + return paramMap; + } + + public static Map getHeaderMap(HttpServletRequest request) { + Map headerMap = new HashMap<>(); + request.getHeaderNames().asIterator() + .forEachRemaining(name -> { + if (!name.equals("user-agent")) { + headerMap.put(name, request.getHeader(name)); + } + }); + return headerMap; + } + + public static String getUserIP(HttpServletRequest httpReq) { + String clientIp = httpReq.getHeader("X-Forwarded-For"); + if (!StringUtils.hasText(clientIp) || "unknown".equalsIgnoreCase(clientIp)) { + // Proxy 서버인 경우 + clientIp = httpReq.getHeader("Proxy-Client-IP"); + } + if (!StringUtils.hasText(clientIp) || "unknown".equalsIgnoreCase(clientIp)) { + // WebLogic 서버인 경우 + clientIp = httpReq.getHeader("WL-Proxy-Client-IP"); + } + if (!StringUtils.hasText(clientIp) || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = httpReq.getHeader("HTTP_CLIENT_IP"); + } + if (!StringUtils.hasText(clientIp) || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = httpReq.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (!StringUtils.hasText(clientIp) || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = httpReq.getRemoteAddr(); + } + String[] clientIpList = clientIp.split(","); + return clientIpList[0]; + } +} diff --git a/src/main/java/com/writely/common/util/MDCUtil.java b/src/main/java/com/writely/common/util/MDCUtil.java new file mode 100644 index 0000000..0dbd98b --- /dev/null +++ b/src/main/java/com/writely/common/util/MDCUtil.java @@ -0,0 +1,43 @@ +package com.writely.common.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.experimental.UtilityClass; +import org.slf4j.MDC; +import org.slf4j.spi.MDCAdapter; + +@UtilityClass +public class MDCUtil { + + public static final String REQUEST_URI_MDC = "[요청 URI]"; + public static final String REQUEST_IP_MDC = "[요청 IP]"; + public static final String HEADER_MAP_MDC = "[Http Header 정보]"; + public static final String PARAMETER_MAP_MDC = "[Parameter 정보]"; + public static final String BODY_MDC = "[Http Body 정보]"; + + private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final MDCAdapter mdc = MDC.getMDCAdapter(); + + public String get(String key) { + return mdc.get(key); + } + + public void set(String key, String value) { + mdc.put(key, value); + } + + public static void setJsonValue(String key, Object value) { + try { + if (value != null) { + String json = objectMapper.writerWithDefaultPrettyPrinter() + .writeValueAsString(value); + mdc.put(key, json); + + } else { + mdc.put(key, "내용 없음"); + } + + } catch (Exception e) { +// + } + } +} diff --git a/src/main/java/com/writely/common/util/StringUtil.java b/src/main/java/com/writely/common/util/StringUtil.java new file mode 100644 index 0000000..bc869a0 --- /dev/null +++ b/src/main/java/com/writely/common/util/StringUtil.java @@ -0,0 +1,84 @@ +package com.writely.common.util; + +import lombok.experimental.UtilityClass; + +@UtilityClass +public class StringUtil { + + public String translateEscapes(String str) { + if (str.isEmpty()) { + return ""; + } + char[] chars = str.toCharArray(); + int length = chars.length; + int from = 0; + int to = 0; + while (from < length) { + char ch = chars[from++]; + if (ch == '\\') { + ch = from < length ? chars[from++] : '\0'; + switch (ch) { + case 'b': + ch = '\b'; + break; + case 'f': + ch = '\f'; + break; + case 'n': + ch = '\n'; + break; + case 'r': + ch = '\r'; + break; + case 's': + ch = ' '; + break; + case 't': + ch = '\t'; + break; + case '\'': + case '\"': + case '\\': + // as is + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + int limit = Integer.min(from + (ch <= '3' ? 2 : 1), length); + int code = ch - '0'; + while (from < limit) { + ch = chars[from]; + if (ch < '0' || '7' < ch) { + break; + } + from++; + code = (code << 3) | (ch - '0'); + } + ch = (char)code; + break; + case '\n': + continue; + case '\r': + if (from < length && chars[from] == '\n') { + from++; + } + continue; + default: { + String msg = String.format( + "Invalid escape sequence: \\%c \\\\u%04X", + ch, (int)ch); + throw new IllegalArgumentException(msg); + } + } + } + + chars[to++] = ch; + } + return new String(chars, 0, to); + } +} diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index f6a3cb1..8311eab 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -25,6 +25,7 @@ + @@ -68,11 +69,17 @@ + + + ${DISCORD_WEBHOOK_URL} + + + From 25fe7dd544f7e90c7af329344114fb28d321352a Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:28:33 +0900 Subject: [PATCH 014/107] =?UTF-8?q?fix:=20=EC=A1=B4=EC=9E=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20api=20=EA=B2=BD=EB=A1=9C=EB=A7=8C=20error=20log=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 12 +-------- .../common/discord/DiscordLogAppender.java | 26 +++++++++---------- .../com/writely/common/filter/MDCFilter.java | 4 +-- .../java/com/writely/common/util/MDCUtil.java | 1 + 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 0f123f7..bd5659b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -5,7 +5,7 @@ on: branches: [ "develop", "stage", "main" ] jobs: - build: + build-test: runs-on: ubuntu-latest steps: - name: checkout @@ -17,15 +17,5 @@ jobs: java-version: '21' distribution: 'temurin' - - name: Gradle Caching - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - name: Build with Gradle run: chmod +x gradlew && ./gradlew build -x test \ No newline at end of file diff --git a/src/main/java/com/writely/common/discord/DiscordLogAppender.java b/src/main/java/com/writely/common/discord/DiscordLogAppender.java index 3bfa9d9..68982c5 100644 --- a/src/main/java/com/writely/common/discord/DiscordLogAppender.java +++ b/src/main/java/com/writely/common/discord/DiscordLogAppender.java @@ -2,8 +2,6 @@ import ch.qos.logback.classic.Level; import ch.qos.logback.classic.spi.ILoggingEvent; -import ch.qos.logback.classic.spi.IThrowableProxy; -import ch.qos.logback.classic.spi.ThrowableProxyUtil; import ch.qos.logback.core.UnsynchronizedAppenderBase; import com.writely.common.discord.model.EmbedObject; import com.writely.common.enums.exception.InternalServerException; @@ -15,6 +13,7 @@ import java.awt.*; import java.time.LocalDateTime; import java.util.Map; +import java.util.regex.Pattern; @Setter @Profile("!local") @@ -32,8 +31,13 @@ protected void append(ILoggingEvent event) { public void sendErrorLog(ILoggingEvent event) { DiscordWebHook discordWebhook = new DiscordWebHook(webhookUrl); Map mdcPropertyMap = event.getMDCPropertyMap(); - Color messageColor = Color.red; + String requestUri = mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC); + if (!Pattern.matches("/products/.*|/auth/.*|/health-check/.*", requestUri)) { + return; + } + + Color messageColor = Color.red; String message = event.getMessage(); int newlineIndex = message.indexOf("\n"); @@ -47,7 +51,7 @@ public void sendErrorLog(ILoggingEvent event) { .setTitle("[에러 내용]") .setColor(messageColor) .setDescription(message) - .addField(MDCUtil.REQUEST_URI_MDC, mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC), true) + .addField(MDCUtil.REQUEST_URI_MDC, mdcPropertyMap.get(MDCUtil.REQUEST_METHOD_MDC) + " " + mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC), true) .addField("[오류 발생 시간]", LocalDateTime.now().toString(), true) .addField(MDCUtil.REQUEST_IP_MDC, mdcPropertyMap.get(MDCUtil.REQUEST_IP_MDC), false) .addField(MDCUtil.HEADER_MAP_MDC, @@ -57,15 +61,11 @@ public void sendErrorLog(ILoggingEvent event) { escapeJsonInternal(mdcPropertyMap.get(MDCUtil.PARAMETER_MAP_MDC)), false)); - IThrowableProxy throwable = event.getThrowableProxy(); - if (throwable != null) { - String exception = ThrowableProxyUtil.asString(throwable).substring(0, 3000); - discordWebhook.addEmbed(new EmbedObject() - .setTitle("[Exception 상세 내용]") - .setColor(messageColor) - .setDescription(escapeJsonInternal(exception)) - ); - } + discordWebhook.addEmbed(new EmbedObject() + .setTitle("[Exception 상세 내용]") + .setColor(messageColor) + .setDescription(escapeJsonInternal(event.getMessage().substring(0, 2000))) + ); try { discordWebhook.execute(); diff --git a/src/main/java/com/writely/common/filter/MDCFilter.java b/src/main/java/com/writely/common/filter/MDCFilter.java index 97ceaf6..28ecd41 100644 --- a/src/main/java/com/writely/common/filter/MDCFilter.java +++ b/src/main/java/com/writely/common/filter/MDCFilter.java @@ -19,8 +19,8 @@ public class MDCFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { - MDCUtil.set(MDCUtil.REQUEST_URI_MDC, - HttpRequestUtil.getRequestMethod(request) + " " + HttpRequestUtil.getRequestUri(request)); + MDCUtil.set(MDCUtil.REQUEST_METHOD_MDC, HttpRequestUtil.getRequestMethod(request)); + MDCUtil.set(MDCUtil.REQUEST_URI_MDC, HttpRequestUtil.getRequestUri(request)); MDCUtil.set(MDCUtil.REQUEST_IP_MDC, HttpRequestUtil.getUserIP(Objects.requireNonNull(request))); MDCUtil.setJsonValue(MDCUtil.HEADER_MAP_MDC, HttpRequestUtil.getHeaderMap(request)); MDCUtil.setJsonValue(MDCUtil.PARAMETER_MAP_MDC, HttpRequestUtil.getParamMap(request)); diff --git a/src/main/java/com/writely/common/util/MDCUtil.java b/src/main/java/com/writely/common/util/MDCUtil.java index 0dbd98b..11b0738 100644 --- a/src/main/java/com/writely/common/util/MDCUtil.java +++ b/src/main/java/com/writely/common/util/MDCUtil.java @@ -8,6 +8,7 @@ @UtilityClass public class MDCUtil { + public static final String REQUEST_METHOD_MDC = "[요청 Method]"; public static final String REQUEST_URI_MDC = "[요청 URI]"; public static final String REQUEST_IP_MDC = "[요청 IP]"; public static final String HEADER_MAP_MDC = "[Http Header 정보]"; From 7d4e50418c94da68a0525ae5b7c5cb2d94e71fbb Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:17:11 +0900 Subject: [PATCH 015/107] feat: AuthResolver (#13) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 컨트롤러 메서드 파라미터로 'MemberSession' 을 주입받는 경우, 인증이 필요한 API 처리가 가능합니다. --- .../com/writely/auth/domain/BaseToken.java | 3 ++ .../com/writely/auth/domain/JoinToken.java | 2 +- .../com/writely/auth/domain/RefreshToken.java | 4 +- .../auth/service/AuthCommandService.java | 9 ++-- .../com/writely/common/config/WebConfig.java | 10 ++++ .../writely/common/domain/MemberSession.java | 14 ++++++ .../writely/common/resolver/AuthResolver.java | 48 +++++++++++++++++++ .../com/writely/common/util/CryptoUtil.java | 4 +- .../member/controller/MemberController.java | 24 ++++++++++ .../member/domain/enums/MemberException.java | 17 +++++++ .../member/response/MyProfileResponse.java | 28 +++++++++++ .../member/service/MemberCommandService.java | 4 ++ .../member/service/MemberQueryService.java | 25 ++++++++++ 13 files changed, 185 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/writely/common/domain/MemberSession.java create mode 100644 src/main/java/com/writely/common/resolver/AuthResolver.java create mode 100644 src/main/java/com/writely/member/controller/MemberController.java create mode 100644 src/main/java/com/writely/member/domain/enums/MemberException.java create mode 100644 src/main/java/com/writely/member/response/MyProfileResponse.java create mode 100644 src/main/java/com/writely/member/service/MemberCommandService.java create mode 100644 src/main/java/com/writely/member/service/MemberQueryService.java diff --git a/src/main/java/com/writely/auth/domain/BaseToken.java b/src/main/java/com/writely/auth/domain/BaseToken.java index 35084e8..ddc23ed 100644 --- a/src/main/java/com/writely/auth/domain/BaseToken.java +++ b/src/main/java/com/writely/auth/domain/BaseToken.java @@ -13,4 +13,7 @@ public class BaseToken { @Id protected String tokenString; + public BaseToken(String tokenString) { + this.tokenString = tokenString; + } } diff --git a/src/main/java/com/writely/auth/domain/JoinToken.java b/src/main/java/com/writely/auth/domain/JoinToken.java index 2e71fb1..08be6b0 100644 --- a/src/main/java/com/writely/auth/domain/JoinToken.java +++ b/src/main/java/com/writely/auth/domain/JoinToken.java @@ -15,7 +15,7 @@ public class JoinToken extends BaseToken { private MemberPassword memberPassword; public JoinToken(String tokenString, Member member, MemberPassword memberPassword) { - this.tokenString = tokenString; + super(tokenString); this.member = member; this.memberPassword = memberPassword; } diff --git a/src/main/java/com/writely/auth/domain/RefreshToken.java b/src/main/java/com/writely/auth/domain/RefreshToken.java index a6194b8..71a2d3d 100644 --- a/src/main/java/com/writely/auth/domain/RefreshToken.java +++ b/src/main/java/com/writely/auth/domain/RefreshToken.java @@ -9,5 +9,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) @RedisHash(value = "refreshToken", timeToLive = 60 * 60 * 24 * 90) public class RefreshToken extends BaseToken { - + public RefreshToken(String tokenString) { + super(tokenString); + } } \ No newline at end of file diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index d4cfde4..056c74e 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -3,10 +3,12 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.writely.auth.domain.JoinToken; import com.writely.auth.domain.JwtPayload; +import com.writely.auth.domain.RefreshToken; import com.writely.auth.domain.enums.AuthException; import com.writely.auth.helper.JwtHelper; import com.writely.auth.helper.MailHelper; import com.writely.auth.repository.JoinTokenRedisRepository; +import com.writely.auth.repository.RefreshTokenRedisRepository; import com.writely.auth.request.JoinRequest; import com.writely.auth.request.JoinTokenRequest; import com.writely.auth.request.LoginRequest; @@ -36,11 +38,11 @@ public class AuthCommandService { private final MemberJpaRepository memberJpaRepository; private final MemberPasswordJpaRepository memberPasswordJpaRepository; + private final RefreshTokenRedisRepository refreshTokenRedisRepository; private final JoinTokenRedisRepository joinTokenRedisRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; private final CryptoUtil cryptoUtil; - private final String salt = "test"; // todo: salt 처리 // 토큰 재발급 public AuthTokenResponse reissueToken(ReissueRequest request) { @@ -57,7 +59,7 @@ public AuthTokenResponse reissueToken(ReissueRequest request) { public AuthTokenResponse login(LoginRequest request) { String passwordHash; try { - passwordHash = cryptoUtil.hash(request.getPassword(), this.salt); + passwordHash = cryptoUtil.hash(request.getPassword()); } catch (Exception ex) { throw new BaseException(ResultCodeInfo.FAILURE); } @@ -77,7 +79,7 @@ public void join(JoinRequest request) { } try { - String passwordHash = cryptoUtil.hash(request.getPassword(), this.salt); + String passwordHash = cryptoUtil.hash(request.getPassword()); Member member = Member.builder() .email(request.getEmail()) .realname(request.getRealname()) @@ -140,6 +142,7 @@ public AuthTokenResponse generateAuthTokens(UUID memberId) { .build(); String accessToken = jwtHelper.generateAccessToken(jwtPayload); String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); + refreshTokenRedisRepository.save(new RefreshToken(refreshToken)); return new AuthTokenResponse(accessToken, refreshToken); } catch (JsonProcessingException ex) { diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java index 1e42490..a9f2ac0 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -1,18 +1,28 @@ package com.writely.common.config; +import com.writely.common.resolver.AuthResolver; +import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.List; @Configuration +@AllArgsConstructor public class WebConfig implements WebMvcConfigurer { + private final AuthResolver authResolver; @Value("${service.cors.origins}") private List origins; + @Override + public void addArgumentResolvers(List resolvers) { + resolvers.add(authResolver); + } + @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") diff --git a/src/main/java/com/writely/common/domain/MemberSession.java b/src/main/java/com/writely/common/domain/MemberSession.java new file mode 100644 index 0000000..8b17088 --- /dev/null +++ b/src/main/java/com/writely/common/domain/MemberSession.java @@ -0,0 +1,14 @@ +package com.writely.common.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.util.UUID; + +@Getter +@AllArgsConstructor +@Builder +public class MemberSession { + private UUID memberId; +} diff --git a/src/main/java/com/writely/common/resolver/AuthResolver.java b/src/main/java/com/writely/common/resolver/AuthResolver.java new file mode 100644 index 0000000..948f7c2 --- /dev/null +++ b/src/main/java/com/writely/common/resolver/AuthResolver.java @@ -0,0 +1,48 @@ +package com.writely.common.resolver; + +import com.writely.auth.domain.JwtPayload; +import com.writely.auth.domain.enums.AuthException; +import com.writely.auth.helper.JwtHelper; +import com.writely.common.domain.MemberSession; +import com.writely.common.exception.BaseException; +import lombok.AllArgsConstructor; +import org.springframework.core.MethodParameter; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +@AllArgsConstructor +@Component +public class AuthResolver implements HandlerMethodArgumentResolver { + private final JwtHelper jwtHelper; + + @Override + public boolean supportsParameter(MethodParameter parameter) { + return parameter.getParameterType().equals(MemberSession.class); + } + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { + String authorization = webRequest.getHeader("Authorization"); + if (authorization == null) { + throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); + } + + String[] parts = authorization.split(" "); + if (parts.length != 2) { + throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); + } + + String accessToken = parts[1]; + if (!jwtHelper.isTokenValid(accessToken)) { + throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); + } + + JwtPayload payload = jwtHelper.getPayload(accessToken); + return MemberSession.builder() + .memberId(payload.getMemberId()) + .build(); + } +} diff --git a/src/main/java/com/writely/common/util/CryptoUtil.java b/src/main/java/com/writely/common/util/CryptoUtil.java index 50fd99f..b5cb755 100644 --- a/src/main/java/com/writely/common/util/CryptoUtil.java +++ b/src/main/java/com/writely/common/util/CryptoUtil.java @@ -55,8 +55,8 @@ public String decrypt(String cipherText) throws GeneralSecurityException { private static final String HASH_ALGO = "SHA-256"; private static final Integer HASH_ROUND = 3; - public String hash(String plainText, String salt) throws GeneralSecurityException { - return hash(plainText + salt, HASH_ROUND); + public String hash(String plainText) throws GeneralSecurityException { + return hash(plainText + SECRET, HASH_ROUND); } private String hash(String hashText, Integer rounds) throws GeneralSecurityException { diff --git a/src/main/java/com/writely/member/controller/MemberController.java b/src/main/java/com/writely/member/controller/MemberController.java new file mode 100644 index 0000000..d74d8d4 --- /dev/null +++ b/src/main/java/com/writely/member/controller/MemberController.java @@ -0,0 +1,24 @@ +package com.writely.member.controller; + +import com.writely.common.domain.MemberSession; +import com.writely.member.response.MyProfileResponse; +import com.writely.member.service.MemberQueryService; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/member") +@Tag(name = "회원") +public class MemberController { + private final MemberQueryService memberQueryService; + + @GetMapping("/me/profile") + public MyProfileResponse getMyProfile(MemberSession memberSession) { + return memberQueryService.getMyProfile(memberSession); + } + +} diff --git a/src/main/java/com/writely/member/domain/enums/MemberException.java b/src/main/java/com/writely/member/domain/enums/MemberException.java new file mode 100644 index 0000000..00b1afa --- /dev/null +++ b/src/main/java/com/writely/member/domain/enums/MemberException.java @@ -0,0 +1,17 @@ +package com.writely.member.domain.enums; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum MemberException implements CodeInfo { + + NOT_EXIST(HttpStatus.NOT_FOUND, "MBR-001", "존재하지 않는 회원입니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/member/response/MyProfileResponse.java b/src/main/java/com/writely/member/response/MyProfileResponse.java new file mode 100644 index 0000000..724e309 --- /dev/null +++ b/src/main/java/com/writely/member/response/MyProfileResponse.java @@ -0,0 +1,28 @@ +package com.writely.member.response; + + +import com.writely.member.domain.Member; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class MyProfileResponse { + @Schema(title = "이메일") + private final String email; + + @Schema(title = "닉네임") + private final String nickname; + + @Schema(title = "프로필 이미지 경로") + private final String profileImage; + + public MyProfileResponse(Member member) { + this.email = member.getEmail(); + this.nickname = member.getNickname(); + this.profileImage = member.getProfileImage(); + } +} diff --git a/src/main/java/com/writely/member/service/MemberCommandService.java b/src/main/java/com/writely/member/service/MemberCommandService.java new file mode 100644 index 0000000..86e8994 --- /dev/null +++ b/src/main/java/com/writely/member/service/MemberCommandService.java @@ -0,0 +1,4 @@ +package com.writely.member.service; + +public class MemberCommandService { +} diff --git a/src/main/java/com/writely/member/service/MemberQueryService.java b/src/main/java/com/writely/member/service/MemberQueryService.java new file mode 100644 index 0000000..a7bb326 --- /dev/null +++ b/src/main/java/com/writely/member/service/MemberQueryService.java @@ -0,0 +1,25 @@ +package com.writely.member.service; + +import com.writely.common.domain.MemberSession; +import com.writely.common.exception.BaseException; +import com.writely.member.domain.Member; +import com.writely.member.domain.enums.MemberException; +import com.writely.member.repository.MemberJpaRepository; +import com.writely.member.response.MyProfileResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberQueryService { + private final MemberJpaRepository memberJpaRepository; + + public MyProfileResponse getMyProfile(MemberSession memberSession) { + Member member = memberJpaRepository.findById(memberSession.getMemberId()) + .orElseThrow(() -> new BaseException(MemberException.NOT_EXIST)); + + return new MyProfileResponse(member); + } +} From b35e1d05569339e4da866ecf0b40fc6bac057f11 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:37:42 +0900 Subject: [PATCH 016/107] =?UTF-8?q?refactor:=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=B5=EC=88=98=ED=98=95=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=B0=8F=20swagger=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20hidden=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/writely/member/controller/MemberController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/writely/member/controller/MemberController.java b/src/main/java/com/writely/member/controller/MemberController.java index d74d8d4..d58d032 100644 --- a/src/main/java/com/writely/member/controller/MemberController.java +++ b/src/main/java/com/writely/member/controller/MemberController.java @@ -3,6 +3,7 @@ import com.writely.common.domain.MemberSession; import com.writely.member.response.MyProfileResponse; import com.writely.member.service.MemberQueryService; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; @@ -11,13 +12,13 @@ @RestController @RequiredArgsConstructor -@RequestMapping("/member") +@RequestMapping("/members") @Tag(name = "회원") public class MemberController { private final MemberQueryService memberQueryService; @GetMapping("/me/profile") - public MyProfileResponse getMyProfile(MemberSession memberSession) { + public MyProfileResponse getMyProfile(@Parameter(hidden = true) MemberSession memberSession) { return memberQueryService.getMyProfile(memberSession); } From 670598c8f071c5334607eb86aefba1ea6e253b7c Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:30:00 +0900 Subject: [PATCH 017/107] refactor: PR(#13) (#15) --- src/main/java/com/writely/common/config/WebConfig.java | 9 ++++----- .../com/writely/member/response/MyProfileResponse.java | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java index a9f2ac0..a0cdee8 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -1,7 +1,7 @@ package com.writely.common.config; import com.writely.common.resolver.AuthResolver; -import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.web.method.support.HandlerMethodArgumentResolver; @@ -11,12 +11,11 @@ import java.util.List; @Configuration -@AllArgsConstructor +@RequiredArgsConstructor public class WebConfig implements WebMvcConfigurer { - private final AuthResolver authResolver; - @Value("${service.cors.origins}") - private List origins; + private final List origins; + private final AuthResolver authResolver; @Override public void addArgumentResolvers(List resolvers) { diff --git a/src/main/java/com/writely/member/response/MyProfileResponse.java b/src/main/java/com/writely/member/response/MyProfileResponse.java index 724e309..a54731a 100644 --- a/src/main/java/com/writely/member/response/MyProfileResponse.java +++ b/src/main/java/com/writely/member/response/MyProfileResponse.java @@ -3,13 +3,11 @@ import com.writely.member.domain.Member; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @Getter @Setter -@AllArgsConstructor public class MyProfileResponse { @Schema(title = "이메일") private final String email; From e2fa85d7ccd1916107f500039c7b47a06dbaf218 Mon Sep 17 00:00:00 2001 From: Wichan Kang <54745422+wichan7@users.noreply.github.com> Date: Wed, 29 Jan 2025 01:13:47 +0900 Subject: [PATCH 018/107] feat(auth): validation (#16) --- build.gradle | 1 + sql/init.sql | 4 +- src/main/generated/writely/Keys.java | 5 + src/main/generated/writely/Public.java | 7 + src/main/generated/writely/Tables.java | 6 + .../writely/tables/AutoModifyMessage.java | 255 ++++++++++++++++++ src/main/generated/writely/tables/Member.java | 14 +- .../tables/pojos/AutoModifyMessage.java | 207 ++++++++++++++ .../writely/tables/pojos/Member.java | 19 -- .../records/AutoModifyMessageRecord.java | 199 ++++++++++++++ .../writely/tables/records/MemberRecord.java | 35 +-- .../auth/controller/AuthController.java | 9 +- .../com/writely/auth/request/JoinRequest.java | 21 +- .../auth/request/JoinTokenRequest.java | 4 +- .../writely/auth/request/LoginRequest.java | 14 +- .../writely/auth/request/ReissueRequest.java | 5 +- .../auth/response/AuthTokenResponse.java | 5 +- .../auth/service/AuthCommandService.java | 1 - .../common/enums/code/ResultCodeInfo.java | 3 +- .../exception/GlobalExceptionHandler.java | 41 ++- .../writely/common/response/BaseResponse.java | 11 +- .../writely/common/validation/IsEmail.java | 18 ++ .../common/validation/IsEmailValidator.java | 15 ++ .../writely/common/validation/IsPassword.java | 18 ++ .../validation/IsPasswordValidator.java | 14 + .../com/writely/member/domain/Member.java | 3 - .../member/response/MyProfileResponse.java | 6 +- 27 files changed, 844 insertions(+), 96 deletions(-) create mode 100644 src/main/generated/writely/tables/AutoModifyMessage.java create mode 100644 src/main/generated/writely/tables/pojos/AutoModifyMessage.java create mode 100644 src/main/generated/writely/tables/records/AutoModifyMessageRecord.java create mode 100644 src/main/java/com/writely/common/validation/IsEmail.java create mode 100644 src/main/java/com/writely/common/validation/IsEmailValidator.java create mode 100644 src/main/java/com/writely/common/validation/IsPassword.java create mode 100644 src/main/java/com/writely/common/validation/IsPasswordValidator.java diff --git a/build.gradle b/build.gradle index 5f7c190..d63d015 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-webflux' + implementation 'org.springframework.boot:spring-boot-starter-validation' /* DB */ runtimeOnly 'org.postgresql:postgresql' diff --git a/sql/init.sql b/sql/init.sql index 56de4e2..57d748f 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -5,8 +5,7 @@ create table member ( id uuid default gen_random_uuid() constraint member_pk primary key, email varchar(255) constraint email_uk unique not null, - realname varchar(10) not null, - nickname varchar(50) not null, + nickname varchar(10) constraint nickname_uk unique not null, profile_image varchar(255), created_at timestamp with time zone not null, updated_at timestamp with time zone not null @@ -14,7 +13,6 @@ create table member comment on table member is '회원'; comment on column member.id is '회원 ID'; comment on column member.email is '회원 이메일'; -comment on column member.realname is '회원 실명'; comment on column member.nickname is '회원 닉네임'; comment on column member.profile_image is '회원 프로필 이미지 경로'; diff --git a/src/main/generated/writely/Keys.java b/src/main/generated/writely/Keys.java index 327ec53..df7e4ab 100644 --- a/src/main/generated/writely/Keys.java +++ b/src/main/generated/writely/Keys.java @@ -9,6 +9,7 @@ import org.jooq.impl.DSL; import org.jooq.impl.Internal; +import writely.tables.AutoModifyMessage; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.Product; @@ -19,6 +20,7 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.records.AutoModifyMessageRecord; import writely.tables.records.MemberPasswordRecord; import writely.tables.records.MemberRecord; import writely.tables.records.ProductCharacterRecord; @@ -42,7 +44,10 @@ public class Keys { // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- + public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); + public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); + public static final UniqueKey NICKNAME_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("nickname_uk"), new TableField[] { Member.MEMBER.NICKNAME }, true); public static final UniqueKey MEMBER_PASSWORD_PK = Internal.createUniqueKey(MemberPassword.MEMBER_PASSWORD, DSL.name("member_password_pk"), new TableField[] { MemberPassword.MEMBER_PASSWORD.MEMBER_ID }, true); public static final UniqueKey PRODUCT_PK = Internal.createUniqueKey(Product.PRODUCT, DSL.name("product_pk"), new TableField[] { Product.PRODUCT.ID }, true); public static final UniqueKey PRODUCT_CHARACTER_PK = Internal.createUniqueKey(ProductCharacter.PRODUCT_CHARACTER, DSL.name("product_character_pk"), new TableField[] { ProductCharacter.PRODUCT_CHARACTER.ID }, true); diff --git a/src/main/generated/writely/Public.java b/src/main/generated/writely/Public.java index fbda896..4df9af5 100644 --- a/src/main/generated/writely/Public.java +++ b/src/main/generated/writely/Public.java @@ -14,6 +14,7 @@ import org.jooq.Table; import org.jooq.impl.SchemaImpl; +import writely.tables.AutoModifyMessage; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.PgpArmorHeaders; @@ -41,6 +42,11 @@ public class Public extends SchemaImpl { */ public static final Public PUBLIC = new Public(); + /** + * 자동 수정 메세지 + */ + public final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** * 회원 */ @@ -146,6 +152,7 @@ public Catalog getCatalog() { @Override public final List> getTables() { return Arrays.asList( + AutoModifyMessage.AUTO_MODIFY_MESSAGE, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, PgpArmorHeaders.PGP_ARMOR_HEADERS, diff --git a/src/main/generated/writely/Tables.java b/src/main/generated/writely/Tables.java index 752a0a9..9169eae 100644 --- a/src/main/generated/writely/Tables.java +++ b/src/main/generated/writely/Tables.java @@ -8,6 +8,7 @@ import org.jooq.Field; import org.jooq.Result; +import writely.tables.AutoModifyMessage; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.PgpArmorHeaders; @@ -28,6 +29,11 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Tables { + /** + * 자동 수정 메세지 + */ + public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** * 회원 */ diff --git a/src/main/generated/writely/tables/AutoModifyMessage.java b/src/main/generated/writely/tables/AutoModifyMessage.java new file mode 100644 index 0000000..d1ac424 --- /dev/null +++ b/src/main/generated/writely/tables/AutoModifyMessage.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.AutoModifyMessageRecord; + + +/** + * 자동 수정 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AutoModifyMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.auto_modify_message + */ + public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = new AutoModifyMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AutoModifyMessageRecord.class; + } + + /** + * The column public.auto_modify_message.id. 자동 수정 메세지 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "자동 수정 메세지 ID"); + + /** + * The column public.auto_modify_message.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.auto_modify_message.role. 메세지 송신자 + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); + + /** + * The column public.auto_modify_message.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); + + /** + * The column public.auto_modify_message.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.auto_modify_message.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.auto_modify_message.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.auto_modify_message.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private AutoModifyMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private AutoModifyMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("자동 수정 메세지"), TableOptions.table(), where); + } + + /** + * Create an aliased public.auto_modify_message table reference + */ + public AutoModifyMessage(String alias) { + this(DSL.name(alias), AUTO_MODIFY_MESSAGE); + } + + /** + * Create an aliased public.auto_modify_message table reference + */ + public AutoModifyMessage(Name alias) { + this(alias, AUTO_MODIFY_MESSAGE); + } + + /** + * Create a public.auto_modify_message table reference + */ + public AutoModifyMessage() { + this(DSL.name("auto_modify_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.AUTO_MODIFY_MESSAGE_PK; + } + + @Override + public AutoModifyMessage as(String alias) { + return new AutoModifyMessage(DSL.name(alias), this); + } + + @Override + public AutoModifyMessage as(Name alias) { + return new AutoModifyMessage(alias, this); + } + + @Override + public AutoModifyMessage as(Table alias) { + return new AutoModifyMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public AutoModifyMessage rename(String name) { + return new AutoModifyMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public AutoModifyMessage rename(Name name) { + return new AutoModifyMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public AutoModifyMessage rename(Table name) { + return new AutoModifyMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage where(Condition condition) { + return new AutoModifyMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AutoModifyMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AutoModifyMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AutoModifyMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AutoModifyMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AutoModifyMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/Member.java b/src/main/generated/writely/tables/Member.java index 3c3cb79..2498a14 100644 --- a/src/main/generated/writely/tables/Member.java +++ b/src/main/generated/writely/tables/Member.java @@ -5,7 +5,9 @@ import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.UUID; import org.jooq.Condition; @@ -61,15 +63,10 @@ public Class getRecordType() { */ public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255).nullable(false), this, "회원 이메일"); - /** - * The column public.member.realname. 회원 실명 - */ - public final TableField REALNAME = createField(DSL.name("realname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 실명"); - /** * The column public.member.nickname. 회원 닉네임 */ - public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(50).nullable(false), this, "회원 닉네임"); + public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 닉네임"); /** * The column public.member.profile_image. 회원 프로필 이미지 경로 @@ -125,6 +122,11 @@ public UniqueKey getPrimaryKey() { return Keys.MEMBER_PK; } + @Override + public List> getUniqueKeys() { + return Arrays.asList(Keys.EMAIL_UK, Keys.NICKNAME_UK); + } + @Override public Member as(String alias) { return new Member(DSL.name(alias), this); diff --git a/src/main/generated/writely/tables/pojos/AutoModifyMessage.java b/src/main/generated/writely/tables/pojos/AutoModifyMessage.java new file mode 100644 index 0000000..5ed9f70 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/AutoModifyMessage.java @@ -0,0 +1,207 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 자동 수정 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AutoModifyMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String role; + private final String content; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public AutoModifyMessage(AutoModifyMessage value) { + this.id = value.id; + this.productId = value.productId; + this.role = value.role; + this.content = value.content; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public AutoModifyMessage( + UUID id, + UUID productId, + String role, + String content, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.role = role; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.auto_modify_message.id. 자동 수정 메세지 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.auto_modify_message.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.auto_modify_message.role. 메세지 송신자 + */ + public String getRole() { + return this.role; + } + + /** + * Getter for public.auto_modify_message.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.auto_modify_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.auto_modify_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.auto_modify_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.auto_modify_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final AutoModifyMessage other = (AutoModifyMessage) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.role == null) { + if (other.role != null) + return false; + } + else if (!this.role.equals(other.role)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("AutoModifyMessage ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(role); + sb.append(", ").append(content); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/Member.java b/src/main/generated/writely/tables/pojos/Member.java index c745c91..ce5492c 100644 --- a/src/main/generated/writely/tables/pojos/Member.java +++ b/src/main/generated/writely/tables/pojos/Member.java @@ -19,7 +19,6 @@ public class Member implements Serializable { private final UUID id; private final String email; - private final String realname; private final String nickname; private final String profileImage; private final OffsetDateTime createdAt; @@ -28,7 +27,6 @@ public class Member implements Serializable { public Member(Member value) { this.id = value.id; this.email = value.email; - this.realname = value.realname; this.nickname = value.nickname; this.profileImage = value.profileImage; this.createdAt = value.createdAt; @@ -38,7 +36,6 @@ public Member(Member value) { public Member( UUID id, String email, - String realname, String nickname, String profileImage, OffsetDateTime createdAt, @@ -46,7 +43,6 @@ public Member( ) { this.id = id; this.email = email; - this.realname = realname; this.nickname = nickname; this.profileImage = profileImage; this.createdAt = createdAt; @@ -67,13 +63,6 @@ public String getEmail() { return this.email; } - /** - * Getter for public.member.realname. 회원 실명 - */ - public String getRealname() { - return this.realname; - } - /** * Getter for public.member.nickname. 회원 닉네임 */ @@ -123,12 +112,6 @@ else if (!this.id.equals(other.id)) } else if (!this.email.equals(other.email)) return false; - if (this.realname == null) { - if (other.realname != null) - return false; - } - else if (!this.realname.equals(other.realname)) - return false; if (this.nickname == null) { if (other.nickname != null) return false; @@ -162,7 +145,6 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.email == null) ? 0 : this.email.hashCode()); - result = prime * result + ((this.realname == null) ? 0 : this.realname.hashCode()); result = prime * result + ((this.nickname == null) ? 0 : this.nickname.hashCode()); result = prime * result + ((this.profileImage == null) ? 0 : this.profileImage.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); @@ -176,7 +158,6 @@ public String toString() { sb.append(id); sb.append(", ").append(email); - sb.append(", ").append(realname); sb.append(", ").append(nickname); sb.append(", ").append(profileImage); sb.append(", ").append(createdAt); diff --git a/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java b/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java new file mode 100644 index 0000000..7510837 --- /dev/null +++ b/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java @@ -0,0 +1,199 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.AutoModifyMessage; + + +/** + * 자동 수정 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AutoModifyMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.auto_modify_message.id. 자동 수정 메세지 ID + */ + public AutoModifyMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.auto_modify_message.id. 자동 수정 메세지 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.auto_modify_message.product_id. 작품 ID + */ + public AutoModifyMessageRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.auto_modify_message.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.auto_modify_message.role. 메세지 송신자 + */ + public AutoModifyMessageRecord setRole(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.auto_modify_message.role. 메세지 송신자 + */ + public String getRole() { + return (String) get(2); + } + + /** + * Setter for public.auto_modify_message.content. 내용 + */ + public AutoModifyMessageRecord setContent(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.auto_modify_message.content. 내용 + */ + public String getContent() { + return (String) get(3); + } + + /** + * Setter for public.auto_modify_message.created_at. 생성일시 + */ + public AutoModifyMessageRecord setCreatedAt(LocalDateTime value) { + set(4, value); + return this; + } + + /** + * Getter for public.auto_modify_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(4); + } + + /** + * Setter for public.auto_modify_message.created_by. 생성자 ID + */ + public AutoModifyMessageRecord setCreatedBy(UUID value) { + set(5, value); + return this; + } + + /** + * Getter for public.auto_modify_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(5); + } + + /** + * Setter for public.auto_modify_message.updated_at. 수정일시 + */ + public AutoModifyMessageRecord setUpdatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.auto_modify_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.auto_modify_message.updated_by. 수정자 ID + */ + public AutoModifyMessageRecord setUpdatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.auto_modify_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(7); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AutoModifyMessageRecord + */ + public AutoModifyMessageRecord() { + super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); + } + + /** + * Create a detached, initialised AutoModifyMessageRecord + */ + public AutoModifyMessageRecord(UUID id, UUID productId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); + + setId(id); + setProductId(productId); + setRole(role); + setContent(content); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised AutoModifyMessageRecord + */ + public AutoModifyMessageRecord(writely.tables.pojos.AutoModifyMessage value) { + super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setRole(value.getRole()); + setContent(value.getContent()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/MemberRecord.java b/src/main/generated/writely/tables/records/MemberRecord.java index a44f76b..b5ee6c2 100644 --- a/src/main/generated/writely/tables/records/MemberRecord.java +++ b/src/main/generated/writely/tables/records/MemberRecord.java @@ -51,26 +51,11 @@ public String getEmail() { return (String) get(1); } - /** - * Setter for public.member.realname. 회원 실명 - */ - public MemberRecord setRealname(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.member.realname. 회원 실명 - */ - public String getRealname() { - return (String) get(2); - } - /** * Setter for public.member.nickname. 회원 닉네임 */ public MemberRecord setNickname(String value) { - set(3, value); + set(2, value); return this; } @@ -78,14 +63,14 @@ public MemberRecord setNickname(String value) { * Getter for public.member.nickname. 회원 닉네임 */ public String getNickname() { - return (String) get(3); + return (String) get(2); } /** * Setter for public.member.profile_image. 회원 프로필 이미지 경로 */ public MemberRecord setProfileImage(String value) { - set(4, value); + set(3, value); return this; } @@ -93,14 +78,14 @@ public MemberRecord setProfileImage(String value) { * Getter for public.member.profile_image. 회원 프로필 이미지 경로 */ public String getProfileImage() { - return (String) get(4); + return (String) get(3); } /** * Setter for public.member.created_at. */ public MemberRecord setCreatedAt(OffsetDateTime value) { - set(5, value); + set(4, value); return this; } @@ -108,14 +93,14 @@ public MemberRecord setCreatedAt(OffsetDateTime value) { * Getter for public.member.created_at. */ public OffsetDateTime getCreatedAt() { - return (OffsetDateTime) get(5); + return (OffsetDateTime) get(4); } /** * Setter for public.member.updated_at. */ public MemberRecord setUpdatedAt(OffsetDateTime value) { - set(6, value); + set(5, value); return this; } @@ -123,7 +108,7 @@ public MemberRecord setUpdatedAt(OffsetDateTime value) { * Getter for public.member.updated_at. */ public OffsetDateTime getUpdatedAt() { - return (OffsetDateTime) get(6); + return (OffsetDateTime) get(5); } // ------------------------------------------------------------------------- @@ -149,12 +134,11 @@ public MemberRecord() { /** * Create a detached, initialised MemberRecord */ - public MemberRecord(UUID id, String email, String realname, String nickname, String profileImage, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + public MemberRecord(UUID id, String email, String nickname, String profileImage, OffsetDateTime createdAt, OffsetDateTime updatedAt) { super(Member.MEMBER); setId(id); setEmail(email); - setRealname(realname); setNickname(nickname); setProfileImage(profileImage); setCreatedAt(createdAt); @@ -171,7 +155,6 @@ public MemberRecord(writely.tables.pojos.Member value) { if (value != null) { setId(value.getId()); setEmail(value.getEmail()); - setRealname(value.getRealname()); setNickname(value.getNickname()); setProfileImage(value.getProfileImage()); setCreatedAt(value.getCreatedAt()); diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java index 442b29d..4c865a9 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -9,6 +9,7 @@ import com.writely.auth.service.AuthQueryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -22,28 +23,28 @@ public class AuthController { @Operation(summary = "토큰 재발급") @PostMapping("/token/reissue") - public AuthTokenResponse reissueToken(ReissueRequest request) { + public AuthTokenResponse reissueToken(@Valid @RequestBody ReissueRequest request) { return authCommandService.reissueToken(request); } @Operation(summary = "로그인") @PostMapping("/login") - public AuthTokenResponse login(@RequestBody LoginRequest request) { + public AuthTokenResponse login(@Valid @RequestBody LoginRequest request) { return authCommandService.login(request); } @Operation(summary = "회원가입") @PostMapping("/join") - public void join(@RequestBody JoinRequest request) { + public void join(@Valid @RequestBody JoinRequest request) { authCommandService.join(request); } @Operation(summary = "회원가입 완료") @PostMapping("/join/complete") - public AuthTokenResponse join(@RequestBody JoinTokenRequest request) { + public AuthTokenResponse join(@Valid @RequestBody JoinTokenRequest request) { return authCommandService.completeJoin(request); } diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/src/main/java/com/writely/auth/request/JoinRequest.java index ea0bcf6..0006495 100644 --- a/src/main/java/com/writely/auth/request/JoinRequest.java +++ b/src/main/java/com/writely/auth/request/JoinRequest.java @@ -1,24 +1,33 @@ package com.writely.auth.request; +import com.writely.common.validation.IsEmail; +import com.writely.common.validation.IsPassword; import com.writely.member.domain.Member; import com.writely.member.domain.MemberPassword; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; @Getter @Setter public class JoinRequest { - @Schema(title = "이메일") + @NotBlank + @Size(max = 255) + @IsEmail + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; - @Schema(title = "비밀번호") + @NotBlank + @Size(min = 8, max = 255) + @IsPassword + @Schema(title = "비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; - @Schema(title = "실명") - private String realname; - - @Schema(title = "닉네임") + @NotBlank + @Size(max = 10) + @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED, example = "노래하는뱁새") private String nickname; } diff --git a/src/main/java/com/writely/auth/request/JoinTokenRequest.java b/src/main/java/com/writely/auth/request/JoinTokenRequest.java index f37719a..7612088 100644 --- a/src/main/java/com/writely/auth/request/JoinTokenRequest.java +++ b/src/main/java/com/writely/auth/request/JoinTokenRequest.java @@ -1,6 +1,7 @@ package com.writely.auth.request; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.*; @Getter @@ -8,6 +9,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) @Builder public class JoinTokenRequest { - @Schema(title = "회원가입 토큰") + @NotBlank + @Schema(title = "회원가입 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") private String joinToken; } diff --git a/src/main/java/com/writely/auth/request/LoginRequest.java b/src/main/java/com/writely/auth/request/LoginRequest.java index 85f660c..629d40f 100644 --- a/src/main/java/com/writely/auth/request/LoginRequest.java +++ b/src/main/java/com/writely/auth/request/LoginRequest.java @@ -1,15 +1,25 @@ package com.writely.auth.request; +import com.writely.common.validation.IsEmail; +import com.writely.common.validation.IsPassword; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; @Getter @Setter public class LoginRequest { - @Schema(title = "이메일") + @NotBlank + @Size(max = 255) + @IsEmail + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; - @Schema(title = "비밀번호") + @NotBlank + @Size(max = 255) + @IsPassword + @Schema(title = "비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; } diff --git a/src/main/java/com/writely/auth/request/ReissueRequest.java b/src/main/java/com/writely/auth/request/ReissueRequest.java index b281703..9d460f7 100644 --- a/src/main/java/com/writely/auth/request/ReissueRequest.java +++ b/src/main/java/com/writely/auth/request/ReissueRequest.java @@ -1,13 +1,14 @@ package com.writely.auth.request; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.Getter; import lombok.Setter; @Getter @Setter public class ReissueRequest { - @Schema(title = "리프래시 토큰") + @NotBlank + @Schema(title = "리프래시 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") private String refreshToken; - } diff --git a/src/main/java/com/writely/auth/response/AuthTokenResponse.java b/src/main/java/com/writely/auth/response/AuthTokenResponse.java index 828334b..512c745 100644 --- a/src/main/java/com/writely/auth/response/AuthTokenResponse.java +++ b/src/main/java/com/writely/auth/response/AuthTokenResponse.java @@ -8,9 +8,10 @@ @Getter @Setter public class AuthTokenResponse { - @Schema(title = "액세스 토큰") + @Schema(title = "액세스 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") private final String accessToken; - @Schema(title = "리프레시 토큰") + + @Schema(title = "리프레시 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") private final String refreshToken; public AuthTokenResponse(String accessToken, String refreshToken) { diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 056c74e..38e4e5e 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -82,7 +82,6 @@ public void join(JoinRequest request) { String passwordHash = cryptoUtil.hash(request.getPassword()); Member member = Member.builder() .email(request.getEmail()) - .realname(request.getRealname()) .nickname(request.getNickname()) .build(); MemberPassword memberPassword = MemberPassword.builder() diff --git a/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java b/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java index de29d9b..1580931 100644 --- a/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java +++ b/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java @@ -9,7 +9,8 @@ public enum ResultCodeInfo implements CodeInfo { SUCCESS(HttpStatus.OK, "RESULT-001", "성공적으로 수행하였습니다."), - FAILURE(HttpStatus.INTERNAL_SERVER_ERROR, "RESULT-002", "알 수 없는 오류가 발생했습니다."); + FAILURE(HttpStatus.INTERNAL_SERVER_ERROR, "RESULT-002", "알 수 없는 오류가 발생했습니다."), + BAD_REQUEST(HttpStatus.BAD_REQUEST, "RESULT-003", "잘못된 요청입니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 371c4c2..8e6ee1d 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -1,33 +1,56 @@ package com.writely.common.exception; import com.writely.common.enums.code.CodeInfo; +import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.response.BaseResponse; import com.writely.common.util.LogUtil; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import java.io.PrintWriter; import java.io.StringWriter; +import java.util.stream.Collectors; @RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler({Exception.class}) - public ResponseEntity> handle(Exception e) { - if(!(e instanceof BaseException) || ((BaseException)e).getCodeInfo() == null) { - String message = getStackTrace(e); - LogUtil.error(message); + public ResponseEntity> handle(Exception e) { + HttpStatus status = null; + BaseResponse response = null; - BaseResponse response = BaseResponse.failure(message); - return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); + if (e instanceof BaseException ex) { + CodeInfo codeInfo = ex.getCodeInfo(); + + status = codeInfo.getStatus(); + response = BaseResponse.failure(codeInfo); + } else if (e instanceof MethodArgumentNotValidException ex) { + CodeInfo codeInfo = ResultCodeInfo.BAD_REQUEST; + + status = codeInfo.getStatus(); + response = BaseResponse.failure(codeInfo); + String responseMessage = codeInfo.getMessage() + + " " + + ex.getBindingResult() + .getFieldErrors() + .stream() + .map(error -> error.getField() + " 이(가)" + error.getDefaultMessage()) + .collect(Collectors.joining(" ")); + response.setMessage(responseMessage); + } + + if (status == null) { + status = ResultCodeInfo.FAILURE.getStatus(); + } + if (response == null) { + response = BaseResponse.failure(); } LogUtil.error(getStackTrace(e)); - CodeInfo codeInfo = ((BaseException) e).getCodeInfo(); - BaseResponse response = BaseResponse.failure(codeInfo); - return new ResponseEntity<>(response, codeInfo.getStatus()); + return new ResponseEntity<>(response, status); } private String getStackTrace(Throwable throwable) { diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/src/main/java/com/writely/common/response/BaseResponse.java index 766772b..d50c309 100644 --- a/src/main/java/com/writely/common/response/BaseResponse.java +++ b/src/main/java/com/writely/common/response/BaseResponse.java @@ -5,6 +5,7 @@ import com.writely.common.enums.code.ResultCodeInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; +import lombok.Setter; import lombok.ToString; @Getter @@ -18,6 +19,7 @@ public class BaseResponse { @Schema(title = "결과 데이터", description = "API 처리 결과 데이터", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private T result; + @Setter @Schema(title = "메시지", description = "API 처리 결과 메시지", requiredMode = Schema.RequiredMode.REQUIRED, example = "성공적으로 수행하였습니다.") private String message; @@ -44,18 +46,11 @@ public static BaseResponse failure() { return res; } - public static BaseResponse failure(String message) { - BaseResponse res = new BaseResponse<>(); - res.message = message; - return res; - } - public static BaseResponse failure(CodeInfo codeInfo) { BaseResponse res = new BaseResponse<>(); res.code = codeInfo.getCode(); res.message = codeInfo.getMessage(); return res; } -} - +} \ No newline at end of file diff --git a/src/main/java/com/writely/common/validation/IsEmail.java b/src/main/java/com/writely/common/validation/IsEmail.java new file mode 100644 index 0000000..a267321 --- /dev/null +++ b/src/main/java/com/writely/common/validation/IsEmail.java @@ -0,0 +1,18 @@ +package com.writely.common.validation; + +import jakarta.validation.Constraint; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) +@Retention(RUNTIME) +@Constraint(validatedBy = IsEmailValidator.class) +public @interface IsEmail { + String message() default "이메일 형식이어야 합니다."; + Class[] groups() default {}; + Class[] payload() default {}; +} \ No newline at end of file diff --git a/src/main/java/com/writely/common/validation/IsEmailValidator.java b/src/main/java/com/writely/common/validation/IsEmailValidator.java new file mode 100644 index 0000000..e2ddee5 --- /dev/null +++ b/src/main/java/com/writely/common/validation/IsEmailValidator.java @@ -0,0 +1,15 @@ +package com.writely.common.validation; + +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; + + +public class IsEmailValidator implements ConstraintValidator { + @Override + public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { + if (s == null) + return true; + + return s.matches("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/common/validation/IsPassword.java b/src/main/java/com/writely/common/validation/IsPassword.java new file mode 100644 index 0000000..85fc5e3 --- /dev/null +++ b/src/main/java/com/writely/common/validation/IsPassword.java @@ -0,0 +1,18 @@ +package com.writely.common.validation; + +import jakarta.validation.Constraint; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) +@Retention(RUNTIME) +@Constraint(validatedBy = IsPasswordValidator.class) +public @interface IsPassword { + String message() default "최소 8자 이상이며, 대문자, 소문자, 숫자, 특수문자 중 3가지를 포함해야 합니다."; + Class[] groups() default {}; + Class[] payload() default {}; +} \ No newline at end of file diff --git a/src/main/java/com/writely/common/validation/IsPasswordValidator.java b/src/main/java/com/writely/common/validation/IsPasswordValidator.java new file mode 100644 index 0000000..1ed5c2e --- /dev/null +++ b/src/main/java/com/writely/common/validation/IsPasswordValidator.java @@ -0,0 +1,14 @@ +package com.writely.common.validation; + +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; + +public class IsPasswordValidator implements ConstraintValidator { + @Override + public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { + if (s == null) + return true; + + return s.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]*$"); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/member/domain/Member.java b/src/main/java/com/writely/member/domain/Member.java index 6390a76..bd9a81d 100644 --- a/src/main/java/com/writely/member/domain/Member.java +++ b/src/main/java/com/writely/member/domain/Member.java @@ -24,9 +24,6 @@ public class Member extends BaseTimeEntity { @Column(nullable = false) private String email; - @Column(nullable = false) - private String realname; - @Column(nullable = false) private String nickname; diff --git a/src/main/java/com/writely/member/response/MyProfileResponse.java b/src/main/java/com/writely/member/response/MyProfileResponse.java index a54731a..b81cbf2 100644 --- a/src/main/java/com/writely/member/response/MyProfileResponse.java +++ b/src/main/java/com/writely/member/response/MyProfileResponse.java @@ -9,13 +9,13 @@ @Getter @Setter public class MyProfileResponse { - @Schema(title = "이메일") + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED) private final String email; - @Schema(title = "닉네임") + @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED) private final String nickname; - @Schema(title = "프로필 이미지 경로") + @Schema(title = "프로필 이미지 경로", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private final String profileImage; public MyProfileResponse(Member member) { From 6fc31d180c358de1c97d2a6be91d82381fc5b8a3 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 29 Jan 2025 02:22:15 +0900 Subject: [PATCH 019/107] =?UTF-8?q?refactor(log):=20stacktrace=EB=A5=BC=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=A1=9C=20=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=98=A4=EB=B2=84=EB=A1=9C=EB=94=A9=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: SBSun --- .../auth/service/AuthCommandService.java | 3 +- .../exception/GlobalExceptionHandler.java | 14 +-------- .../java/com/writely/common/util/LogUtil.java | 29 +++++++++++++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 38e4e5e..4ecf39b 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -17,6 +17,7 @@ import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.exception.BaseException; import com.writely.common.util.CryptoUtil; +import com.writely.common.util.LogUtil; import com.writely.member.domain.Member; import com.writely.member.domain.MemberPassword; import com.writely.member.repository.MemberPasswordJpaRepository; @@ -145,7 +146,7 @@ public AuthTokenResponse generateAuthTokens(UUID memberId) { return new AuthTokenResponse(accessToken, refreshToken); } catch (JsonProcessingException ex) { - ex.printStackTrace(); + LogUtil.error(ex); throw new BaseException(ResultCodeInfo.FAILURE); } diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 8e6ee1d..3370894 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -9,9 +9,6 @@ import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; - -import java.io.PrintWriter; -import java.io.StringWriter; import java.util.stream.Collectors; @RestControllerAdvice @@ -49,17 +46,8 @@ public ResponseEntity> handle(Exception e) { response = BaseResponse.failure(); } - LogUtil.error(getStackTrace(e)); + LogUtil.error(e); return new ResponseEntity<>(response, status); } - private String getStackTrace(Throwable throwable) { - if (throwable == null) { - return "No exception provided."; - } - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(stringWriter); - throwable.printStackTrace(printWriter); - return stringWriter.toString(); - } } diff --git a/src/main/java/com/writely/common/util/LogUtil.java b/src/main/java/com/writely/common/util/LogUtil.java index df64954..338495a 100644 --- a/src/main/java/com/writely/common/util/LogUtil.java +++ b/src/main/java/com/writely/common/util/LogUtil.java @@ -5,6 +5,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.PrintWriter; +import java.io.StringWriter; + @Slf4j @UtilityClass public class LogUtil { @@ -14,20 +17,46 @@ public class LogUtil { public void debug(String msg) { LOG.info(msg); } + public void debug(Throwable throwable) { + LOG.info(getStackTrace(throwable)); + } public void trace(String msg) { LOG.trace(msg); } + public void trace(Throwable throwable) { + LOG.trace(getStackTrace(throwable)); + } public void info(String msg) { LOG.info(msg); } + public void info(Throwable throwable) { + LOG.info(getStackTrace(throwable)); + } public void warn(String msg) { LOG.warn(msg); } + public void warn(Throwable throwable) { + LOG.warn(getStackTrace(throwable)); + } public void error(String msg) { LOG.error(msg); } + public void error(Throwable throwable) { + LOG.error(getStackTrace(throwable)); + } + + private String getStackTrace(Throwable throwable) { + if (throwable == null) { + return "No exception provided."; + } + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + throwable.printStackTrace(printWriter); + return stringWriter.toString(); + } + } From 9a1e2fcf3e4f1b9b80a7c0ead5b2fc2fb9b7ce72 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Thu, 30 Jan 2025 16:32:09 +0900 Subject: [PATCH 020/107] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=EC=97=AC=EB=B6=80=20=EC=A1=B0=ED=9A=8C=20(#1?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../writely/auth/controller/AuthController.java | 15 ++++++++++----- .../writely/auth/request/CheckEmailRequest.java | 16 ++++++++++++++++ .../com/writely/auth/request/JoinRequest.java | 2 -- .../com/writely/auth/request/LoginRequest.java | 2 -- .../auth/response/CheckEmailResponse.java | 16 ++++++++++++++++ .../writely/auth/service/AuthQueryService.java | 14 ++++++++++++++ .../common/exception/GlobalExceptionHandler.java | 2 +- .../writely/common/response/BaseResponse.java | 6 ------ .../com/writely/common/validation/IsEmail.java | 3 +++ .../writely/common/validation/IsPassword.java | 3 +++ 10 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/writely/auth/request/CheckEmailRequest.java create mode 100644 src/main/java/com/writely/auth/response/CheckEmailResponse.java diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java index 4c865a9..d7561c9 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -1,10 +1,8 @@ package com.writely.auth.controller; -import com.writely.auth.request.JoinRequest; -import com.writely.auth.request.JoinTokenRequest; -import com.writely.auth.request.LoginRequest; -import com.writely.auth.request.ReissueRequest; +import com.writely.auth.request.*; import com.writely.auth.response.AuthTokenResponse; +import com.writely.auth.response.CheckEmailResponse; import com.writely.auth.service.AuthCommandService; import com.writely.auth.service.AuthQueryService; import io.swagger.v3.oas.annotations.Operation; @@ -44,8 +42,15 @@ public void join(@Valid @RequestBody JoinRequest request) { @Operation(summary = "회원가입 완료") @PostMapping("/join/complete") - public AuthTokenResponse join(@Valid @RequestBody JoinTokenRequest request) { + public AuthTokenResponse completeJoin(@Valid @RequestBody JoinTokenRequest request) { return authCommandService.completeJoin(request); } + + @Operation(summary = "이메일 중복 조회") + @GetMapping("/check-email") + public CheckEmailResponse checkEmail(@Valid CheckEmailRequest request) { + + return authQueryService.checkEmail(request); + } } diff --git a/src/main/java/com/writely/auth/request/CheckEmailRequest.java b/src/main/java/com/writely/auth/request/CheckEmailRequest.java new file mode 100644 index 0000000..7dcabc3 --- /dev/null +++ b/src/main/java/com/writely/auth/request/CheckEmailRequest.java @@ -0,0 +1,16 @@ +package com.writely.auth.request; + +import com.writely.common.validation.IsEmail; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CheckEmailRequest { + @NotBlank + @IsEmail + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") + private String email; +} diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/src/main/java/com/writely/auth/request/JoinRequest.java index 0006495..8d1fd14 100644 --- a/src/main/java/com/writely/auth/request/JoinRequest.java +++ b/src/main/java/com/writely/auth/request/JoinRequest.java @@ -14,13 +14,11 @@ @Setter public class JoinRequest { @NotBlank - @Size(max = 255) @IsEmail @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; @NotBlank - @Size(min = 8, max = 255) @IsPassword @Schema(title = "비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; diff --git a/src/main/java/com/writely/auth/request/LoginRequest.java b/src/main/java/com/writely/auth/request/LoginRequest.java index 629d40f..0702b27 100644 --- a/src/main/java/com/writely/auth/request/LoginRequest.java +++ b/src/main/java/com/writely/auth/request/LoginRequest.java @@ -12,13 +12,11 @@ @Setter public class LoginRequest { @NotBlank - @Size(max = 255) @IsEmail @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; @NotBlank - @Size(max = 255) @IsPassword @Schema(title = "비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; diff --git a/src/main/java/com/writely/auth/response/CheckEmailResponse.java b/src/main/java/com/writely/auth/response/CheckEmailResponse.java new file mode 100644 index 0000000..50baca4 --- /dev/null +++ b/src/main/java/com/writely/auth/response/CheckEmailResponse.java @@ -0,0 +1,16 @@ +package com.writely.auth.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class CheckEmailResponse { + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") + private String email; + @Schema(title = "존재 여부", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private boolean exists; +} diff --git a/src/main/java/com/writely/auth/service/AuthQueryService.java b/src/main/java/com/writely/auth/service/AuthQueryService.java index d8a31ee..4ba8391 100644 --- a/src/main/java/com/writely/auth/service/AuthQueryService.java +++ b/src/main/java/com/writely/auth/service/AuthQueryService.java @@ -1,8 +1,22 @@ package com.writely.auth.service; +import com.writely.auth.request.CheckEmailRequest; +import com.writely.auth.response.CheckEmailResponse; +import com.writely.member.repository.MemberJpaRepository; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +@RequiredArgsConstructor +@Transactional(readOnly = true) @Service public class AuthQueryService { + private final MemberJpaRepository memberJpaRepository; + + public CheckEmailResponse checkEmail(CheckEmailRequest request) { + boolean exists = memberJpaRepository.findByEmail(request.getEmail()).isPresent(); + + return new CheckEmailResponse(request.getEmail(), exists); + } } diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 3370894..5973725 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -43,7 +43,7 @@ public ResponseEntity> handle(Exception e) { status = ResultCodeInfo.FAILURE.getStatus(); } if (response == null) { - response = BaseResponse.failure(); + response = BaseResponse.failure(ResultCodeInfo.FAILURE); } LogUtil.error(e); diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/src/main/java/com/writely/common/response/BaseResponse.java index d50c309..84a13b8 100644 --- a/src/main/java/com/writely/common/response/BaseResponse.java +++ b/src/main/java/com/writely/common/response/BaseResponse.java @@ -40,12 +40,6 @@ public static BaseResponse success(T data) { return res; } - public static BaseResponse failure() { - BaseResponse res = new BaseResponse<>(); - res.message = ResultCodeInfo.FAILURE.getMessage(); - return res; - } - public static BaseResponse failure(CodeInfo codeInfo) { BaseResponse res = new BaseResponse<>(); res.code = codeInfo.getCode(); diff --git a/src/main/java/com/writely/common/validation/IsEmail.java b/src/main/java/com/writely/common/validation/IsEmail.java index a267321..61c35f1 100644 --- a/src/main/java/com/writely/common/validation/IsEmail.java +++ b/src/main/java/com/writely/common/validation/IsEmail.java @@ -1,6 +1,8 @@ package com.writely.common.validation; import jakarta.validation.Constraint; +import jakarta.validation.constraints.Size; + import java.lang.annotation.Retention; import java.lang.annotation.Target; @@ -11,6 +13,7 @@ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Constraint(validatedBy = IsEmailValidator.class) +@Size(max = 255) public @interface IsEmail { String message() default "이메일 형식이어야 합니다."; Class[] groups() default {}; diff --git a/src/main/java/com/writely/common/validation/IsPassword.java b/src/main/java/com/writely/common/validation/IsPassword.java index 85fc5e3..771e54e 100644 --- a/src/main/java/com/writely/common/validation/IsPassword.java +++ b/src/main/java/com/writely/common/validation/IsPassword.java @@ -1,6 +1,8 @@ package com.writely.common.validation; import jakarta.validation.Constraint; +import jakarta.validation.constraints.Size; + import java.lang.annotation.Retention; import java.lang.annotation.Target; @@ -11,6 +13,7 @@ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Constraint(validatedBy = IsPasswordValidator.class) +@Size(min = 8, max = 255) public @interface IsPassword { String message() default "최소 8자 이상이며, 대문자, 소문자, 숫자, 특수문자 중 3가지를 포함해야 합니다."; Class[] groups() default {}; From fca2177eb761eda048b65f69dfad0e82dbca88ff Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Thu, 30 Jan 2025 21:13:48 +0900 Subject: [PATCH 021/107] chore: update configurations for JWT (#19) --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index d2a6d51..95a9099 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit d2a6d513f1cf90bcbb3002985c4d2b0a8d0f9a17 +Subproject commit 95a9099eb07cfb4381e11b5c9042f0aba045e156 From df80f4134e0dda9346216667c8bd05195d8c9434 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Fri, 31 Jan 2025 02:25:46 +0900 Subject: [PATCH 022/107] =?UTF-8?q?feat(auth):=20=EB=B9=84=EB=B0=80?= =?UTF-8?q?=EB=B2=88=ED=98=B8=20=EB=B3=80=EA=B2=BD=20(#20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 16 +- .../com/writely/auth/domain/ChpwToken.java | 15 ++ .../auth/domain/enums/AuthException.java | 5 +- .../com/writely/auth/helper/JwtHelper.java | 20 +- .../com/writely/auth/helper/MailHelper.java | 17 +- .../repository/ChpwTokenRedisRepository.java | 8 + .../auth/request/ChpwCompletionRequest.java | 20 ++ .../com/writely/auth/request/ChpwRequest.java | 14 ++ ...equest.java => JoinCompletionRequest.java} | 2 +- .../auth/service/AuthCommandService.java | 175 ++++++++++++------ .../com/writely/common/util/CryptoUtil.java | 45 +++-- src/main/resources/templates/mail/chpw.html | 2 +- 12 files changed, 255 insertions(+), 84 deletions(-) create mode 100644 src/main/java/com/writely/auth/domain/ChpwToken.java create mode 100644 src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java create mode 100644 src/main/java/com/writely/auth/request/ChpwCompletionRequest.java create mode 100644 src/main/java/com/writely/auth/request/ChpwRequest.java rename src/main/java/com/writely/auth/request/{JoinTokenRequest.java => JoinCompletionRequest.java} (94%) diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java index d7561c9..56a3dcf 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -42,11 +42,25 @@ public void join(@Valid @RequestBody JoinRequest request) { @Operation(summary = "회원가입 완료") @PostMapping("/join/complete") - public AuthTokenResponse completeJoin(@Valid @RequestBody JoinTokenRequest request) { + public AuthTokenResponse completeJoin(@Valid @RequestBody JoinCompletionRequest request) { return authCommandService.completeJoin(request); } + @Operation(summary = "비밀번호 변경") + @PostMapping("/chpw") + public void changePassword(@Valid @RequestBody ChpwRequest request) { + + authCommandService.changePassword(request); + } + + @Operation(summary = "비밀번호 변경 완료") + @PostMapping("/chpw/complete") + public void completeChangePassword(@Valid @RequestBody ChpwCompletionRequest request) { + + authCommandService.completeChangePassword(request); + } + @Operation(summary = "이메일 중복 조회") @GetMapping("/check-email") public CheckEmailResponse checkEmail(@Valid CheckEmailRequest request) { diff --git a/src/main/java/com/writely/auth/domain/ChpwToken.java b/src/main/java/com/writely/auth/domain/ChpwToken.java new file mode 100644 index 0000000..7bdeaea --- /dev/null +++ b/src/main/java/com/writely/auth/domain/ChpwToken.java @@ -0,0 +1,15 @@ +package com.writely.auth.domain; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.redis.core.RedisHash; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@RedisHash(value = "joinToken", timeToLive = 60 * 60) +public class ChpwToken extends BaseToken { + public ChpwToken(String tokenString) { + super(tokenString); + } +} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/src/main/java/com/writely/auth/domain/enums/AuthException.java index 797a0be..c5c31ce 100644 --- a/src/main/java/com/writely/auth/domain/enums/AuthException.java +++ b/src/main/java/com/writely/auth/domain/enums/AuthException.java @@ -13,7 +13,10 @@ public enum AuthException implements CodeInfo { JOIN_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-101", "가입 토큰이 유효하지 않습니다."), JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "로그인에 실패하였습니다."), - MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."); + MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), + CHPW_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), + CHPW_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), + CHPW_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/auth/helper/JwtHelper.java b/src/main/java/com/writely/auth/helper/JwtHelper.java index 3e85c4b..e2fa93a 100644 --- a/src/main/java/com/writely/auth/helper/JwtHelper.java +++ b/src/main/java/com/writely/auth/helper/JwtHelper.java @@ -21,6 +21,7 @@ public class JwtHelper { private final Long accessTokenExpirationPeriod; private final Long refreshTokenExpirationPeriod; private final Long joinTokenExpirationPeriod; + private final Long chpwTokenExpirationPeriod; private final CryptoUtil cryptoUtil; public JwtHelper ( @@ -28,29 +29,36 @@ public JwtHelper ( @Value("${jwt.access-token-expiration-period}") Long accessTokenExpirationPeriod, @Value("${jwt.refresh-token-expiration-period}") Long refreshTokenExpirationPeriod, @Value("${jwt.join-token-expiration-period}") Long joinTokenExpirationPeriod, + @Value("${jwt.chpw-token-expiration-period}") Long chpwTokenExpirationPeriod, @Autowired CryptoUtil cryptoUtil ) { this.algorithm = Algorithm.HMAC256(secret); this.accessTokenExpirationPeriod = accessTokenExpirationPeriod; this.refreshTokenExpirationPeriod = refreshTokenExpirationPeriod; this.joinTokenExpirationPeriod = joinTokenExpirationPeriod; + this.chpwTokenExpirationPeriod = chpwTokenExpirationPeriod; this.cryptoUtil = cryptoUtil; } - public String generateAccessToken(JwtPayload payload) throws JsonProcessingException { + public String generateAccessToken(JwtPayload payload) { return generateJwt(this.accessTokenExpirationPeriod, payload); } - public String generateRefreshToken(JwtPayload payload) throws JsonProcessingException { + public String generateRefreshToken(JwtPayload payload) { return generateJwt(this.refreshTokenExpirationPeriod, payload); } - public String generateJoinToken(JwtPayload payload) throws JsonProcessingException { + public String generateJoinToken(JwtPayload payload) { return generateJwt(this.joinTokenExpirationPeriod, payload); } + public String generateChpwToken(JwtPayload payload) { + + return generateJwt(this.chpwTokenExpirationPeriod, payload); + } + public JwtPayload getPayload(String token) throws JWTVerificationException { try { JWTVerifier verifier = JWT.require(algorithm).build(); @@ -75,7 +83,8 @@ public boolean isTokenValid(String token) { } } - private String generateJwt(Long expPeriod, JwtPayload payload) throws JsonProcessingException { + private String generateJwt(Long expPeriod, JwtPayload payload) { + try { String jsonPayload = new ObjectMapper().writeValueAsString(payload); return JWT.create() @@ -83,5 +92,8 @@ private String generateJwt(Long expPeriod, JwtPayload payload) throws JsonProces .withExpiresAt(Instant.ofEpochSecond(Instant.now().getEpochSecond() + expPeriod)) .withIssuedAt(Instant.now()) .sign(algorithm); + } catch (Exception ex) { + throw new RuntimeException(); + } } } \ No newline at end of file diff --git a/src/main/java/com/writely/auth/helper/MailHelper.java b/src/main/java/com/writely/auth/helper/MailHelper.java index 2fbb6e2..8da5fbd 100644 --- a/src/main/java/com/writely/auth/helper/MailHelper.java +++ b/src/main/java/com/writely/auth/helper/MailHelper.java @@ -2,6 +2,7 @@ import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; +import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; @@ -16,14 +17,24 @@ public class MailHelper { private final SpringTemplateEngine templateEngine; public void send ( - String mailTo, String subject, String templatePath, Context variables + MailType mailType, String mailTo, Context variables ) throws MessagingException { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, false, "UTF-8"); mimeMessageHelper.setTo(mailTo); - mimeMessageHelper.setSubject(subject); - mimeMessageHelper.setText(templateEngine.process(templatePath, variables), true); + mimeMessageHelper.setSubject(mailType.getSubject()); + mimeMessageHelper.setText(templateEngine.process(mailType.getTemplatePath(), variables), true); javaMailSender.send(mimeMessage); } + + @Getter + @RequiredArgsConstructor + public enum MailType { + JOIN("[WritelyForWriters] 회원가입 안내입니다.", "mail/join"), + CHPW("[WritelyForWriters] 비밀번호 변경 안내입니다.", "mail/chpw"); + + private final String subject; + private final String templatePath; + } } diff --git a/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java new file mode 100644 index 0000000..7d4692e --- /dev/null +++ b/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java @@ -0,0 +1,8 @@ +package com.writely.auth.repository; + +import com.writely.auth.domain.ChpwToken; +import org.springframework.data.repository.CrudRepository; + +public interface ChpwTokenRedisRepository extends CrudRepository { + +} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/request/ChpwCompletionRequest.java b/src/main/java/com/writely/auth/request/ChpwCompletionRequest.java new file mode 100644 index 0000000..4b8a575 --- /dev/null +++ b/src/main/java/com/writely/auth/request/ChpwCompletionRequest.java @@ -0,0 +1,20 @@ +package com.writely.auth.request; + +import com.writely.common.validation.IsPassword; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.*; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class ChpwCompletionRequest { + @NotBlank + @Schema(title = "비밀번호 변경 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") + private String chpwToken; + + @NotBlank + @IsPassword + @Schema(title = "변경할 비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") + private String password; +} diff --git a/src/main/java/com/writely/auth/request/ChpwRequest.java b/src/main/java/com/writely/auth/request/ChpwRequest.java new file mode 100644 index 0000000..8de5ba1 --- /dev/null +++ b/src/main/java/com/writely/auth/request/ChpwRequest.java @@ -0,0 +1,14 @@ +package com.writely.auth.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.*; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class ChpwRequest { + @NotBlank + @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") + private String email; +} diff --git a/src/main/java/com/writely/auth/request/JoinTokenRequest.java b/src/main/java/com/writely/auth/request/JoinCompletionRequest.java similarity index 94% rename from src/main/java/com/writely/auth/request/JoinTokenRequest.java rename to src/main/java/com/writely/auth/request/JoinCompletionRequest.java index 7612088..a77745e 100644 --- a/src/main/java/com/writely/auth/request/JoinTokenRequest.java +++ b/src/main/java/com/writely/auth/request/JoinCompletionRequest.java @@ -8,7 +8,7 @@ @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) @Builder -public class JoinTokenRequest { +public class JoinCompletionRequest { @NotBlank @Schema(title = "회원가입 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") private String joinToken; diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 4ecf39b..9346193 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -1,18 +1,14 @@ package com.writely.auth.service; import com.fasterxml.jackson.core.JsonProcessingException; -import com.writely.auth.domain.JoinToken; -import com.writely.auth.domain.JwtPayload; -import com.writely.auth.domain.RefreshToken; +import com.writely.auth.domain.*; import com.writely.auth.domain.enums.AuthException; import com.writely.auth.helper.JwtHelper; import com.writely.auth.helper.MailHelper; +import com.writely.auth.repository.ChpwTokenRedisRepository; import com.writely.auth.repository.JoinTokenRedisRepository; import com.writely.auth.repository.RefreshTokenRedisRepository; -import com.writely.auth.request.JoinRequest; -import com.writely.auth.request.JoinTokenRequest; -import com.writely.auth.request.LoginRequest; -import com.writely.auth.request.ReissueRequest; +import com.writely.auth.request.*; import com.writely.auth.response.AuthTokenResponse; import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.exception.BaseException; @@ -29,7 +25,6 @@ import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; -import java.security.GeneralSecurityException; import java.util.UUID; @Service @@ -41,11 +36,14 @@ public class AuthCommandService { private final MemberPasswordJpaRepository memberPasswordJpaRepository; private final RefreshTokenRedisRepository refreshTokenRedisRepository; private final JoinTokenRedisRepository joinTokenRedisRepository; + private final ChpwTokenRedisRepository chpwTokenRedisRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; private final CryptoUtil cryptoUtil; - // 토큰 재발급 + /** + * 토큰 재발급 + */ public AuthTokenResponse reissueToken(ReissueRequest request) { // 토큰이 비유효하면 if (!jwtHelper.isTokenValid(request.getRefreshToken())) { @@ -56,14 +54,11 @@ public AuthTokenResponse reissueToken(ReissueRequest request) { return generateAuthTokens(payload.getMemberId()); } - // 로그인 + /** + * 로그인 + */ public AuthTokenResponse login(LoginRequest request) { - String passwordHash; - try { - passwordHash = cryptoUtil.hash(request.getPassword()); - } catch (Exception ex) { - throw new BaseException(ResultCodeInfo.FAILURE); - } + String passwordHash = cryptoUtil.hash(request.getPassword()); MemberPassword memberPassword = memberPasswordJpaRepository.findByPassword(passwordHash) .orElseThrow(() -> new BaseException(AuthException.LOGIN_FAILED)); @@ -71,51 +66,52 @@ public AuthTokenResponse login(LoginRequest request) { return generateAuthTokens(memberPassword.getMemberId()); } - // 회원가입 + /** + * 회원 가입 + */ public void join(JoinRequest request) { - // 이미 있는 회원인지 검사 if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); } - try { - String passwordHash = cryptoUtil.hash(request.getPassword()); - Member member = Member.builder() - .email(request.getEmail()) - .nickname(request.getNickname()) - .build(); - MemberPassword memberPassword = MemberPassword.builder() - .memberId(member.getId()) - .password(passwordHash) - .build(); - String jwtString = jwtHelper.generateJoinToken( - JwtPayload.builder().memberId(member.getId()).build() - ); - // joinToken redis 저장 - JoinToken joinToken = new JoinToken(jwtString, member, memberPassword); - joinTokenRedisRepository.save(joinToken); + // 회원 정보 설정 + String passwordHash = cryptoUtil.hash(request.getPassword()); + Member member = Member.builder() + .email(request.getEmail()) + .nickname(request.getNickname()) + .build(); + MemberPassword memberPassword = MemberPassword.builder() + .memberId(member.getId()) + .password(passwordHash) + .build(); + String jwtString = jwtHelper.generateJoinToken( + JwtPayload.builder().memberId(member.getId()).build() + ); + + // joinToken redis 저장 + JoinToken joinToken = new JoinToken(jwtString, member, memberPassword); + joinTokenRedisRepository.save(joinToken); + try { // 이메일 전송 Context emailCtx = new Context(); emailCtx.setVariable("joinToken", joinToken.getTokenString()); - mailHelper.send( + MailHelper.MailType.JOIN, request.getEmail(), - "[WritelyForWriters] 회원가입 안내입니다.", - "mail/join", emailCtx ); // todo: 메일 디자인 - } catch (JsonProcessingException | GeneralSecurityException ex) { - throw new BaseException(ResultCodeInfo.FAILURE); } catch (MessagingException e) { throw new BaseException(AuthException.MAIL_SEND_FAILED); } } - // 회원가입 완료 - public AuthTokenResponse completeJoin(JoinTokenRequest request) { + /** + * 회원가입 완료 + */ + public AuthTokenResponse completeJoin(JoinCompletionRequest request) { final String joinTokenString = request.getJoinToken(); // 토큰이 비유효한 경우 @@ -131,24 +127,91 @@ public AuthTokenResponse completeJoin(JoinTokenRequest request) { memberJpaRepository.save(joinToken.getMember()); memberPasswordJpaRepository.save(joinToken.getMemberPassword()); + // 토큰 무효화 + this.invalidateToken(joinToken); + return generateAuthTokens(joinToken.getMember().getId()); } - - // 인증 토큰 생성 - public AuthTokenResponse generateAuthTokens(UUID memberId) { + + /** + * 비밀번호 변경 + */ + public void changePassword(ChpwRequest request) { + Member member = memberJpaRepository.findByEmail(request.getEmail()) + .orElseThrow(() -> new BaseException(AuthException.CHPW_EMAIL_NOT_FOUND)); + + // 비밀번호 변경 토큰 생성 & 저장 + JwtPayload payload = JwtPayload.builder() + .memberId(member.getId()) + .build(); + ChpwToken chpwToken = new ChpwToken(jwtHelper.generateChpwToken(payload)); + chpwTokenRedisRepository.save(chpwToken); + + // 이메일 전송 try { - JwtPayload jwtPayload = JwtPayload.builder() - .memberId(memberId) - .build(); - String accessToken = jwtHelper.generateAccessToken(jwtPayload); - String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); - refreshTokenRedisRepository.save(new RefreshToken(refreshToken)); - - return new AuthTokenResponse(accessToken, refreshToken); - } catch (JsonProcessingException ex) { - LogUtil.error(ex); - - throw new BaseException(ResultCodeInfo.FAILURE); + Context emailCtx = new Context(); + emailCtx.setVariable("chpwToken", chpwToken.getTokenString()); + mailHelper.send( + MailHelper.MailType.CHPW, + member.getEmail(), + emailCtx + ); + } catch (MessagingException e) { + throw new BaseException(AuthException.CHPW_EMAIL_NOT_FOUND); + } + + } + + /** + * 비밀번호 변경 완료 + */ + public void completeChangePassword(ChpwCompletionRequest request) { + // 토큰이 비유효한 경우 + if (!jwtHelper.isTokenValid(request.getChpwToken())) { + throw new BaseException(AuthException.CHPW_TOKEN_NOT_VALID); + } + + // 토큰 레디스 조회 + ChpwToken chpwToken = chpwTokenRedisRepository.findById(request.getChpwToken()) + .orElseThrow(() -> new BaseException(AuthException.CHPW_TOKEN_NOT_VALID)); + JwtPayload payload = jwtHelper.getPayload(chpwToken.getTokenString()); + + // 비밀번호 변경 + MemberPassword memberPassword = memberPasswordJpaRepository.findById(payload.getMemberId()) + .orElseThrow(() -> new BaseException(ResultCodeInfo.FAILURE)); + String passwordHash = cryptoUtil.hash(request.getPassword()); + memberPassword.setPassword(passwordHash); + + // 토큰 무효화 + this.invalidateToken(chpwToken); + } + + /** + * 인증 토큰 발급 (액세스 + 리프래시) + */ + private AuthTokenResponse generateAuthTokens(UUID memberId) { + JwtPayload jwtPayload = JwtPayload.builder() + .memberId(memberId) + .build(); + String accessToken = jwtHelper.generateAccessToken(jwtPayload); + String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); + refreshTokenRedisRepository.save(new RefreshToken(refreshToken)); + + return new AuthTokenResponse(accessToken, refreshToken); + } + + /** + * 토큰 무효화 (Redis에서 관리하는 토큰의 경우) + */ + private void invalidateToken(BaseToken token) { + if (token instanceof RefreshToken refreshToken) { + refreshTokenRedisRepository.delete(refreshToken); + } + else if (token instanceof JoinToken joinToken) { + joinTokenRedisRepository.delete(joinToken); + } + else if (token instanceof ChpwToken chpwToken) { + chpwTokenRedisRepository.delete(chpwToken); } } } diff --git a/src/main/java/com/writely/common/util/CryptoUtil.java b/src/main/java/com/writely/common/util/CryptoUtil.java index b5cb755..4a2b680 100644 --- a/src/main/java/com/writely/common/util/CryptoUtil.java +++ b/src/main/java/com/writely/common/util/CryptoUtil.java @@ -6,7 +6,6 @@ import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import java.security.GeneralSecurityException; import java.security.MessageDigest; import java.util.Base64; @@ -24,29 +23,37 @@ public class CryptoUtil { @Value("${crypto.iv}") private String IV; - public String encrypt(String plainText) throws GeneralSecurityException { + public String encrypt(String plainText) { SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET.getBytes(), CRYPT_ALGO); IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes()); - Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); - cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivSpec); + try { + Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivSpec); - byte[] cipherText = cipher.doFinal(plainText.getBytes()); + byte[] cipherText = cipher.doFinal(plainText.getBytes()); - return encodeBase64(cipherText); + return encodeBase64(cipherText); + } catch (Exception ex) { + throw new RuntimeException(); + } } - public String decrypt(String cipherText) throws GeneralSecurityException { + public String decrypt(String cipherText) { SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET.getBytes(), CRYPT_ALGO); IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes()); - Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); - cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivSpec); + try { + Cipher cipher = Cipher.getInstance(CRYPT_ALGO + "/" + CRYPT_MODE + "/" + CRYPT_PADDING); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivSpec); - byte[] decoded = decodeBase64(cipherText); - byte[] plainText = cipher.doFinal(decoded); + byte[] decoded = decodeBase64(cipherText); + byte[] plainText = cipher.doFinal(decoded); - return new String(plainText); + return new String(plainText); + } catch (Exception ex) { + throw new RuntimeException(); + } } /** @@ -55,17 +62,21 @@ public String decrypt(String cipherText) throws GeneralSecurityException { private static final String HASH_ALGO = "SHA-256"; private static final Integer HASH_ROUND = 3; - public String hash(String plainText) throws GeneralSecurityException { + public String hash(String plainText) { return hash(plainText + SECRET, HASH_ROUND); } - private String hash(String hashText, Integer rounds) throws GeneralSecurityException { + private String hash(String hashText, Integer rounds) { if (rounds == 0) return hashText; - MessageDigest md = MessageDigest.getInstance(HASH_ALGO); - md.update((hashText).getBytes()); + try { + MessageDigest md = MessageDigest.getInstance(HASH_ALGO); + md.update((hashText).getBytes()); - return hash(bytesToHex(md.digest()), --rounds); + return hash(bytesToHex(md.digest()), --rounds); + } catch (Exception ex) { + throw new RuntimeException(); + } } private String bytesToHex(byte[] bytes) { diff --git a/src/main/resources/templates/mail/chpw.html b/src/main/resources/templates/mail/chpw.html index ddf9624..f3b5981 100644 --- a/src/main/resources/templates/mail/chpw.html +++ b/src/main/resources/templates/mail/chpw.html @@ -5,7 +5,7 @@

Hello

ch pw us

-
+

From a782a2e324b89d3cc14705d12be8e1e9d8e90985 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 1 Feb 2025 13:56:44 +0900 Subject: [PATCH 023/107] refactor(pr20): rename chpw to changePassword (#21) --- BE-secret | 2 +- .../auth/controller/AuthController.java | 8 ++-- ...hpwToken.java => ChangePasswordToken.java} | 6 +-- .../auth/domain/enums/AuthException.java | 6 +-- .../com/writely/auth/helper/JwtHelper.java | 10 ++-- .../com/writely/auth/helper/MailHelper.java | 2 +- .../ChangePasswordTokenRedisRepository.java | 8 ++++ .../repository/ChpwTokenRedisRepository.java | 8 ---- ...a => ChangePasswordCompletionRequest.java} | 4 +- ...equest.java => ChangePasswordRequest.java} | 2 +- .../auth/service/AuthCommandService.java | 47 ++++++++++--------- .../mail/{chpw.html => change-password.html} | 2 +- 12 files changed, 55 insertions(+), 50 deletions(-) rename src/main/java/com/writely/auth/domain/{ChpwToken.java => ChangePasswordToken.java} (60%) create mode 100644 src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java delete mode 100644 src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java rename src/main/java/com/writely/auth/request/{ChpwCompletionRequest.java => ChangePasswordCompletionRequest.java} (89%) rename src/main/java/com/writely/auth/request/{ChpwRequest.java => ChangePasswordRequest.java} (91%) rename src/main/resources/templates/mail/{chpw.html => change-password.html} (78%) diff --git a/BE-secret b/BE-secret index 95a9099..7ff1ec8 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 95a9099eb07cfb4381e11b5c9042f0aba045e156 +Subproject commit 7ff1ec89c5053fb510dd4cb9f8949402cd4216e5 diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java index 56a3dcf..4c317d8 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -48,15 +48,15 @@ public AuthTokenResponse completeJoin(@Valid @RequestBody JoinCompletionRequest } @Operation(summary = "비밀번호 변경") - @PostMapping("/chpw") - public void changePassword(@Valid @RequestBody ChpwRequest request) { + @PostMapping("/change-password") + public void changePassword(@Valid @RequestBody ChangePasswordRequest request) { authCommandService.changePassword(request); } @Operation(summary = "비밀번호 변경 완료") - @PostMapping("/chpw/complete") - public void completeChangePassword(@Valid @RequestBody ChpwCompletionRequest request) { + @PostMapping("/change-password/complete") + public void completeChangePassword(@Valid @RequestBody ChangePasswordCompletionRequest request) { authCommandService.completeChangePassword(request); } diff --git a/src/main/java/com/writely/auth/domain/ChpwToken.java b/src/main/java/com/writely/auth/domain/ChangePasswordToken.java similarity index 60% rename from src/main/java/com/writely/auth/domain/ChpwToken.java rename to src/main/java/com/writely/auth/domain/ChangePasswordToken.java index 7bdeaea..f892c5e 100644 --- a/src/main/java/com/writely/auth/domain/ChpwToken.java +++ b/src/main/java/com/writely/auth/domain/ChangePasswordToken.java @@ -7,9 +7,9 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@RedisHash(value = "joinToken", timeToLive = 60 * 60) -public class ChpwToken extends BaseToken { - public ChpwToken(String tokenString) { +@RedisHash(value = "changePasswordToken", timeToLive = 60 * 60) +public class ChangePasswordToken extends BaseToken { + public ChangePasswordToken(String tokenString) { super(tokenString); } } \ No newline at end of file diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/src/main/java/com/writely/auth/domain/enums/AuthException.java index c5c31ce..7dda3e9 100644 --- a/src/main/java/com/writely/auth/domain/enums/AuthException.java +++ b/src/main/java/com/writely/auth/domain/enums/AuthException.java @@ -14,9 +14,9 @@ public enum AuthException implements CodeInfo { JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "로그인에 실패하였습니다."), MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), - CHPW_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), - CHPW_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), - CHPW_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."); + CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), + CHANGE_PASSWORD_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), + CHANGE_PASSWORD_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/auth/helper/JwtHelper.java b/src/main/java/com/writely/auth/helper/JwtHelper.java index e2fa93a..bd2b337 100644 --- a/src/main/java/com/writely/auth/helper/JwtHelper.java +++ b/src/main/java/com/writely/auth/helper/JwtHelper.java @@ -21,7 +21,7 @@ public class JwtHelper { private final Long accessTokenExpirationPeriod; private final Long refreshTokenExpirationPeriod; private final Long joinTokenExpirationPeriod; - private final Long chpwTokenExpirationPeriod; + private final Long changePasswordTokenExpirationPeriod; private final CryptoUtil cryptoUtil; public JwtHelper ( @@ -29,14 +29,14 @@ public JwtHelper ( @Value("${jwt.access-token-expiration-period}") Long accessTokenExpirationPeriod, @Value("${jwt.refresh-token-expiration-period}") Long refreshTokenExpirationPeriod, @Value("${jwt.join-token-expiration-period}") Long joinTokenExpirationPeriod, - @Value("${jwt.chpw-token-expiration-period}") Long chpwTokenExpirationPeriod, + @Value("${jwt.change-password-token-expiration-period}") Long changePasswordTokenExpirationPeriod, @Autowired CryptoUtil cryptoUtil ) { this.algorithm = Algorithm.HMAC256(secret); this.accessTokenExpirationPeriod = accessTokenExpirationPeriod; this.refreshTokenExpirationPeriod = refreshTokenExpirationPeriod; this.joinTokenExpirationPeriod = joinTokenExpirationPeriod; - this.chpwTokenExpirationPeriod = chpwTokenExpirationPeriod; + this.changePasswordTokenExpirationPeriod = changePasswordTokenExpirationPeriod; this.cryptoUtil = cryptoUtil; } @@ -54,9 +54,9 @@ public String generateJoinToken(JwtPayload payload) { return generateJwt(this.joinTokenExpirationPeriod, payload); } - public String generateChpwToken(JwtPayload payload) { + public String generateChangePasswordToken(JwtPayload payload) { - return generateJwt(this.chpwTokenExpirationPeriod, payload); + return generateJwt(this.changePasswordTokenExpirationPeriod, payload); } public JwtPayload getPayload(String token) throws JWTVerificationException { diff --git a/src/main/java/com/writely/auth/helper/MailHelper.java b/src/main/java/com/writely/auth/helper/MailHelper.java index 8da5fbd..ab050d8 100644 --- a/src/main/java/com/writely/auth/helper/MailHelper.java +++ b/src/main/java/com/writely/auth/helper/MailHelper.java @@ -32,7 +32,7 @@ public void send ( @RequiredArgsConstructor public enum MailType { JOIN("[WritelyForWriters] 회원가입 안내입니다.", "mail/join"), - CHPW("[WritelyForWriters] 비밀번호 변경 안내입니다.", "mail/chpw"); + CHANGE_PASSWORD("[WritelyForWriters] 비밀번호 변경 안내입니다.", "mail/change-password"); private final String subject; private final String templatePath; diff --git a/src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java new file mode 100644 index 0000000..6621925 --- /dev/null +++ b/src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java @@ -0,0 +1,8 @@ +package com.writely.auth.repository; + +import com.writely.auth.domain.ChangePasswordToken; +import org.springframework.data.repository.CrudRepository; + +public interface ChangePasswordTokenRedisRepository extends CrudRepository { + +} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java deleted file mode 100644 index 7d4692e..0000000 --- a/src/main/java/com/writely/auth/repository/ChpwTokenRedisRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.writely.auth.repository; - -import com.writely.auth.domain.ChpwToken; -import org.springframework.data.repository.CrudRepository; - -public interface ChpwTokenRedisRepository extends CrudRepository { - -} \ No newline at end of file diff --git a/src/main/java/com/writely/auth/request/ChpwCompletionRequest.java b/src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java similarity index 89% rename from src/main/java/com/writely/auth/request/ChpwCompletionRequest.java rename to src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java index 4b8a575..a7519a3 100644 --- a/src/main/java/com/writely/auth/request/ChpwCompletionRequest.java +++ b/src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java @@ -8,10 +8,10 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor -public class ChpwCompletionRequest { +public class ChangePasswordCompletionRequest { @NotBlank @Schema(title = "비밀번호 변경 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") - private String chpwToken; + private String changePasswordToken; @NotBlank @IsPassword diff --git a/src/main/java/com/writely/auth/request/ChpwRequest.java b/src/main/java/com/writely/auth/request/ChangePasswordRequest.java similarity index 91% rename from src/main/java/com/writely/auth/request/ChpwRequest.java rename to src/main/java/com/writely/auth/request/ChangePasswordRequest.java index 8de5ba1..1e31f14 100644 --- a/src/main/java/com/writely/auth/request/ChpwRequest.java +++ b/src/main/java/com/writely/auth/request/ChangePasswordRequest.java @@ -7,7 +7,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor -public class ChpwRequest { +public class ChangePasswordRequest { @NotBlank @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 9346193..0efa71a 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -1,11 +1,10 @@ package com.writely.auth.service; -import com.fasterxml.jackson.core.JsonProcessingException; import com.writely.auth.domain.*; import com.writely.auth.domain.enums.AuthException; import com.writely.auth.helper.JwtHelper; import com.writely.auth.helper.MailHelper; -import com.writely.auth.repository.ChpwTokenRedisRepository; +import com.writely.auth.repository.ChangePasswordTokenRedisRepository; import com.writely.auth.repository.JoinTokenRedisRepository; import com.writely.auth.repository.RefreshTokenRedisRepository; import com.writely.auth.request.*; @@ -13,7 +12,6 @@ import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.exception.BaseException; import com.writely.common.util.CryptoUtil; -import com.writely.common.util.LogUtil; import com.writely.member.domain.Member; import com.writely.member.domain.MemberPassword; import com.writely.member.repository.MemberPasswordJpaRepository; @@ -36,7 +34,7 @@ public class AuthCommandService { private final MemberPasswordJpaRepository memberPasswordJpaRepository; private final RefreshTokenRedisRepository refreshTokenRedisRepository; private final JoinTokenRedisRepository joinTokenRedisRepository; - private final ChpwTokenRedisRepository chpwTokenRedisRepository; + private final ChangePasswordTokenRedisRepository changePasswordTokenRedisRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; private final CryptoUtil cryptoUtil; @@ -136,28 +134,28 @@ public AuthTokenResponse completeJoin(JoinCompletionRequest request) { /** * 비밀번호 변경 */ - public void changePassword(ChpwRequest request) { + public void changePassword(ChangePasswordRequest request) { Member member = memberJpaRepository.findByEmail(request.getEmail()) - .orElseThrow(() -> new BaseException(AuthException.CHPW_EMAIL_NOT_FOUND)); + .orElseThrow(() -> new BaseException(AuthException.CHANGE_PASSWORD_EMAIL_NOT_FOUND)); // 비밀번호 변경 토큰 생성 & 저장 JwtPayload payload = JwtPayload.builder() .memberId(member.getId()) .build(); - ChpwToken chpwToken = new ChpwToken(jwtHelper.generateChpwToken(payload)); - chpwTokenRedisRepository.save(chpwToken); + ChangePasswordToken changePasswordToken = new ChangePasswordToken(jwtHelper.generateChangePasswordToken(payload)); + changePasswordTokenRedisRepository.save(changePasswordToken); // 이메일 전송 try { Context emailCtx = new Context(); - emailCtx.setVariable("chpwToken", chpwToken.getTokenString()); + emailCtx.setVariable("changePasswordToken", changePasswordToken.getTokenString()); mailHelper.send( - MailHelper.MailType.CHPW, + MailHelper.MailType.CHANGE_PASSWORD, member.getEmail(), emailCtx ); } catch (MessagingException e) { - throw new BaseException(AuthException.CHPW_EMAIL_NOT_FOUND); + throw new BaseException(AuthException.CHANGE_PASSWORD_EMAIL_NOT_FOUND); } } @@ -165,25 +163,32 @@ public void changePassword(ChpwRequest request) { /** * 비밀번호 변경 완료 */ - public void completeChangePassword(ChpwCompletionRequest request) { + public void completeChangePassword(ChangePasswordCompletionRequest request) { // 토큰이 비유효한 경우 - if (!jwtHelper.isTokenValid(request.getChpwToken())) { - throw new BaseException(AuthException.CHPW_TOKEN_NOT_VALID); + if (!jwtHelper.isTokenValid(request.getChangePasswordToken())) { + throw new BaseException(AuthException.CHANGE_PASSWORD_TOKEN_NOT_VALID); } // 토큰 레디스 조회 - ChpwToken chpwToken = chpwTokenRedisRepository.findById(request.getChpwToken()) - .orElseThrow(() -> new BaseException(AuthException.CHPW_TOKEN_NOT_VALID)); - JwtPayload payload = jwtHelper.getPayload(chpwToken.getTokenString()); + ChangePasswordToken changePasswordToken = changePasswordTokenRedisRepository.findById(request.getChangePasswordToken()) + .orElseThrow(() -> new BaseException(AuthException.CHANGE_PASSWORD_TOKEN_NOT_VALID)); + JwtPayload payload = jwtHelper.getPayload(changePasswordToken.getTokenString()); - // 비밀번호 변경 + // 비밀번호 조회 MemberPassword memberPassword = memberPasswordJpaRepository.findById(payload.getMemberId()) .orElseThrow(() -> new BaseException(ResultCodeInfo.FAILURE)); String passwordHash = cryptoUtil.hash(request.getPassword()); + + // 이전 비밀번호와 동일한 경우 + if (passwordHash.equals(memberPassword.getPassword())) { + throw new BaseException(AuthException.CHANGE_PASSWORD_USED_PASSWORD_BEFORE); + } + + // 비밀번호 변경 memberPassword.setPassword(passwordHash); // 토큰 무효화 - this.invalidateToken(chpwToken); + this.invalidateToken(changePasswordToken); } /** @@ -210,8 +215,8 @@ private void invalidateToken(BaseToken token) { else if (token instanceof JoinToken joinToken) { joinTokenRedisRepository.delete(joinToken); } - else if (token instanceof ChpwToken chpwToken) { - chpwTokenRedisRepository.delete(chpwToken); + else if (token instanceof ChangePasswordToken changePasswordToken) { + changePasswordTokenRedisRepository.delete(changePasswordToken); } } } diff --git a/src/main/resources/templates/mail/chpw.html b/src/main/resources/templates/mail/change-password.html similarity index 78% rename from src/main/resources/templates/mail/chpw.html rename to src/main/resources/templates/mail/change-password.html index f3b5981..92ec073 100644 --- a/src/main/resources/templates/mail/chpw.html +++ b/src/main/resources/templates/mail/change-password.html @@ -5,7 +5,7 @@

Hello

ch pw us

-
+

From 6d367e3522280324768c9cb1c3b89d67c501d3e3 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:48:18 +0900 Subject: [PATCH 024/107] =?UTF-8?q?refactor:=20product=20domain=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 4 +- .../writely/tables/ProductCustomField.java | 4 +- .../tables/pojos/ProductCustomField.java | 24 +++++------ .../records/ProductCustomFieldRecord.java | 14 +++--- .../product/controller/ProductController.java | 4 +- .../product/domain/ProductCustomField.java | 14 +++--- .../domain/enums/ProductSectionType.java | 43 +++++++++++++++++++ ...t.java => ProductTemplateSaveRequest.java} | 7 +-- .../response/ProductTemplateResponse.java | 5 ++- .../service/ProductCommandService.java | 22 +++++----- 10 files changed, 94 insertions(+), 47 deletions(-) create mode 100644 src/main/java/com/writely/product/domain/enums/ProductSectionType.java rename src/main/java/com/writely/product/request/{ProductTemplateCreateRequest.java => ProductTemplateSaveRequest.java} (96%) diff --git a/sql/init.sql b/sql/init.sql index 57d748f..c2a2280 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -102,7 +102,7 @@ create table product_custom_field constraint product_custom_field_pk primary key, product_id uuid not null, - section_code varchar(20) not null, + section_type varchar(20) not null, name varchar(30) not null, content text not null, seq smallint not null, @@ -115,7 +115,7 @@ create table product_custom_field comment on table product_custom_field is '작품 커스텀 필드'; comment on column product_custom_field.id is '커스텀 필드 ID'; comment on column product_custom_field.product_id is '작품 ID'; -comment on column product_custom_field.section_code is '섹션 코드'; +comment on column product_custom_field.section_type is '섹션 타입'; comment on column product_custom_field.name is '이름'; comment on column product_custom_field.content is '내용'; comment on column product_custom_field.seq is '순서'; diff --git a/src/main/generated/writely/tables/ProductCustomField.java b/src/main/generated/writely/tables/ProductCustomField.java index 8e7b18b..750a9a0 100644 --- a/src/main/generated/writely/tables/ProductCustomField.java +++ b/src/main/generated/writely/tables/ProductCustomField.java @@ -62,9 +62,9 @@ public Class getRecordType() { public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); /** - * The column public.product_custom_field.section_code. 섹션 코드 + * The column public.product_custom_field.section_type. 섹션 타입 */ - public final TableField SECTION_CODE = createField(DSL.name("section_code"), SQLDataType.VARCHAR(20).nullable(false), this, "섹션 코드"); + public final TableField SECTION_TYPE = createField(DSL.name("section_type"), SQLDataType.VARCHAR(20).nullable(false), this, "섹션 타입"); /** * The column public.product_custom_field.name. 이름 diff --git a/src/main/generated/writely/tables/pojos/ProductCustomField.java b/src/main/generated/writely/tables/pojos/ProductCustomField.java index a749a04..393b58f 100644 --- a/src/main/generated/writely/tables/pojos/ProductCustomField.java +++ b/src/main/generated/writely/tables/pojos/ProductCustomField.java @@ -19,7 +19,7 @@ public class ProductCustomField implements Serializable { private final UUID id; private final UUID productId; - private final String sectionCode; + private final String sectionType; private final String name; private final String content; private final Short seq; @@ -31,7 +31,7 @@ public class ProductCustomField implements Serializable { public ProductCustomField(ProductCustomField value) { this.id = value.id; this.productId = value.productId; - this.sectionCode = value.sectionCode; + this.sectionType = value.sectionType; this.name = value.name; this.content = value.content; this.seq = value.seq; @@ -44,7 +44,7 @@ public ProductCustomField(ProductCustomField value) { public ProductCustomField( UUID id, UUID productId, - String sectionCode, + String sectionType, String name, String content, Short seq, @@ -55,7 +55,7 @@ public ProductCustomField( ) { this.id = id; this.productId = productId; - this.sectionCode = sectionCode; + this.sectionType = sectionType; this.name = name; this.content = content; this.seq = seq; @@ -80,10 +80,10 @@ public UUID getProductId() { } /** - * Getter for public.product_custom_field.section_code. 섹션 코드 + * Getter for public.product_custom_field.section_type. 섹션 타입 */ - public String getSectionCode() { - return this.sectionCode; + public String getSectionType() { + return this.sectionType; } /** @@ -156,11 +156,11 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; - if (this.sectionCode == null) { - if (other.sectionCode != null) + if (this.sectionType == null) { + if (other.sectionType != null) return false; } - else if (!this.sectionCode.equals(other.sectionCode)) + else if (!this.sectionType.equals(other.sectionType)) return false; if (this.name == null) { if (other.name != null) @@ -213,7 +213,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); - result = prime * result + ((this.sectionCode == null) ? 0 : this.sectionCode.hashCode()); + result = prime * result + ((this.sectionType == null) ? 0 : this.sectionType.hashCode()); result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.seq == null) ? 0 : this.seq.hashCode()); @@ -230,7 +230,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); - sb.append(", ").append(sectionCode); + sb.append(", ").append(sectionType); sb.append(", ").append(name); sb.append(", ").append(content); sb.append(", ").append(seq); diff --git a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java index 563f1cd..6d16910 100644 --- a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java +++ b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java @@ -52,17 +52,17 @@ public UUID getProductId() { } /** - * Setter for public.product_custom_field.section_code. 섹션 코드 + * Setter for public.product_custom_field.section_type. 섹션 타입 */ - public ProductCustomFieldRecord setSectionCode(String value) { + public ProductCustomFieldRecord setSectionType(String value) { set(2, value); return this; } /** - * Getter for public.product_custom_field.section_code. 섹션 코드 + * Getter for public.product_custom_field.section_type. 섹션 타입 */ - public String getSectionCode() { + public String getSectionType() { return (String) get(2); } @@ -194,12 +194,12 @@ public ProductCustomFieldRecord() { /** * Create a detached, initialised ProductCustomFieldRecord */ - public ProductCustomFieldRecord(UUID id, UUID productId, String sectionCode, String name, String content, Short seq, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductCustomFieldRecord(UUID id, UUID productId, String sectionType, String name, String content, Short seq, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductCustomField.PRODUCT_CUSTOM_FIELD); setId(id); setProductId(productId); - setSectionCode(sectionCode); + setSectionType(sectionType); setName(name); setContent(content); setSeq(seq); @@ -219,7 +219,7 @@ public ProductCustomFieldRecord(writely.tables.pojos.ProductCustomField value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); - setSectionCode(value.getSectionCode()); + setSectionType(value.getSectionType()); setName(value.getName()); setContent(value.getContent()); setSeq(value.getSeq()); diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/src/main/java/com/writely/product/controller/ProductController.java index ddc3a08..8823ae2 100644 --- a/src/main/java/com/writely/product/controller/ProductController.java +++ b/src/main/java/com/writely/product/controller/ProductController.java @@ -2,7 +2,7 @@ import com.writely.product.request.ProductMemoCreateRequest; import com.writely.product.request.ProductModifyRequest; -import com.writely.product.request.ProductTemplateCreateRequest; +import com.writely.product.request.ProductTemplateSaveRequest; import com.writely.product.response.ProductDetailResponse; import com.writely.product.response.ProductMemoResponse; import com.writely.product.response.ProductResponse; @@ -44,7 +44,7 @@ public UUID modify( @PostMapping("/{productId}/templates") public void createTemplate( @PathVariable UUID productId, - @RequestBody ProductTemplateCreateRequest request) { + @RequestBody ProductTemplateSaveRequest request) { productCommandService.saveTemplate(productId, request); } diff --git a/src/main/java/com/writely/product/domain/ProductCustomField.java b/src/main/java/com/writely/product/domain/ProductCustomField.java index 673661f..6f7797f 100644 --- a/src/main/java/com/writely/product/domain/ProductCustomField.java +++ b/src/main/java/com/writely/product/domain/ProductCustomField.java @@ -1,6 +1,7 @@ package com.writely.product.domain; import com.writely.common.domain.BaseAuditTimeEntity; +import com.writely.product.domain.enums.ProductSectionType; import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; @@ -23,8 +24,9 @@ public class ProductCustomField extends BaseAuditTimeEntity { @Column(name = "product_id", nullable = false) private UUID productId; - @Column(name = "section_code", nullable = false) - private String sectionCode; + @Convert(converter = ProductSectionType.TypeCodeConverter.class) + @Column(name = "section_type", nullable = false) + private ProductSectionType sectionType; @Column(name = "name", nullable = false) private String name; @@ -36,16 +38,16 @@ public class ProductCustomField extends BaseAuditTimeEntity { private Short seq; @Builder - public ProductCustomField(UUID productId, String sectionCode, String name, String content, Short seq) { + public ProductCustomField(UUID productId, ProductSectionType sectionType, String name, String content, Short seq) { this.productId = productId; - this.sectionCode = sectionCode; + this.sectionType = sectionType; this.name = name; this.content = content; this.seq = seq; } - public void update(String sectionCode, String name, String content, Short seq) { - this.sectionCode = sectionCode; + public void update(ProductSectionType sectionType, String name, String content, Short seq) { + this.sectionType = sectionType; this.name = name; this.content = content; this.seq = seq; diff --git a/src/main/java/com/writely/product/domain/enums/ProductSectionType.java b/src/main/java/com/writely/product/domain/enums/ProductSectionType.java new file mode 100644 index 0000000..daa9608 --- /dev/null +++ b/src/main/java/com/writely/product/domain/enums/ProductSectionType.java @@ -0,0 +1,43 @@ +package com.writely.product.domain.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.writely.common.converter.AbstractEnumCodeConverter; +import com.writely.common.enums.Codable; +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import java.util.EnumSet; + +@Getter +@RequiredArgsConstructor +public enum ProductSectionType implements Codable { + + CHARACTER("character"), + WORLDVIEW("worldview"); + + private final String code; + + public static boolean containCode(String code) { + return EnumSet.allOf(ProductSectionType.class).stream().anyMatch(e -> e.getCode().equals(code)); + } + + @JsonCreator + public static ProductSectionType fromCode(final String code) { + return Codable.fromCode(ProductSectionType.class, code); + } + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public ProductSectionType convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(ProductSectionType.class, dbData); + } + } + + @JsonValue + public String getCode() { + return code; + } +} diff --git a/src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java b/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java similarity index 96% rename from src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java rename to src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java index 13e1e77..e9c7251 100644 --- a/src/main/java/com/writely/product/request/ProductTemplateCreateRequest.java +++ b/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java @@ -1,6 +1,7 @@ package com.writely.product.request; import com.writely.product.domain.*; +import com.writely.product.domain.enums.ProductSectionType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; @@ -10,7 +11,7 @@ @Getter @Setter -public class ProductTemplateCreateRequest { +public class ProductTemplateSaveRequest { private List characters; private List customFields; @@ -67,7 +68,7 @@ public static class CustomField { @Schema(nullable = true) private UUID id; @Schema(title = "섹션 코드") - private String sectionCode; + private ProductSectionType sectionType; @Schema(title = "필드 이름") private String name; @Schema(title = "필드 내용") @@ -78,7 +79,7 @@ public static class CustomField { public ProductCustomField toEntity(UUID productId) { return ProductCustomField.builder() .productId(productId) - .sectionCode(sectionCode) + .sectionType(sectionType) .name(name) .content(content) .seq(seq) diff --git a/src/main/java/com/writely/product/response/ProductTemplateResponse.java b/src/main/java/com/writely/product/response/ProductTemplateResponse.java index 5eae045..923dcaa 100644 --- a/src/main/java/com/writely/product/response/ProductTemplateResponse.java +++ b/src/main/java/com/writely/product/response/ProductTemplateResponse.java @@ -1,6 +1,7 @@ package com.writely.product.response; import com.writely.product.domain.*; +import com.writely.product.domain.enums.ProductSectionType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; @@ -77,7 +78,7 @@ public static class CustomField { private final UUID id; @Schema(title = "섹션 코드") - private final String sectionCode; + private final ProductSectionType sectionType; @Schema(title = "필드 이름") private final String name; @Schema(title = "필드 내용") @@ -87,7 +88,7 @@ public static class CustomField { public CustomField(ProductCustomField customField) { this.id = customField.getId(); - this.sectionCode = customField.getSectionCode(); + this.sectionType = customField.getSectionType(); this.name = customField.getName(); this.content = customField.getContent(); this.seq = customField.getSeq(); diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index 0929654..f48e82e 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -6,7 +6,7 @@ import com.writely.product.repository.*; import com.writely.product.request.ProductMemoCreateRequest; import com.writely.product.request.ProductModifyRequest; -import com.writely.product.request.ProductTemplateCreateRequest; +import com.writely.product.request.ProductTemplateSaveRequest; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -42,7 +42,7 @@ public void createMemo(UUID productId, ProductMemoCreateRequest request) { } @Transactional - public void saveTemplate(UUID productId, ProductTemplateCreateRequest request) { + public void saveTemplate(UUID productId, ProductTemplateSaveRequest request) { Product product = productQueryService.getById(productId); modifyCharacters(product, request.getCharacters()); @@ -84,7 +84,7 @@ private ProductMemo getMemoById(UUID memoId) { .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); } - private void modifyCharacters(Product product, List characters) { + private void modifyCharacters(Product product, List characters) { Map savedCharacterMap = product.getCharacters().stream() .collect(Collectors.toMap(ProductCharacter::getId, Function.identity())); if (characters.isEmpty()) { @@ -93,7 +93,7 @@ private void modifyCharacters(Product product, List modifyIds = characters.stream() - .map(ProductTemplateCreateRequest.Character::getId) + .map(ProductTemplateSaveRequest.Character::getId) .filter(Objects::nonNull) .collect(Collectors.toSet()); @@ -121,7 +121,7 @@ private void modifyCharacters(Product product, List customFields) { + private void modifyCustomFields(Product product, List customFields) { Map savedCustomFieldMap = product.getCustomFields().stream() .collect(Collectors.toMap(ProductCustomField::getId, Function.identity())); if (customFields.isEmpty()) { @@ -130,7 +130,7 @@ private void modifyCustomFields(Product product, List modifyIds = customFields.stream() - .map(ProductTemplateCreateRequest.CustomField::getId) + .map(ProductTemplateSaveRequest.CustomField::getId) .filter(Objects::nonNull) .collect(Collectors.toSet()); @@ -150,14 +150,14 @@ private void modifyCustomFields(Product product, List Date: Fri, 7 Feb 2025 00:03:37 +0900 Subject: [PATCH 025/107] =?UTF-8?q?fix:=20deploy=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88?= =?UTF-8?q?=EB=A5=BC=20=EC=A2=85=EB=A3=8C=EC=8B=9C=ED=82=A4=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cd63187..d983fc7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -57,8 +57,8 @@ jobs: --parameters commands='[ "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }}", "cd /root", - "[ $(docker ps -q | wc -l) -gt 0 ] && docker stop $(docker ps -q)", - "[ $(docker images -q | wc -l) -gt 0 ] && docker rmi $(docker images -q)", + "[ $(docker ps --filter 'publish=8080' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=8080' -q)", + "[ $(docker images -q ${{ secrets.ECR_REGISTRY_URI }}:latest | wc -l) -gt 0 ] && docker rmi ${{ secrets.ECR_REGISTRY_URI }}:latest", "docker pull ${{ secrets.ECR_REGISTRY_URI }}:latest", "docker run --rm -d -p 8080:8080 --name writely-api -v /writely/logs:/writely/logs ${{ secrets.ECR_REGISTRY_URI }}:latest" ]' \ From 71e68ad2d13e9ac41e9c29bac5144330a721bce5 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 8 Feb 2025 14:05:18 +0900 Subject: [PATCH 026/107] =?UTF-8?q?feat:=20auto=20modify(=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EC=88=98=EC=A0=95)=20sse=20=ED=86=B5=EC=8B=A0?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EA=B5=AC=ED=98=84=20(#25)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- sql/init.sql | 27 +++++++ .../controller/AutoModifyController.java | 47 +++++++++++ .../assistant/domain/MessageContent.java | 28 +++++++ .../domain/automodify/AutoModifyMessage.java | 40 ++++++++++ .../AutoModifyMessageJpaRepository.java | 8 ++ .../domain/enums/AssistantException.java | 17 ++++ .../domain/enums/MessageSenderRole.java | 25 ++++++ .../assistant/request/AutoModifyRequest.java | 17 ++++ .../assistant/request/ChatRequest.java | 13 +++ .../assistant/service/AutoModifyService.java | 80 +++++++++++++++++++ .../com/writely/product/domain/Product.java | 51 ------------ 12 files changed, 303 insertions(+), 52 deletions(-) create mode 100644 src/main/java/com/writely/assistant/controller/AutoModifyController.java create mode 100644 src/main/java/com/writely/assistant/domain/MessageContent.java create mode 100644 src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java create mode 100644 src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java create mode 100644 src/main/java/com/writely/assistant/domain/enums/AssistantException.java create mode 100644 src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java create mode 100644 src/main/java/com/writely/assistant/request/AutoModifyRequest.java create mode 100644 src/main/java/com/writely/assistant/request/ChatRequest.java create mode 100644 src/main/java/com/writely/assistant/service/AutoModifyService.java diff --git a/BE-secret b/BE-secret index 7ff1ec8..1abfa16 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 7ff1ec89c5053fb510dd4cb9f8949402cd4216e5 +Subproject commit 1abfa161015db4311c7061ff7aea20c2bb19a071 diff --git a/sql/init.sql b/sql/init.sql index c2a2280..e7bfb3f 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -289,3 +289,30 @@ comment on column product_worldview.updated_by is '수정자 ID'; alter table product_worldview owner to postgres; +-- auto_modify_message +create table auto_modify_message +( + id uuid default gen_random_uuid() not null + constraint auto_modify_message_pk + primary key, + product_id uuid not null, + role varchar(10) not null, + content text, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null +); + +comment on table auto_modify_message is '자동 수정 메세지'; +comment on column auto_modify_message.id is '자동 수정 메세지 ID'; +comment on column auto_modify_message.product_id is '작품 ID'; +comment on column auto_modify_message.role is '메세지 송신자'; +comment on column auto_modify_message.content is '내용'; +comment on column auto_modify_message.created_at is '생성일시'; +comment on column auto_modify_message.created_by is '생성자 ID'; +comment on column auto_modify_message.updated_at is '수정일시'; +comment on column auto_modify_message.updated_by is '수정자 ID'; + +alter table auto_modify_message + owner to postgres; diff --git a/src/main/java/com/writely/assistant/controller/AutoModifyController.java b/src/main/java/com/writely/assistant/controller/AutoModifyController.java new file mode 100644 index 0000000..39671b8 --- /dev/null +++ b/src/main/java/com/writely/assistant/controller/AutoModifyController.java @@ -0,0 +1,47 @@ +package com.writely.assistant.controller; + +import com.writely.assistant.request.AutoModifyRequest; +import com.writely.assistant.service.AutoModifyService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.util.UUID; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/auto-modify") +@Tag(name = "AI 어시스턴트 - 자동 수정") +public class AutoModifyController { + + private final AutoModifyService autoModifyService; + + @Operation(summary = "메세지 저장") + @PostMapping("/messages") + public UUID createMessage(@RequestBody AutoModifyRequest request) { + return autoModifyService.createMessage(request); + } + + @Operation(summary = "메세지 전송 및 응답(SSE)") + @GetMapping("/stream/messages") + public SseEmitter streamMessage( + @RequestParam UUID productId, + @RequestParam UUID messageId + ) { + SseEmitter emitter = autoModifyService.sendMessage(productId, messageId); + setResponseHeaderForSSE(); + return emitter; + } + + private void setResponseHeaderForSSE() { + HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); + if (response != null) { + response.setContentType("text/event-stream; charset=UTF-8"); + } + } +} diff --git a/src/main/java/com/writely/assistant/domain/MessageContent.java b/src/main/java/com/writely/assistant/domain/MessageContent.java new file mode 100644 index 0000000..9095cad --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/MessageContent.java @@ -0,0 +1,28 @@ +package com.writely.assistant.domain; + +import com.writely.assistant.domain.enums.MessageSenderRole; +import jakarta.persistence.*; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Embeddable +@NoArgsConstructor +public class MessageContent { + + @Convert(converter = MessageSenderRole.TypeCodeConverter.class) + @Column(name = "role", nullable = false) + private MessageSenderRole role; + + @Column(name = "content") + private String content; + + public MessageContent(MessageSenderRole role, String content) { + this.role = role; + this.content = content; + } + + public void updateContent(String content) { + this.content = content; + } +} diff --git a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java b/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java new file mode 100644 index 0000000..6ff8bc5 --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java @@ -0,0 +1,40 @@ +package com.writely.assistant.domain.automodify; + +import com.writely.assistant.domain.MessageContent; +import com.writely.assistant.domain.enums.MessageSenderRole; +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "auto_modify_message") +public class AutoModifyMessage extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Embedded + private MessageContent messageContent; + + public AutoModifyMessage(UUID productId, MessageSenderRole role, String content) { + this.productId = productId; + this.messageContent = new MessageContent(role, content); + } + + public MessageSenderRole getRole() { + return messageContent.getRole(); + } + + public String getContent() { + return messageContent.getContent(); + } +} diff --git a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java b/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java new file mode 100644 index 0000000..7f6fd36 --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java @@ -0,0 +1,8 @@ +package com.writely.assistant.domain.automodify; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface AutoModifyMessageJpaRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/assistant/domain/enums/AssistantException.java b/src/main/java/com/writely/assistant/domain/enums/AssistantException.java new file mode 100644 index 0000000..29ffb8e --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/enums/AssistantException.java @@ -0,0 +1,17 @@ +package com.writely.assistant.domain.enums; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum AssistantException implements CodeInfo { + + NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 메세지입니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java b/src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java new file mode 100644 index 0000000..69d5579 --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java @@ -0,0 +1,25 @@ +package com.writely.assistant.domain.enums; + +import com.writely.common.converter.AbstractEnumCodeConverter; +import com.writely.common.enums.Codable; +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum MessageSenderRole implements Codable { + + MEMBER("member"), + ASSISTANT("assistant"); + + private final String code; + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public MessageSenderRole convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(MessageSenderRole.class, dbData); + } + } +} diff --git a/src/main/java/com/writely/assistant/request/AutoModifyRequest.java b/src/main/java/com/writely/assistant/request/AutoModifyRequest.java new file mode 100644 index 0000000..64a1da1 --- /dev/null +++ b/src/main/java/com/writely/assistant/request/AutoModifyRequest.java @@ -0,0 +1,17 @@ +package com.writely.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class AutoModifyRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "내용") + private String content; +} diff --git a/src/main/java/com/writely/assistant/request/ChatRequest.java b/src/main/java/com/writely/assistant/request/ChatRequest.java new file mode 100644 index 0000000..2298f50 --- /dev/null +++ b/src/main/java/com/writely/assistant/request/ChatRequest.java @@ -0,0 +1,13 @@ +package com.writely.assistant.request; + +import lombok.Getter; + +@Getter +public class ChatRequest { + + private final String query; + + public ChatRequest(String query) { + this.query = query; + } +} diff --git a/src/main/java/com/writely/assistant/service/AutoModifyService.java b/src/main/java/com/writely/assistant/service/AutoModifyService.java new file mode 100644 index 0000000..512c962 --- /dev/null +++ b/src/main/java/com/writely/assistant/service/AutoModifyService.java @@ -0,0 +1,80 @@ +package com.writely.assistant.service; + +import com.writely.assistant.domain.automodify.AutoModifyMessage; +import com.writely.assistant.domain.automodify.AutoModifyMessageJpaRepository; +import com.writely.assistant.domain.enums.AssistantException; +import com.writely.assistant.domain.enums.MessageSenderRole; +import com.writely.assistant.request.AutoModifyRequest; +import com.writely.common.exception.BaseException; +import com.writely.product.domain.enums.ProductException; +import com.writely.product.repository.ProductJpaRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class AutoModifyService { + + @Value("${service.assistant.url}") + private String assistantUrl; + + private final long TIMEOUT = 180_000L; + + private final AutoModifyMessageJpaRepository autoModifyMessageRepository; + private final ProductJpaRepository productRepository; + + @Transactional + public UUID createMessage(AutoModifyRequest request) { + verifyExistProduct(request.getProductId()); + + AutoModifyMessage autoModifyMemberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); + return autoModifyMessageRepository.save(autoModifyMemberMessage).getId(); + } + + public SseEmitter sendMessage(UUID productId, UUID messageId) { + verifyExistProduct(productId); + AutoModifyMessage message = getById(messageId); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + WebClient.create(assistantUrl + "/v1/assistant/feedback/stream") + .get() + .uri(uriBuilder -> uriBuilder + .queryParam("tenant_id", "1") + .queryParam("query", message.getContent()) + .queryParam("user_setting", "") + .build()) + .retrieve() + .bodyToFlux(String.class) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + } catch (IOException e) { + emitter.completeWithError(e); + } + }, + error -> emitter.completeWithError(error), + emitter::complete + ); + + return emitter; + } + + private AutoModifyMessage getById(UUID messageId) { + return autoModifyMessageRepository.findById(messageId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } + + private void verifyExistProduct(UUID productId) { + if (!productRepository.existsById(productId)) { + throw new BaseException(ProductException.NOT_EXIST); + } + } +} diff --git a/src/main/java/com/writely/product/domain/Product.java b/src/main/java/com/writely/product/domain/Product.java index 2afaaca..3964ae1 100644 --- a/src/main/java/com/writely/product/domain/Product.java +++ b/src/main/java/com/writely/product/domain/Product.java @@ -4,14 +4,12 @@ import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.Setter; import java.util.ArrayList; import java.util.List; import java.util.UUID; @Getter -@Setter @Entity @NoArgsConstructor @Table(name = "product") @@ -59,53 +57,4 @@ public void update(String title, String content) { this.title = title; this.content = content; } - - public void addCharacters(List addCharacters) { - if (addCharacters == null || addCharacters.isEmpty()) { - return; - } - this.characters.addAll(addCharacters); - } - - public void addCustomFields(List addCustomFields) { - if (addCustomFields == null || addCustomFields.isEmpty()) { - return; - } - this.customFields.addAll(addCustomFields); - } - - public void addIdeaNote(ProductIdeaNote addIdeaNote) { - if (addIdeaNote == null) { - return; - } - this.ideaNote = addIdeaNote; - } - - public void addMemo(ProductMemo addMemo) { - if (addMemo == null) { - return; - } - this.memos.add(addMemo); - } - - public void addPlot(ProductPlot addPlot) { - if (addPlot == null) { - return; - } - this.plot = addPlot; - } - - public void addSynopsis(ProductSynopsis addSynopsis) { - if (addSynopsis == null) { - return; - } - this.synopsis = addSynopsis; - } - - public void addWorldview(ProductWorldview addWorldview) { - if (addWorldview == null) { - return; - } - this.worldview = addWorldview; - } } From 7ff65585a79180605e8e07be4e7d505fdc235b77 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 10 Feb 2025 22:23:20 +0900 Subject: [PATCH 027/107] =?UTF-8?q?feat(terms):=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20=EC=8B=9C=20=EC=95=BD=EA=B4=80=20=EB=8F=99?= =?UTF-8?q?=EC=9D=98=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=A0=95=EC=9D=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 32 +++ src/main/generated/writely/Keys.java | 6 + src/main/generated/writely/Public.java | 16 +- src/main/generated/writely/Tables.java | 12 + src/main/generated/writely/tables/Terms.java | 255 ++++++++++++++++++ .../generated/writely/tables/TermsAgree.java | 235 ++++++++++++++++ .../generated/writely/tables/pojos/Terms.java | 207 ++++++++++++++ .../writely/tables/pojos/TermsAgree.java | 131 +++++++++ .../tables/records/TermsAgreeRecord.java | 131 +++++++++ .../writely/tables/records/TermsRecord.java | 199 ++++++++++++++ .../com/writely/auth/request/JoinRequest.java | 10 +- .../auth/service/AuthCommandService.java | 1 + .../java/com/writely/terms/domain/Terms.java | 41 +++ .../com/writely/terms/domain/TermsAgree.java | 28 ++ .../writely/terms/domain/TermsAgreeId.java | 18 ++ .../writely/terms/domain/enums/TermsCode.java | 36 +++ .../repository/TermsAgreeJpaRepository.java | 8 + .../writely/terms/repository/TermsDao.java | 37 +++ .../terms/repository/TermsJpaRepository.java | 10 + .../writely/terms/request/TermsRequest.java | 16 ++ .../writely/terms/service/TermsService.java | 14 + 21 files changed, 1440 insertions(+), 3 deletions(-) create mode 100644 src/main/generated/writely/tables/Terms.java create mode 100644 src/main/generated/writely/tables/TermsAgree.java create mode 100644 src/main/generated/writely/tables/pojos/Terms.java create mode 100644 src/main/generated/writely/tables/pojos/TermsAgree.java create mode 100644 src/main/generated/writely/tables/records/TermsAgreeRecord.java create mode 100644 src/main/generated/writely/tables/records/TermsRecord.java create mode 100644 src/main/java/com/writely/terms/domain/Terms.java create mode 100644 src/main/java/com/writely/terms/domain/TermsAgree.java create mode 100644 src/main/java/com/writely/terms/domain/TermsAgreeId.java create mode 100644 src/main/java/com/writely/terms/domain/enums/TermsCode.java create mode 100644 src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java create mode 100644 src/main/java/com/writely/terms/repository/TermsDao.java create mode 100644 src/main/java/com/writely/terms/repository/TermsJpaRepository.java create mode 100644 src/main/java/com/writely/terms/request/TermsRequest.java create mode 100644 src/main/java/com/writely/terms/service/TermsService.java diff --git a/sql/init.sql b/sql/init.sql index e7bfb3f..6f037dc 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -27,6 +27,38 @@ comment on table member_password is '회원_비밀번호'; comment on column member_password.member_id is '회원 ID'; comment on column member_password.password is '회원 비밀번호'; +-- terms +create table terms +( + id uuid constraint terms_pk primary key, + cd varchar(10) not null, + version int not null, + title varchar(50) not null, + content text not null, + is_required boolean default false not null, + created_at timestamp with time zone not null, + updated_at timestamp with time zone not null +); +comment on table terms is '약관'; +comment on column terms.id is '약관 ID'; +comment on column terms.cd is '약관 코드'; +comment on column terms.version is '약관 버전'; +comment on column terms.title is '약관 제목'; +comment on column terms.content is '약관 내용'; +comment on column terms.is_required is '동의 필수 여부'; + +create table terms_agree +( + terms_cd varchar(10) not null, + member_id uuid not null, + created_at timestamp with time zone not null, + updated_at timestamp with time zone not null, + constraint terms_agree_pk primary key (terms_cd, member_id) +); +comment on table terms_agree is '약관_동의'; +comment on column terms_agree.terms_id is '약관 ID'; +comment on column terms_agree.member_id is '회원 ID'; + -- product create table product ( diff --git a/src/main/generated/writely/Keys.java b/src/main/generated/writely/Keys.java index df7e4ab..73f6553 100644 --- a/src/main/generated/writely/Keys.java +++ b/src/main/generated/writely/Keys.java @@ -20,6 +20,8 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.Terms; +import writely.tables.TermsAgree; import writely.tables.records.AutoModifyMessageRecord; import writely.tables.records.MemberPasswordRecord; import writely.tables.records.MemberRecord; @@ -31,6 +33,8 @@ import writely.tables.records.ProductRecord; import writely.tables.records.ProductSynopsisRecord; import writely.tables.records.ProductWorldviewRecord; +import writely.tables.records.TermsAgreeRecord; +import writely.tables.records.TermsRecord; /** @@ -57,4 +61,6 @@ public class Keys { public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); public static final UniqueKey PRODUCT_SYNOPSIS_PK = Internal.createUniqueKey(ProductSynopsis.PRODUCT_SYNOPSIS, DSL.name("product_synopsis_pk"), new TableField[] { ProductSynopsis.PRODUCT_SYNOPSIS.ID }, true); public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); + public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); + public static final UniqueKey TERMS_AGREE_PK = Internal.createUniqueKey(TermsAgree.TERMS_AGREE, DSL.name("terms_agree_pk"), new TableField[] { TermsAgree.TERMS_AGREE.TERMS_CD, TermsAgree.TERMS_AGREE.MEMBER_ID }, true); } diff --git a/src/main/generated/writely/Public.java b/src/main/generated/writely/Public.java index 4df9af5..f8d102a 100644 --- a/src/main/generated/writely/Public.java +++ b/src/main/generated/writely/Public.java @@ -26,6 +26,8 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.Terms; +import writely.tables.TermsAgree; import writely.tables.records.PgpArmorHeadersRecord; @@ -136,6 +138,16 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + /** + * 약관 + */ + public final Terms TERMS = Terms.TERMS; + + /** + * 약관_동의 + */ + public final TermsAgree TERMS_AGREE = TermsAgree.TERMS_AGREE; + /** * No further instances allowed */ @@ -163,7 +175,9 @@ public final List> getTables() { ProductMemo.PRODUCT_MEMO, ProductPlot.PRODUCT_PLOT, ProductSynopsis.PRODUCT_SYNOPSIS, - ProductWorldview.PRODUCT_WORLDVIEW + ProductWorldview.PRODUCT_WORLDVIEW, + Terms.TERMS, + TermsAgree.TERMS_AGREE ); } } diff --git a/src/main/generated/writely/Tables.java b/src/main/generated/writely/Tables.java index 9169eae..3004ca9 100644 --- a/src/main/generated/writely/Tables.java +++ b/src/main/generated/writely/Tables.java @@ -20,6 +20,8 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.Terms; +import writely.tables.TermsAgree; import writely.tables.records.PgpArmorHeadersRecord; @@ -122,4 +124,14 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( * 작품 세계관 */ public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + + /** + * 약관 + */ + public static final Terms TERMS = Terms.TERMS; + + /** + * 약관_동의 + */ + public static final TermsAgree TERMS_AGREE = TermsAgree.TERMS_AGREE; } diff --git a/src/main/generated/writely/tables/Terms.java b/src/main/generated/writely/tables/Terms.java new file mode 100644 index 0000000..275051e --- /dev/null +++ b/src/main/generated/writely/tables/Terms.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.TermsRecord; + + +/** + * 약관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Terms extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.terms + */ + public static final Terms TERMS = new Terms(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TermsRecord.class; + } + + /** + * The column public.terms.id. 약관 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "약관 ID"); + + /** + * The column public.terms.cd. 약관 코드 + */ + public final TableField CD = createField(DSL.name("cd"), SQLDataType.VARCHAR(10).nullable(false), this, "약관 코드"); + + /** + * The column public.terms.version. 약관 버전 + */ + public final TableField VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, "약관 버전"); + + /** + * The column public.terms.title. 약관 제목 + */ + public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(50).nullable(false), this, "약관 제목"); + + /** + * The column public.terms.content. 약관 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "약관 내용"); + + /** + * The column public.terms.is_required. 동의 필수 여부 + */ + public final TableField IS_REQUIRED = createField(DSL.name("is_required"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "동의 필수 여부"); + + /** + * The column public.terms.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.terms.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private Terms(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private Terms(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("약관"), TableOptions.table(), where); + } + + /** + * Create an aliased public.terms table reference + */ + public Terms(String alias) { + this(DSL.name(alias), TERMS); + } + + /** + * Create an aliased public.terms table reference + */ + public Terms(Name alias) { + this(alias, TERMS); + } + + /** + * Create a public.terms table reference + */ + public Terms() { + this(DSL.name("terms"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.TERMS_PK; + } + + @Override + public Terms as(String alias) { + return new Terms(DSL.name(alias), this); + } + + @Override + public Terms as(Name alias) { + return new Terms(alias, this); + } + + @Override + public Terms as(Table alias) { + return new Terms(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Terms rename(String name) { + return new Terms(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Terms rename(Name name) { + return new Terms(name, null); + } + + /** + * Rename this table + */ + @Override + public Terms rename(Table name) { + return new Terms(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms where(Condition condition) { + return new Terms(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Terms where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Terms where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Terms where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Terms where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Terms whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/TermsAgree.java b/src/main/generated/writely/tables/TermsAgree.java new file mode 100644 index 0000000..ce9d01c --- /dev/null +++ b/src/main/generated/writely/tables/TermsAgree.java @@ -0,0 +1,235 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.TermsAgreeRecord; + + +/** + * 약관_동의 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class TermsAgree extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.terms_agree + */ + public static final TermsAgree TERMS_AGREE = new TermsAgree(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TermsAgreeRecord.class; + } + + /** + * The column public.terms_agree.terms_cd. 약관 코드 + */ + public final TableField TERMS_CD = createField(DSL.name("terms_cd"), SQLDataType.VARCHAR(10).nullable(false), this, "약관 코드"); + + /** + * The column public.terms_agree.member_id. 회원 ID + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), SQLDataType.UUID.nullable(false), this, "회원 ID"); + + /** + * The column public.terms_agree.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.terms_agree.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private TermsAgree(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private TermsAgree(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("약관_동의"), TableOptions.table(), where); + } + + /** + * Create an aliased public.terms_agree table reference + */ + public TermsAgree(String alias) { + this(DSL.name(alias), TERMS_AGREE); + } + + /** + * Create an aliased public.terms_agree table reference + */ + public TermsAgree(Name alias) { + this(alias, TERMS_AGREE); + } + + /** + * Create a public.terms_agree table reference + */ + public TermsAgree() { + this(DSL.name("terms_agree"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.TERMS_AGREE_PK; + } + + @Override + public TermsAgree as(String alias) { + return new TermsAgree(DSL.name(alias), this); + } + + @Override + public TermsAgree as(Name alias) { + return new TermsAgree(alias, this); + } + + @Override + public TermsAgree as(Table alias) { + return new TermsAgree(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public TermsAgree rename(String name) { + return new TermsAgree(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TermsAgree rename(Name name) { + return new TermsAgree(name, null); + } + + /** + * Rename this table + */ + @Override + public TermsAgree rename(Table name) { + return new TermsAgree(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree where(Condition condition) { + return new TermsAgree(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgree where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgree where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgree where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgree where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgree whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/pojos/Terms.java b/src/main/generated/writely/tables/pojos/Terms.java new file mode 100644 index 0000000..8eb84e8 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/Terms.java @@ -0,0 +1,207 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.OffsetDateTime; +import java.util.UUID; + + +/** + * 약관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Terms implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String cd; + private final Integer version; + private final String title; + private final String content; + private final Boolean isRequired; + private final OffsetDateTime createdAt; + private final OffsetDateTime updatedAt; + + public Terms(Terms value) { + this.id = value.id; + this.cd = value.cd; + this.version = value.version; + this.title = value.title; + this.content = value.content; + this.isRequired = value.isRequired; + this.createdAt = value.createdAt; + this.updatedAt = value.updatedAt; + } + + public Terms( + UUID id, + String cd, + Integer version, + String title, + String content, + Boolean isRequired, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.id = id; + this.cd = cd; + this.version = version; + this.title = title; + this.content = content; + this.isRequired = isRequired; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Getter for public.terms.id. 약관 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.terms.cd. 약관 코드 + */ + public String getCd() { + return this.cd; + } + + /** + * Getter for public.terms.version. 약관 버전 + */ + public Integer getVersion() { + return this.version; + } + + /** + * Getter for public.terms.title. 약관 제목 + */ + public String getTitle() { + return this.title; + } + + /** + * Getter for public.terms.content. 약관 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.terms.is_required. 동의 필수 여부 + */ + public Boolean getIsRequired() { + return this.isRequired; + } + + /** + * Getter for public.terms.created_at. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.terms.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Terms other = (Terms) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.cd == null) { + if (other.cd != null) + return false; + } + else if (!this.cd.equals(other.cd)) + return false; + if (this.version == null) { + if (other.version != null) + return false; + } + else if (!this.version.equals(other.version)) + return false; + if (this.title == null) { + if (other.title != null) + return false; + } + else if (!this.title.equals(other.title)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.isRequired == null) { + if (other.isRequired != null) + return false; + } + else if (!this.isRequired.equals(other.isRequired)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.cd == null) ? 0 : this.cd.hashCode()); + result = prime * result + ((this.version == null) ? 0 : this.version.hashCode()); + result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.isRequired == null) ? 0 : this.isRequired.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Terms ("); + + sb.append(id); + sb.append(", ").append(cd); + sb.append(", ").append(version); + sb.append(", ").append(title); + sb.append(", ").append(content); + sb.append(", ").append(isRequired); + sb.append(", ").append(createdAt); + sb.append(", ").append(updatedAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/TermsAgree.java b/src/main/generated/writely/tables/pojos/TermsAgree.java new file mode 100644 index 0000000..4e1540c --- /dev/null +++ b/src/main/generated/writely/tables/pojos/TermsAgree.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.OffsetDateTime; +import java.util.UUID; + + +/** + * 약관_동의 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class TermsAgree implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String termsCd; + private final UUID memberId; + private final OffsetDateTime createdAt; + private final OffsetDateTime updatedAt; + + public TermsAgree(TermsAgree value) { + this.termsCd = value.termsCd; + this.memberId = value.memberId; + this.createdAt = value.createdAt; + this.updatedAt = value.updatedAt; + } + + public TermsAgree( + String termsCd, + UUID memberId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.termsCd = termsCd; + this.memberId = memberId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Getter for public.terms_agree.terms_cd. 약관 코드 + */ + public String getTermsCd() { + return this.termsCd; + } + + /** + * Getter for public.terms_agree.member_id. 회원 ID + */ + public UUID getMemberId() { + return this.memberId; + } + + /** + * Getter for public.terms_agree.created_at. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.terms_agree.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final TermsAgree other = (TermsAgree) obj; + if (this.termsCd == null) { + if (other.termsCd != null) + return false; + } + else if (!this.termsCd.equals(other.termsCd)) + return false; + if (this.memberId == null) { + if (other.memberId != null) + return false; + } + else if (!this.memberId.equals(other.memberId)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.termsCd == null) ? 0 : this.termsCd.hashCode()); + result = prime * result + ((this.memberId == null) ? 0 : this.memberId.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TermsAgree ("); + + sb.append(termsCd); + sb.append(", ").append(memberId); + sb.append(", ").append(createdAt); + sb.append(", ").append(updatedAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/records/TermsAgreeRecord.java b/src/main/generated/writely/tables/records/TermsAgreeRecord.java new file mode 100644 index 0000000..34ccb6d --- /dev/null +++ b/src/main/generated/writely/tables/records/TermsAgreeRecord.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.jooq.Record2; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.TermsAgree; + + +/** + * 약관_동의 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class TermsAgreeRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.terms_agree.terms_cd. 약관 코드 + */ + public TermsAgreeRecord setTermsCd(String value) { + set(0, value); + return this; + } + + /** + * Getter for public.terms_agree.terms_cd. 약관 코드 + */ + public String getTermsCd() { + return (String) get(0); + } + + /** + * Setter for public.terms_agree.member_id. 회원 ID + */ + public TermsAgreeRecord setMemberId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.terms_agree.member_id. 회원 ID + */ + public UUID getMemberId() { + return (UUID) get(1); + } + + /** + * Setter for public.terms_agree.created_at. + */ + public TermsAgreeRecord setCreatedAt(OffsetDateTime value) { + set(2, value); + return this; + } + + /** + * Getter for public.terms_agree.created_at. + */ + public OffsetDateTime getCreatedAt() { + return (OffsetDateTime) get(2); + } + + /** + * Setter for public.terms_agree.updated_at. + */ + public TermsAgreeRecord setUpdatedAt(OffsetDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.terms_agree.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return (OffsetDateTime) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record2 key() { + return (Record2) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TermsAgreeRecord + */ + public TermsAgreeRecord() { + super(TermsAgree.TERMS_AGREE); + } + + /** + * Create a detached, initialised TermsAgreeRecord + */ + public TermsAgreeRecord(String termsCd, UUID memberId, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(TermsAgree.TERMS_AGREE); + + setTermsCd(termsCd); + setMemberId(memberId); + setCreatedAt(createdAt); + setUpdatedAt(updatedAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised TermsAgreeRecord + */ + public TermsAgreeRecord(writely.tables.pojos.TermsAgree value) { + super(TermsAgree.TERMS_AGREE); + + if (value != null) { + setTermsCd(value.getTermsCd()); + setMemberId(value.getMemberId()); + setCreatedAt(value.getCreatedAt()); + setUpdatedAt(value.getUpdatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/TermsRecord.java b/src/main/generated/writely/tables/records/TermsRecord.java new file mode 100644 index 0000000..4f49302 --- /dev/null +++ b/src/main/generated/writely/tables/records/TermsRecord.java @@ -0,0 +1,199 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.Terms; + + +/** + * 약관 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class TermsRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.terms.id. 약관 ID + */ + public TermsRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.terms.id. 약관 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.terms.cd. 약관 코드 + */ + public TermsRecord setCd(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.terms.cd. 약관 코드 + */ + public String getCd() { + return (String) get(1); + } + + /** + * Setter for public.terms.version. 약관 버전 + */ + public TermsRecord setVersion(Integer value) { + set(2, value); + return this; + } + + /** + * Getter for public.terms.version. 약관 버전 + */ + public Integer getVersion() { + return (Integer) get(2); + } + + /** + * Setter for public.terms.title. 약관 제목 + */ + public TermsRecord setTitle(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.terms.title. 약관 제목 + */ + public String getTitle() { + return (String) get(3); + } + + /** + * Setter for public.terms.content. 약관 내용 + */ + public TermsRecord setContent(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.terms.content. 약관 내용 + */ + public String getContent() { + return (String) get(4); + } + + /** + * Setter for public.terms.is_required. 동의 필수 여부 + */ + public TermsRecord setIsRequired(Boolean value) { + set(5, value); + return this; + } + + /** + * Getter for public.terms.is_required. 동의 필수 여부 + */ + public Boolean getIsRequired() { + return (Boolean) get(5); + } + + /** + * Setter for public.terms.created_at. + */ + public TermsRecord setCreatedAt(OffsetDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.terms.created_at. + */ + public OffsetDateTime getCreatedAt() { + return (OffsetDateTime) get(6); + } + + /** + * Setter for public.terms.updated_at. + */ + public TermsRecord setUpdatedAt(OffsetDateTime value) { + set(7, value); + return this; + } + + /** + * Getter for public.terms.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return (OffsetDateTime) get(7); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TermsRecord + */ + public TermsRecord() { + super(Terms.TERMS); + } + + /** + * Create a detached, initialised TermsRecord + */ + public TermsRecord(UUID id, String cd, Integer version, String title, String content, Boolean isRequired, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(Terms.TERMS); + + setId(id); + setCd(cd); + setVersion(version); + setTitle(title); + setContent(content); + setIsRequired(isRequired); + setCreatedAt(createdAt); + setUpdatedAt(updatedAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised TermsRecord + */ + public TermsRecord(writely.tables.pojos.Terms value) { + super(Terms.TERMS); + + if (value != null) { + setId(value.getId()); + setCd(value.getCd()); + setVersion(value.getVersion()); + setTitle(value.getTitle()); + setContent(value.getContent()); + setIsRequired(value.getIsRequired()); + setCreatedAt(value.getCreatedAt()); + setUpdatedAt(value.getUpdatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/src/main/java/com/writely/auth/request/JoinRequest.java index 8d1fd14..023c6cd 100644 --- a/src/main/java/com/writely/auth/request/JoinRequest.java +++ b/src/main/java/com/writely/auth/request/JoinRequest.java @@ -2,14 +2,16 @@ import com.writely.common.validation.IsEmail; import com.writely.common.validation.IsPassword; -import com.writely.member.domain.Member; -import com.writely.member.domain.MemberPassword; +import com.writely.terms.request.TermsRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class JoinRequest { @@ -28,4 +30,8 @@ public class JoinRequest { @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED, example = "노래하는뱁새") private String nickname; + @NotNull + @Schema(title = "약관 목록", requiredMode = Schema.RequiredMode.REQUIRED, example = "[{termsCd: \"1001\", isAgreed: true}, {termsCd: \"1002\", isAgreed: false}]") + private List termsList; + } diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 0efa71a..77d364d 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -68,6 +68,7 @@ public AuthTokenResponse login(LoginRequest request) { * 회원 가입 */ public void join(JoinRequest request) { + // 이미 있는 회원인지 검사 if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); diff --git a/src/main/java/com/writely/terms/domain/Terms.java b/src/main/java/com/writely/terms/domain/Terms.java new file mode 100644 index 0000000..c717fe7 --- /dev/null +++ b/src/main/java/com/writely/terms/domain/Terms.java @@ -0,0 +1,41 @@ +package com.writely.terms.domain; + +import com.writely.common.domain.BaseTimeEntity; +import com.writely.terms.domain.enums.TermsCode; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import writely.tables.records.TermsRecord; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "terms") +public class Terms extends BaseTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Convert(converter = TermsCode.TypeCodeConverter.class) + @Column(nullable = false) + private String cd; + + @Column(nullable = false) + private String title; + + @Column(nullable = false) + private String content; + + @Column(name = "is_required", nullable = false) + private Boolean isRequired; + + public Terms(TermsRecord terms) { + this.id = terms.getId(); + } + +} diff --git a/src/main/java/com/writely/terms/domain/TermsAgree.java b/src/main/java/com/writely/terms/domain/TermsAgree.java new file mode 100644 index 0000000..4d0142c --- /dev/null +++ b/src/main/java/com/writely/terms/domain/TermsAgree.java @@ -0,0 +1,28 @@ +package com.writely.terms.domain; + +import com.writely.common.domain.BaseTimeEntity; +import com.writely.terms.domain.enums.TermsCode; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "terms_agree") +@IdClass(TermsAgreeId.class) +public class TermsAgree extends BaseTimeEntity { + + @Id + @Column(name = "terms_cd", nullable = false) + private TermsCode termsCd; + + @Id + @Column(name = "member_id", nullable = false) + private UUID memberId; + +} diff --git a/src/main/java/com/writely/terms/domain/TermsAgreeId.java b/src/main/java/com/writely/terms/domain/TermsAgreeId.java new file mode 100644 index 0000000..676a4db --- /dev/null +++ b/src/main/java/com/writely/terms/domain/TermsAgreeId.java @@ -0,0 +1,18 @@ +package com.writely.terms.domain; + +import com.writely.terms.domain.enums.TermsCode; +import jakarta.persistence.Column; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.io.Serializable; +import java.util.UUID; + +@Getter +@AllArgsConstructor +public class TermsAgreeId implements Serializable { + + private TermsCode termsCd; + private UUID memberId; + +} diff --git a/src/main/java/com/writely/terms/domain/enums/TermsCode.java b/src/main/java/com/writely/terms/domain/enums/TermsCode.java new file mode 100644 index 0000000..bb4fda4 --- /dev/null +++ b/src/main/java/com/writely/terms/domain/enums/TermsCode.java @@ -0,0 +1,36 @@ +package com.writely.terms.domain.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.writely.common.converter.AbstractEnumCodeConverter; +import com.writely.common.enums.Codable; +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum TermsCode implements Codable { + PRIVACY_POLICY("1001"), + MARKETING_AGREEMENT("1002"); + + private final String code; + + @JsonCreator + public static TermsCode fromCode(final String code) { + return Codable.fromCode(TermsCode.class, code); + } + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public TermsCode convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(TermsCode.class, dbData); + } + } + + @JsonValue + public String getCode() { + return code; + } +} diff --git a/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java b/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java new file mode 100644 index 0000000..ef960fe --- /dev/null +++ b/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java @@ -0,0 +1,8 @@ +package com.writely.terms.repository; + +import com.writely.terms.domain.TermsAgree; +import org.springframework.data.repository.CrudRepository; + +public interface TermsAgreeJpaRepository extends CrudRepository { + +} diff --git a/src/main/java/com/writely/terms/repository/TermsDao.java b/src/main/java/com/writely/terms/repository/TermsDao.java new file mode 100644 index 0000000..876728c --- /dev/null +++ b/src/main/java/com/writely/terms/repository/TermsDao.java @@ -0,0 +1,37 @@ +package com.writely.terms.repository; + +import lombok.RequiredArgsConstructor; +import org.jooq.DSLContext; +import org.springframework.stereotype.Repository; +import writely.tables.Terms; +import static org.jooq.impl.DSL.*; +import org.jooq.*; +import org.jooq.impl.*; +import writely.tables.records.TermsRecord; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class TermsDao { + private final DSLContext dsl; + private final Terms TERMS = writely.tables.Terms.TERMS; + + public List selectLatestTermsList() { + Table latestTerms = table( + select(TERMS.CD, max(TERMS.VERSION).as("max_version")) + .from(TERMS) + .groupBy(TERMS.CD) + ).as("latest_terms"); + + return dsl.select() // 전체 필드 조회 + .from(TERMS) + .join(latestTerms) + .on(TERMS.CD.eq(latestTerms.field(TERMS.CD))) + .and(TERMS.VERSION.eq(latestTerms.field("max_version", Integer.class))) + .fetchInto(TermsRecord.class) + .stream() + .map(com.writely.terms.domain.Terms::new) + .toList(); + } +} diff --git a/src/main/java/com/writely/terms/repository/TermsJpaRepository.java b/src/main/java/com/writely/terms/repository/TermsJpaRepository.java new file mode 100644 index 0000000..bd9b9f7 --- /dev/null +++ b/src/main/java/com/writely/terms/repository/TermsJpaRepository.java @@ -0,0 +1,10 @@ +package com.writely.terms.repository; + +import com.writely.terms.domain.Terms; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TermsJpaRepository extends CrudRepository { + +} diff --git a/src/main/java/com/writely/terms/request/TermsRequest.java b/src/main/java/com/writely/terms/request/TermsRequest.java new file mode 100644 index 0000000..31954f8 --- /dev/null +++ b/src/main/java/com/writely/terms/request/TermsRequest.java @@ -0,0 +1,16 @@ +package com.writely.terms.request; + +import com.writely.terms.domain.enums.TermsCode; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public class TermsRequest { + @NotNull + private TermsCode termsCd; + + @NotNull + private Boolean isAgreed; +} diff --git a/src/main/java/com/writely/terms/service/TermsService.java b/src/main/java/com/writely/terms/service/TermsService.java new file mode 100644 index 0000000..cdb46e2 --- /dev/null +++ b/src/main/java/com/writely/terms/service/TermsService.java @@ -0,0 +1,14 @@ +package com.writely.terms.service; + +import com.writely.terms.repository.TermsDao; +import com.writely.terms.repository.TermsJpaRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class TermsService { + private final TermsDao termsDao; + private final TermsJpaRepository termsJpaRepository; + +} From 4df9dbd03f74a4e75db50da3d308020cc66a3ecd Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Fri, 14 Feb 2025 00:08:52 +0900 Subject: [PATCH 028/107] =?UTF-8?q?refactor:=20memo=20table=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EB=B0=8F=20api=20=EC=88=98=EC=A0=95=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 19 ++-- .../generated/writely/tables/ProductMemo.java | 20 +++++ .../writely/tables/pojos/ProductMemo.java | 76 ++++++++++++++++ .../tables/records/ProductMemoRecord.java | 86 +++++++++++++++++-- .../product/controller/ProductController.java | 6 +- .../writely/product/domain/ProductMemo.java | 24 +++++- ...quest.java => ProductMemoSaveRequest.java} | 6 +- .../product/response/ProductMemoResponse.java | 10 ++- .../service/ProductCommandService.java | 12 +-- .../product/service/ProductQueryService.java | 3 + 10 files changed, 233 insertions(+), 29 deletions(-) rename src/main/java/com/writely/product/request/{ProductMemoCreateRequest.java => ProductMemoSaveRequest.java} (55%) diff --git a/sql/init.sql b/sql/init.sql index 6f037dc..18b9af0 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -188,21 +188,26 @@ alter table product_ideanote -- product_memo create table product_memo ( - id uuid default gen_random_uuid() not null + id uuid default gen_random_uuid() not null constraint product_memo_pk primary key, - product_id uuid not null, - content text not null, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + product_id uuid not null, + content text not null, + selected_text text not null, + start_index integer not null, + end_index integer not null, + status varchar(10) not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_memo is '작품 메모'; comment on column product_memo.id is '메모 ID'; comment on column product_memo.product_id is '작품 ID'; comment on column product_memo.content is '내용'; +comment on column product_memo.status is '상태'; comment on column product_memo.created_at is '생성일시'; comment on column product_memo.created_by is '생성자 ID'; comment on column product_memo.updated_at is '수정일시'; diff --git a/src/main/generated/writely/tables/ProductMemo.java b/src/main/generated/writely/tables/ProductMemo.java index 97f233d..bf4ca39 100644 --- a/src/main/generated/writely/tables/ProductMemo.java +++ b/src/main/generated/writely/tables/ProductMemo.java @@ -66,6 +66,26 @@ public Class getRecordType() { */ public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); + /** + * The column public.product_memo.selected_text. + */ + public final TableField SELECTED_TEXT = createField(DSL.name("selected_text"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.product_memo.start_index. + */ + public final TableField START_INDEX = createField(DSL.name("start_index"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column public.product_memo.end_index. + */ + public final TableField END_INDEX = createField(DSL.name("end_index"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column public.product_memo.is_completed. 완료여부 + */ + public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false), this, "완료여부"); + /** * The column public.product_memo.created_at. 생성일시 */ diff --git a/src/main/generated/writely/tables/pojos/ProductMemo.java b/src/main/generated/writely/tables/pojos/ProductMemo.java index 2e750f5..3926b78 100644 --- a/src/main/generated/writely/tables/pojos/ProductMemo.java +++ b/src/main/generated/writely/tables/pojos/ProductMemo.java @@ -20,6 +20,10 @@ public class ProductMemo implements Serializable { private final UUID id; private final UUID productId; private final String content; + private final String selectedText; + private final Integer startIndex; + private final Integer endIndex; + private final Boolean isCompleted; private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; @@ -29,6 +33,10 @@ public ProductMemo(ProductMemo value) { this.id = value.id; this.productId = value.productId; this.content = value.content; + this.selectedText = value.selectedText; + this.startIndex = value.startIndex; + this.endIndex = value.endIndex; + this.isCompleted = value.isCompleted; this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; @@ -39,6 +47,10 @@ public ProductMemo( UUID id, UUID productId, String content, + String selectedText, + Integer startIndex, + Integer endIndex, + Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, @@ -47,6 +59,10 @@ public ProductMemo( this.id = id; this.productId = productId; this.content = content; + this.selectedText = selectedText; + this.startIndex = startIndex; + this.endIndex = endIndex; + this.isCompleted = isCompleted; this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; @@ -74,6 +90,34 @@ public String getContent() { return this.content; } + /** + * Getter for public.product_memo.selected_text. + */ + public String getSelectedText() { + return this.selectedText; + } + + /** + * Getter for public.product_memo.start_index. + */ + public Integer getStartIndex() { + return this.startIndex; + } + + /** + * Getter for public.product_memo.end_index. + */ + public Integer getEndIndex() { + return this.endIndex; + } + + /** + * Getter for public.product_memo.is_completed. 완료여부 + */ + public Boolean getIsCompleted() { + return this.isCompleted; + } + /** * Getter for public.product_memo.created_at. 생성일시 */ @@ -129,6 +173,30 @@ else if (!this.productId.equals(other.productId)) } else if (!this.content.equals(other.content)) return false; + if (this.selectedText == null) { + if (other.selectedText != null) + return false; + } + else if (!this.selectedText.equals(other.selectedText)) + return false; + if (this.startIndex == null) { + if (other.startIndex != null) + return false; + } + else if (!this.startIndex.equals(other.startIndex)) + return false; + if (this.endIndex == null) { + if (other.endIndex != null) + return false; + } + else if (!this.endIndex.equals(other.endIndex)) + return false; + if (this.isCompleted == null) { + if (other.isCompleted != null) + return false; + } + else if (!this.isCompleted.equals(other.isCompleted)) + return false; if (this.createdAt == null) { if (other.createdAt != null) return false; @@ -163,6 +231,10 @@ public int hashCode() { result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.selectedText == null) ? 0 : this.selectedText.hashCode()); + result = prime * result + ((this.startIndex == null) ? 0 : this.startIndex.hashCode()); + result = prime * result + ((this.endIndex == null) ? 0 : this.endIndex.hashCode()); + result = prime * result + ((this.isCompleted == null) ? 0 : this.isCompleted.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); @@ -177,6 +249,10 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); sb.append(", ").append(content); + sb.append(", ").append(selectedText); + sb.append(", ").append(startIndex); + sb.append(", ").append(endIndex); + sb.append(", ").append(isCompleted); sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); diff --git a/src/main/generated/writely/tables/records/ProductMemoRecord.java b/src/main/generated/writely/tables/records/ProductMemoRecord.java index 380bfbf..51fdf91 100644 --- a/src/main/generated/writely/tables/records/ProductMemoRecord.java +++ b/src/main/generated/writely/tables/records/ProductMemoRecord.java @@ -66,11 +66,71 @@ public String getContent() { return (String) get(2); } + /** + * Setter for public.product_memo.selected_text. + */ + public ProductMemoRecord setSelectedText(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_memo.selected_text. + */ + public String getSelectedText() { + return (String) get(3); + } + + /** + * Setter for public.product_memo.start_index. + */ + public ProductMemoRecord setStartIndex(Integer value) { + set(4, value); + return this; + } + + /** + * Getter for public.product_memo.start_index. + */ + public Integer getStartIndex() { + return (Integer) get(4); + } + + /** + * Setter for public.product_memo.end_index. + */ + public ProductMemoRecord setEndIndex(Integer value) { + set(5, value); + return this; + } + + /** + * Getter for public.product_memo.end_index. + */ + public Integer getEndIndex() { + return (Integer) get(5); + } + + /** + * Setter for public.product_memo.is_completed. 완료여부 + */ + public ProductMemoRecord setIsCompleted(Boolean value) { + set(6, value); + return this; + } + + /** + * Getter for public.product_memo.is_completed. 완료여부 + */ + public Boolean getIsCompleted() { + return (Boolean) get(6); + } + /** * Setter for public.product_memo.created_at. 생성일시 */ public ProductMemoRecord setCreatedAt(LocalDateTime value) { - set(3, value); + set(7, value); return this; } @@ -78,14 +138,14 @@ public ProductMemoRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_memo.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(3); + return (LocalDateTime) get(7); } /** * Setter for public.product_memo.created_by. 생성자 ID */ public ProductMemoRecord setCreatedBy(UUID value) { - set(4, value); + set(8, value); return this; } @@ -93,14 +153,14 @@ public ProductMemoRecord setCreatedBy(UUID value) { * Getter for public.product_memo.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(4); + return (UUID) get(8); } /** * Setter for public.product_memo.updated_at. 수정일시 */ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { - set(5, value); + set(9, value); return this; } @@ -108,14 +168,14 @@ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_memo.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(5); + return (LocalDateTime) get(9); } /** * Setter for public.product_memo.updated_by. 수정일시 */ public ProductMemoRecord setUpdatedBy(UUID value) { - set(6, value); + set(10, value); return this; } @@ -123,7 +183,7 @@ public ProductMemoRecord setUpdatedBy(UUID value) { * Getter for public.product_memo.updated_by. 수정일시 */ public UUID getUpdatedBy() { - return (UUID) get(6); + return (UUID) get(10); } // ------------------------------------------------------------------------- @@ -149,12 +209,16 @@ public ProductMemoRecord() { /** * Create a detached, initialised ProductMemoRecord */ - public ProductMemoRecord(UUID id, UUID productId, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductMemoRecord(UUID id, UUID productId, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductMemo.PRODUCT_MEMO); setId(id); setProductId(productId); setContent(content); + setSelectedText(selectedText); + setStartIndex(startIndex); + setEndIndex(endIndex); + setIsCompleted(isCompleted); setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); @@ -172,6 +236,10 @@ public ProductMemoRecord(writely.tables.pojos.ProductMemo value) { setId(value.getId()); setProductId(value.getProductId()); setContent(value.getContent()); + setSelectedText(value.getSelectedText()); + setStartIndex(value.getStartIndex()); + setEndIndex(value.getEndIndex()); + setIsCompleted(value.getIsCompleted()); setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/src/main/java/com/writely/product/controller/ProductController.java index 8823ae2..71e7877 100644 --- a/src/main/java/com/writely/product/controller/ProductController.java +++ b/src/main/java/com/writely/product/controller/ProductController.java @@ -1,6 +1,6 @@ package com.writely.product.controller; -import com.writely.product.request.ProductMemoCreateRequest; +import com.writely.product.request.ProductMemoSaveRequest; import com.writely.product.request.ProductModifyRequest; import com.writely.product.request.ProductTemplateSaveRequest; import com.writely.product.response.ProductDetailResponse; @@ -52,7 +52,7 @@ public void createTemplate( @PostMapping("/{productId}/memos") public void createMemo( @PathVariable UUID productId, - @RequestBody ProductMemoCreateRequest request) { + @RequestBody ProductMemoSaveRequest request) { productCommandService.createMemo(productId, request); } @@ -85,7 +85,7 @@ public List getMemos(@PathVariable UUID productId) { public void modifyMemo( @PathVariable UUID productId, @PathVariable UUID memoId, - @RequestBody ProductMemoCreateRequest request) { + @RequestBody ProductMemoSaveRequest request) { productCommandService.modifyMemo(productId, memoId, request); } diff --git a/src/main/java/com/writely/product/domain/ProductMemo.java b/src/main/java/com/writely/product/domain/ProductMemo.java index e41ebca..30e967f 100644 --- a/src/main/java/com/writely/product/domain/ProductMemo.java +++ b/src/main/java/com/writely/product/domain/ProductMemo.java @@ -25,12 +25,32 @@ public class ProductMemo extends BaseAuditTimeEntity { @Column(name = "content", nullable = false) private String content; - public ProductMemo(UUID productId, String content) { + @Column(name = "selected_text", nullable = false) + private String selectedText; + + @Column(name = "start_index", nullable = false) + private Integer startIndex; + + @Column(name = "endIndex", nullable = false) + private Integer endIndex; + + @Column(name = "is_completed", nullable = false) + private Boolean isCompleted = Boolean.FALSE; + + public ProductMemo(UUID productId, String content, String selected_text, + Integer startIndex, Integer endIndex) { this.productId = productId; this.content = content; + this.selectedText = selected_text; + this.startIndex = startIndex; + this.endIndex = endIndex; } - public void update(String content) { + public void update(String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted) { this.content = content; + this.selectedText = selectedText; + this.startIndex = startIndex; + this.endIndex = endIndex; + this.isCompleted = isCompleted; } } diff --git a/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java b/src/main/java/com/writely/product/request/ProductMemoSaveRequest.java similarity index 55% rename from src/main/java/com/writely/product/request/ProductMemoCreateRequest.java rename to src/main/java/com/writely/product/request/ProductMemoSaveRequest.java index 8d99ea5..b910a9c 100644 --- a/src/main/java/com/writely/product/request/ProductMemoCreateRequest.java +++ b/src/main/java/com/writely/product/request/ProductMemoSaveRequest.java @@ -6,8 +6,12 @@ @Getter @Setter -public class ProductMemoCreateRequest { +public class ProductMemoSaveRequest { @Schema(title = "내용") private String content; + private String selectedText; + private Integer startIndex; + private Integer endIndex; + private Boolean isCompleted; } diff --git a/src/main/java/com/writely/product/response/ProductMemoResponse.java b/src/main/java/com/writely/product/response/ProductMemoResponse.java index 71a73b7..dd46010 100644 --- a/src/main/java/com/writely/product/response/ProductMemoResponse.java +++ b/src/main/java/com/writely/product/response/ProductMemoResponse.java @@ -1,7 +1,6 @@ package com.writely.product.response; import com.writely.product.domain.ProductMemo; -import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import java.util.UUID; @@ -10,11 +9,18 @@ public class ProductMemoResponse { private final UUID id; - @Schema(title = "내용") private final String content; + private final String selectedText; + private final Integer startIndex; + private final Integer endIndex; + private final Boolean isCompleted; public ProductMemoResponse(ProductMemo memo) { this.id = memo.getId(); this.content = memo.getContent(); + this.selectedText = memo.getSelectedText(); + this.startIndex = memo.getStartIndex(); + this.endIndex = memo.getEndIndex(); + this.isCompleted = memo.getIsCompleted(); } } diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index f48e82e..a13b184 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -4,7 +4,7 @@ import com.writely.product.domain.*; import com.writely.product.domain.enums.ProductException; import com.writely.product.repository.*; -import com.writely.product.request.ProductMemoCreateRequest; +import com.writely.product.request.ProductMemoSaveRequest; import com.writely.product.request.ProductModifyRequest; import com.writely.product.request.ProductTemplateSaveRequest; import lombok.RequiredArgsConstructor; @@ -35,10 +35,11 @@ public UUID create() { } @Transactional - public void createMemo(UUID productId, ProductMemoCreateRequest request) { + public void createMemo(UUID productId, ProductMemoSaveRequest request) { verifyExistProduct(productId); - productMemoRepository.save(new ProductMemo(productId, request.getContent())); + productMemoRepository.save(new ProductMemo(productId, request.getContent(), + request.getSelectedText(), request.getStartIndex(), request.getEndIndex())); } @Transactional @@ -62,12 +63,13 @@ public UUID modify(UUID productId, ProductModifyRequest request) { } @Transactional - public void modifyMemo(UUID productId, UUID memoId, ProductMemoCreateRequest request) { + public void modifyMemo(UUID productId, UUID memoId, ProductMemoSaveRequest request) { verifyExistProduct(productId); ProductMemo memo = getMemoById(memoId); - memo.update(request.getContent()); + memo.update(request.getContent(), request.getSelectedText(), request.getStartIndex() + , request.getEndIndex(), request.getIsCompleted()); } @Transactional diff --git a/src/main/java/com/writely/product/service/ProductQueryService.java b/src/main/java/com/writely/product/service/ProductQueryService.java index 5cf2f70..503a845 100644 --- a/src/main/java/com/writely/product/service/ProductQueryService.java +++ b/src/main/java/com/writely/product/service/ProductQueryService.java @@ -2,6 +2,7 @@ import com.writely.common.exception.BaseException; import com.writely.product.domain.Product; +import com.writely.product.domain.ProductMemo; import com.writely.product.domain.enums.ProductException; import com.writely.product.repository.ProductDao; import com.writely.product.repository.ProductJpaRepository; @@ -13,6 +14,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Comparator; import java.util.List; import java.util.UUID; @@ -45,6 +47,7 @@ public List getMemos(UUID productId) { Product product = getById(productId); return product.getMemos().stream() + .sorted(Comparator.comparing(ProductMemo::getUpdatedAt).reversed()) .map(ProductMemoResponse::new) .toList(); } From 3bdb0e35325a262b41698b94f3bf652ad1ea1dcd Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Fri, 14 Feb 2025 20:39:15 +0900 Subject: [PATCH 029/107] =?UTF-8?q?feat(email):=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EA=B0=80=EC=9E=85/=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EC=9E=AC=EC=84=A4=EC=A0=95=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=BB=A8=ED=85=90=EC=B8=A0=20=EC=B6=94=EA=B0=80=20(#28)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/writely/auth/helper/MailHelper.java | 19 +++++++++-- .../auth/service/AuthCommandService.java | 16 +++++---- .../templates/mail/change-password.html | 33 +++++++++++++++---- src/main/resources/templates/mail/join.html | 32 ++++++++++++++---- 4 files changed, 76 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/writely/auth/helper/MailHelper.java b/src/main/java/com/writely/auth/helper/MailHelper.java index ab050d8..10090b8 100644 --- a/src/main/java/com/writely/auth/helper/MailHelper.java +++ b/src/main/java/com/writely/auth/helper/MailHelper.java @@ -2,6 +2,8 @@ import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.mail.javamail.JavaMailSender; @@ -17,12 +19,15 @@ public class MailHelper { private final SpringTemplateEngine templateEngine; public void send ( - MailType mailType, String mailTo, Context variables + MailType mailType, String mailTo, MailData data ) throws MessagingException { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, false, "UTF-8"); mimeMessageHelper.setTo(mailTo); mimeMessageHelper.setSubject(mailType.getSubject()); + + Context variables = new Context(); + variables.setVariable("data", data); mimeMessageHelper.setText(templateEngine.process(mailType.getTemplatePath(), variables), true); javaMailSender.send(mimeMessage); @@ -31,10 +36,18 @@ public void send ( @Getter @RequiredArgsConstructor public enum MailType { - JOIN("[WritelyForWriters] 회원가입 안내입니다.", "mail/join"), - CHANGE_PASSWORD("[WritelyForWriters] 비밀번호 변경 안내입니다.", "mail/change-password"); + JOIN("[라이틀리] 계정을 인증해주세요!", "mail/join"), + CHANGE_PASSWORD("[라이틀리] 비밀번호 재설정 안내", "mail/change-password"); private final String subject; private final String templatePath; } + + @Getter + @AllArgsConstructor + @Builder + public static class MailData { + private String token; + private String nickname; + } } diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 77d364d..a0213de 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -94,13 +94,14 @@ public void join(JoinRequest request) { try { // 이메일 전송 - Context emailCtx = new Context(); - emailCtx.setVariable("joinToken", joinToken.getTokenString()); mailHelper.send( MailHelper.MailType.JOIN, request.getEmail(), - emailCtx - ); // todo: 메일 디자인 + MailHelper.MailData.builder() + .nickname(request.getNickname()) + .token(joinToken.getTokenString()) + .build() + ); } catch (MessagingException e) { throw new BaseException(AuthException.MAIL_SEND_FAILED); } @@ -148,12 +149,13 @@ public void changePassword(ChangePasswordRequest request) { // 이메일 전송 try { - Context emailCtx = new Context(); - emailCtx.setVariable("changePasswordToken", changePasswordToken.getTokenString()); mailHelper.send( MailHelper.MailType.CHANGE_PASSWORD, member.getEmail(), - emailCtx + MailHelper.MailData.builder() + .nickname(member.getNickname()) + .token(changePasswordToken.getTokenString()) + .build() ); } catch (MessagingException e) { throw new BaseException(AuthException.CHANGE_PASSWORD_EMAIL_NOT_FOUND); diff --git a/src/main/resources/templates/mail/change-password.html b/src/main/resources/templates/mail/change-password.html index 92ec073..ff12fca 100644 --- a/src/main/resources/templates/mail/change-password.html +++ b/src/main/resources/templates/mail/change-password.html @@ -1,13 +1,32 @@ + + + -
-

Hello

-
-

ch pw us

-
+
+

+ 안녕하세요, 님.
+

+

+ 비밀번호 재설정을 요청하셨나요? 아래 링크를 클릭하여 새 비밀번호를 설정해 주세요.
+ https://writely-for-writers.co.kr/change-password/complete +

+

+ ⚠️보안 주의사항 +

    +
  • 이 링크는 일정 시간 후(예: 24시간) 만료됩니다.
  • +
  • 본인이 요청하지 않았다면 이 이메일을 무시하셔도 됩니다.
  • +
  • 계정 보안을 위해 비밀번호를 다른 서비스와 다르게 설정하는 것을 추천드립니다.
  • +
+

+

+ 궁금한 점이 있다면 언제든지 writelyforwriters@gmail.com을 통해 문의해 주세요. +

+

+ 감사합니다!
+ 라이틀리 팀 드림 +

-
-
\ No newline at end of file diff --git a/src/main/resources/templates/mail/join.html b/src/main/resources/templates/mail/join.html index de66ff0..432e26c 100644 --- a/src/main/resources/templates/mail/join.html +++ b/src/main/resources/templates/mail/join.html @@ -1,13 +1,31 @@ + + + -
-

Hello

-
-

join us

-
+
+

+ 안녕하세요, 님!
+ 라이틀리에 가입해 주셔서 감사합니다. +

+

+ 계정을 활성화하려면 아래 버튼을 클릭하여 이메일 주소를 인증해 주세요.
+ https://writely-for-writers.co.kr/join/complete +

+

+ 위 버튼이 작동하지 않는다면 아래 링크를 복사하여 브라우저 주소창에 붙여넣어 주세요.
+ + https://writely-for-writers.co.kr/join/complete?joinToken= +

+

+ 이메일 인증은 보안을 위해 필수 절차이며, 일정 시간 내에 완료되지 않으면 계정이 비활성화될 수 있습니다.
+ 궁금한 점이 있다면 언제든지 writelyforwriters@gmail.com을 통해 문의해 주세요. +

+

+ 감사합니다!
+ 라이틀리 팀 드림 +

-
-
\ No newline at end of file From 28ec7c32da2a395847e58350f3ff9081823dc429 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 16 Feb 2025 16:51:49 +0900 Subject: [PATCH 030/107] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=95=84?= =?UTF-8?q?=EC=9B=83=20(#29)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 9 +++++++++ .../com/writely/auth/domain/RefreshToken.java | 9 ++++++++- .../RefreshTokenRedisRepository.java | 5 ++++- .../auth/service/AuthCommandService.java | 19 +++++++++++++++---- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/src/main/java/com/writely/auth/controller/AuthController.java index 4c317d8..7e234af 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/src/main/java/com/writely/auth/controller/AuthController.java @@ -5,7 +5,9 @@ import com.writely.auth.response.CheckEmailResponse; import com.writely.auth.service.AuthCommandService; import com.writely.auth.service.AuthQueryService; +import com.writely.common.domain.MemberSession; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -33,6 +35,13 @@ public AuthTokenResponse login(@Valid @RequestBody LoginRequest request) { return authCommandService.login(request); } + @Operation(summary = "로그아웃") + @PostMapping("/logout") + public void logout(@Parameter(hidden = true) MemberSession memberSession) { + + authCommandService.logout(memberSession.getMemberId()); + } + @Operation(summary = "회원가입") @PostMapping("/join") public void join(@Valid @RequestBody JoinRequest request) { diff --git a/src/main/java/com/writely/auth/domain/RefreshToken.java b/src/main/java/com/writely/auth/domain/RefreshToken.java index 71a2d3d..db298fa 100644 --- a/src/main/java/com/writely/auth/domain/RefreshToken.java +++ b/src/main/java/com/writely/auth/domain/RefreshToken.java @@ -4,12 +4,19 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.springframework.data.redis.core.RedisHash; +import org.springframework.data.redis.core.index.Indexed; + +import java.util.UUID; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @RedisHash(value = "refreshToken", timeToLive = 60 * 60 * 24 * 90) public class RefreshToken extends BaseToken { - public RefreshToken(String tokenString) { + @Indexed + private UUID memberId; + + public RefreshToken(String tokenString, UUID memberId) { super(tokenString); + this.memberId = memberId; } } \ No newline at end of file diff --git a/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java b/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java index da944aa..73354db 100644 --- a/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java +++ b/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java @@ -3,6 +3,9 @@ import com.writely.auth.domain.RefreshToken; import org.springframework.data.repository.CrudRepository; -public interface RefreshTokenRedisRepository extends CrudRepository { +import java.util.Optional; +import java.util.UUID; +public interface RefreshTokenRedisRepository extends CrudRepository { + Optional findByMemberId(UUID memberId); } diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index a0213de..034501c 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -21,7 +21,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.thymeleaf.context.Context; import java.util.UUID; @@ -43,11 +42,16 @@ public class AuthCommandService { * 토큰 재발급 */ public AuthTokenResponse reissueToken(ReissueRequest request) { - // 토큰이 비유효하면 + // 리프래시 토큰이 비유효하면 if (!jwtHelper.isTokenValid(request.getRefreshToken())) { throw new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID); } + // 레디스 검사 + RefreshToken oldRefreshToken = refreshTokenRedisRepository.findById(request.getRefreshToken()) + .orElseThrow(() -> new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID)); + this.invalidateToken(oldRefreshToken); + JwtPayload payload = jwtHelper.getPayload(request.getRefreshToken()); return generateAuthTokens(payload.getMemberId()); } @@ -64,11 +68,18 @@ public AuthTokenResponse login(LoginRequest request) { return generateAuthTokens(memberPassword.getMemberId()); } + /** + * 로그아웃 + */ + public void logout(UUID memberId) { + refreshTokenRedisRepository.findByMemberId(memberId) + .ifPresent(this::invalidateToken); + } + /** * 회원 가입 */ public void join(JoinRequest request) { - // 이미 있는 회원인지 검사 if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); @@ -203,7 +214,7 @@ private AuthTokenResponse generateAuthTokens(UUID memberId) { .build(); String accessToken = jwtHelper.generateAccessToken(jwtPayload); String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); - refreshTokenRedisRepository.save(new RefreshToken(refreshToken)); + refreshTokenRedisRepository.save(new RefreshToken(refreshToken, memberId));; return new AuthTokenResponse(accessToken, refreshToken); } From 263fc14abacbf75c2b9895f5a9a0a3559a1f1d45 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 19 Feb 2025 23:30:54 +0900 Subject: [PATCH 031/107] =?UTF-8?q?feat(terms):=20=EC=95=BD=EA=B4=80=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20(#30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- .../auth/domain/enums/AuthException.java | 3 +- .../com/writely/auth/request/JoinRequest.java | 6 +-- .../auth/service/AuthCommandService.java | 2 + .../com/writely/common/config/WebConfig.java | 7 ++++ .../terms/controller/TermsController.java | 27 ++++++++++++ .../writely/terms/domain/TermsAgreeId.java | 1 - .../writely/terms/domain/enums/TermsCode.java | 9 ++++ .../terms/domain/enums/TermsException.java | 16 +++++++ .../writely/terms/repository/TermsDao.java | 35 ++++++++-------- ...rmsRequest.java => TermsAgreeRequest.java} | 2 +- .../terms/response/TermsDetailResponse.java | 42 +++++++++++++++++++ .../terms/service/TermsCommandService.java | 10 +++++ .../terms/service/TermsQueryService.java | 36 ++++++++++++++++ .../writely/terms/service/TermsService.java | 14 ------- .../templates/mail/change-password.html | 2 +- src/main/resources/templates/mail/join.html | 4 +- 17 files changed, 176 insertions(+), 42 deletions(-) create mode 100644 src/main/java/com/writely/terms/controller/TermsController.java create mode 100644 src/main/java/com/writely/terms/domain/enums/TermsException.java rename src/main/java/com/writely/terms/request/{TermsRequest.java => TermsAgreeRequest.java} (90%) create mode 100644 src/main/java/com/writely/terms/response/TermsDetailResponse.java create mode 100644 src/main/java/com/writely/terms/service/TermsCommandService.java create mode 100644 src/main/java/com/writely/terms/service/TermsQueryService.java delete mode 100644 src/main/java/com/writely/terms/service/TermsService.java diff --git a/BE-secret b/BE-secret index 1abfa16..b13abcf 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 1abfa161015db4311c7061ff7aea20c2bb19a071 +Subproject commit b13abcf4b3137767f98ed47b6c19a3f1d9e1d42c diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/src/main/java/com/writely/auth/domain/enums/AuthException.java index 7dda3e9..0ebfeb4 100644 --- a/src/main/java/com/writely/auth/domain/enums/AuthException.java +++ b/src/main/java/com/writely/auth/domain/enums/AuthException.java @@ -16,7 +16,8 @@ public enum AuthException implements CodeInfo { MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), CHANGE_PASSWORD_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), - CHANGE_PASSWORD_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."); + CHANGE_PASSWORD_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."), + TERMS_AGREE_REQUIRED(HttpStatus.BAD_REQUEST, "AUTH-404", "필수 약관 동의가 필요합니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/src/main/java/com/writely/auth/request/JoinRequest.java index 023c6cd..5101c75 100644 --- a/src/main/java/com/writely/auth/request/JoinRequest.java +++ b/src/main/java/com/writely/auth/request/JoinRequest.java @@ -2,7 +2,7 @@ import com.writely.common.validation.IsEmail; import com.writely.common.validation.IsPassword; -import com.writely.terms.request.TermsRequest; +import com.writely.terms.request.TermsAgreeRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; @@ -31,7 +31,7 @@ public class JoinRequest { private String nickname; @NotNull - @Schema(title = "약관 목록", requiredMode = Schema.RequiredMode.REQUIRED, example = "[{termsCd: \"1001\", isAgreed: true}, {termsCd: \"1002\", isAgreed: false}]") - private List termsList; + @Schema(title = "약관 동의 목록", requiredMode = Schema.RequiredMode.REQUIRED, example = "[{termsCd: \"1001\", isAgreed: true}, {termsCd: \"1002\", isAgreed: false}]") + private List termsList; } diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 034501c..05b80d7 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -16,6 +16,7 @@ import com.writely.member.domain.MemberPassword; import com.writely.member.repository.MemberPasswordJpaRepository; import com.writely.member.repository.MemberJpaRepository; +import com.writely.terms.service.TermsQueryService; import jakarta.mail.MessagingException; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; @@ -29,6 +30,7 @@ @Transactional @Slf4j public class AuthCommandService { + private final TermsQueryService termsQueryService; private final MemberJpaRepository memberJpaRepository; private final MemberPasswordJpaRepository memberPasswordJpaRepository; private final RefreshTokenRedisRepository refreshTokenRedisRepository; diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java index a0cdee8..67ddd3a 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -1,9 +1,11 @@ package com.writely.common.config; import com.writely.common.resolver.AuthResolver; +import com.writely.terms.domain.enums.TermsCode; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -22,6 +24,11 @@ public void addArgumentResolvers(List resolvers) resolvers.add(authResolver); } + @Override + public void addFormatters(FormatterRegistry registry) { + registry.addConverter(new TermsCode.CodeConverter()); + } + @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") diff --git a/src/main/java/com/writely/terms/controller/TermsController.java b/src/main/java/com/writely/terms/controller/TermsController.java new file mode 100644 index 0000000..96ff4f3 --- /dev/null +++ b/src/main/java/com/writely/terms/controller/TermsController.java @@ -0,0 +1,27 @@ +package com.writely.terms.controller; + +import com.writely.terms.domain.enums.TermsCode; +import com.writely.terms.response.TermsDetailResponse; +import com.writely.terms.service.TermsQueryService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/terms") +@Tag(name = "약관") +@Slf4j +public class TermsController { + private final TermsQueryService termsQueryService; + + @Operation(summary = "약관 상세 조회") + @GetMapping("/{termsCd}") + public TermsDetailResponse getTermsByTermsCd(@PathVariable TermsCode termsCd) { + + return termsQueryService.getTermsByTermsCd(termsCd); + } + +} diff --git a/src/main/java/com/writely/terms/domain/TermsAgreeId.java b/src/main/java/com/writely/terms/domain/TermsAgreeId.java index 676a4db..3ab4237 100644 --- a/src/main/java/com/writely/terms/domain/TermsAgreeId.java +++ b/src/main/java/com/writely/terms/domain/TermsAgreeId.java @@ -1,7 +1,6 @@ package com.writely.terms.domain; import com.writely.terms.domain.enums.TermsCode; -import jakarta.persistence.Column; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/writely/terms/domain/enums/TermsCode.java b/src/main/java/com/writely/terms/domain/enums/TermsCode.java index bb4fda4..1781a83 100644 --- a/src/main/java/com/writely/terms/domain/enums/TermsCode.java +++ b/src/main/java/com/writely/terms/domain/enums/TermsCode.java @@ -7,9 +7,11 @@ import jakarta.persistence.Converter; import lombok.Getter; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; @Getter @RequiredArgsConstructor +@Slf4j public enum TermsCode implements Codable { PRIVACY_POLICY("1001"), MARKETING_AGREEMENT("1002"); @@ -29,6 +31,13 @@ public TermsCode convertToEntityAttribute(String dbData) { } } + public static class CodeConverter implements org.springframework.core.convert.converter.Converter { + @Override + public TermsCode convert(String code) { + return TermsCode.fromCode(code); + } + } + @JsonValue public String getCode() { return code; diff --git a/src/main/java/com/writely/terms/domain/enums/TermsException.java b/src/main/java/com/writely/terms/domain/enums/TermsException.java new file mode 100644 index 0000000..c0cddfe --- /dev/null +++ b/src/main/java/com/writely/terms/domain/enums/TermsException.java @@ -0,0 +1,16 @@ +package com.writely.terms.domain.enums; + +import com.writely.common.enums.code.CodeInfo; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum TermsException implements CodeInfo { + TERMS_NOT_FOUND(HttpStatus.NOT_FOUND, "TERMS-001", "약관을 찾을 수 없습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/writely/terms/repository/TermsDao.java b/src/main/java/com/writely/terms/repository/TermsDao.java index 876728c..1183325 100644 --- a/src/main/java/com/writely/terms/repository/TermsDao.java +++ b/src/main/java/com/writely/terms/repository/TermsDao.java @@ -1,37 +1,36 @@ package com.writely.terms.repository; +import com.writely.terms.domain.enums.TermsCode; import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; -import writely.tables.Terms; -import static org.jooq.impl.DSL.*; -import org.jooq.*; -import org.jooq.impl.*; import writely.tables.records.TermsRecord; import java.util.List; +import java.util.Optional; + +import static writely.tables.Terms.TERMS; @Repository @RequiredArgsConstructor public class TermsDao { private final DSLContext dsl; - private final Terms TERMS = writely.tables.Terms.TERMS; - public List selectLatestTermsList() { - Table latestTerms = table( - select(TERMS.CD, max(TERMS.VERSION).as("max_version")) + public Optional selectLatestTermsByTermsCd(TermsCode termsCode) { + return Optional.ofNullable( + dsl.select() .from(TERMS) - .groupBy(TERMS.CD) - ).as("latest_terms"); + .where(TERMS.CD.eq(termsCode.getCode())) + .orderBy(TERMS.VERSION.desc()) + .fetchAnyInto(TermsRecord.class) + ); + } - return dsl.select() // 전체 필드 조회 + public List selectAllLatestTermsList() { + return dsl.selectDistinct(TERMS.CD) .from(TERMS) - .join(latestTerms) - .on(TERMS.CD.eq(latestTerms.field(TERMS.CD))) - .and(TERMS.VERSION.eq(latestTerms.field("max_version", Integer.class))) - .fetchInto(TermsRecord.class) - .stream() - .map(com.writely.terms.domain.Terms::new) - .toList(); + .orderBy(TERMS.CD.asc(), TERMS.VERSION.desc()) + .fetchInto(TermsRecord.class); } + } diff --git a/src/main/java/com/writely/terms/request/TermsRequest.java b/src/main/java/com/writely/terms/request/TermsAgreeRequest.java similarity index 90% rename from src/main/java/com/writely/terms/request/TermsRequest.java rename to src/main/java/com/writely/terms/request/TermsAgreeRequest.java index 31954f8..a780a1f 100644 --- a/src/main/java/com/writely/terms/request/TermsRequest.java +++ b/src/main/java/com/writely/terms/request/TermsAgreeRequest.java @@ -7,7 +7,7 @@ @AllArgsConstructor @Getter -public class TermsRequest { +public class TermsAgreeRequest { @NotNull private TermsCode termsCd; diff --git a/src/main/java/com/writely/terms/response/TermsDetailResponse.java b/src/main/java/com/writely/terms/response/TermsDetailResponse.java new file mode 100644 index 0000000..e95b577 --- /dev/null +++ b/src/main/java/com/writely/terms/response/TermsDetailResponse.java @@ -0,0 +1,42 @@ +package com.writely.terms.response; + +import com.writely.terms.domain.enums.TermsCode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import writely.tables.records.TermsRecord; + +import java.time.LocalDateTime; +import java.util.UUID; + +@Getter +@Setter +public class TermsDetailResponse { + @Schema(title = "약관 아이디", requiredMode = Schema.RequiredMode.REQUIRED) + private UUID id; + @Schema(title = "약관 코드", requiredMode = Schema.RequiredMode.REQUIRED) + private TermsCode cd; + @Schema(title = "약관 제목", requiredMode = Schema.RequiredMode.REQUIRED) + private String title; + @Schema(title = "약관 내용", requiredMode = Schema.RequiredMode.REQUIRED) + private String content; + @Schema(title = "약관 버전", requiredMode = Schema.RequiredMode.REQUIRED) + private int version; + @Schema(title = "약관 동의 필수 여부", requiredMode = Schema.RequiredMode.REQUIRED) + private boolean isRequired; + @Schema(title = "생성일", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createdAt; + @Schema(title = "수정일", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime updatedAt; + + public TermsDetailResponse(TermsRecord terms) { + this.id = terms.getId(); + this.cd = TermsCode.fromCode(terms.getCd()); + this.title = terms.getTitle(); + this.content = terms.getContent(); + this.version = terms.getVersion(); + this.isRequired = terms.getIsRequired(); + this.createdAt = terms.getCreatedAt().toLocalDateTime(); + this.updatedAt = terms.getUpdatedAt().toLocalDateTime(); + } +} diff --git a/src/main/java/com/writely/terms/service/TermsCommandService.java b/src/main/java/com/writely/terms/service/TermsCommandService.java new file mode 100644 index 0000000..ec70958 --- /dev/null +++ b/src/main/java/com/writely/terms/service/TermsCommandService.java @@ -0,0 +1,10 @@ +package com.writely.terms.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class TermsCommandService { + +} diff --git a/src/main/java/com/writely/terms/service/TermsQueryService.java b/src/main/java/com/writely/terms/service/TermsQueryService.java new file mode 100644 index 0000000..76ac660 --- /dev/null +++ b/src/main/java/com/writely/terms/service/TermsQueryService.java @@ -0,0 +1,36 @@ +package com.writely.terms.service; + +import com.writely.common.enums.code.ResultCodeInfo; +import com.writely.common.exception.BaseException; +import com.writely.terms.domain.enums.TermsCode; +import com.writely.terms.domain.enums.TermsException; +import com.writely.terms.repository.TermsDao; +import com.writely.terms.response.TermsDetailResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import writely.tables.records.TermsRecord; + +import java.util.List; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class TermsQueryService { + private final TermsDao termsDao; + + public TermsDetailResponse getTermsByTermsCd(TermsCode termsCd) { + TermsRecord terms = termsDao.selectLatestTermsByTermsCd(termsCd) + .orElseThrow(() -> new BaseException(TermsException.TERMS_NOT_FOUND)); + + return new TermsDetailResponse(terms); + } + + public List getAllTermsList() { + + return termsDao.selectAllLatestTermsList() + .stream() + .map(TermsDetailResponse::new) + .toList(); + } +} diff --git a/src/main/java/com/writely/terms/service/TermsService.java b/src/main/java/com/writely/terms/service/TermsService.java deleted file mode 100644 index cdb46e2..0000000 --- a/src/main/java/com/writely/terms/service/TermsService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.writely.terms.service; - -import com.writely.terms.repository.TermsDao; -import com.writely.terms.repository.TermsJpaRepository; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -@Service -@RequiredArgsConstructor -public class TermsService { - private final TermsDao termsDao; - private final TermsJpaRepository termsJpaRepository; - -} diff --git a/src/main/resources/templates/mail/change-password.html b/src/main/resources/templates/mail/change-password.html index ff12fca..8c16d87 100644 --- a/src/main/resources/templates/mail/change-password.html +++ b/src/main/resources/templates/mail/change-password.html @@ -10,7 +10,7 @@

비밀번호 재설정을 요청하셨나요? 아래 링크를 클릭하여 새 비밀번호를 설정해 주세요.
- https://writely-for-writers.co.kr/change-password/complete + 비밀번호 재설정하기

⚠️보안 주의사항 diff --git a/src/main/resources/templates/mail/join.html b/src/main/resources/templates/mail/join.html index 432e26c..ec80797 100644 --- a/src/main/resources/templates/mail/join.html +++ b/src/main/resources/templates/mail/join.html @@ -10,8 +10,8 @@ 라이틀리에 가입해 주셔서 감사합니다.

- 계정을 활성화하려면 아래 버튼을 클릭하여 이메일 주소를 인증해 주세요.
- https://writely-for-writers.co.kr/join/complete + 계정을 활성화하려면 아래 링크를 클릭하여 이메일 주소를 인증해 주세요.
+ 이메일 인증하기

위 버튼이 작동하지 않는다면 아래 링크를 복사하여 브라우저 주소창에 붙여넣어 주세요.
From f6a1a24f36643c865aa5e67bbe0ee3e40db33975 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 22 Feb 2025 21:52:55 +0900 Subject: [PATCH 032/107] =?UTF-8?q?feat:=20=ED=95=84=EC=88=98=20=EC=95=BD?= =?UTF-8?q?=EA=B4=80=20=EB=8F=99=EC=9D=98=20=EC=97=AC=EB=B6=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit github action으로 배포 잘 되는지 검사하기 위한 풀리퀘 --- .../java/com/writely/auth/service/AuthCommandService.java | 8 ++++++++ src/main/java/com/writely/terms/repository/TermsDao.java | 5 +++++ .../java/com/writely/terms/service/TermsQueryService.java | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 05b80d7..9f44043 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -16,6 +16,7 @@ import com.writely.member.domain.MemberPassword; import com.writely.member.repository.MemberPasswordJpaRepository; import com.writely.member.repository.MemberJpaRepository; +import com.writely.terms.request.TermsAgreeRequest; import com.writely.terms.service.TermsQueryService; import jakarta.mail.MessagingException; import jakarta.transaction.Transactional; @@ -82,6 +83,13 @@ public void logout(UUID memberId) { * 회원 가입 */ public void join(JoinRequest request) { + // 필수 약관이 모두 포함되어있는지 검사 + if (!termsQueryService.isContainingRequiredTerms( + request.getTermsList().stream().map(TermsAgreeRequest::getTermsCd).toList()) + ) { + throw new BaseException(AuthException.TERMS_AGREE_REQUIRED); + } + // 이미 있는 회원인지 검사 if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); diff --git a/src/main/java/com/writely/terms/repository/TermsDao.java b/src/main/java/com/writely/terms/repository/TermsDao.java index 1183325..0c20bda 100644 --- a/src/main/java/com/writely/terms/repository/TermsDao.java +++ b/src/main/java/com/writely/terms/repository/TermsDao.java @@ -33,4 +33,9 @@ public List selectAllLatestTermsList() { .fetchInto(TermsRecord.class); } + public boolean isContainingRequiredTerms(List termsCodeList) { + + // todo + return true; + } } diff --git a/src/main/java/com/writely/terms/service/TermsQueryService.java b/src/main/java/com/writely/terms/service/TermsQueryService.java index 76ac660..8a83d09 100644 --- a/src/main/java/com/writely/terms/service/TermsQueryService.java +++ b/src/main/java/com/writely/terms/service/TermsQueryService.java @@ -1,6 +1,5 @@ package com.writely.terms.service; -import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.exception.BaseException; import com.writely.terms.domain.enums.TermsCode; import com.writely.terms.domain.enums.TermsException; @@ -26,6 +25,11 @@ public TermsDetailResponse getTermsByTermsCd(TermsCode termsCd) { return new TermsDetailResponse(terms); } + public boolean isContainingRequiredTerms(List termsCodeList) { + + return termsDao.isContainingRequiredTerms(termsCodeList); + } + public List getAllTermsList() { return termsDao.selectAllLatestTermsList() From cf64fbe38ffad23d3153f38160ca20e445f23199 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 23 Feb 2025 15:29:48 +0900 Subject: [PATCH 033/107] =?UTF-8?q?refactor:=20terms=5Fagree=20->=20terms?= =?UTF-8?q?=5Fagreement=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 10 +- src/main/generated/writely/Keys.java | 6 +- src/main/generated/writely/Public.java | 6 +- src/main/generated/writely/Tables.java | 4 +- .../generated/writely/tables/TermsAgree.java | 235 ------------------ .../writely/tables/TermsAgreement.java | 235 ++++++++++++++++++ .../{TermsAgree.java => TermsAgreement.java} | 18 +- ...eRecord.java => TermsAgreementRecord.java} | 46 ++-- 8 files changed, 280 insertions(+), 280 deletions(-) delete mode 100644 src/main/generated/writely/tables/TermsAgree.java create mode 100644 src/main/generated/writely/tables/TermsAgreement.java rename src/main/generated/writely/tables/pojos/{TermsAgree.java => TermsAgreement.java} (85%) rename src/main/generated/writely/tables/records/{TermsAgreeRecord.java => TermsAgreementRecord.java} (57%) diff --git a/sql/init.sql b/sql/init.sql index 18b9af0..fe19243 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -47,17 +47,17 @@ comment on column terms.title is '약관 제목'; comment on column terms.content is '약관 내용'; comment on column terms.is_required is '동의 필수 여부'; -create table terms_agree +create table terms_agreement ( terms_cd varchar(10) not null, member_id uuid not null, created_at timestamp with time zone not null, updated_at timestamp with time zone not null, - constraint terms_agree_pk primary key (terms_cd, member_id) + constraint terms_agreement_pk primary key (terms_cd, member_id) ); -comment on table terms_agree is '약관_동의'; -comment on column terms_agree.terms_id is '약관 ID'; -comment on column terms_agree.member_id is '회원 ID'; +comment on table terms_agreement is '약관_동의'; +comment on column terms_agreement.terms_cd is '약관 코드'; +comment on column terms_agreement.member_id is '회원 ID'; -- product create table product diff --git a/src/main/generated/writely/Keys.java b/src/main/generated/writely/Keys.java index 73f6553..d216e14 100644 --- a/src/main/generated/writely/Keys.java +++ b/src/main/generated/writely/Keys.java @@ -21,7 +21,7 @@ import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; import writely.tables.Terms; -import writely.tables.TermsAgree; +import writely.tables.TermsAgreement; import writely.tables.records.AutoModifyMessageRecord; import writely.tables.records.MemberPasswordRecord; import writely.tables.records.MemberRecord; @@ -33,7 +33,7 @@ import writely.tables.records.ProductRecord; import writely.tables.records.ProductSynopsisRecord; import writely.tables.records.ProductWorldviewRecord; -import writely.tables.records.TermsAgreeRecord; +import writely.tables.records.TermsAgreementRecord; import writely.tables.records.TermsRecord; @@ -62,5 +62,5 @@ public class Keys { public static final UniqueKey PRODUCT_SYNOPSIS_PK = Internal.createUniqueKey(ProductSynopsis.PRODUCT_SYNOPSIS, DSL.name("product_synopsis_pk"), new TableField[] { ProductSynopsis.PRODUCT_SYNOPSIS.ID }, true); public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); - public static final UniqueKey TERMS_AGREE_PK = Internal.createUniqueKey(TermsAgree.TERMS_AGREE, DSL.name("terms_agree_pk"), new TableField[] { TermsAgree.TERMS_AGREE.TERMS_CD, TermsAgree.TERMS_AGREE.MEMBER_ID }, true); + public static final UniqueKey TERMS_AGREEMENT_PK = Internal.createUniqueKey(TermsAgreement.TERMS_AGREEMENT, DSL.name("terms_agreement_pk"), new TableField[] { TermsAgreement.TERMS_AGREEMENT.TERMS_CD, TermsAgreement.TERMS_AGREEMENT.MEMBER_ID }, true); } diff --git a/src/main/generated/writely/Public.java b/src/main/generated/writely/Public.java index f8d102a..497dea8 100644 --- a/src/main/generated/writely/Public.java +++ b/src/main/generated/writely/Public.java @@ -27,7 +27,7 @@ import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; import writely.tables.Terms; -import writely.tables.TermsAgree; +import writely.tables.TermsAgreement; import writely.tables.records.PgpArmorHeadersRecord; @@ -146,7 +146,7 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( /** * 약관_동의 */ - public final TermsAgree TERMS_AGREE = TermsAgree.TERMS_AGREE; + public final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; /** * No further instances allowed @@ -177,7 +177,7 @@ public final List> getTables() { ProductSynopsis.PRODUCT_SYNOPSIS, ProductWorldview.PRODUCT_WORLDVIEW, Terms.TERMS, - TermsAgree.TERMS_AGREE + TermsAgreement.TERMS_AGREEMENT ); } } diff --git a/src/main/generated/writely/Tables.java b/src/main/generated/writely/Tables.java index 3004ca9..1ce0a30 100644 --- a/src/main/generated/writely/Tables.java +++ b/src/main/generated/writely/Tables.java @@ -21,7 +21,7 @@ import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; import writely.tables.Terms; -import writely.tables.TermsAgree; +import writely.tables.TermsAgreement; import writely.tables.records.PgpArmorHeadersRecord; @@ -133,5 +133,5 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( /** * 약관_동의 */ - public static final TermsAgree TERMS_AGREE = TermsAgree.TERMS_AGREE; + public static final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; } diff --git a/src/main/generated/writely/tables/TermsAgree.java b/src/main/generated/writely/tables/TermsAgree.java deleted file mode 100644 index ce9d01c..0000000 --- a/src/main/generated/writely/tables/TermsAgree.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.OffsetDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.TermsAgreeRecord; - - -/** - * 약관_동의 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class TermsAgree extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.terms_agree - */ - public static final TermsAgree TERMS_AGREE = new TermsAgree(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return TermsAgreeRecord.class; - } - - /** - * The column public.terms_agree.terms_cd. 약관 코드 - */ - public final TableField TERMS_CD = createField(DSL.name("terms_cd"), SQLDataType.VARCHAR(10).nullable(false), this, "약관 코드"); - - /** - * The column public.terms_agree.member_id. 회원 ID - */ - public final TableField MEMBER_ID = createField(DSL.name("member_id"), SQLDataType.UUID.nullable(false), this, "회원 ID"); - - /** - * The column public.terms_agree.created_at. - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); - - /** - * The column public.terms_agree.updated_at. - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); - - private TermsAgree(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private TermsAgree(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("약관_동의"), TableOptions.table(), where); - } - - /** - * Create an aliased public.terms_agree table reference - */ - public TermsAgree(String alias) { - this(DSL.name(alias), TERMS_AGREE); - } - - /** - * Create an aliased public.terms_agree table reference - */ - public TermsAgree(Name alias) { - this(alias, TERMS_AGREE); - } - - /** - * Create a public.terms_agree table reference - */ - public TermsAgree() { - this(DSL.name("terms_agree"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.TERMS_AGREE_PK; - } - - @Override - public TermsAgree as(String alias) { - return new TermsAgree(DSL.name(alias), this); - } - - @Override - public TermsAgree as(Name alias) { - return new TermsAgree(alias, this); - } - - @Override - public TermsAgree as(Table alias) { - return new TermsAgree(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public TermsAgree rename(String name) { - return new TermsAgree(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public TermsAgree rename(Name name) { - return new TermsAgree(name, null); - } - - /** - * Rename this table - */ - @Override - public TermsAgree rename(Table name) { - return new TermsAgree(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree where(Condition condition) { - return new TermsAgree(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public TermsAgree where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public TermsAgree where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public TermsAgree where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public TermsAgree where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public TermsAgree whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/src/main/generated/writely/tables/TermsAgreement.java b/src/main/generated/writely/tables/TermsAgreement.java new file mode 100644 index 0000000..de3907f --- /dev/null +++ b/src/main/generated/writely/tables/TermsAgreement.java @@ -0,0 +1,235 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.TermsAgreementRecord; + + +/** + * 약관_동의 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class TermsAgreement extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.terms_agreement + */ + public static final TermsAgreement TERMS_AGREEMENT = new TermsAgreement(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TermsAgreementRecord.class; + } + + /** + * The column public.terms_agreement.terms_cd. 약관 코드 + */ + public final TableField TERMS_CD = createField(DSL.name("terms_cd"), SQLDataType.VARCHAR(10).nullable(false), this, "약관 코드"); + + /** + * The column public.terms_agreement.member_id. 회원 ID + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), SQLDataType.UUID.nullable(false), this, "회원 ID"); + + /** + * The column public.terms_agreement.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.terms_agreement.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private TermsAgreement(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private TermsAgreement(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("약관_동의"), TableOptions.table(), where); + } + + /** + * Create an aliased public.terms_agreement table reference + */ + public TermsAgreement(String alias) { + this(DSL.name(alias), TERMS_AGREEMENT); + } + + /** + * Create an aliased public.terms_agreement table reference + */ + public TermsAgreement(Name alias) { + this(alias, TERMS_AGREEMENT); + } + + /** + * Create a public.terms_agreement table reference + */ + public TermsAgreement() { + this(DSL.name("terms_agreement"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.TERMS_AGREEMENT_PK; + } + + @Override + public TermsAgreement as(String alias) { + return new TermsAgreement(DSL.name(alias), this); + } + + @Override + public TermsAgreement as(Name alias) { + return new TermsAgreement(alias, this); + } + + @Override + public TermsAgreement as(Table alias) { + return new TermsAgreement(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public TermsAgreement rename(String name) { + return new TermsAgreement(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TermsAgreement rename(Name name) { + return new TermsAgreement(name, null); + } + + /** + * Rename this table + */ + @Override + public TermsAgreement rename(Table name) { + return new TermsAgreement(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement where(Condition condition) { + return new TermsAgreement(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgreement where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgreement where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgreement where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public TermsAgreement where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public TermsAgreement whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/pojos/TermsAgree.java b/src/main/generated/writely/tables/pojos/TermsAgreement.java similarity index 85% rename from src/main/generated/writely/tables/pojos/TermsAgree.java rename to src/main/generated/writely/tables/pojos/TermsAgreement.java index 4e1540c..7ce3dab 100644 --- a/src/main/generated/writely/tables/pojos/TermsAgree.java +++ b/src/main/generated/writely/tables/pojos/TermsAgreement.java @@ -13,7 +13,7 @@ * 약관_동의 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class TermsAgree implements Serializable { +public class TermsAgreement implements Serializable { private static final long serialVersionUID = 1L; @@ -22,14 +22,14 @@ public class TermsAgree implements Serializable { private final OffsetDateTime createdAt; private final OffsetDateTime updatedAt; - public TermsAgree(TermsAgree value) { + public TermsAgreement(TermsAgreement value) { this.termsCd = value.termsCd; this.memberId = value.memberId; this.createdAt = value.createdAt; this.updatedAt = value.updatedAt; } - public TermsAgree( + public TermsAgreement( String termsCd, UUID memberId, OffsetDateTime createdAt, @@ -42,28 +42,28 @@ public TermsAgree( } /** - * Getter for public.terms_agree.terms_cd. 약관 코드 + * Getter for public.terms_agreement.terms_cd. 약관 코드 */ public String getTermsCd() { return this.termsCd; } /** - * Getter for public.terms_agree.member_id. 회원 ID + * Getter for public.terms_agreement.member_id. 회원 ID */ public UUID getMemberId() { return this.memberId; } /** - * Getter for public.terms_agree.created_at. + * Getter for public.terms_agreement.created_at. */ public OffsetDateTime getCreatedAt() { return this.createdAt; } /** - * Getter for public.terms_agree.updated_at. + * Getter for public.terms_agreement.updated_at. */ public OffsetDateTime getUpdatedAt() { return this.updatedAt; @@ -77,7 +77,7 @@ public boolean equals(Object obj) { return false; if (getClass() != obj.getClass()) return false; - final TermsAgree other = (TermsAgree) obj; + final TermsAgreement other = (TermsAgreement) obj; if (this.termsCd == null) { if (other.termsCd != null) return false; @@ -118,7 +118,7 @@ public int hashCode() { @Override public String toString() { - StringBuilder sb = new StringBuilder("TermsAgree ("); + StringBuilder sb = new StringBuilder("TermsAgreement ("); sb.append(termsCd); sb.append(", ").append(memberId); diff --git a/src/main/generated/writely/tables/records/TermsAgreeRecord.java b/src/main/generated/writely/tables/records/TermsAgreementRecord.java similarity index 57% rename from src/main/generated/writely/tables/records/TermsAgreeRecord.java rename to src/main/generated/writely/tables/records/TermsAgreementRecord.java index 34ccb6d..0694e17 100644 --- a/src/main/generated/writely/tables/records/TermsAgreeRecord.java +++ b/src/main/generated/writely/tables/records/TermsAgreementRecord.java @@ -10,72 +10,72 @@ import org.jooq.Record2; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.TermsAgree; +import writely.tables.TermsAgreement; /** * 약관_동의 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class TermsAgreeRecord extends UpdatableRecordImpl { +public class TermsAgreementRecord extends UpdatableRecordImpl { private static final long serialVersionUID = 1L; /** - * Setter for public.terms_agree.terms_cd. 약관 코드 + * Setter for public.terms_agreement.terms_cd. 약관 코드 */ - public TermsAgreeRecord setTermsCd(String value) { + public TermsAgreementRecord setTermsCd(String value) { set(0, value); return this; } /** - * Getter for public.terms_agree.terms_cd. 약관 코드 + * Getter for public.terms_agreement.terms_cd. 약관 코드 */ public String getTermsCd() { return (String) get(0); } /** - * Setter for public.terms_agree.member_id. 회원 ID + * Setter for public.terms_agreement.member_id. 회원 ID */ - public TermsAgreeRecord setMemberId(UUID value) { + public TermsAgreementRecord setMemberId(UUID value) { set(1, value); return this; } /** - * Getter for public.terms_agree.member_id. 회원 ID + * Getter for public.terms_agreement.member_id. 회원 ID */ public UUID getMemberId() { return (UUID) get(1); } /** - * Setter for public.terms_agree.created_at. + * Setter for public.terms_agreement.created_at. */ - public TermsAgreeRecord setCreatedAt(OffsetDateTime value) { + public TermsAgreementRecord setCreatedAt(OffsetDateTime value) { set(2, value); return this; } /** - * Getter for public.terms_agree.created_at. + * Getter for public.terms_agreement.created_at. */ public OffsetDateTime getCreatedAt() { return (OffsetDateTime) get(2); } /** - * Setter for public.terms_agree.updated_at. + * Setter for public.terms_agreement.updated_at. */ - public TermsAgreeRecord setUpdatedAt(OffsetDateTime value) { + public TermsAgreementRecord setUpdatedAt(OffsetDateTime value) { set(3, value); return this; } /** - * Getter for public.terms_agree.updated_at. + * Getter for public.terms_agreement.updated_at. */ public OffsetDateTime getUpdatedAt() { return (OffsetDateTime) get(3); @@ -95,17 +95,17 @@ public Record2 key() { // ------------------------------------------------------------------------- /** - * Create a detached TermsAgreeRecord + * Create a detached TermsAgreementRecord */ - public TermsAgreeRecord() { - super(TermsAgree.TERMS_AGREE); + public TermsAgreementRecord() { + super(TermsAgreement.TERMS_AGREEMENT); } /** - * Create a detached, initialised TermsAgreeRecord + * Create a detached, initialised TermsAgreementRecord */ - public TermsAgreeRecord(String termsCd, UUID memberId, OffsetDateTime createdAt, OffsetDateTime updatedAt) { - super(TermsAgree.TERMS_AGREE); + public TermsAgreementRecord(String termsCd, UUID memberId, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(TermsAgreement.TERMS_AGREEMENT); setTermsCd(termsCd); setMemberId(memberId); @@ -115,10 +115,10 @@ public TermsAgreeRecord(String termsCd, UUID memberId, OffsetDateTime createdAt, } /** - * Create a detached, initialised TermsAgreeRecord + * Create a detached, initialised TermsAgreementRecord */ - public TermsAgreeRecord(writely.tables.pojos.TermsAgree value) { - super(TermsAgree.TERMS_AGREE); + public TermsAgreementRecord(writely.tables.pojos.TermsAgreement value) { + super(TermsAgreement.TERMS_AGREEMENT); if (value != null) { setTermsCd(value.getTermsCd()); From dd542996116af80c867ce9d57c1c9dd275fb912a Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 23 Feb 2025 19:40:46 +0900 Subject: [PATCH 034/107] =?UTF-8?q?feat:=20=EC=9D=B8=EC=A6=9D=20=EC=8B=9C?= =?UTF-8?q?=20=EC=95=BD=EA=B4=80,=20=EC=95=BD=EA=B4=80=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/writely/auth/domain/JoinToken.java | 7 ++++- .../auth/service/AuthCommandService.java | 23 +++++++++++++--- .../com/writely/common/config/WebConfig.java | 2 +- .../terms/controller/TermsController.java | 10 +++++++ .../writely/terms/domain/TermsAgreeId.java | 17 ------------ .../{TermsAgree.java => TermsAgreement.java} | 14 +++++----- .../terms/domain/TermsAgreementId.java | 26 +++++++++++++++++++ .../writely/terms/domain/enums/TermsCode.java | 2 +- .../repository/TermsAgreeJpaRepository.java | 4 +-- .../writely/terms/repository/TermsDao.java | 16 +++++++++--- .../terms/response/TermsSummaryResponse.java | 26 +++++++++++++++++++ .../terms/service/TermsQueryService.java | 9 ++++--- 12 files changed, 115 insertions(+), 41 deletions(-) delete mode 100644 src/main/java/com/writely/terms/domain/TermsAgreeId.java rename src/main/java/com/writely/terms/domain/{TermsAgree.java => TermsAgreement.java} (64%) create mode 100644 src/main/java/com/writely/terms/domain/TermsAgreementId.java create mode 100644 src/main/java/com/writely/terms/response/TermsSummaryResponse.java diff --git a/src/main/java/com/writely/auth/domain/JoinToken.java b/src/main/java/com/writely/auth/domain/JoinToken.java index 08be6b0..205f916 100644 --- a/src/main/java/com/writely/auth/domain/JoinToken.java +++ b/src/main/java/com/writely/auth/domain/JoinToken.java @@ -2,21 +2,26 @@ import com.writely.member.domain.Member; import com.writely.member.domain.MemberPassword; +import com.writely.terms.domain.TermsAgreement; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import org.springframework.data.redis.core.RedisHash; +import java.util.List; + @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @RedisHash(value = "joinToken", timeToLive = 60 * 60) public class JoinToken extends BaseToken { private Member member; private MemberPassword memberPassword; + private List termsAgreementList; - public JoinToken(String tokenString, Member member, MemberPassword memberPassword) { + public JoinToken(String tokenString, Member member, MemberPassword memberPassword, List termsAgreementList) { super(tokenString); this.member = member; this.memberPassword = memberPassword; + this.termsAgreementList = termsAgreementList; } } diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 9f44043..434cfc7 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -16,6 +16,9 @@ import com.writely.member.domain.MemberPassword; import com.writely.member.repository.MemberPasswordJpaRepository; import com.writely.member.repository.MemberJpaRepository; +import com.writely.terms.domain.TermsAgreement; +import com.writely.terms.domain.enums.TermsCode; +import com.writely.terms.repository.TermsAgreeJpaRepository; import com.writely.terms.request.TermsAgreeRequest; import com.writely.terms.service.TermsQueryService; import jakarta.mail.MessagingException; @@ -24,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.List; import java.util.UUID; @Service @@ -37,6 +41,7 @@ public class AuthCommandService { private final RefreshTokenRedisRepository refreshTokenRedisRepository; private final JoinTokenRedisRepository joinTokenRedisRepository; private final ChangePasswordTokenRedisRepository changePasswordTokenRedisRepository; + private final TermsAgreeJpaRepository termsAgreeJpaRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; private final CryptoUtil cryptoUtil; @@ -84,9 +89,12 @@ public void logout(UUID memberId) { */ public void join(JoinRequest request) { // 필수 약관이 모두 포함되어있는지 검사 - if (!termsQueryService.isContainingRequiredTerms( - request.getTermsList().stream().map(TermsAgreeRequest::getTermsCd).toList()) - ) { + List agreedTermsList = request.getTermsList() + .stream() + .filter(TermsAgreeRequest::getIsAgreed) + .map(TermsAgreeRequest::getTermsCd) + .toList(); + if (!termsQueryService.isContainingAllRequiredTerms(agreedTermsList)) { throw new BaseException(AuthException.TERMS_AGREE_REQUIRED); } @@ -105,12 +113,18 @@ public void join(JoinRequest request) { .memberId(member.getId()) .password(passwordHash) .build(); + List termsAgreementList = agreedTermsList.stream() + .map(t -> TermsAgreement.builder() + .termsCd(t) + .memberId(member.getId()) + .build() + ).toList(); String jwtString = jwtHelper.generateJoinToken( JwtPayload.builder().memberId(member.getId()).build() ); // joinToken redis 저장 - JoinToken joinToken = new JoinToken(jwtString, member, memberPassword); + JoinToken joinToken = new JoinToken(jwtString, member, memberPassword, termsAgreementList); joinTokenRedisRepository.save(joinToken); try { @@ -147,6 +161,7 @@ public AuthTokenResponse completeJoin(JoinCompletionRequest request) { // 가입 완료 처리 memberJpaRepository.save(joinToken.getMember()); memberPasswordJpaRepository.save(joinToken.getMemberPassword()); + joinToken.getTermsAgreementList().forEach(termsAgreeJpaRepository::save); // 토큰 무효화 this.invalidateToken(joinToken); diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/src/main/java/com/writely/common/config/WebConfig.java index 67ddd3a..331189e 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/src/main/java/com/writely/common/config/WebConfig.java @@ -26,7 +26,7 @@ public void addArgumentResolvers(List resolvers) @Override public void addFormatters(FormatterRegistry registry) { - registry.addConverter(new TermsCode.CodeConverter()); + registry.addConverter(new TermsCode.SpringConverter()); } @Override diff --git a/src/main/java/com/writely/terms/controller/TermsController.java b/src/main/java/com/writely/terms/controller/TermsController.java index 96ff4f3..d4be43e 100644 --- a/src/main/java/com/writely/terms/controller/TermsController.java +++ b/src/main/java/com/writely/terms/controller/TermsController.java @@ -2,6 +2,7 @@ import com.writely.terms.domain.enums.TermsCode; import com.writely.terms.response.TermsDetailResponse; +import com.writely.terms.response.TermsSummaryResponse; import com.writely.terms.service.TermsQueryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -9,6 +10,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequiredArgsConstructor @RequestMapping("/terms") @@ -24,4 +27,11 @@ public TermsDetailResponse getTermsByTermsCd(@PathVariable TermsCode termsCd) { return termsQueryService.getTermsByTermsCd(termsCd); } + @Operation(summary = "약관 목록 조회") + @GetMapping("/") + public List getTermsList() { + + return termsQueryService.getAllTermsList(); + } + } diff --git a/src/main/java/com/writely/terms/domain/TermsAgreeId.java b/src/main/java/com/writely/terms/domain/TermsAgreeId.java deleted file mode 100644 index 3ab4237..0000000 --- a/src/main/java/com/writely/terms/domain/TermsAgreeId.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.writely.terms.domain; - -import com.writely.terms.domain.enums.TermsCode; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.io.Serializable; -import java.util.UUID; - -@Getter -@AllArgsConstructor -public class TermsAgreeId implements Serializable { - - private TermsCode termsCd; - private UUID memberId; - -} diff --git a/src/main/java/com/writely/terms/domain/TermsAgree.java b/src/main/java/com/writely/terms/domain/TermsAgreement.java similarity index 64% rename from src/main/java/com/writely/terms/domain/TermsAgree.java rename to src/main/java/com/writely/terms/domain/TermsAgreement.java index 4d0142c..35ecffc 100644 --- a/src/main/java/com/writely/terms/domain/TermsAgree.java +++ b/src/main/java/com/writely/terms/domain/TermsAgreement.java @@ -3,19 +3,19 @@ import com.writely.common.domain.BaseTimeEntity; import com.writely.terms.domain.enums.TermsCode; import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import lombok.*; import java.util.UUID; @Getter @Setter @Entity -@NoArgsConstructor -@Table(name = "terms_agree") -@IdClass(TermsAgreeId.class) -public class TermsAgree extends BaseTimeEntity { +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +@Builder +@Table(name = "terms_agreement") +@IdClass(TermsAgreementId.class) +public class TermsAgreement extends BaseTimeEntity { @Id @Column(name = "terms_cd", nullable = false) diff --git a/src/main/java/com/writely/terms/domain/TermsAgreementId.java b/src/main/java/com/writely/terms/domain/TermsAgreementId.java new file mode 100644 index 0000000..bfe4e9c --- /dev/null +++ b/src/main/java/com/writely/terms/domain/TermsAgreementId.java @@ -0,0 +1,26 @@ +package com.writely.terms.domain; + +import com.writely.terms.domain.enums.TermsCode; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.UUID; + +@Getter +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class TermsAgreementId implements Serializable { + + @Convert(converter = TermsCode.TypeCodeConverter.class) + @Column(name = "terms_cd", nullable = false) + private TermsCode termsCd; + + @Column(name = "member_id", nullable = false) + private UUID memberId; + +} diff --git a/src/main/java/com/writely/terms/domain/enums/TermsCode.java b/src/main/java/com/writely/terms/domain/enums/TermsCode.java index 1781a83..914ff10 100644 --- a/src/main/java/com/writely/terms/domain/enums/TermsCode.java +++ b/src/main/java/com/writely/terms/domain/enums/TermsCode.java @@ -31,7 +31,7 @@ public TermsCode convertToEntityAttribute(String dbData) { } } - public static class CodeConverter implements org.springframework.core.convert.converter.Converter { + public static class SpringConverter implements org.springframework.core.convert.converter.Converter { @Override public TermsCode convert(String code) { return TermsCode.fromCode(code); diff --git a/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java b/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java index ef960fe..621a805 100644 --- a/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java +++ b/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java @@ -1,8 +1,8 @@ package com.writely.terms.repository; -import com.writely.terms.domain.TermsAgree; +import com.writely.terms.domain.TermsAgreement; import org.springframework.data.repository.CrudRepository; -public interface TermsAgreeJpaRepository extends CrudRepository { +public interface TermsAgreeJpaRepository extends CrudRepository { } diff --git a/src/main/java/com/writely/terms/repository/TermsDao.java b/src/main/java/com/writely/terms/repository/TermsDao.java index 0c20bda..d218a97 100644 --- a/src/main/java/com/writely/terms/repository/TermsDao.java +++ b/src/main/java/com/writely/terms/repository/TermsDao.java @@ -9,6 +9,7 @@ import java.util.List; import java.util.Optional; +import static org.jooq.impl.DSL.count; import static writely.tables.Terms.TERMS; @Repository @@ -27,15 +28,22 @@ public Optional selectLatestTermsByTermsCd(TermsCode termsCode) { } public List selectAllLatestTermsList() { - return dsl.selectDistinct(TERMS.CD) + return dsl.select() + .distinctOn(TERMS.CD) .from(TERMS) .orderBy(TERMS.CD.asc(), TERMS.VERSION.desc()) .fetchInto(TermsRecord.class); } - public boolean isContainingRequiredTerms(List termsCodeList) { + public boolean isContainingAllRequiredTerms(List termsCodeList) { + int notAgreedTermsCount = dsl.selectCount() + .from(TERMS) + .where( + TERMS.IS_REQUIRED.eq(true) + ).and( + TERMS.CD.notIn(termsCodeList.stream().map(TermsCode::getCode).toList()) + ).fetchOne(count()); - // todo - return true; + return notAgreedTermsCount == 0; } } diff --git a/src/main/java/com/writely/terms/response/TermsSummaryResponse.java b/src/main/java/com/writely/terms/response/TermsSummaryResponse.java new file mode 100644 index 0000000..59307fc --- /dev/null +++ b/src/main/java/com/writely/terms/response/TermsSummaryResponse.java @@ -0,0 +1,26 @@ +package com.writely.terms.response; + +import com.writely.terms.domain.enums.TermsCode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import writely.tables.records.TermsRecord; + +import java.util.UUID; + +@Getter +@Setter +public class TermsSummaryResponse { + @Schema(title = "약관 아이디", requiredMode = Schema.RequiredMode.REQUIRED) + private UUID id; + @Schema(title = "약관 코드", requiredMode = Schema.RequiredMode.REQUIRED) + private TermsCode cd; + @Schema(title = "약관 제목", requiredMode = Schema.RequiredMode.REQUIRED) + private String title; + + public TermsSummaryResponse(TermsRecord terms) { + this.id = terms.getId(); + this.cd = TermsCode.fromCode(terms.getCd()); + this.title = terms.getTitle(); + } +} diff --git a/src/main/java/com/writely/terms/service/TermsQueryService.java b/src/main/java/com/writely/terms/service/TermsQueryService.java index 8a83d09..fa2ccaf 100644 --- a/src/main/java/com/writely/terms/service/TermsQueryService.java +++ b/src/main/java/com/writely/terms/service/TermsQueryService.java @@ -5,6 +5,7 @@ import com.writely.terms.domain.enums.TermsException; import com.writely.terms.repository.TermsDao; import com.writely.terms.response.TermsDetailResponse; +import com.writely.terms.response.TermsSummaryResponse; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,16 +26,16 @@ public TermsDetailResponse getTermsByTermsCd(TermsCode termsCd) { return new TermsDetailResponse(terms); } - public boolean isContainingRequiredTerms(List termsCodeList) { + public boolean isContainingAllRequiredTerms(List termsCodeList) { - return termsDao.isContainingRequiredTerms(termsCodeList); + return termsDao.isContainingAllRequiredTerms(termsCodeList); } - public List getAllTermsList() { + public List getAllTermsList() { return termsDao.selectAllLatestTermsList() .stream() - .map(TermsDetailResponse::new) + .map(TermsSummaryResponse::new) .toList(); } } From 6b3b1e768f7e2696497550e676bbf4efbf1f9af2 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 1 Mar 2025 14:54:16 +0900 Subject: [PATCH 035/107] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C=20=EC=8B=9C=EB=8F=84=ED=9A=9F=EC=88=98=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20(#34)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- sql/init.sql | 13 +++++ .../com/writely/auth/domain/LoginAttempt.java | 28 ++++++++++ .../auth/domain/enums/AuthException.java | 1 + .../domain/enums/LoginAttemptResultType.java | 25 +++++++++ .../repository/LoginAttemptJpaRepository.java | 11 ++++ .../auth/response/LoginFailResponse.java | 14 +++++ .../auth/service/AuthCommandService.java | 53 +++++++++++++++++-- .../common/exception/BaseException.java | 6 +++ .../exception/GlobalExceptionHandler.java | 12 ++--- .../writely/common/response/BaseResponse.java | 8 +++ 11 files changed, 163 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/writely/auth/domain/LoginAttempt.java create mode 100644 src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java create mode 100644 src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java create mode 100644 src/main/java/com/writely/auth/response/LoginFailResponse.java diff --git a/BE-secret b/BE-secret index b13abcf..fe8d57e 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit b13abcf4b3137767f98ed47b6c19a3f1d9e1d42c +Subproject commit fe8d57ecbb4d9e4f0275289ed9ceefe467b9e489 diff --git a/sql/init.sql b/sql/init.sql index fe19243..f5f4422 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -27,6 +27,19 @@ comment on table member_password is '회원_비밀번호'; comment on column member_password.member_id is '회원 ID'; comment on column member_password.password is '회원 비밀번호'; +create table login_attempt +( + id uuid constraint login_attempt_pk primary key, + email varchar(255) not null, + result varchar(10) not null, + created_at timestamp with time zone not null, + updated_at timestamp with time zone not null +); +comment on table login_attempt is '로그인_시도'; +comment on column login_attempt.id is '로그인 시도 ID'; +comment on column login_attempt.email is '로그인 시도한 이메일'; +comment on column login_attempt.result is '로그인 시도 후 결과'; + -- terms create table terms ( diff --git a/src/main/java/com/writely/auth/domain/LoginAttempt.java b/src/main/java/com/writely/auth/domain/LoginAttempt.java new file mode 100644 index 0000000..1c5c54f --- /dev/null +++ b/src/main/java/com/writely/auth/domain/LoginAttempt.java @@ -0,0 +1,28 @@ +package com.writely.auth.domain; + +import com.writely.auth.domain.enums.LoginAttemptResultType; +import com.writely.common.domain.BaseTimeEntity; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "login_attempt") +public class LoginAttempt extends BaseTimeEntity { + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(nullable = false) + private String email; + + @Convert(converter = LoginAttemptResultType.TypeCodeConverter.class) + @Column(nullable = false) + private LoginAttemptResultType result; +} diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/src/main/java/com/writely/auth/domain/enums/AuthException.java index 0ebfeb4..bd5981a 100644 --- a/src/main/java/com/writely/auth/domain/enums/AuthException.java +++ b/src/main/java/com/writely/auth/domain/enums/AuthException.java @@ -13,6 +13,7 @@ public enum AuthException implements CodeInfo { JOIN_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-101", "가입 토큰이 유효하지 않습니다."), JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "로그인에 실패하였습니다."), + LOGIN_BLOCKED(HttpStatus.UNAUTHORIZED, "AUTH-202", "로그인 실패 가능 횟수를 초과하였습니다."), MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), CHANGE_PASSWORD_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), diff --git a/src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java b/src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java new file mode 100644 index 0000000..38e5370 --- /dev/null +++ b/src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java @@ -0,0 +1,25 @@ +package com.writely.auth.domain.enums; + +import com.writely.common.converter.AbstractEnumCodeConverter; +import com.writely.common.enums.Codable; +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum LoginAttemptResultType implements Codable { + SUCCEED("succeed"), + FAILED("failed"), + BLOCKED("blocked"); + + private final String code; + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public LoginAttemptResultType convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(LoginAttemptResultType.class, dbData); + } + } +} diff --git a/src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java b/src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java new file mode 100644 index 0000000..9112911 --- /dev/null +++ b/src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java @@ -0,0 +1,11 @@ +package com.writely.auth.repository; + +import com.writely.auth.domain.LoginAttempt; +import org.springframework.data.repository.CrudRepository; + +import java.util.List; +import java.util.UUID; + +public interface LoginAttemptJpaRepository extends CrudRepository { + List findTop5ByEmailOrderByCreatedAtDesc(String email); +} diff --git a/src/main/java/com/writely/auth/response/LoginFailResponse.java b/src/main/java/com/writely/auth/response/LoginFailResponse.java new file mode 100644 index 0000000..31dafde --- /dev/null +++ b/src/main/java/com/writely/auth/response/LoginFailResponse.java @@ -0,0 +1,14 @@ +package com.writely.auth.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class LoginFailResponse { + @Schema(title = "남은 로그인 시도 횟수", requiredMode = Schema.RequiredMode.REQUIRED, example = "4") + private int remainingAttempts; +} diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/src/main/java/com/writely/auth/service/AuthCommandService.java index 434cfc7..ef39b97 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/src/main/java/com/writely/auth/service/AuthCommandService.java @@ -2,13 +2,16 @@ import com.writely.auth.domain.*; import com.writely.auth.domain.enums.AuthException; +import com.writely.auth.domain.enums.LoginAttemptResultType; import com.writely.auth.helper.JwtHelper; import com.writely.auth.helper.MailHelper; import com.writely.auth.repository.ChangePasswordTokenRedisRepository; import com.writely.auth.repository.JoinTokenRedisRepository; +import com.writely.auth.repository.LoginAttemptJpaRepository; import com.writely.auth.repository.RefreshTokenRedisRepository; import com.writely.auth.request.*; import com.writely.auth.response.AuthTokenResponse; +import com.writely.auth.response.LoginFailResponse; import com.writely.common.enums.code.ResultCodeInfo; import com.writely.common.exception.BaseException; import com.writely.common.util.CryptoUtil; @@ -27,12 +30,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.List; import java.util.UUID; @Service @RequiredArgsConstructor -@Transactional @Slf4j public class AuthCommandService { private final TermsQueryService termsQueryService; @@ -42,6 +45,7 @@ public class AuthCommandService { private final JoinTokenRedisRepository joinTokenRedisRepository; private final ChangePasswordTokenRedisRepository changePasswordTokenRedisRepository; private final TermsAgreeJpaRepository termsAgreeJpaRepository; + private final LoginAttemptJpaRepository loginAttemptJpaRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; private final CryptoUtil cryptoUtil; @@ -49,6 +53,7 @@ public class AuthCommandService { /** * 토큰 재발급 */ + @Transactional public AuthTokenResponse reissueToken(ReissueRequest request) { // 리프래시 토큰이 비유효하면 if (!jwtHelper.isTokenValid(request.getRefreshToken())) { @@ -68,17 +73,53 @@ public AuthTokenResponse reissueToken(ReissueRequest request) { * 로그인 */ public AuthTokenResponse login(LoginRequest request) { - String passwordHash = cryptoUtil.hash(request.getPassword()); + List lastFiveAttempts = loginAttemptJpaRepository.findTop5ByEmailOrderByCreatedAtDesc(request.getEmail()); - MemberPassword memberPassword = memberPasswordJpaRepository.findByPassword(passwordHash) + // 있는 이메일인지 검사 + memberJpaRepository.findByEmail(request.getEmail()) .orElseThrow(() -> new BaseException(AuthException.LOGIN_FAILED)); + // 로그인 시도가 블락 상태이고, 블락 시간으로부터 1시간이 지나지 않은 경우 + if ( + !lastFiveAttempts.isEmpty() + && lastFiveAttempts.getFirst().getResult() == LoginAttemptResultType.BLOCKED + && lastFiveAttempts.getFirst().getCreatedAt().isAfter(LocalDateTime.now().minusHours(1)) + ) { + throw new BaseException(AuthException.LOGIN_BLOCKED); + } + + String passwordHash = cryptoUtil.hash(request.getPassword()); + MemberPassword memberPassword = memberPasswordJpaRepository.findByPassword(passwordHash).orElse(null); + + LoginAttempt newLoginAttempt = new LoginAttempt(); + newLoginAttempt.setEmail(request.getEmail()); + + if (memberPassword == null) { + int attemptsRemaining = 5 - 1; + // 남은 시도 횟수 계산 + for (LoginAttempt attempt : lastFiveAttempts) { + if (attempt.getResult() != LoginAttemptResultType.FAILED) break; + attemptsRemaining -= 1; + } + + newLoginAttempt.setResult( + attemptsRemaining == 0 + ? LoginAttemptResultType.BLOCKED + : LoginAttemptResultType.FAILED + ); + loginAttemptJpaRepository.save(newLoginAttempt); + throw new BaseException(AuthException.LOGIN_FAILED, new LoginFailResponse(attemptsRemaining)); + } + + newLoginAttempt.setResult(LoginAttemptResultType.SUCCEED); + loginAttemptJpaRepository.save(newLoginAttempt); return generateAuthTokens(memberPassword.getMemberId()); } /** * 로그아웃 */ + @Transactional public void logout(UUID memberId) { refreshTokenRedisRepository.findByMemberId(memberId) .ifPresent(this::invalidateToken); @@ -87,6 +128,7 @@ public void logout(UUID memberId) { /** * 회원 가입 */ + @Transactional public void join(JoinRequest request) { // 필수 약관이 모두 포함되어있는지 검사 List agreedTermsList = request.getTermsList() @@ -146,6 +188,7 @@ public void join(JoinRequest request) { /** * 회원가입 완료 */ + @Transactional public AuthTokenResponse completeJoin(JoinCompletionRequest request) { final String joinTokenString = request.getJoinToken(); @@ -172,6 +215,7 @@ public AuthTokenResponse completeJoin(JoinCompletionRequest request) { /** * 비밀번호 변경 */ + @Transactional public void changePassword(ChangePasswordRequest request) { Member member = memberJpaRepository.findByEmail(request.getEmail()) .orElseThrow(() -> new BaseException(AuthException.CHANGE_PASSWORD_EMAIL_NOT_FOUND)); @@ -202,6 +246,7 @@ public void changePassword(ChangePasswordRequest request) { /** * 비밀번호 변경 완료 */ + @Transactional public void completeChangePassword(ChangePasswordCompletionRequest request) { // 토큰이 비유효한 경우 if (!jwtHelper.isTokenValid(request.getChangePasswordToken())) { @@ -233,6 +278,7 @@ public void completeChangePassword(ChangePasswordCompletionRequest request) { /** * 인증 토큰 발급 (액세스 + 리프래시) */ + @Transactional private AuthTokenResponse generateAuthTokens(UUID memberId) { JwtPayload jwtPayload = JwtPayload.builder() .memberId(memberId) @@ -247,6 +293,7 @@ private AuthTokenResponse generateAuthTokens(UUID memberId) { /** * 토큰 무효화 (Redis에서 관리하는 토큰의 경우) */ + @Transactional private void invalidateToken(BaseToken token) { if (token instanceof RefreshToken refreshToken) { refreshTokenRedisRepository.delete(refreshToken); diff --git a/src/main/java/com/writely/common/exception/BaseException.java b/src/main/java/com/writely/common/exception/BaseException.java index 1adffa0..13b5a3e 100644 --- a/src/main/java/com/writely/common/exception/BaseException.java +++ b/src/main/java/com/writely/common/exception/BaseException.java @@ -7,6 +7,7 @@ public class BaseException extends RuntimeException { private CodeInfo codeInfo; + private Object extraParams; public BaseException() { } @@ -15,6 +16,11 @@ public BaseException(CodeInfo codeInfo) { this.codeInfo = codeInfo; } + public BaseException(CodeInfo codeInfo, Object extraParams) { + this.codeInfo = codeInfo; + this.extraParams = extraParams; + } + @Override public String toString() { return "BaseException [status=" + codeInfo.getStatus().value() + ", code=" + codeInfo.getCode() + ", message=" + codeInfo.getMessage() + "]"; diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java index 5973725..e95a113 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java @@ -16,15 +16,16 @@ public class GlobalExceptionHandler { @ExceptionHandler({Exception.class}) public ResponseEntity> handle(Exception e) { + LogUtil.error(e); + HttpStatus status = null; BaseResponse response = null; if (e instanceof BaseException ex) { - CodeInfo codeInfo = ex.getCodeInfo(); - - status = codeInfo.getStatus(); - response = BaseResponse.failure(codeInfo); - } else if (e instanceof MethodArgumentNotValidException ex) { + status = ex.getCodeInfo().getStatus(); + response = BaseResponse.failure(ex.getCodeInfo(), ex.getExtraParams()); + } + else if (e instanceof MethodArgumentNotValidException ex) { CodeInfo codeInfo = ResultCodeInfo.BAD_REQUEST; status = codeInfo.getStatus(); @@ -46,7 +47,6 @@ public ResponseEntity> handle(Exception e) { response = BaseResponse.failure(ResultCodeInfo.FAILURE); } - LogUtil.error(e); return new ResponseEntity<>(response, status); } diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/src/main/java/com/writely/common/response/BaseResponse.java index 84a13b8..9f947b3 100644 --- a/src/main/java/com/writely/common/response/BaseResponse.java +++ b/src/main/java/com/writely/common/response/BaseResponse.java @@ -47,4 +47,12 @@ public static BaseResponse failure(CodeInfo codeInfo) { return res; } + public static BaseResponse failure(CodeInfo codeInfo, T extraParams) { + BaseResponse res = new BaseResponse<>(); + res.code = codeInfo.getCode(); + res.message = codeInfo.getMessage(); + res.result = extraParams; + return res; + } + } \ No newline at end of file From 4bcbcf94b7dc4618c85bba8b169ae5e748c13fc3 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 1 Mar 2025 20:17:25 +0900 Subject: [PATCH 036/107] =?UTF-8?q?refactor:=20auto=20modify=EC=97=90=20te?= =?UTF-8?q?mplate=20=EC=A0=95=EB=B3=B4=20=EC=A0=81=EC=9A=A9=20(#35)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 24 +- src/main/generated/writely/Keys.java | 3 + src/main/generated/writely/Public.java | 9 +- src/main/generated/writely/Tables.java | 8 +- .../writely/tables/LoginAttempt.java | 240 ++++++++++++++++++ .../writely/tables/ProductCustomField.java | 9 +- .../generated/writely/tables/ProductPlot.java | 19 +- .../writely/tables/pojos/LoginAttempt.java | 150 +++++++++++ .../tables/pojos/ProductCustomField.java | 21 +- .../writely/tables/pojos/ProductPlot.java | 81 +----- .../tables/records/LoginAttemptRecord.java | 148 +++++++++++ .../records/ProductCustomFieldRecord.java | 53 ++-- .../tables/records/ProductPlotRecord.java | 81 ++---- ...ntroller.java => AssistantController.java} | 18 +- .../domain/enums/AssistantException.java | 4 +- ...est.java => AutoModifyMessageRequest.java} | 2 +- .../assistant/request/ChatRequest.java | 13 - .../assistant/request/UserSetting.java | 189 ++++++++++++++ .../assistant/service/AutoModifyService.java | 41 ++- .../product/domain/ProductCharacter.java | 8 + .../product/domain/ProductCustomField.java | 10 +- .../writely/product/domain/ProductPlot.java | 22 +- .../product/domain/ProductSynopsis.java | 2 +- .../product/domain/ProductWorldview.java | 8 + .../ProductCustomFieldJpaRepository.java | 7 + .../request/ProductTemplateSaveRequest.java | 47 ++-- .../response/ProductTemplateResponse.java | 33 +-- .../service/ProductCommandService.java | 148 ++++++----- 28 files changed, 1039 insertions(+), 359 deletions(-) create mode 100644 src/main/generated/writely/tables/LoginAttempt.java create mode 100644 src/main/generated/writely/tables/pojos/LoginAttempt.java create mode 100644 src/main/generated/writely/tables/records/LoginAttemptRecord.java rename src/main/java/com/writely/assistant/controller/{AutoModifyController.java => AssistantController.java} (74%) rename src/main/java/com/writely/assistant/request/{AutoModifyRequest.java => AutoModifyMessageRequest.java} (88%) delete mode 100644 src/main/java/com/writely/assistant/request/ChatRequest.java create mode 100644 src/main/java/com/writely/assistant/request/UserSetting.java diff --git a/sql/init.sql b/sql/init.sql index f5f4422..4774d29 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -147,6 +147,7 @@ create table product_custom_field constraint product_custom_field_pk primary key, product_id uuid not null, + section_id uuid not null, section_type varchar(20) not null, name varchar(30) not null, content text not null, @@ -157,9 +158,9 @@ create table product_custom_field updated_by uuid not null ); -comment on table product_custom_field is '작품 커스텀 필드'; comment on column product_custom_field.id is '커스텀 필드 ID'; comment on column product_custom_field.product_id is '작품 ID'; +comment on column product_custom_field.section_id is '섹션 ID'; comment on column product_custom_field.section_type is '섹션 타입'; comment on column product_custom_field.name is '이름'; comment on column product_custom_field.content is '내용'; @@ -172,6 +173,7 @@ comment on column product_custom_field.updated_by is '수정자 ID'; alter table product_custom_field owner to postgres; + --product_ideanote create table product_ideanote ( @@ -232,25 +234,19 @@ alter table product_memo --product_plot create table product_plot ( - id uuid not null + id uuid not null constraint product_plot_pk primary key, - exposition text, - complication text, - climax text, - resolution text, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + content text, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table product_plot is '작품 줄거리'; comment on column product_plot.id is '줄거리 ID'; -comment on column product_plot.exposition is '발단'; -comment on column product_plot.complication is '전개'; -comment on column product_plot.climax is '위기'; -comment on column product_plot.climax is '결말'; +comment on column product_plot.content is '내용'; comment on column product_plot.created_at is '생성일시'; comment on column product_plot.created_by is '생성자 ID'; comment on column product_plot.updated_at is '수정일시'; diff --git a/src/main/generated/writely/Keys.java b/src/main/generated/writely/Keys.java index d216e14..0d93ec2 100644 --- a/src/main/generated/writely/Keys.java +++ b/src/main/generated/writely/Keys.java @@ -10,6 +10,7 @@ import org.jooq.impl.Internal; import writely.tables.AutoModifyMessage; +import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.Product; @@ -23,6 +24,7 @@ import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.records.AutoModifyMessageRecord; +import writely.tables.records.LoginAttemptRecord; import writely.tables.records.MemberPasswordRecord; import writely.tables.records.MemberRecord; import writely.tables.records.ProductCharacterRecord; @@ -49,6 +51,7 @@ public class Keys { // ------------------------------------------------------------------------- public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); + public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); public static final UniqueKey NICKNAME_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("nickname_uk"), new TableField[] { Member.MEMBER.NICKNAME }, true); diff --git a/src/main/generated/writely/Public.java b/src/main/generated/writely/Public.java index 497dea8..811486f 100644 --- a/src/main/generated/writely/Public.java +++ b/src/main/generated/writely/Public.java @@ -15,6 +15,7 @@ import org.jooq.impl.SchemaImpl; import writely.tables.AutoModifyMessage; +import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.PgpArmorHeaders; @@ -49,6 +50,11 @@ public class Public extends SchemaImpl { */ public final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * 로그인_시도 + */ + public final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; + /** * 회원 */ @@ -109,7 +115,7 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( public final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; /** - * 작품 커스텀 필드 + * The table public.product_custom_field. */ public final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; @@ -165,6 +171,7 @@ public Catalog getCatalog() { public final List> getTables() { return Arrays.asList( AutoModifyMessage.AUTO_MODIFY_MESSAGE, + LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, PgpArmorHeaders.PGP_ARMOR_HEADERS, diff --git a/src/main/generated/writely/Tables.java b/src/main/generated/writely/Tables.java index 1ce0a30..3f0bb88 100644 --- a/src/main/generated/writely/Tables.java +++ b/src/main/generated/writely/Tables.java @@ -9,6 +9,7 @@ import org.jooq.Result; import writely.tables.AutoModifyMessage; +import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; import writely.tables.PgpArmorHeaders; @@ -36,6 +37,11 @@ public class Tables { */ public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * 로그인_시도 + */ + public static final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; + /** * 회원 */ @@ -96,7 +102,7 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( public static final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; /** - * 작품 커스텀 필드 + * The table public.product_custom_field. */ public static final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; diff --git a/src/main/generated/writely/tables/LoginAttempt.java b/src/main/generated/writely/tables/LoginAttempt.java new file mode 100644 index 0000000..fd53486 --- /dev/null +++ b/src/main/generated/writely/tables/LoginAttempt.java @@ -0,0 +1,240 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.OffsetDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.LoginAttemptRecord; + + +/** + * 로그인_시도 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LoginAttempt extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.login_attempt + */ + public static final LoginAttempt LOGIN_ATTEMPT = new LoginAttempt(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return LoginAttemptRecord.class; + } + + /** + * The column public.login_attempt.id. 로그인 시도 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "로그인 시도 ID"); + + /** + * The column public.login_attempt.email. 로그인 시도한 이메일 + */ + public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255).nullable(false), this, "로그인 시도한 이메일"); + + /** + * The column public.login_attempt.result. 로그인 시도 후 결과 + */ + public final TableField RESULT = createField(DSL.name("result"), SQLDataType.VARCHAR(10).nullable(false), this, "로그인 시도 후 결과"); + + /** + * The column public.login_attempt.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + /** + * The column public.login_attempt.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + + private LoginAttempt(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private LoginAttempt(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("로그인_시도"), TableOptions.table(), where); + } + + /** + * Create an aliased public.login_attempt table reference + */ + public LoginAttempt(String alias) { + this(DSL.name(alias), LOGIN_ATTEMPT); + } + + /** + * Create an aliased public.login_attempt table reference + */ + public LoginAttempt(Name alias) { + this(alias, LOGIN_ATTEMPT); + } + + /** + * Create a public.login_attempt table reference + */ + public LoginAttempt() { + this(DSL.name("login_attempt"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.LOGIN_ATTEMPT_PK; + } + + @Override + public LoginAttempt as(String alias) { + return new LoginAttempt(DSL.name(alias), this); + } + + @Override + public LoginAttempt as(Name alias) { + return new LoginAttempt(alias, this); + } + + @Override + public LoginAttempt as(Table alias) { + return new LoginAttempt(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public LoginAttempt rename(String name) { + return new LoginAttempt(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public LoginAttempt rename(Name name) { + return new LoginAttempt(name, null); + } + + /** + * Rename this table + */ + @Override + public LoginAttempt rename(Table name) { + return new LoginAttempt(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt where(Condition condition) { + return new LoginAttempt(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LoginAttempt where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LoginAttempt where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LoginAttempt where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LoginAttempt where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LoginAttempt whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/ProductCustomField.java b/src/main/generated/writely/tables/ProductCustomField.java index 750a9a0..83e586f 100644 --- a/src/main/generated/writely/tables/ProductCustomField.java +++ b/src/main/generated/writely/tables/ProductCustomField.java @@ -31,7 +31,7 @@ /** - * 작품 커스텀 필드 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class ProductCustomField extends TableImpl { @@ -61,6 +61,11 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + /** + * The column public.product_custom_field.section_id. 섹션 ID + */ + public final TableField SECTION_ID = createField(DSL.name("section_id"), SQLDataType.UUID.nullable(false), this, "섹션 ID"); + /** * The column public.product_custom_field.section_type. 섹션 타입 */ @@ -106,7 +111,7 @@ private ProductCustomField(Name alias, Table aliased) } private ProductCustomField(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("작품 커스텀 필드"), TableOptions.table(), where); + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); } /** diff --git a/src/main/generated/writely/tables/ProductPlot.java b/src/main/generated/writely/tables/ProductPlot.java index ddd27fa..7cbba29 100644 --- a/src/main/generated/writely/tables/ProductPlot.java +++ b/src/main/generated/writely/tables/ProductPlot.java @@ -57,24 +57,9 @@ public Class getRecordType() { public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "줄거리 ID"); /** - * The column public.product_plot.exposition. 발단 + * The column public.product_plot.content. 내용 */ - public final TableField EXPOSITION = createField(DSL.name("exposition"), SQLDataType.CLOB, this, "발단"); - - /** - * The column public.product_plot.complication. 전개 - */ - public final TableField COMPLICATION = createField(DSL.name("complication"), SQLDataType.CLOB, this, "전개"); - - /** - * The column public.product_plot.climax. 결말 - */ - public final TableField CLIMAX = createField(DSL.name("climax"), SQLDataType.CLOB, this, "결말"); - - /** - * The column public.product_plot.resolution. - */ - public final TableField RESOLUTION = createField(DSL.name("resolution"), SQLDataType.CLOB, this, ""); + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); /** * The column public.product_plot.created_at. 생성일시 diff --git a/src/main/generated/writely/tables/pojos/LoginAttempt.java b/src/main/generated/writely/tables/pojos/LoginAttempt.java new file mode 100644 index 0000000..3c8f5a6 --- /dev/null +++ b/src/main/generated/writely/tables/pojos/LoginAttempt.java @@ -0,0 +1,150 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.OffsetDateTime; +import java.util.UUID; + + +/** + * 로그인_시도 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LoginAttempt implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final String email; + private final String result; + private final OffsetDateTime createdAt; + private final OffsetDateTime updatedAt; + + public LoginAttempt(LoginAttempt value) { + this.id = value.id; + this.email = value.email; + this.result = value.result; + this.createdAt = value.createdAt; + this.updatedAt = value.updatedAt; + } + + public LoginAttempt( + UUID id, + String email, + String result, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.id = id; + this.email = email; + this.result = result; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Getter for public.login_attempt.id. 로그인 시도 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.login_attempt.email. 로그인 시도한 이메일 + */ + public String getEmail() { + return this.email; + } + + /** + * Getter for public.login_attempt.result. 로그인 시도 후 결과 + */ + public String getResult() { + return this.result; + } + + /** + * Getter for public.login_attempt.created_at. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.login_attempt.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final LoginAttempt other = (LoginAttempt) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.email == null) { + if (other.email != null) + return false; + } + else if (!this.email.equals(other.email)) + return false; + if (this.result == null) { + if (other.result != null) + return false; + } + else if (!this.result.equals(other.result)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.email == null) ? 0 : this.email.hashCode()); + result = prime * result + ((this.result == null) ? 0 : this.result.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("LoginAttempt ("); + + sb.append(id); + sb.append(", ").append(email); + sb.append(", ").append(result); + sb.append(", ").append(createdAt); + sb.append(", ").append(updatedAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/ProductCustomField.java b/src/main/generated/writely/tables/pojos/ProductCustomField.java index 393b58f..0ca8e72 100644 --- a/src/main/generated/writely/tables/pojos/ProductCustomField.java +++ b/src/main/generated/writely/tables/pojos/ProductCustomField.java @@ -10,7 +10,7 @@ /** - * 작품 커스텀 필드 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class ProductCustomField implements Serializable { @@ -19,6 +19,7 @@ public class ProductCustomField implements Serializable { private final UUID id; private final UUID productId; + private final UUID sectionId; private final String sectionType; private final String name; private final String content; @@ -31,6 +32,7 @@ public class ProductCustomField implements Serializable { public ProductCustomField(ProductCustomField value) { this.id = value.id; this.productId = value.productId; + this.sectionId = value.sectionId; this.sectionType = value.sectionType; this.name = value.name; this.content = value.content; @@ -44,6 +46,7 @@ public ProductCustomField(ProductCustomField value) { public ProductCustomField( UUID id, UUID productId, + UUID sectionId, String sectionType, String name, String content, @@ -55,6 +58,7 @@ public ProductCustomField( ) { this.id = id; this.productId = productId; + this.sectionId = sectionId; this.sectionType = sectionType; this.name = name; this.content = content; @@ -79,6 +83,13 @@ public UUID getProductId() { return this.productId; } + /** + * Getter for public.product_custom_field.section_id. 섹션 ID + */ + public UUID getSectionId() { + return this.sectionId; + } + /** * Getter for public.product_custom_field.section_type. 섹션 타입 */ @@ -156,6 +167,12 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; + if (this.sectionId == null) { + if (other.sectionId != null) + return false; + } + else if (!this.sectionId.equals(other.sectionId)) + return false; if (this.sectionType == null) { if (other.sectionType != null) return false; @@ -213,6 +230,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.sectionId == null) ? 0 : this.sectionId.hashCode()); result = prime * result + ((this.sectionType == null) ? 0 : this.sectionType.hashCode()); result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); @@ -230,6 +248,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); + sb.append(", ").append(sectionId); sb.append(", ").append(sectionType); sb.append(", ").append(name); sb.append(", ").append(content); diff --git a/src/main/generated/writely/tables/pojos/ProductPlot.java b/src/main/generated/writely/tables/pojos/ProductPlot.java index d2455f3..7955e8c 100644 --- a/src/main/generated/writely/tables/pojos/ProductPlot.java +++ b/src/main/generated/writely/tables/pojos/ProductPlot.java @@ -18,10 +18,7 @@ public class ProductPlot implements Serializable { private static final long serialVersionUID = 1L; private final UUID id; - private final String exposition; - private final String complication; - private final String climax; - private final String resolution; + private final String content; private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; @@ -29,10 +26,7 @@ public class ProductPlot implements Serializable { public ProductPlot(ProductPlot value) { this.id = value.id; - this.exposition = value.exposition; - this.complication = value.complication; - this.climax = value.climax; - this.resolution = value.resolution; + this.content = value.content; this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; @@ -41,20 +35,14 @@ public ProductPlot(ProductPlot value) { public ProductPlot( UUID id, - String exposition, - String complication, - String climax, - String resolution, + String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy ) { this.id = id; - this.exposition = exposition; - this.complication = complication; - this.climax = climax; - this.resolution = resolution; + this.content = content; this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; @@ -69,31 +57,10 @@ public UUID getId() { } /** - * Getter for public.product_plot.exposition. 발단 + * Getter for public.product_plot.content. 내용 */ - public String getExposition() { - return this.exposition; - } - - /** - * Getter for public.product_plot.complication. 전개 - */ - public String getComplication() { - return this.complication; - } - - /** - * Getter for public.product_plot.climax. 결말 - */ - public String getClimax() { - return this.climax; - } - - /** - * Getter for public.product_plot.resolution. - */ - public String getResolution() { - return this.resolution; + public String getContent() { + return this.content; } /** @@ -139,29 +106,11 @@ public boolean equals(Object obj) { } else if (!this.id.equals(other.id)) return false; - if (this.exposition == null) { - if (other.exposition != null) - return false; - } - else if (!this.exposition.equals(other.exposition)) - return false; - if (this.complication == null) { - if (other.complication != null) - return false; - } - else if (!this.complication.equals(other.complication)) - return false; - if (this.climax == null) { - if (other.climax != null) - return false; - } - else if (!this.climax.equals(other.climax)) - return false; - if (this.resolution == null) { - if (other.resolution != null) + if (this.content == null) { + if (other.content != null) return false; } - else if (!this.resolution.equals(other.resolution)) + else if (!this.content.equals(other.content)) return false; if (this.createdAt == null) { if (other.createdAt != null) @@ -195,10 +144,7 @@ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.exposition == null) ? 0 : this.exposition.hashCode()); - result = prime * result + ((this.complication == null) ? 0 : this.complication.hashCode()); - result = prime * result + ((this.climax == null) ? 0 : this.climax.hashCode()); - result = prime * result + ((this.resolution == null) ? 0 : this.resolution.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); @@ -211,10 +157,7 @@ public String toString() { StringBuilder sb = new StringBuilder("ProductPlot ("); sb.append(id); - sb.append(", ").append(exposition); - sb.append(", ").append(complication); - sb.append(", ").append(climax); - sb.append(", ").append(resolution); + sb.append(", ").append(content); sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); diff --git a/src/main/generated/writely/tables/records/LoginAttemptRecord.java b/src/main/generated/writely/tables/records/LoginAttemptRecord.java new file mode 100644 index 0000000..0f53a5a --- /dev/null +++ b/src/main/generated/writely/tables/records/LoginAttemptRecord.java @@ -0,0 +1,148 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.OffsetDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.LoginAttempt; + + +/** + * 로그인_시도 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LoginAttemptRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.login_attempt.id. 로그인 시도 ID + */ + public LoginAttemptRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.login_attempt.id. 로그인 시도 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.login_attempt.email. 로그인 시도한 이메일 + */ + public LoginAttemptRecord setEmail(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.login_attempt.email. 로그인 시도한 이메일 + */ + public String getEmail() { + return (String) get(1); + } + + /** + * Setter for public.login_attempt.result. 로그인 시도 후 결과 + */ + public LoginAttemptRecord setResult(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.login_attempt.result. 로그인 시도 후 결과 + */ + public String getResult() { + return (String) get(2); + } + + /** + * Setter for public.login_attempt.created_at. + */ + public LoginAttemptRecord setCreatedAt(OffsetDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.login_attempt.created_at. + */ + public OffsetDateTime getCreatedAt() { + return (OffsetDateTime) get(3); + } + + /** + * Setter for public.login_attempt.updated_at. + */ + public LoginAttemptRecord setUpdatedAt(OffsetDateTime value) { + set(4, value); + return this; + } + + /** + * Getter for public.login_attempt.updated_at. + */ + public OffsetDateTime getUpdatedAt() { + return (OffsetDateTime) get(4); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached LoginAttemptRecord + */ + public LoginAttemptRecord() { + super(LoginAttempt.LOGIN_ATTEMPT); + } + + /** + * Create a detached, initialised LoginAttemptRecord + */ + public LoginAttemptRecord(UUID id, String email, String result, OffsetDateTime createdAt, OffsetDateTime updatedAt) { + super(LoginAttempt.LOGIN_ATTEMPT); + + setId(id); + setEmail(email); + setResult(result); + setCreatedAt(createdAt); + setUpdatedAt(updatedAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised LoginAttemptRecord + */ + public LoginAttemptRecord(writely.tables.pojos.LoginAttempt value) { + super(LoginAttempt.LOGIN_ATTEMPT); + + if (value != null) { + setId(value.getId()); + setEmail(value.getEmail()); + setResult(value.getResult()); + setCreatedAt(value.getCreatedAt()); + setUpdatedAt(value.getUpdatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java index 6d16910..f8a07ad 100644 --- a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java +++ b/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java @@ -14,7 +14,7 @@ /** - * 작품 커스텀 필드 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class ProductCustomFieldRecord extends UpdatableRecordImpl { @@ -51,11 +51,26 @@ public UUID getProductId() { return (UUID) get(1); } + /** + * Setter for public.product_custom_field.section_id. 섹션 ID + */ + public ProductCustomFieldRecord setSectionId(UUID value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_custom_field.section_id. 섹션 ID + */ + public UUID getSectionId() { + return (UUID) get(2); + } + /** * Setter for public.product_custom_field.section_type. 섹션 타입 */ public ProductCustomFieldRecord setSectionType(String value) { - set(2, value); + set(3, value); return this; } @@ -63,14 +78,14 @@ public ProductCustomFieldRecord setSectionType(String value) { * Getter for public.product_custom_field.section_type. 섹션 타입 */ public String getSectionType() { - return (String) get(2); + return (String) get(3); } /** * Setter for public.product_custom_field.name. 이름 */ public ProductCustomFieldRecord setName(String value) { - set(3, value); + set(4, value); return this; } @@ -78,14 +93,14 @@ public ProductCustomFieldRecord setName(String value) { * Getter for public.product_custom_field.name. 이름 */ public String getName() { - return (String) get(3); + return (String) get(4); } /** * Setter for public.product_custom_field.content. 내용 */ public ProductCustomFieldRecord setContent(String value) { - set(4, value); + set(5, value); return this; } @@ -93,14 +108,14 @@ public ProductCustomFieldRecord setContent(String value) { * Getter for public.product_custom_field.content. 내용 */ public String getContent() { - return (String) get(4); + return (String) get(5); } /** * Setter for public.product_custom_field.seq. 순서 */ public ProductCustomFieldRecord setSeq(Short value) { - set(5, value); + set(6, value); return this; } @@ -108,14 +123,14 @@ public ProductCustomFieldRecord setSeq(Short value) { * Getter for public.product_custom_field.seq. 순서 */ public Short getSeq() { - return (Short) get(5); + return (Short) get(6); } /** * Setter for public.product_custom_field.created_at. 생성일시 */ public ProductCustomFieldRecord setCreatedAt(LocalDateTime value) { - set(6, value); + set(7, value); return this; } @@ -123,14 +138,14 @@ public ProductCustomFieldRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_custom_field.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(6); + return (LocalDateTime) get(7); } /** * Setter for public.product_custom_field.created_by. 생성자 ID */ public ProductCustomFieldRecord setCreatedBy(UUID value) { - set(7, value); + set(8, value); return this; } @@ -138,14 +153,14 @@ public ProductCustomFieldRecord setCreatedBy(UUID value) { * Getter for public.product_custom_field.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(7); + return (UUID) get(8); } /** * Setter for public.product_custom_field.updated_at. 수정일시 */ public ProductCustomFieldRecord setUpdatedAt(LocalDateTime value) { - set(8, value); + set(9, value); return this; } @@ -153,14 +168,14 @@ public ProductCustomFieldRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_custom_field.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(8); + return (LocalDateTime) get(9); } /** * Setter for public.product_custom_field.updated_by. 수정자 ID */ public ProductCustomFieldRecord setUpdatedBy(UUID value) { - set(9, value); + set(10, value); return this; } @@ -168,7 +183,7 @@ public ProductCustomFieldRecord setUpdatedBy(UUID value) { * Getter for public.product_custom_field.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(9); + return (UUID) get(10); } // ------------------------------------------------------------------------- @@ -194,11 +209,12 @@ public ProductCustomFieldRecord() { /** * Create a detached, initialised ProductCustomFieldRecord */ - public ProductCustomFieldRecord(UUID id, UUID productId, String sectionType, String name, String content, Short seq, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductCustomFieldRecord(UUID id, UUID productId, UUID sectionId, String sectionType, String name, String content, Short seq, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductCustomField.PRODUCT_CUSTOM_FIELD); setId(id); setProductId(productId); + setSectionId(sectionId); setSectionType(sectionType); setName(name); setContent(content); @@ -219,6 +235,7 @@ public ProductCustomFieldRecord(writely.tables.pojos.ProductCustomField value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); + setSectionId(value.getSectionId()); setSectionType(value.getSectionType()); setName(value.getName()); setContent(value.getContent()); diff --git a/src/main/generated/writely/tables/records/ProductPlotRecord.java b/src/main/generated/writely/tables/records/ProductPlotRecord.java index 165afed..409f785 100644 --- a/src/main/generated/writely/tables/records/ProductPlotRecord.java +++ b/src/main/generated/writely/tables/records/ProductPlotRecord.java @@ -37,70 +37,25 @@ public UUID getId() { } /** - * Setter for public.product_plot.exposition. 발단 + * Setter for public.product_plot.content. 내용 */ - public ProductPlotRecord setExposition(String value) { + public ProductPlotRecord setContent(String value) { set(1, value); return this; } /** - * Getter for public.product_plot.exposition. 발단 + * Getter for public.product_plot.content. 내용 */ - public String getExposition() { + public String getContent() { return (String) get(1); } - /** - * Setter for public.product_plot.complication. 전개 - */ - public ProductPlotRecord setComplication(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.product_plot.complication. 전개 - */ - public String getComplication() { - return (String) get(2); - } - - /** - * Setter for public.product_plot.climax. 결말 - */ - public ProductPlotRecord setClimax(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.product_plot.climax. 결말 - */ - public String getClimax() { - return (String) get(3); - } - - /** - * Setter for public.product_plot.resolution. - */ - public ProductPlotRecord setResolution(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.product_plot.resolution. - */ - public String getResolution() { - return (String) get(4); - } - /** * Setter for public.product_plot.created_at. 생성일시 */ public ProductPlotRecord setCreatedAt(LocalDateTime value) { - set(5, value); + set(2, value); return this; } @@ -108,14 +63,14 @@ public ProductPlotRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_plot.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); + return (LocalDateTime) get(2); } /** * Setter for public.product_plot.created_by. 생성자 ID */ public ProductPlotRecord setCreatedBy(UUID value) { - set(6, value); + set(3, value); return this; } @@ -123,14 +78,14 @@ public ProductPlotRecord setCreatedBy(UUID value) { * Getter for public.product_plot.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(6); + return (UUID) get(3); } /** * Setter for public.product_plot.updated_at. 수정일시 */ public ProductPlotRecord setUpdatedAt(LocalDateTime value) { - set(7, value); + set(4, value); return this; } @@ -138,14 +93,14 @@ public ProductPlotRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_plot.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); + return (LocalDateTime) get(4); } /** * Setter for public.product_plot.updated_by. 수정자 ID */ public ProductPlotRecord setUpdatedBy(UUID value) { - set(8, value); + set(5, value); return this; } @@ -153,7 +108,7 @@ public ProductPlotRecord setUpdatedBy(UUID value) { * Getter for public.product_plot.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(8); + return (UUID) get(5); } // ------------------------------------------------------------------------- @@ -179,14 +134,11 @@ public ProductPlotRecord() { /** * Create a detached, initialised ProductPlotRecord */ - public ProductPlotRecord(UUID id, String exposition, String complication, String climax, String resolution, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductPlotRecord(UUID id, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductPlot.PRODUCT_PLOT); setId(id); - setExposition(exposition); - setComplication(complication); - setClimax(climax); - setResolution(resolution); + setContent(content); setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); @@ -202,10 +154,7 @@ public ProductPlotRecord(writely.tables.pojos.ProductPlot value) { if (value != null) { setId(value.getId()); - setExposition(value.getExposition()); - setComplication(value.getComplication()); - setClimax(value.getClimax()); - setResolution(value.getResolution()); + setContent(value.getContent()); setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); diff --git a/src/main/java/com/writely/assistant/controller/AutoModifyController.java b/src/main/java/com/writely/assistant/controller/AssistantController.java similarity index 74% rename from src/main/java/com/writely/assistant/controller/AutoModifyController.java rename to src/main/java/com/writely/assistant/controller/AssistantController.java index 39671b8..a145380 100644 --- a/src/main/java/com/writely/assistant/controller/AutoModifyController.java +++ b/src/main/java/com/writely/assistant/controller/AssistantController.java @@ -1,6 +1,6 @@ package com.writely.assistant.controller; -import com.writely.assistant.request.AutoModifyRequest; +import com.writely.assistant.request.AutoModifyMessageRequest; import com.writely.assistant.service.AutoModifyService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -15,20 +15,20 @@ @RestController @RequiredArgsConstructor -@RequestMapping("/auto-modify") -@Tag(name = "AI 어시스턴트 - 자동 수정") -public class AutoModifyController { +@RequestMapping("/assistant") +@Tag(name = "AI 어시스턴트") +public class AssistantController { private final AutoModifyService autoModifyService; - @Operation(summary = "메세지 저장") - @PostMapping("/messages") - public UUID createMessage(@RequestBody AutoModifyRequest request) { + @Operation(summary = "자동 수정 메세지 저장") + @PostMapping("/auto-modify/messages") + public UUID createMessage(@RequestBody AutoModifyMessageRequest request) { return autoModifyService.createMessage(request); } - @Operation(summary = "메세지 전송 및 응답(SSE)") - @GetMapping("/stream/messages") + @Operation(summary = "자동 수정 스트리밍") + @GetMapping("/auto-modify/stream") public SseEmitter streamMessage( @RequestParam UUID productId, @RequestParam UUID messageId diff --git a/src/main/java/com/writely/assistant/domain/enums/AssistantException.java b/src/main/java/com/writely/assistant/domain/enums/AssistantException.java index 29ffb8e..0d1b8fa 100644 --- a/src/main/java/com/writely/assistant/domain/enums/AssistantException.java +++ b/src/main/java/com/writely/assistant/domain/enums/AssistantException.java @@ -9,7 +9,9 @@ @RequiredArgsConstructor public enum AssistantException implements CodeInfo { - NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 메세지입니다."); + NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 메세지입니다."), + SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-002", "SSE 데이터 전송 중 오류가 발생했습니다."), + WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "WebClient 요청 중 오류가 발생했습니다."); private final HttpStatus status; private final String code; diff --git a/src/main/java/com/writely/assistant/request/AutoModifyRequest.java b/src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java similarity index 88% rename from src/main/java/com/writely/assistant/request/AutoModifyRequest.java rename to src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java index 64a1da1..b16bc08 100644 --- a/src/main/java/com/writely/assistant/request/AutoModifyRequest.java +++ b/src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AutoModifyRequest { +public class AutoModifyMessageRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/src/main/java/com/writely/assistant/request/ChatRequest.java b/src/main/java/com/writely/assistant/request/ChatRequest.java deleted file mode 100644 index 2298f50..0000000 --- a/src/main/java/com/writely/assistant/request/ChatRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.writely.assistant.request; - -import lombok.Getter; - -@Getter -public class ChatRequest { - - private final String query; - - public ChatRequest(String query) { - this.query = query; - } -} diff --git a/src/main/java/com/writely/assistant/request/UserSetting.java b/src/main/java/com/writely/assistant/request/UserSetting.java new file mode 100644 index 0000000..c198f03 --- /dev/null +++ b/src/main/java/com/writely/assistant/request/UserSetting.java @@ -0,0 +1,189 @@ +package com.writely.assistant.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.writely.product.domain.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +import java.util.List; + +@Getter +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UserSetting { + + private final Synopsis synopsis; + private final Worldview worldview; + private final List characters; + private final Plot plot; + private final IdeaNote ideaNote; + + public UserSetting(Product product) { + this.characters = product.getCharacters().stream() + .map(UserSetting.Character::new) + .toList(); + this.ideaNote = product.getIdeaNote() != null ? new UserSetting.IdeaNote(product.getIdeaNote()) : null; + this.plot = product.getPlot() != null ? new UserSetting.Plot(product.getPlot()) : null; + this.synopsis = product.getSynopsis() != null ? new UserSetting.Synopsis(product.getSynopsis()) : null; + this.worldview = product.getWorldview() != null ? new UserSetting.Worldview(product.getWorldview()) : null; + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Character { + + @Schema(title = "소개", nullable = true) + private final String intro; + @Schema(name = "이름", nullable = true) + private final String character_name; + @Schema(name = "나이", nullable = true) + private final String age; + @Schema(name = "성별", nullable = true) + private final String gender; + @Schema(name = "직업", nullable = true) + private final String character_occupation; + @Schema(name = "외모", nullable = true) + private final String appearance; + @Schema(name = "성격", nullable = true) + private final String personality; + @Schema(name = "특징", nullable = true) + private final String characteristic; + @Schema(name = "주요관계", nullable = true) + private final String relationship; + @Schema(name = "커스텀 필드 목록", nullable = true) + private final List customFields; + + public Character(ProductCharacter character) { + this.intro = character.getIntro(); + this.character_name = character.getName(); + this.age = String.valueOf(character.getAge()); + this.gender = character.getGender(); + this.character_occupation = character.getOccupation(); + this.appearance = character.getAppearance(); + this.personality = character.getPersonality(); + this.characteristic = character.getCharacteristic(); + this.relationship = character.getRelationship(); + this.customFields = character.getCustomFields().stream() + .map(CustomField::new) + .toList(); + } + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class CustomField { + + @Schema(title = "필드 이름") + private final String custom_field_name; + @Schema(title = "필드 내용") + private final String custom_field_content; + + public CustomField(ProductCustomField customField) { + this.custom_field_name = customField.getName(); + this.custom_field_content = customField.getContent(); + } + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class IdeaNote { + + @Schema(title = "제목", nullable = true) + private final String idea_title; + @Schema(title = "내용", nullable = true) + private final String idea_content; + + public IdeaNote(ProductIdeaNote ideaNote) { + this.idea_title = ideaNote.getTitle(); + this.idea_content = ideaNote.getContent(); + } + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Plot { + + @Schema(title = "내용", nullable = true) + private final String content; + + public Plot(ProductPlot plot) { + this.content = plot.getContent(); + } + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Synopsis { + + @Schema(title = "장르") + private final String genre; + @Schema(title = "분량", nullable = true) + private final String length; + @Schema(title = "기획 의도", nullable = true) + private final String purpose; + @Schema(title = "로그라인") + private final String logline; + @Schema(title = "예시 문장", nullable = true) + private final String example; + + public Synopsis(ProductSynopsis synopsis) { + this.genre = synopsis.getGenre(); + this.length = synopsis.getLength(); + this.purpose = synopsis.getPurpose(); + this.logline = synopsis.getLogline(); + this.example = synopsis.getExample(); + } + } + + @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Worldview { + + @Schema(title = "지리", nullable = true) + private final String geography; + @Schema(title = "역사", nullable = true) + private final String history; + @Schema(title = "정치", nullable = true) + private final String politics; + @Schema(title = "사회", nullable = true) + private final String society; + @Schema(title = "종교", nullable = true) + private final String religion; + @Schema(title = "경제", nullable = true) + private final String economy; + @Schema(title = "기술", nullable = true) + private final String technology; + @Schema(title = "생활", nullable = true) + private final String lifestyle; + @Schema(title = "언어", nullable = true) + private final String language; + @Schema(title = "문화", nullable = true) + private final String culture; + @Schema(title = "종족", nullable = true) + private final String species; + @Schema(title = "직업", nullable = true) + private final String occupation; + @Schema(title = "갈등 관계", nullable = true) + private final String conflict; + @Schema(name = "커스텀 필드 목록", nullable = true) + private final List customFields; + + public Worldview(ProductWorldview worldview) { + this.geography = worldview.getGeography(); + this.history = worldview.getHistory(); + this.politics = worldview.getPolitics(); + this.society = worldview.getSociety(); + this.religion = worldview.getReligion(); + this.economy = worldview.getEconomy(); + this.technology = worldview.getTechnology(); + this.lifestyle = worldview.getLifestyle(); + this.language = worldview.getLanguage(); + this.culture = worldview.getCulture(); + this.species = worldview.getSpecies(); + this.occupation = worldview.getOccupation(); + this.conflict = worldview.getConflict(); + this.customFields = worldview.getCustomFields().stream() + .map(CustomField::new) + .toList(); + } + } +} diff --git a/src/main/java/com/writely/assistant/service/AutoModifyService.java b/src/main/java/com/writely/assistant/service/AutoModifyService.java index 512c962..49debd2 100644 --- a/src/main/java/com/writely/assistant/service/AutoModifyService.java +++ b/src/main/java/com/writely/assistant/service/AutoModifyService.java @@ -4,18 +4,25 @@ import com.writely.assistant.domain.automodify.AutoModifyMessageJpaRepository; import com.writely.assistant.domain.enums.AssistantException; import com.writely.assistant.domain.enums.MessageSenderRole; -import com.writely.assistant.request.AutoModifyRequest; +import com.writely.assistant.request.AutoModifyMessageRequest; +import com.writely.assistant.request.UserSetting; import com.writely.common.exception.BaseException; +import com.writely.common.util.LogUtil; import com.writely.product.domain.enums.ProductException; import com.writely.product.repository.ProductJpaRepository; +import com.writely.product.service.ProductQueryService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatusCode; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import reactor.core.publisher.Mono; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; @Service @@ -29,9 +36,10 @@ public class AutoModifyService { private final AutoModifyMessageJpaRepository autoModifyMessageRepository; private final ProductJpaRepository productRepository; + private final ProductQueryService productQueryService; @Transactional - public UUID createMessage(AutoModifyRequest request) { + public UUID createMessage(AutoModifyMessageRequest request) { verifyExistProduct(request.getProductId()); AutoModifyMessage autoModifyMemberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); @@ -42,25 +50,36 @@ public SseEmitter sendMessage(UUID productId, UUID messageId) { verifyExistProduct(productId); AutoModifyMessage message = getById(messageId); + Map requestMap = new HashMap<>(); + requestMap.put("tenant_id", "1"); + requestMap.put("query", message.getContent()); + requestMap.put("user_setting", new UserSetting(productQueryService.getById(productId))); + SseEmitter emitter = new SseEmitter(TIMEOUT); - WebClient.create(assistantUrl + "/v1/assistant/feedback/stream") - .get() - .uri(uriBuilder -> uriBuilder - .queryParam("tenant_id", "1") - .queryParam("query", message.getContent()) - .queryParam("user_setting", "") - .build()) + WebClient.create(assistantUrl + "/v1/assistant/auto-modify/stream") + .post() + .bodyValue(requestMap) .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> LogUtil.error("Error response: " + errorBody)) // 오류 응답 출력 + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) // 예외로 변환 + ) .bodyToFlux(String.class) .subscribe( data -> { try { emitter.send(SseEmitter.event().data(data)); } catch (IOException e) { - emitter.completeWithError(e); + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); } }, - error -> emitter.completeWithError(error), + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, emitter::complete ); diff --git a/src/main/java/com/writely/product/domain/ProductCharacter.java b/src/main/java/com/writely/product/domain/ProductCharacter.java index cce63b1..0df3ab3 100644 --- a/src/main/java/com/writely/product/domain/ProductCharacter.java +++ b/src/main/java/com/writely/product/domain/ProductCharacter.java @@ -6,7 +6,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.hibernate.annotations.SQLRestriction; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; @Getter @@ -50,6 +53,11 @@ public class ProductCharacter extends BaseAuditTimeEntity { @Column(name = "relationship") private String relationship; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "section_id") + @SQLRestriction("section_type = 'character'") + private List customFields = new ArrayList<>(); + @Builder public ProductCharacter(UUID productId, String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship) { this.productId = productId; diff --git a/src/main/java/com/writely/product/domain/ProductCustomField.java b/src/main/java/com/writely/product/domain/ProductCustomField.java index 6f7797f..7f999e2 100644 --- a/src/main/java/com/writely/product/domain/ProductCustomField.java +++ b/src/main/java/com/writely/product/domain/ProductCustomField.java @@ -24,6 +24,9 @@ public class ProductCustomField extends BaseAuditTimeEntity { @Column(name = "product_id", nullable = false) private UUID productId; + @Column(name = "section_id", nullable = false) + private UUID sectionId; + @Convert(converter = ProductSectionType.TypeCodeConverter.class) @Column(name = "section_type", nullable = false) private ProductSectionType sectionType; @@ -38,18 +41,17 @@ public class ProductCustomField extends BaseAuditTimeEntity { private Short seq; @Builder - public ProductCustomField(UUID productId, ProductSectionType sectionType, String name, String content, Short seq) { + public ProductCustomField(UUID productId, UUID sectionId, ProductSectionType sectionType, String name, String content, Short seq) { this.productId = productId; + this.sectionId = sectionId; this.sectionType = sectionType; this.name = name; this.content = content; this.seq = seq; } - public void update(ProductSectionType sectionType, String name, String content, Short seq) { - this.sectionType = sectionType; + public void update(String name, String content) { this.name = name; this.content = content; - this.seq = seq; } } diff --git a/src/main/java/com/writely/product/domain/ProductPlot.java b/src/main/java/com/writely/product/domain/ProductPlot.java index fa013d7..846d24a 100644 --- a/src/main/java/com/writely/product/domain/ProductPlot.java +++ b/src/main/java/com/writely/product/domain/ProductPlot.java @@ -20,27 +20,15 @@ public class ProductPlot extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private UUID id; @Column - private String exposition; - @Column - private String complication; - @Column - private String climax; - @Column - private String resolution; + private String content; @Builder - public ProductPlot(UUID id, String exposition, String complication, String climax, String resolution) { + public ProductPlot(UUID id, String content) { this.id = id; - this.exposition = exposition; - this.complication = complication; - this.climax = climax; - this.resolution = resolution; + this.content = content; } - public void update(String exposition, String complication, String climax, String resolution) { - this.exposition = exposition; - this.complication = complication; - this.climax = climax; - this.resolution = resolution; + public void update(String content) { + this.content = content; } } diff --git a/src/main/java/com/writely/product/domain/ProductSynopsis.java b/src/main/java/com/writely/product/domain/ProductSynopsis.java index 45909fc..73adca0 100644 --- a/src/main/java/com/writely/product/domain/ProductSynopsis.java +++ b/src/main/java/com/writely/product/domain/ProductSynopsis.java @@ -29,7 +29,7 @@ public class ProductSynopsis extends BaseAuditTimeEntity { @Column(name = "purpose") private String purpose; - @Column(name = "logline") + @Column(name = "logline", nullable = false) private String logline; @Column(name = "example") diff --git a/src/main/java/com/writely/product/domain/ProductWorldview.java b/src/main/java/com/writely/product/domain/ProductWorldview.java index 361fd7f..9f96f85 100644 --- a/src/main/java/com/writely/product/domain/ProductWorldview.java +++ b/src/main/java/com/writely/product/domain/ProductWorldview.java @@ -6,7 +6,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.hibernate.annotations.SQLRestriction; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; @Getter @@ -59,6 +62,11 @@ public class ProductWorldview extends BaseAuditTimeEntity { @Column(name = "conflict") private String conflict; + @OneToMany(fetch = FetchType.LAZY) + @JoinColumn(name = "section_id") + @SQLRestriction("section_type = 'worldview'") + private List customFields = new ArrayList<>(); + @Builder public ProductWorldview(UUID id, String geography, String history, String politics, String society, String religion, String economy, String technology, String lifestyle, String language, String culture, String species, String occupation, String conflict) { this.id = id; diff --git a/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java b/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java index 45888c1..efa1100 100644 --- a/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java +++ b/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java @@ -2,8 +2,15 @@ import com.writely.product.domain.ProductCustomField; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import java.util.UUID; public interface ProductCustomFieldJpaRepository extends JpaRepository { + + @Modifying + @Query(value = "DELETE FROM product_custom_field WHERE product_id = :productId AND section_type = :sectionType", nativeQuery = true) + void deleteAllByProductIdAndSectionType(@Param("productId") UUID productId, @Param("sectionType") String sectionType); } diff --git a/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java b/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java index e9c7251..7dbe6ad 100644 --- a/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java +++ b/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java @@ -14,7 +14,6 @@ public class ProductTemplateSaveRequest { private List characters; - private List customFields; private IdeaNote ideaNote; private Plot plot; private Synopsis synopsis; @@ -26,24 +25,26 @@ public static class Character { @Schema(nullable = true) private UUID id; - @Schema(title = "소개", nullable = true) + @Schema(title = "소개", nullable = true, example = "미국 최고의 기업가") private String intro; - @Schema(title = "이름", nullable = true) + @Schema(title = "이름", nullable = true, example = "CEO") private String name; - @Schema(title = "나이", nullable = true) + @Schema(title = "나이", nullable = true, example = "40") private Short age; - @Schema(title = "성별", nullable = true) + @Schema(title = "성별", nullable = true, example = "남성") private String gender; - @Schema(title = "직업", nullable = true) + @Schema(title = "직업", nullable = true, example = "CEO") private String occupation; - @Schema(title = "외모", nullable = true) + @Schema(title = "외모", nullable = true, example = "평범") private String appearance; - @Schema(title = "성격", nullable = true) + @Schema(title = "성격", nullable = true, example = "다정함") private String personality; @Schema(title = "특징", nullable = true) private String characteristic; @Schema(title = "주요관계", nullable = true) private String relationship; + @Schema(title = "커스텀 필드", nullable = true) + private List customFields; public ProductCharacter toEntity(UUID productId) { return ProductCharacter.builder() @@ -67,22 +68,19 @@ public static class CustomField { @Schema(nullable = true) private UUID id; - @Schema(title = "섹션 코드") - private ProductSectionType sectionType; @Schema(title = "필드 이름") private String name; @Schema(title = "필드 내용") private String content; - @Schema(title = "필드 순서") - private Short seq; - public ProductCustomField toEntity(UUID productId) { + public ProductCustomField toEntity(UUID productId, UUID sectionId, ProductSectionType sectionType) { return ProductCustomField.builder() .productId(productId) + .sectionId(sectionId) .sectionType(sectionType) .name(name) .content(content) - .seq(seq) + .seq((short) 1) .build(); } } @@ -101,22 +99,13 @@ public static class IdeaNote { @Setter public static class Plot { - @Schema(title = "발단", nullable = true) - private String exposition; - @Schema(title = "전개", nullable = true) - private String complication; - @Schema(title = "위기", nullable = true) - private String climax; - @Schema(title = "결말", nullable = true) - private String resolution; + @Schema(title = "내용", nullable = true) + private String content; public ProductPlot toEntity(UUID productId) { return ProductPlot.builder() .id(productId) - .exposition(exposition) - .complication(complication) - .climax(climax) - .resolution(resolution) + .content(content) .build(); } } @@ -125,13 +114,13 @@ public ProductPlot toEntity(UUID productId) { @Setter public static class Synopsis { - @Schema(title = "장르") + @Schema(title = "장르", example = "SF, 로맨스") private String genre; @Schema(title = "분량", nullable = true) private String length; @Schema(title = "기획 의도", nullable = true) private String purpose; - @Schema(title = "로그라인", nullable = true) + @Schema(title = "로그라인") private String logline; @Schema(title = "예시 문장", nullable = true) private String example; @@ -178,6 +167,8 @@ public static class Worldview { private String occupation; @Schema(title = "갈등 관계", nullable = true) private String conflict; + @Schema(title = "커스텀 필드", nullable = true) + private List customFields; public ProductWorldview toEntity(UUID productId) { return ProductWorldview.builder() diff --git a/src/main/java/com/writely/product/response/ProductTemplateResponse.java b/src/main/java/com/writely/product/response/ProductTemplateResponse.java index 923dcaa..1104de6 100644 --- a/src/main/java/com/writely/product/response/ProductTemplateResponse.java +++ b/src/main/java/com/writely/product/response/ProductTemplateResponse.java @@ -1,7 +1,6 @@ package com.writely.product.response; import com.writely.product.domain.*; -import com.writely.product.domain.enums.ProductSectionType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; @@ -14,7 +13,6 @@ public class ProductTemplateResponse { private final UUID id; private final List characters; - private final List customFields; private final IdeaNote ideaNote; private final Plot plot; private final Synopsis synopsis; @@ -25,9 +23,6 @@ public ProductTemplateResponse(Product product) { this.characters = product.getCharacters().stream() .map(Character::new) .toList(); - this.customFields = product.getCustomFields().stream() - .map(CustomField::new) - .toList(); this.ideaNote = product.getIdeaNote() != null ? new IdeaNote(product.getIdeaNote()) : null; this.plot = product.getPlot() != null ? new Plot(product.getPlot()) : null; this.synopsis = product.getSynopsis() != null ? new Synopsis(product.getSynopsis()) : null; @@ -57,6 +52,8 @@ public static class Character { private final String characteristic; @Schema(name = "주요관계", nullable = true) private final String relationship; + @Schema(name = "커스텀 필드 목록", nullable = true) + private final List customFields; public Character(ProductCharacter character) { this.id = character.getId(); @@ -69,6 +66,9 @@ public Character(ProductCharacter character) { this.personality = character.getPersonality(); this.characteristic = character.getCharacteristic(); this.relationship = character.getRelationship(); + this.customFields = character.getCustomFields().stream() + .map(CustomField::new) + .toList(); } } @@ -77,8 +77,6 @@ public Character(ProductCharacter character) { public static class CustomField { private final UUID id; - @Schema(title = "섹션 코드") - private final ProductSectionType sectionType; @Schema(title = "필드 이름") private final String name; @Schema(title = "필드 내용") @@ -88,7 +86,6 @@ public static class CustomField { public CustomField(ProductCustomField customField) { this.id = customField.getId(); - this.sectionType = customField.getSectionType(); this.name = customField.getName(); this.content = customField.getContent(); this.seq = customField.getSeq(); @@ -117,21 +114,12 @@ public IdeaNote(ProductIdeaNote ideaNote) { public static class Plot { private final UUID id; - @Schema(title = "발단", nullable = true) - private final String exposition; - @Schema(title = "전개", nullable = true) - private final String complication; - @Schema(title = "위기", nullable = true) - private final String climax; - @Schema(title = "결말", nullable = true) - private final String resolution; + @Schema(title = "내용", nullable = true) + private final String content; public Plot(ProductPlot plot) { this.id = plot.getId(); - this.exposition = plot.getExposition(); - this.complication = plot.getComplication(); - this.climax = plot.getClimax(); - this.resolution = plot.getResolution(); + this.content = plot.getContent(); } } @@ -192,6 +180,8 @@ public static class Worldview { private final String occupation; @Schema(title = "갈등 관계", nullable = true) private final String conflict; + @Schema(name = "커스텀 필드 목록", nullable = true) + private final List customFields; public Worldview(ProductWorldview worldview) { this.id = worldview.getId(); @@ -208,6 +198,9 @@ public Worldview(ProductWorldview worldview) { this.species = worldview.getSpecies(); this.occupation = worldview.getOccupation(); this.conflict = worldview.getConflict(); + this.customFields = worldview.getCustomFields().stream() + .map(CustomField::new) + .toList(); } } } diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/src/main/java/com/writely/product/service/ProductCommandService.java index a13b184..860851f 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/src/main/java/com/writely/product/service/ProductCommandService.java @@ -3,6 +3,7 @@ import com.writely.common.exception.BaseException; import com.writely.product.domain.*; import com.writely.product.domain.enums.ProductException; +import com.writely.product.domain.enums.ProductSectionType; import com.writely.product.repository.*; import com.writely.product.request.ProductMemoSaveRequest; import com.writely.product.request.ProductModifyRequest; @@ -47,7 +48,6 @@ public void saveTemplate(UUID productId, ProductTemplateSaveRequest request) { Product product = productQueryService.getById(productId); modifyCharacters(product, request.getCharacters()); - modifyCustomFields(product, request.getCustomFields()); modifyIdeaNote(product, request.getIdeaNote()); modifyPlot(product, request.getPlot()); modifySynopsis(product, request.getSynopsis()); @@ -86,15 +86,16 @@ private ProductMemo getMemoById(UUID memoId) { .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); } - private void modifyCharacters(Product product, List characters) { + private void modifyCharacters(Product product, List requestInfos) { Map savedCharacterMap = product.getCharacters().stream() .collect(Collectors.toMap(ProductCharacter::getId, Function.identity())); - if (characters.isEmpty()) { + if (requestInfos == null || requestInfos.isEmpty()) { + productCustomFieldJpaRepository.deleteAllByProductIdAndSectionType(product.getId(), ProductSectionType.CHARACTER.getCode()); productCharacterJpaRepository.deleteAll(savedCharacterMap.values()); return; } - Set modifyIds = characters.stream() + Set modifyIds = requestInfos.stream() .map(ProductTemplateSaveRequest.Character::getId) .filter(Objects::nonNull) .collect(Collectors.toSet()); @@ -106,127 +107,144 @@ private void modifyCharacters(Product product, List addCharacters = new ArrayList<>(); - characters.forEach(e -> { - if (e.getId() == null) { - addCharacters.add(e.toEntity(product.getId())); + requestInfos.forEach(request -> { + if (request.getId() == null) { + ProductCharacter newCharacter = request.toEntity(product.getId()); + addCharacters.add(newCharacter); + + modifyCustomFields(product.getId(), newCharacter.getId(), ProductSectionType.CHARACTER, + request.getCustomFields(), List.of()); } else { - ProductCharacter savedCharacter = savedCharacterMap.get(e.getId()); + ProductCharacter savedCharacter = savedCharacterMap.get(request.getId()); if (savedCharacter == null) { throw new BaseException(ProductException.NOT_EXIST_CHARACTER); } - savedCharacter.update(e.getIntro(), e.getName(), e.getAge(), e.getGender(), e.getOccupation(), - e.getAppearance(), e.getPersonality(), e.getCharacteristic(), e.getRelationship()); + savedCharacter.update(request.getIntro(), request.getName(), request.getAge(), request.getGender(), request.getOccupation(), + request.getAppearance(), request.getPersonality(), request.getCharacteristic(), request.getRelationship()); + + modifyCustomFields(product.getId(), savedCharacter.getId(), ProductSectionType.CHARACTER, + request.getCustomFields(), savedCharacter.getCustomFields()); } }); productCharacterJpaRepository.saveAll(addCharacters); } - private void modifyCustomFields(Product product, List customFields) { - Map savedCustomFieldMap = product.getCustomFields().stream() + private void modifyCustomFields(UUID productId, UUID sectionId, ProductSectionType sectionType, + List requestInfos, + List savedCustomFields) { + Map savedCustomFieldMap = savedCustomFields.stream() .collect(Collectors.toMap(ProductCustomField::getId, Function.identity())); - if (customFields.isEmpty()) { - productCustomFieldJpaRepository.deleteAll(savedCustomFieldMap.values()); + + if (requestInfos == null || requestInfos.isEmpty()) { + productCustomFieldJpaRepository.deleteAll(savedCustomFields); return; } - Set modifyIds = customFields.stream() + Set modifyIds = requestInfos.stream() .map(ProductTemplateSaveRequest.CustomField::getId) .filter(Objects::nonNull) .collect(Collectors.toSet()); - List deleteCharacters = savedCustomFieldMap.values().stream() - .filter(e -> !modifyIds.contains(e.getId())) + List deleteCustomFields = savedCustomFields.stream() + .filter(cf -> !modifyIds.contains(cf.getId())) .toList(); - productCustomFieldJpaRepository.deleteAll(deleteCharacters); + productCustomFieldJpaRepository.deleteAll(deleteCustomFields); List addCustomFields = new ArrayList<>(); - customFields.forEach(e -> { - if (e.getId() == null) { - addCustomFields.add(e.toEntity(product.getId())); + + for (ProductTemplateSaveRequest.CustomField request : requestInfos) { + if (request.getId() == null) { + addCustomFields.add(request.toEntity(productId, sectionId, sectionType)); } else { - ProductCustomField savedCustomField = savedCustomFieldMap.get(e.getId()); - if (savedCustomField == null) { + ProductCustomField savedField = savedCustomFieldMap.get(request.getId()); + if (savedField == null) { throw new BaseException(ProductException.NOT_EXIST_CUSTOM_FIELD); } - - savedCustomField.update(e.getSectionType(), e.getName(), e.getContent(), e.getSeq()); + savedField.update(request.getName(), request.getContent()); } - }); + } productCustomFieldJpaRepository.saveAll(addCustomFields); } - private void modifyIdeaNote(Product product, ProductTemplateSaveRequest.IdeaNote ideaNote) { + private void modifyIdeaNote(Product product, ProductTemplateSaveRequest.IdeaNote requestInfo) { ProductIdeaNote savedIdeaNote = product.getIdeaNote(); - if (ideaNote == null && savedIdeaNote != null) { - productIdeaNoteRepository.delete(savedIdeaNote); + if (requestInfo == null) { + if (savedIdeaNote != null) { + productIdeaNoteRepository.delete(savedIdeaNote); + } return; } - if (ideaNote != null) { - if (savedIdeaNote == null) { - ProductIdeaNote newIdeaNote = new ProductIdeaNote(product.getId(), ideaNote.getTitle(), ideaNote.getContent()); - productIdeaNoteRepository.save(newIdeaNote); - } else { - savedIdeaNote.update(ideaNote.getTitle(), ideaNote.getContent()); - } + if (savedIdeaNote == null) { + ProductIdeaNote newIdeaNote = new ProductIdeaNote(product.getId(), requestInfo.getTitle(), requestInfo.getContent()); + productIdeaNoteRepository.save(newIdeaNote); + } else { + savedIdeaNote.update(requestInfo.getTitle(), requestInfo.getContent()); } } - private void modifyPlot(Product product, ProductTemplateSaveRequest.Plot plot) { + private void modifyPlot(Product product, ProductTemplateSaveRequest.Plot requestInfo) { ProductPlot savedPlot = product.getPlot(); - if (plot == null && savedPlot != null) { - productPlotRepository.delete(savedPlot); + if (requestInfo == null) { + if (savedPlot != null) { + productPlotRepository.delete(savedPlot); + } return; } - if (plot != null) { - if (savedPlot == null) { - productPlotRepository.save(plot.toEntity(product.getId())); - } else { - savedPlot.update(plot.getExposition(), plot.getComplication(), plot.getComplication(), plot.getComplication()); - } + if (savedPlot == null) { + productPlotRepository.save(requestInfo.toEntity(product.getId())); + } else { + savedPlot.update(requestInfo.getContent()); } } - private void modifySynopsis(Product product, ProductTemplateSaveRequest.Synopsis synopsis) { + private void modifySynopsis(Product product, ProductTemplateSaveRequest.Synopsis requestInfo) { ProductSynopsis savedSynopsis = product.getSynopsis(); - if (synopsis == null && savedSynopsis != null) { - productSynopsisRepository.delete(savedSynopsis); + if (requestInfo == null) { + if (savedSynopsis != null) { + productSynopsisRepository.delete(savedSynopsis); + } return; } - if (synopsis != null) { - if (savedSynopsis == null) { - productSynopsisRepository.save(synopsis.toEntity(product.getId())); - } else { - savedSynopsis.update(synopsis.getGenre(), synopsis.getLength(), synopsis.getPurpose(), synopsis.getLogline(), synopsis.getExample()); - } + if (savedSynopsis == null) { + productSynopsisRepository.save(requestInfo.toEntity(product.getId())); + } else { + savedSynopsis.update(requestInfo.getGenre(), requestInfo.getLength(), requestInfo.getPurpose(), requestInfo.getLogline(), requestInfo.getExample()); } } - private void modifyWorldview(Product product, ProductTemplateSaveRequest.Worldview worldview) { + private void modifyWorldview(Product product, ProductTemplateSaveRequest.Worldview requestInfo) { ProductWorldview savedWorldview = product.getWorldview(); - if (worldview == null && savedWorldview != null) { - productWorldviewRepository.delete(savedWorldview); + if (requestInfo == null) { + if (savedWorldview != null) { + productCustomFieldJpaRepository.deleteAllByProductIdAndSectionType(product.getId(), ProductSectionType.WORLDVIEW.getCode()); + productWorldviewRepository.delete(savedWorldview); + } return; } - if (worldview != null) { - if (savedWorldview == null) { - productWorldviewRepository.save(worldview.toEntity(product.getId())); - } else { - savedWorldview.update(worldview.getGeography(), worldview.getHistory(), worldview.getPolitics(), - worldview.getSociety(), worldview.getReligion(), worldview.getEconomy(), worldview.getTechnology(), worldview.getLifestyle(), - worldview.getLanguage(), worldview.getCulture(), worldview.getSpecies(), worldview.getOccupation(), worldview.getConflict()); - } + if (savedWorldview == null) { + ProductWorldview newWorldview = productWorldviewRepository.save(requestInfo.toEntity(product.getId())); + + modifyCustomFields(product.getId(), newWorldview.getId(), ProductSectionType.WORLDVIEW, + requestInfo.getCustomFields(), List.of()); + } else { + savedWorldview.update(requestInfo.getGeography(), requestInfo.getHistory(), requestInfo.getPolitics(), + requestInfo.getSociety(), requestInfo.getReligion(), requestInfo.getEconomy(), requestInfo.getTechnology(), requestInfo.getLifestyle(), + requestInfo.getLanguage(), requestInfo.getCulture(), requestInfo.getSpecies(), requestInfo.getOccupation(), requestInfo.getConflict()); + + modifyCustomFields(product.getId(), savedWorldview.getId(), ProductSectionType.WORLDVIEW, + requestInfo.getCustomFields(), savedWorldview.getCustomFields()); } } From bded67a718853818a226c92451f18c05709a49da Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 5 Mar 2025 21:21:49 +0900 Subject: [PATCH 037/107] =?UTF-8?q?feat:=20user=20modify(=EC=88=98?= =?UTF-8?q?=EB=8F=99=20=EC=88=98=EC=A0=95)=20api=20=EC=97=B0=EB=8F=99=20(#?= =?UTF-8?q?36)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 18 ++++ .../controller/AssistantController.java | 24 ++++- .../assistant/domain/MessageContent.java | 2 +- .../domain/usermodify/UserModifyMessage.java | 44 +++++++++ .../UserModifyMessageJpaRepository.java | 8 ++ .../request/UserModifyMessageRequest.java | 19 ++++ .../assistant/request/UserSetting.java | 8 +- .../assistant/service/AutoModifyService.java | 13 +-- .../assistant/service/UserModifyService.java | 92 +++++++++++++++++++ .../product/service/ProductQueryService.java | 6 ++ 10 files changed, 216 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java create mode 100644 src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java create mode 100644 src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java create mode 100644 src/main/java/com/writely/assistant/service/UserModifyService.java diff --git a/sql/init.sql b/sql/init.sql index 4774d29..1d79718 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -362,3 +362,21 @@ comment on column auto_modify_message.updated_by is '수정자 ID'; alter table auto_modify_message owner to postgres; + +create table user_modify_message +( + id uuid default gen_random_uuid() not null + constraint user_modify_message_pk + primary key, + product_id uuid not null, + role varchar(10) not null, + content text not null, + prompt text not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null +); + +alter table user_modify_message + owner to postgres; diff --git a/src/main/java/com/writely/assistant/controller/AssistantController.java b/src/main/java/com/writely/assistant/controller/AssistantController.java index a145380..671de22 100644 --- a/src/main/java/com/writely/assistant/controller/AssistantController.java +++ b/src/main/java/com/writely/assistant/controller/AssistantController.java @@ -1,7 +1,9 @@ package com.writely.assistant.controller; import com.writely.assistant.request.AutoModifyMessageRequest; +import com.writely.assistant.request.UserModifyMessageRequest; import com.writely.assistant.service.AutoModifyService; +import com.writely.assistant.service.UserModifyService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; @@ -20,16 +22,23 @@ public class AssistantController { private final AutoModifyService autoModifyService; + private final UserModifyService userModifyService; @Operation(summary = "자동 수정 메세지 저장") @PostMapping("/auto-modify/messages") - public UUID createMessage(@RequestBody AutoModifyMessageRequest request) { + public UUID createAutoModifyMessage(@RequestBody AutoModifyMessageRequest request) { return autoModifyService.createMessage(request); } + @Operation(summary = "수동 수정 메세지 저장") + @PostMapping("/user-modify/messages") + public UUID createUserModifyMessage(@RequestBody UserModifyMessageRequest request) { + return userModifyService.createMessage(request); + } + @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") - public SseEmitter streamMessage( + public SseEmitter streamAutoModifyMessage( @RequestParam UUID productId, @RequestParam UUID messageId ) { @@ -38,6 +47,17 @@ public SseEmitter streamMessage( return emitter; } + @Operation(summary = "수동 수정 스트리밍") + @GetMapping("/user-modify/stream") + public SseEmitter streamUserModifyMessage( + @RequestParam UUID productId, + @RequestParam UUID messageId + ) { + SseEmitter emitter = userModifyService.sendMessage(productId, messageId); + setResponseHeaderForSSE(); + return emitter; + } + private void setResponseHeaderForSSE() { HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); if (response != null) { diff --git a/src/main/java/com/writely/assistant/domain/MessageContent.java b/src/main/java/com/writely/assistant/domain/MessageContent.java index 9095cad..356c4c0 100644 --- a/src/main/java/com/writely/assistant/domain/MessageContent.java +++ b/src/main/java/com/writely/assistant/domain/MessageContent.java @@ -14,7 +14,7 @@ public class MessageContent { @Column(name = "role", nullable = false) private MessageSenderRole role; - @Column(name = "content") + @Column(name = "content", nullable = false) private String content; public MessageContent(MessageSenderRole role, String content) { diff --git a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java b/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java new file mode 100644 index 0000000..1f5910d --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java @@ -0,0 +1,44 @@ +package com.writely.assistant.domain.usermodify; + +import com.writely.assistant.domain.MessageContent; +import com.writely.assistant.domain.enums.MessageSenderRole; +import com.writely.common.domain.BaseAuditTimeEntity; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "user_modify_message") +public class UserModifyMessage extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Embedded + private MessageContent messageContent; + + @Column(name = "prompt", nullable = false) + private String prompt; + + public UserModifyMessage(UUID productId, MessageSenderRole role, String content, String prompt) { + this.productId = productId; + this.messageContent = new MessageContent(role, content); + this.prompt = prompt; + } + + public MessageSenderRole getRole() { + return messageContent.getRole(); + } + + public String getContent() { + return messageContent.getContent(); + } +} diff --git a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java b/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java new file mode 100644 index 0000000..b3cde66 --- /dev/null +++ b/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java @@ -0,0 +1,8 @@ +package com.writely.assistant.domain.usermodify; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface UserModifyMessageJpaRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java b/src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java new file mode 100644 index 0000000..6c1ee5c --- /dev/null +++ b/src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java @@ -0,0 +1,19 @@ +package com.writely.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class UserModifyMessageRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "내용") + private String content; + @Schema(title = "프롬프트") + private String prompt; +} diff --git a/src/main/java/com/writely/assistant/request/UserSetting.java b/src/main/java/com/writely/assistant/request/UserSetting.java index c198f03..88b9d1c 100644 --- a/src/main/java/com/writely/assistant/request/UserSetting.java +++ b/src/main/java/com/writely/assistant/request/UserSetting.java @@ -50,7 +50,7 @@ public static class Character { @Schema(name = "주요관계", nullable = true) private final String relationship; @Schema(name = "커스텀 필드 목록", nullable = true) - private final List customFields; + private final List custom_fields; public Character(ProductCharacter character) { this.intro = character.getIntro(); @@ -62,7 +62,7 @@ public Character(ProductCharacter character) { this.personality = character.getPersonality(); this.characteristic = character.getCharacteristic(); this.relationship = character.getRelationship(); - this.customFields = character.getCustomFields().stream() + this.custom_fields = character.getCustomFields().stream() .map(CustomField::new) .toList(); } @@ -165,7 +165,7 @@ public static class Worldview { @Schema(title = "갈등 관계", nullable = true) private final String conflict; @Schema(name = "커스텀 필드 목록", nullable = true) - private final List customFields; + private final List custom_fields; public Worldview(ProductWorldview worldview) { this.geography = worldview.getGeography(); @@ -181,7 +181,7 @@ public Worldview(ProductWorldview worldview) { this.species = worldview.getSpecies(); this.occupation = worldview.getOccupation(); this.conflict = worldview.getConflict(); - this.customFields = worldview.getCustomFields().stream() + this.custom_fields = worldview.getCustomFields().stream() .map(CustomField::new) .toList(); } diff --git a/src/main/java/com/writely/assistant/service/AutoModifyService.java b/src/main/java/com/writely/assistant/service/AutoModifyService.java index 49debd2..393b708 100644 --- a/src/main/java/com/writely/assistant/service/AutoModifyService.java +++ b/src/main/java/com/writely/assistant/service/AutoModifyService.java @@ -8,8 +8,6 @@ import com.writely.assistant.request.UserSetting; import com.writely.common.exception.BaseException; import com.writely.common.util.LogUtil; -import com.writely.product.domain.enums.ProductException; -import com.writely.product.repository.ProductJpaRepository; import com.writely.product.service.ProductQueryService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; @@ -35,19 +33,18 @@ public class AutoModifyService { private final long TIMEOUT = 180_000L; private final AutoModifyMessageJpaRepository autoModifyMessageRepository; - private final ProductJpaRepository productRepository; private final ProductQueryService productQueryService; @Transactional public UUID createMessage(AutoModifyMessageRequest request) { - verifyExistProduct(request.getProductId()); + productQueryService.verifyExist(request.getProductId()); AutoModifyMessage autoModifyMemberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); return autoModifyMessageRepository.save(autoModifyMemberMessage).getId(); } public SseEmitter sendMessage(UUID productId, UUID messageId) { - verifyExistProduct(productId); + productQueryService.verifyExist(productId); AutoModifyMessage message = getById(messageId); Map requestMap = new HashMap<>(); @@ -90,10 +87,4 @@ private AutoModifyMessage getById(UUID messageId) { return autoModifyMessageRepository.findById(messageId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } - - private void verifyExistProduct(UUID productId) { - if (!productRepository.existsById(productId)) { - throw new BaseException(ProductException.NOT_EXIST); - } - } } diff --git a/src/main/java/com/writely/assistant/service/UserModifyService.java b/src/main/java/com/writely/assistant/service/UserModifyService.java new file mode 100644 index 0000000..4d38cb1 --- /dev/null +++ b/src/main/java/com/writely/assistant/service/UserModifyService.java @@ -0,0 +1,92 @@ +package com.writely.assistant.service; + +import com.writely.assistant.domain.enums.AssistantException; +import com.writely.assistant.domain.enums.MessageSenderRole; +import com.writely.assistant.domain.usermodify.UserModifyMessage; +import com.writely.assistant.domain.usermodify.UserModifyMessageJpaRepository; +import com.writely.assistant.request.UserModifyMessageRequest; +import com.writely.assistant.request.UserSetting; +import com.writely.common.exception.BaseException; +import com.writely.common.util.LogUtil; +import com.writely.product.service.ProductQueryService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatusCode; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class UserModifyService { + + @Value("${service.assistant.url}") + private String assistantUrl; + + private final long TIMEOUT = 180_000L; + + private final UserModifyMessageJpaRepository userModifyMessageJpaRepository; + private final ProductQueryService productQueryService; + + @Transactional + public UUID createMessage(UserModifyMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UserModifyMessage userModifyMemberMessage = + new UserModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + return userModifyMessageJpaRepository.save(userModifyMemberMessage).getId(); + } + + public SseEmitter sendMessage(UUID productId, UUID messageId) { + productQueryService.verifyExist(productId); + UserModifyMessage message = getById(messageId); + + Map requestMap = new HashMap<>(); + requestMap.put("tenant_id", "1"); + requestMap.put("user_setting", new UserSetting(productQueryService.getById(productId))); + requestMap.put("query", message.getContent()); + requestMap.put("how_polish", message.getPrompt()); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + WebClient.create(assistantUrl + "/v1/assistant/user-modify/stream") + .post() + .bodyValue(requestMap) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> LogUtil.error("Error response: " + errorBody)) // 오류 응답 출력 + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) // 예외로 변환 + ) + .bodyToFlux(String.class) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, + emitter::complete + ); + + return emitter; + } + + private UserModifyMessage getById(UUID messageId) { + return userModifyMessageJpaRepository.findById(messageId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } +} diff --git a/src/main/java/com/writely/product/service/ProductQueryService.java b/src/main/java/com/writely/product/service/ProductQueryService.java index 503a845..b913a22 100644 --- a/src/main/java/com/writely/product/service/ProductQueryService.java +++ b/src/main/java/com/writely/product/service/ProductQueryService.java @@ -51,4 +51,10 @@ public List getMemos(UUID productId) { .map(ProductMemoResponse::new) .toList(); } + + public void verifyExist(UUID productId) { + if (!productRepository.existsById(productId)) { + throw new BaseException(ProductException.NOT_EXIST); + } + } } From 337e2019bba4fc004797a57e86ef204b82309b07 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 8 Mar 2025 23:11:22 +0900 Subject: [PATCH 038/107] =?UTF-8?q?feat:=20feedback=20api=20=EC=97=B0?= =?UTF-8?q?=EB=8F=99=20=EB=B0=8F=20multi=20module=20=EC=A0=81=EC=9A=A9=20(?= =?UTF-8?q?#37)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- BE-secret | 2 +- Dockerfile | 6 +- api/build.gradle | 34 +++ .../main/java/writeon/api/ApiApplication.java | 28 ++ .../writeon/api}/HealthCheckController.java | 6 +- .../controller/AssistantController.java | 38 ++- .../request/AutoModifyMessageRequest.java | 2 +- .../request/FeedbackMessageRequest.java | 17 ++ .../request/UserModifyMessageRequest.java | 2 +- .../assistant/service/AutoModifyService.java | 80 ++++++ .../assistant/service/FeedbackService.java | 80 ++++++ .../assistant/service/UserModifyService.java | 81 ++++++ .../api}/auth/controller/AuthController.java | 16 +- .../writeon/api}/auth/helper/JwtHelper.java | 9 +- .../writeon/api}/auth/helper/MailHelper.java | 2 +- .../ChangePasswordCompletionRequest.java | 9 +- .../auth/request/ChangePasswordRequest.java | 7 +- .../api}/auth/request/CheckEmailRequest.java | 4 +- .../auth/request/JoinCompletionRequest.java | 2 +- .../api}/auth/request/JoinRequest.java | 8 +- .../api}/auth/request/LoginRequest.java | 7 +- .../api}/auth/request/ReissueRequest.java | 2 +- .../api}/auth/response/AuthTokenResponse.java | 2 +- .../auth/response/CheckEmailResponse.java | 2 +- .../api}/auth/response/LoginFailResponse.java | 2 +- .../api}/auth/service/AuthCommandService.java | 52 ++-- .../api}/auth/service/AuthQueryService.java | 8 +- .../api}/common/audit/CustomAuditorAware.java | 2 +- .../api}/common/config/AuditConfig.java | 4 +- .../writeon/api}/common/config/WebConfig.java | 36 +-- .../common/discord/DiscordLogAppender.java | 10 +- .../api}/common/discord/DiscordWebHook.java | 16 +- .../common/discord/model/EmbedObject.java | 2 +- .../api}/common/discord/model/Field.java | 2 +- .../api}/common/discord/model/JsonObject.java | 2 +- .../common/enums/code/ResultCodeInfo.java | 3 +- .../exception/InternalServerException.java | 4 +- .../enums/exception/ParameterException.java | 4 +- .../api}/common/exception/BaseException.java | 4 +- .../exception/GlobalExceptionHandler.java | 11 +- .../writeon/api}/common/filter/MDCFilter.java | 6 +- .../api}/common/resolver/AuthResolver.java | 12 +- .../api}/common/response/BaseResponse.java | 6 +- .../response/GlobalResponseBodyHandler.java | 4 +- .../writeon/api}/common/util/CryptoUtil.java | 2 +- .../api}/common/util/DateTimeUtil.java | 6 +- .../api}/common/util/HttpRequestUtil.java | 2 +- .../writeon/api}/common/util/LogUtil.java | 2 +- .../writeon/api}/common/util/MDCUtil.java | 2 +- .../writeon/api}/common/util/StringUtil.java | 2 +- .../api}/common/validation/IsEmail.java | 3 +- .../common/validation/IsEmailValidator.java | 2 +- .../api}/common/validation/IsPassword.java | 3 +- .../validation/IsPasswordValidator.java | 2 +- .../member/controller/MemberController.java | 8 +- .../member/response/MyProfileResponse.java | 4 +- .../member/service/MemberCommandService.java | 2 +- .../member/service/MemberQueryService.java | 14 +- .../product/controller/ProductController.java | 20 +- .../api}/product/repository/ProductDao.java | 4 +- .../request/ProductMemoSaveRequest.java | 2 +- .../product/request/ProductModifyRequest.java | 2 +- .../request/ProductTemplateSaveRequest.java | 6 +- .../response/ProductDetailResponse.java | 6 +- .../product/response/ProductMemoResponse.java | 4 +- .../product/response/ProductResponse.java | 2 +- .../response/ProductTemplateResponse.java | 4 +- .../service/ProductCommandService.java | 20 +- .../product/service/ProductQueryService.java | 24 +- .../terms/controller/TermsController.java | 15 +- .../api}/terms/repository/TermsDao.java | 4 +- .../api}/terms/request/TermsAgreeRequest.java | 4 +- .../terms/response/TermsDetailResponse.java | 4 +- .../terms/response/TermsSummaryResponse.java | 4 +- .../terms/service/TermsCommandService.java | 2 +- .../api}/terms/service/TermsQueryService.java | 16 +- .../src}/main/resources/logback-spring.xml | 0 .../templates/mail/change-password.html | 0 .../main/resources/templates/mail/join.html | 0 assistant-api-client/build.gradle | 17 ++ .../AssistantApiClient.java | 63 +++++ .../assistantapiclient/WebApiClient.java | 41 +++ .../config/AssistantApiClientConfig.java | 20 ++ .../AssistantConfigurationProperties.java | 15 ++ .../request/AutoModifyRequest.java | 20 ++ .../request/FeedbackRequest.java | 20 ++ .../request/UserModifyRequest.java | 22 ++ .../request/UserSetting.java | 49 +--- build.gradle | 138 +++------- domain/build.gradle | 76 ++++++ .../generated/writely/DefaultCatalog.java | 0 .../src}/main/generated/writely/Keys.java | 3 + .../src}/main/generated/writely/Public.java | 7 + .../src}/main/generated/writely/Routines.java | 0 .../src}/main/generated/writely/Tables.java | 6 + .../generated/writely/routines/Armor1.java | 0 .../generated/writely/routines/Armor2.java | 0 .../generated/writely/routines/Crypt.java | 0 .../generated/writely/routines/Dearmor.java | 0 .../generated/writely/routines/Decrypt.java | 0 .../generated/writely/routines/DecryptIv.java | 0 .../generated/writely/routines/Digest1.java | 0 .../generated/writely/routines/Digest2.java | 0 .../generated/writely/routines/Encrypt.java | 0 .../generated/writely/routines/EncryptIv.java | 0 .../writely/routines/GenRandomBytes.java | 0 .../writely/routines/GenRandomUuid.java | 0 .../generated/writely/routines/GenSalt1.java | 0 .../generated/writely/routines/GenSalt2.java | 0 .../generated/writely/routines/Hmac1.java | 0 .../generated/writely/routines/Hmac2.java | 0 .../generated/writely/routines/PgpKeyId.java | 0 .../writely/routines/PgpPubDecrypt1.java | 0 .../writely/routines/PgpPubDecrypt2.java | 0 .../writely/routines/PgpPubDecrypt3.java | 0 .../writely/routines/PgpPubDecryptBytea1.java | 0 .../writely/routines/PgpPubDecryptBytea2.java | 0 .../writely/routines/PgpPubDecryptBytea3.java | 0 .../writely/routines/PgpPubEncrypt1.java | 0 .../writely/routines/PgpPubEncrypt2.java | 0 .../writely/routines/PgpPubEncryptBytea1.java | 0 .../writely/routines/PgpPubEncryptBytea2.java | 0 .../writely/routines/PgpSymDecrypt1.java | 0 .../writely/routines/PgpSymDecrypt2.java | 0 .../writely/routines/PgpSymDecryptBytea1.java | 0 .../writely/routines/PgpSymDecryptBytea2.java | 0 .../writely/routines/PgpSymEncrypt1.java | 0 .../writely/routines/PgpSymEncrypt2.java | 0 .../writely/routines/PgpSymEncryptBytea1.java | 0 .../writely/routines/PgpSymEncryptBytea2.java | 0 .../writely/tables/AutoModifyMessage.java | 0 .../writely/tables/FeedbackMessage.java | 255 ++++++++++++++++++ .../writely/tables/LoginAttempt.java | 0 .../main/generated/writely/tables/Member.java | 0 .../writely/tables/MemberPassword.java | 0 .../writely/tables/PgpArmorHeaders.java | 0 .../generated/writely/tables/Product.java | 0 .../writely/tables/ProductCharacter.java | 0 .../writely/tables/ProductCustomField.java | 0 .../writely/tables/ProductIdeanote.java | 0 .../generated/writely/tables/ProductMemo.java | 0 .../generated/writely/tables/ProductPlot.java | 0 .../writely/tables/ProductSynopsis.java | 0 .../writely/tables/ProductWorldview.java | 0 .../main/generated/writely/tables/Terms.java | 0 .../writely/tables/TermsAgreement.java | 0 .../tables/pojos/AutoModifyMessage.java | 0 .../writely/tables/pojos/FeedbackMessage.java | 207 ++++++++++++++ .../writely/tables/pojos/LoginAttempt.java | 0 .../writely/tables/pojos/Member.java | 0 .../writely/tables/pojos/MemberPassword.java | 0 .../writely/tables/pojos/PgpArmorHeaders.java | 0 .../writely/tables/pojos/Product.java | 0 .../tables/pojos/ProductCharacter.java | 0 .../tables/pojos/ProductCustomField.java | 0 .../writely/tables/pojos/ProductIdeanote.java | 0 .../writely/tables/pojos/ProductMemo.java | 0 .../writely/tables/pojos/ProductPlot.java | 0 .../writely/tables/pojos/ProductSynopsis.java | 0 .../tables/pojos/ProductWorldview.java | 0 .../generated/writely/tables/pojos/Terms.java | 0 .../writely/tables/pojos/TermsAgreement.java | 0 .../records/AutoModifyMessageRecord.java | 0 .../tables/records/FeedbackMessageRecord.java | 199 ++++++++++++++ .../tables/records/LoginAttemptRecord.java | 0 .../tables/records/MemberPasswordRecord.java | 0 .../writely/tables/records/MemberRecord.java | 0 .../tables/records/PgpArmorHeadersRecord.java | 0 .../records/ProductCharacterRecord.java | 0 .../records/ProductCustomFieldRecord.java | 0 .../tables/records/ProductIdeanoteRecord.java | 0 .../tables/records/ProductMemoRecord.java | 0 .../tables/records/ProductPlotRecord.java | 0 .../writely/tables/records/ProductRecord.java | 0 .../tables/records/ProductSynopsisRecord.java | 0 .../records/ProductWorldviewRecord.java | 0 .../tables/records/TermsAgreementRecord.java | 0 .../writely/tables/records/TermsRecord.java | 0 .../domain/assistant}/MessageContent.java | 8 +- .../automodify/AutoModifyMessage.java | 8 +- .../AutoModifyMessageJpaRepository.java | 2 +- .../assistant}/enums/AssistantException.java | 4 +- .../assistant}/enums/MessageSenderRole.java | 6 +- .../assistant/feedback/FeedbackMessage.java | 40 +++ .../FeedbackMessageJpaRepository.java | 8 + .../usermodify/UserModifyMessage.java | 10 +- .../UserModifyMessageJpaRepository.java | 2 +- .../java/writeon/domain/auth}/BaseToken.java | 2 +- .../domain/auth}/ChangePasswordToken.java | 2 +- .../java/writeon/domain/auth}/JoinToken.java | 8 +- .../java/writeon/domain/auth}/JwtPayload.java | 2 +- .../writeon/domain/auth}/LoginAttempt.java | 6 +- .../writeon/domain/auth}/RefreshToken.java | 2 +- .../domain/auth}/enums/AuthException.java | 4 +- .../auth}/enums/LoginAttemptResultType.java | 6 +- .../ChangePasswordTokenRedisRepository.java | 4 +- .../repository/JoinTokenRedisRepository.java | 4 +- .../repository/LoginAttemptJpaRepository.java | 4 +- .../RefreshTokenRedisRepository.java | 4 +- .../domain/common}/BaseAuditTimeEntity.java | 7 +- .../domain/common}/BaseTimeEntity.java | 7 +- .../writeon/domain/common}/MemberSession.java | 2 +- .../converter/AbstractEnumCodeConverter.java | 4 +- .../writeon/domain}/common/enums/Codable.java | 2 +- .../domain/common/enums}/CodeInfo.java | 2 +- .../java/writeon/domain/member}/Member.java | 10 +- .../domain/member}/MemberPassword.java | 10 +- .../domain/member}/enums/MemberException.java | 4 +- .../repository/MemberJpaRepository.java | 4 +- .../MemberPasswordJpaRepository.java | 4 +- .../java/writeon/domain/product}/Product.java | 4 +- .../domain/product}/ProductCharacter.java | 4 +- .../domain/product}/ProductCustomField.java | 6 +- .../domain/product}/ProductIdeaNote.java | 9 +- .../writeon/domain/product}/ProductMemo.java | 9 +- .../writeon/domain/product}/ProductPlot.java | 9 +- .../domain/product}/ProductSynopsis.java | 9 +- .../domain/product}/ProductWorldview.java | 4 +- .../product}/enums/ProductException.java | 4 +- .../product}/enums/ProductSectionType.java | 6 +- .../ProductCharacterJpaRepository.java | 4 +- .../ProductCustomFieldJpaRepository.java | 4 +- .../ProductIdeaNoteJpaRepository.java | 4 +- .../repository/ProductJpaRepository.java | 4 +- .../repository/ProductMemoJpaRepository.java | 4 +- .../repository/ProductPlotJpaRepository.java | 4 +- .../ProductSynopsisJpaRepository.java | 4 +- .../ProductWorldviewJpaRepository.java | 4 +- .../java/writeon/domain/terms}/Terms.java | 6 +- .../writeon/domain/terms}/TermsAgreement.java | 6 +- .../domain/terms}/TermsAgreementId.java | 4 +- .../domain/terms}/enums/TermsCode.java | 6 +- .../domain/terms}/enums/TermsException.java | 4 +- .../repository/TermsAgreeJpaRepository.java | 4 +- .../terms/repository/TermsJpaRepository.java | 4 +- settings.gradle | 5 +- sql/init.sql | 30 ++- .../java/com/writely/WritelyApplication.java | 23 -- .../assistant/service/AutoModifyService.java | 90 ------- .../assistant/service/UserModifyService.java | 92 ------- .../common/config/WebClientConfig.java | 14 - 242 files changed, 1826 insertions(+), 743 deletions(-) create mode 100644 api/build.gradle create mode 100644 api/src/main/java/writeon/api/ApiApplication.java rename {src/main/java/com/writely => api/src/main/java/writeon/api}/HealthCheckController.java (82%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/assistant/controller/AssistantController.java (60%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/assistant/request/AutoModifyMessageRequest.java (88%) create mode 100644 api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java rename {src/main/java/com/writely => api/src/main/java/writeon/api}/assistant/request/UserModifyMessageRequest.java (90%) create mode 100644 api/src/main/java/writeon/api/assistant/service/AutoModifyService.java create mode 100644 api/src/main/java/writeon/api/assistant/service/FeedbackService.java create mode 100644 api/src/main/java/writeon/api/assistant/service/UserModifyService.java rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/controller/AuthController.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/helper/JwtHelper.java (95%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/helper/MailHelper.java (98%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/ChangePasswordCompletionRequest.java (79%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/ChangePasswordRequest.java (71%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/CheckEmailRequest.java (81%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/JoinCompletionRequest.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/JoinRequest.java (85%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/LoginRequest.java (75%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/request/ReissueRequest.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/response/AuthTokenResponse.java (96%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/response/CheckEmailResponse.java (93%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/response/LoginFailResponse.java (90%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/service/AuthCommandService.java (89%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/auth/service/AuthQueryService.java (73%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/audit/CustomAuditorAware.java (89%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/config/AuditConfig.java (84%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/config/WebConfig.java (53%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/discord/DiscordLogAppender.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/discord/DiscordWebHook.java (91%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/discord/model/EmbedObject.java (95%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/discord/model/Field.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/discord/model/JsonObject.java (97%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/enums/code/ResultCodeInfo.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/enums/exception/InternalServerException.java (82%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/enums/exception/ParameterException.java (84%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/exception/BaseException.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/exception/GlobalExceptionHandler.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/filter/MDCFilter.java (90%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/resolver/AuthResolver.java (85%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/response/BaseResponse.java (93%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/response/GlobalResponseBodyHandler.java (93%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/CryptoUtil.java (98%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/DateTimeUtil.java (95%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/HttpRequestUtil.java (98%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/LogUtil.java (97%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/MDCUtil.java (97%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/util/StringUtil.java (98%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/validation/IsEmail.java (86%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/validation/IsEmailValidator.java (92%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/validation/IsPassword.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/common/validation/IsPasswordValidator.java (92%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/member/controller/MemberController.java (78%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/member/response/MyProfileResponse.java (90%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/member/service/MemberCommandService.java (52%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/member/service/MemberQueryService.java (63%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/controller/ProductController.java (83%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/repository/ProductDao.java (84%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/request/ProductMemoSaveRequest.java (90%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/request/ProductModifyRequest.java (87%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/request/ProductTemplateSaveRequest.java (97%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/response/ProductDetailResponse.java (88%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/response/ProductMemoResponse.java (88%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/response/ProductResponse.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/response/ProductTemplateResponse.java (98%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/service/ProductCommandService.java (95%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/product/service/ProductQueryService.java (71%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/controller/TermsController.java (61%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/repository/TermsDao.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/request/TermsAgreeRequest.java (75%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/response/TermsDetailResponse.java (94%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/response/TermsSummaryResponse.java (89%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/service/TermsCommandService.java (82%) rename {src/main/java/com/writely => api/src/main/java/writeon/api}/terms/service/TermsQueryService.java (74%) rename {src => api/src}/main/resources/logback-spring.xml (100%) rename {src => api/src}/main/resources/templates/mail/change-password.html (100%) rename {src => api/src}/main/resources/templates/mail/join.html (100%) create mode 100644 assistant-api-client/build.gradle create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantApiClientConfig.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantConfigurationProperties.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java rename {src/main/java/com/writely/assistant => assistant-api-client/src/main/java/writeon/assistantapiclient}/request/UserSetting.java (67%) create mode 100644 domain/build.gradle rename {src => domain/src}/main/generated/writely/DefaultCatalog.java (100%) rename {src => domain/src}/main/generated/writely/Keys.java (94%) rename {src => domain/src}/main/generated/writely/Public.java (95%) rename {src => domain/src}/main/generated/writely/Routines.java (100%) rename {src => domain/src}/main/generated/writely/Tables.java (95%) rename {src => domain/src}/main/generated/writely/routines/Armor1.java (100%) rename {src => domain/src}/main/generated/writely/routines/Armor2.java (100%) rename {src => domain/src}/main/generated/writely/routines/Crypt.java (100%) rename {src => domain/src}/main/generated/writely/routines/Dearmor.java (100%) rename {src => domain/src}/main/generated/writely/routines/Decrypt.java (100%) rename {src => domain/src}/main/generated/writely/routines/DecryptIv.java (100%) rename {src => domain/src}/main/generated/writely/routines/Digest1.java (100%) rename {src => domain/src}/main/generated/writely/routines/Digest2.java (100%) rename {src => domain/src}/main/generated/writely/routines/Encrypt.java (100%) rename {src => domain/src}/main/generated/writely/routines/EncryptIv.java (100%) rename {src => domain/src}/main/generated/writely/routines/GenRandomBytes.java (100%) rename {src => domain/src}/main/generated/writely/routines/GenRandomUuid.java (100%) rename {src => domain/src}/main/generated/writely/routines/GenSalt1.java (100%) rename {src => domain/src}/main/generated/writely/routines/GenSalt2.java (100%) rename {src => domain/src}/main/generated/writely/routines/Hmac1.java (100%) rename {src => domain/src}/main/generated/writely/routines/Hmac2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpKeyId.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecrypt1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecrypt2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecrypt3.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecryptBytea1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecryptBytea2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubDecryptBytea3.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubEncrypt1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubEncrypt2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubEncryptBytea1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpPubEncryptBytea2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymDecrypt1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymDecrypt2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymDecryptBytea1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymDecryptBytea2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymEncrypt1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymEncrypt2.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymEncryptBytea1.java (100%) rename {src => domain/src}/main/generated/writely/routines/PgpSymEncryptBytea2.java (100%) rename {src => domain/src}/main/generated/writely/tables/AutoModifyMessage.java (100%) create mode 100644 domain/src/main/generated/writely/tables/FeedbackMessage.java rename {src => domain/src}/main/generated/writely/tables/LoginAttempt.java (100%) rename {src => domain/src}/main/generated/writely/tables/Member.java (100%) rename {src => domain/src}/main/generated/writely/tables/MemberPassword.java (100%) rename {src => domain/src}/main/generated/writely/tables/PgpArmorHeaders.java (100%) rename {src => domain/src}/main/generated/writely/tables/Product.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductCharacter.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductCustomField.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductIdeanote.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductMemo.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductPlot.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductSynopsis.java (100%) rename {src => domain/src}/main/generated/writely/tables/ProductWorldview.java (100%) rename {src => domain/src}/main/generated/writely/tables/Terms.java (100%) rename {src => domain/src}/main/generated/writely/tables/TermsAgreement.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/AutoModifyMessage.java (100%) create mode 100644 domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java rename {src => domain/src}/main/generated/writely/tables/pojos/LoginAttempt.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/Member.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/MemberPassword.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/PgpArmorHeaders.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/Product.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductCharacter.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductCustomField.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductIdeanote.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductMemo.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductPlot.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductSynopsis.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/ProductWorldview.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/Terms.java (100%) rename {src => domain/src}/main/generated/writely/tables/pojos/TermsAgreement.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/AutoModifyMessageRecord.java (100%) create mode 100644 domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java rename {src => domain/src}/main/generated/writely/tables/records/LoginAttemptRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/MemberPasswordRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/MemberRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/PgpArmorHeadersRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductCharacterRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductCustomFieldRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductIdeanoteRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductMemoRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductPlotRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductSynopsisRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/ProductWorldviewRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/TermsAgreementRecord.java (100%) rename {src => domain/src}/main/generated/writely/tables/records/TermsRecord.java (100%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/MessageContent.java (73%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/automodify/AutoModifyMessage.java (79%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/automodify/AutoModifyMessageJpaRepository.java (79%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/enums/AssistantException.java (87%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/enums/MessageSenderRole.java (79%) create mode 100644 domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java create mode 100644 domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/usermodify/UserModifyMessage.java (77%) rename {src/main/java/com/writely/assistant/domain => domain/src/main/java/writeon/domain/assistant}/usermodify/UserModifyMessageJpaRepository.java (79%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/BaseToken.java (92%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/ChangePasswordToken.java (92%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/JoinToken.java (81%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/JwtPayload.java (87%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/LoginAttempt.java (79%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/RefreshToken.java (94%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/enums/AuthException.java (94%) rename {src/main/java/com/writely/auth/domain => domain/src/main/java/writeon/domain/auth}/enums/LoginAttemptResultType.java (80%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/auth/repository/ChangePasswordTokenRedisRepository.java (65%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/auth/repository/JoinTokenRedisRepository.java (65%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/auth/repository/LoginAttemptJpaRepository.java (76%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/auth/repository/RefreshTokenRedisRepository.java (76%) rename {src/main/java/com/writely/common/domain => domain/src/main/java/writeon/domain/common}/BaseAuditTimeEntity.java (84%) rename {src/main/java/com/writely/common/domain => domain/src/main/java/writeon/domain/common}/BaseTimeEntity.java (78%) rename {src/main/java/com/writely/common/domain => domain/src/main/java/writeon/domain/common}/MemberSession.java (85%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/common/converter/AbstractEnumCodeConverter.java (88%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/common/enums/Codable.java (93%) rename {src/main/java/com/writely/common/enums/code => domain/src/main/java/writeon/domain/common/enums}/CodeInfo.java (79%) rename {src/main/java/com/writely/member/domain => domain/src/main/java/writeon/domain/member}/Member.java (70%) rename {src/main/java/com/writely/member/domain => domain/src/main/java/writeon/domain/member}/MemberPassword.java (63%) rename {src/main/java/com/writely/member/domain => domain/src/main/java/writeon/domain/member}/enums/MemberException.java (81%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/member/repository/MemberJpaRepository.java (75%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/member/repository/MemberPasswordJpaRepository.java (75%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/Product.java (94%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductCharacter.java (96%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductCustomField.java (90%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductIdeaNote.java (76%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductMemo.java (87%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductPlot.java (72%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductSynopsis.java (85%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/ProductWorldview.java (97%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/enums/ProductException.java (88%) rename {src/main/java/com/writely/product/domain => domain/src/main/java/writeon/domain/product}/enums/ProductSectionType.java (88%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductCharacterJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductCustomFieldJpaRepository.java (87%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductIdeaNoteJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductMemoJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductPlotJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductSynopsisJpaRepository.java (66%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/product/repository/ProductWorldviewJpaRepository.java (66%) rename {src/main/java/com/writely/terms/domain => domain/src/main/java/writeon/domain/terms}/Terms.java (85%) rename {src/main/java/com/writely/terms/domain => domain/src/main/java/writeon/domain/terms}/TermsAgreement.java (78%) rename {src/main/java/com/writely/terms/domain => domain/src/main/java/writeon/domain/terms}/TermsAgreementId.java (87%) rename {src/main/java/com/writely/terms/domain => domain/src/main/java/writeon/domain/terms}/enums/TermsCode.java (88%) rename {src/main/java/com/writely/terms/domain => domain/src/main/java/writeon/domain/terms}/enums/TermsException.java (81%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/terms/repository/TermsAgreeJpaRepository.java (64%) rename {src/main/java/com/writely => domain/src/main/java/writeon/domain}/terms/repository/TermsJpaRepository.java (72%) delete mode 100644 src/main/java/com/writely/WritelyApplication.java delete mode 100644 src/main/java/com/writely/assistant/service/AutoModifyService.java delete mode 100644 src/main/java/com/writely/assistant/service/UserModifyService.java delete mode 100644 src/main/java/com/writely/common/config/WebClientConfig.java diff --git a/.gitignore b/.gitignore index 47ee6f5..e468764 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,4 @@ out/ *.pid ### secrets ### -**/src/main/resources/**/application*.yml \ No newline at end of file +application*.yml \ No newline at end of file diff --git a/BE-secret b/BE-secret index fe8d57e..794ad02 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit fe8d57ecbb4d9e4f0275289ed9ceefe467b9e489 +Subproject commit 794ad02dd1d2a8b6c8bf8744d5bc4d80c1ec3283 diff --git a/Dockerfile b/Dockerfile index a0011cc..c3bccc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM openjdk:21-jdk-slim -WORKDIR /writely +WORKDIR /writeon ENV TZ=Asiz/Seoul -COPY build/libs/*.jar writely.jar +COPY api/build/libs/*.jar writeon.jar -ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "writely.jar"] \ No newline at end of file +ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "writeon.jar"] \ No newline at end of file diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 0000000..71e8667 --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,34 @@ +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-webflux' + + /* Mail */ + implementation 'org.springframework.boot:spring-boot-starter-mail' + + /* Template engine */ + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' + + /* Swagger */ + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' + + implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64' + + implementation project(':assistant-api-client') + implementation project(':domain') +} + +jar { + enabled = false +} + +task copySecret(type: Copy) { + copy { + from '../BE-secret/api' + include "*.yml" + into 'src/main/resources' + } +} + +tasks.named('bootJar') { + mainClass = 'writeon.api.ApiApplication' +} \ No newline at end of file diff --git a/api/src/main/java/writeon/api/ApiApplication.java b/api/src/main/java/writeon/api/ApiApplication.java new file mode 100644 index 0000000..5f72d6a --- /dev/null +++ b/api/src/main/java/writeon/api/ApiApplication.java @@ -0,0 +1,28 @@ +package writeon.api; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; + +@SpringBootApplication +@ComponentScan(basePackages = {"writeon.api", "writeon.assistantapiclient"}) +@EntityScan(basePackages = "writeon.domain") +@EnableJpaRepositories( + basePackages = "writeon.domain", + includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*JpaRepository") +) +@EnableRedisRepositories( + basePackages = "writeon.domain", + includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*RedisRepository") +) +public class ApiApplication { + + public static void main(String[] args) { + SpringApplication.run(ApiApplication.class, args); + } + +} diff --git a/src/main/java/com/writely/HealthCheckController.java b/api/src/main/java/writeon/api/HealthCheckController.java similarity index 82% rename from src/main/java/com/writely/HealthCheckController.java rename to api/src/main/java/writeon/api/HealthCheckController.java index 543f087..66992e3 100644 --- a/src/main/java/com/writely/HealthCheckController.java +++ b/api/src/main/java/writeon/api/HealthCheckController.java @@ -1,7 +1,7 @@ -package com.writely; +package writeon.api; -import com.writely.common.enums.exception.ParameterException; -import com.writely.common.exception.BaseException; +import writeon.api.common.enums.exception.ParameterException; +import writeon.api.common.exception.BaseException; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/src/main/java/com/writely/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java similarity index 60% rename from src/main/java/com/writely/assistant/controller/AssistantController.java rename to api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 671de22..86a2611 100644 --- a/src/main/java/com/writely/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,9 +1,5 @@ -package com.writely.assistant.controller; +package writeon.api.assistant.controller; -import com.writely.assistant.request.AutoModifyMessageRequest; -import com.writely.assistant.request.UserModifyMessageRequest; -import com.writely.assistant.service.AutoModifyService; -import com.writely.assistant.service.UserModifyService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; @@ -12,6 +8,12 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.AutoModifyMessageRequest; +import writeon.api.assistant.request.FeedbackMessageRequest; +import writeon.api.assistant.request.UserModifyMessageRequest; +import writeon.api.assistant.service.AutoModifyService; +import writeon.api.assistant.service.FeedbackService; +import writeon.api.assistant.service.UserModifyService; import java.util.UUID; @@ -22,6 +24,7 @@ public class AssistantController { private final AutoModifyService autoModifyService; + private final FeedbackService feedbackService; private final UserModifyService userModifyService; @Operation(summary = "자동 수정 메세지 저장") @@ -30,6 +33,12 @@ public UUID createAutoModifyMessage(@RequestBody AutoModifyMessageRequest reques return autoModifyService.createMessage(request); } + @Operation(summary = "구간 피드백 메세지 저장") + @PostMapping("/feedback/messages") + public UUID createFeedbackMessage(@RequestBody FeedbackMessageRequest request) { + return feedbackService.createMessage(request); + } + @Operation(summary = "수동 수정 메세지 저장") @PostMapping("/user-modify/messages") public UUID createUserModifyMessage(@RequestBody UserModifyMessageRequest request) { @@ -38,22 +47,33 @@ public UUID createUserModifyMessage(@RequestBody UserModifyMessageRequest reques @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") - public SseEmitter streamAutoModifyMessage( + public SseEmitter streamAutoModify( + @RequestParam UUID productId, + @RequestParam UUID messageId + ) { + SseEmitter emitter = autoModifyService.streamAutoModify(productId, messageId); + setResponseHeaderForSSE(); + return emitter; + } + + @Operation(summary = "구간 피드백 스트리밍") + @GetMapping("/feedback/stream") + public SseEmitter streamFeedback( @RequestParam UUID productId, @RequestParam UUID messageId ) { - SseEmitter emitter = autoModifyService.sendMessage(productId, messageId); + SseEmitter emitter = feedbackService.streamFeedback(productId, messageId); setResponseHeaderForSSE(); return emitter; } @Operation(summary = "수동 수정 스트리밍") @GetMapping("/user-modify/stream") - public SseEmitter streamUserModifyMessage( + public SseEmitter streamUserModify( @RequestParam UUID productId, @RequestParam UUID messageId ) { - SseEmitter emitter = userModifyService.sendMessage(productId, messageId); + SseEmitter emitter = userModifyService.streamUserModify(productId, messageId); setResponseHeaderForSSE(); return emitter; } diff --git a/src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java similarity index 88% rename from src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java index b16bc08..94b71f4 100644 --- a/src/main/java/com/writely/assistant/request/AutoModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java @@ -1,4 +1,4 @@ -package com.writely.assistant.request; +package writeon.api.assistant.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java new file mode 100644 index 0000000..2639721 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java @@ -0,0 +1,17 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class FeedbackMessageRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "내용") + private String content; +} diff --git a/src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java similarity index 90% rename from src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java index 6c1ee5c..7111219 100644 --- a/src/main/java/com/writely/assistant/request/UserModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java @@ -1,4 +1,4 @@ -package com.writely.assistant.request; +package writeon.api.assistant.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java new file mode 100644 index 0000000..bb71ad5 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -0,0 +1,80 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.AutoModifyMessageRequest; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.AutoModifyRequest; +import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.automodify.AutoModifyMessage; +import writeon.domain.assistant.automodify.AutoModifyMessageJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.MessageSenderRole; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class AutoModifyService { + + private final long TIMEOUT = 180_000L; + + private final AutoModifyMessageJpaRepository autoModifyMessageRepository; + private final ProductQueryService productQueryService; + private final AssistantApiClient assistantApiClient; + + @Transactional + public UUID createMessage(AutoModifyMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + AutoModifyMessage memberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); + return autoModifyMessageRepository.save(memberMessage).getId(); + } + + public SseEmitter streamAutoModify(UUID productId, UUID messageId) { + productQueryService.verifyExist(productId); + AutoModifyMessage message = getById(messageId); + + UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + AutoModifyRequest request = new AutoModifyRequest(userSetting, message.getContent()); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + StringBuilder responseBuilder = new StringBuilder(); + + assistantApiClient.streamAutoModify(request) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + responseBuilder.append(data); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, + () -> { + AutoModifyMessage assistantMessage = new AutoModifyMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); + autoModifyMessageRepository.save(assistantMessage); + emitter.complete(); + } + ); + + return emitter; + } + + private AutoModifyMessage getById(UUID messageId) { + return autoModifyMessageRepository.findById(messageId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java new file mode 100644 index 0000000..f246d4f --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -0,0 +1,80 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.FeedbackMessageRequest; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.FeedbackRequest; +import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.assistant.feedback.FeedbackMessage; +import writeon.domain.assistant.feedback.FeedbackMessageJpaRepository; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class FeedbackService { + + private final long TIMEOUT = 180_000L; + + private final FeedbackMessageJpaRepository feedbackMessageRepository; + private final ProductQueryService productQueryService; + private final AssistantApiClient assistantApiClient; + + @Transactional + public UUID createMessage(FeedbackMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + FeedbackMessage memberMessage = new FeedbackMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); + return feedbackMessageRepository.save(memberMessage).getId(); + } + + public SseEmitter streamFeedback(UUID productId, UUID messageId) { + productQueryService.verifyExist(productId); + FeedbackMessage message = getById(messageId); + + UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + FeedbackRequest request = new FeedbackRequest(userSetting, message.getContent()); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + StringBuilder responseBuilder = new StringBuilder(); + + assistantApiClient.streamFeedback(request) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + responseBuilder.append(data); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, + () -> { + FeedbackMessage assistantMessage = new FeedbackMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); + feedbackMessageRepository.save(assistantMessage); + emitter.complete(); + } + ); + + return emitter; + } + + private FeedbackMessage getById(UUID messageId) { + return feedbackMessageRepository.findById(messageId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java new file mode 100644 index 0000000..544a64d --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -0,0 +1,81 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.UserModifyMessageRequest; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.UserModifyRequest; +import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.assistant.usermodify.UserModifyMessage; +import writeon.domain.assistant.usermodify.UserModifyMessageJpaRepository; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class UserModifyService { + + private final long TIMEOUT = 180_000L; + + private final UserModifyMessageJpaRepository userModifyMessageRepository; + private final ProductQueryService productQueryService; + private final AssistantApiClient assistantApiClient; + + @Transactional + public UUID createMessage(UserModifyMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UserModifyMessage memberMessage = + new UserModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + return userModifyMessageRepository.save(memberMessage).getId(); + } + + public SseEmitter streamUserModify(UUID productId, UUID messageId) { + productQueryService.verifyExist(productId); + UserModifyMessage message = getById(messageId); + + UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + UserModifyRequest request = new UserModifyRequest(userSetting, message.getContent(), message.getPrompt()); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + StringBuilder responseBuilder = new StringBuilder(); + + assistantApiClient.streamUserModify(request) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + responseBuilder.append(data); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, + () -> { + UserModifyMessage assistantMessage = new UserModifyMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + userModifyMessageRepository.save(assistantMessage); + emitter.complete(); + } + ); + + return emitter; + } + + private UserModifyMessage getById(UUID messageId) { + return userModifyMessageRepository.findById(messageId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } +} diff --git a/src/main/java/com/writely/auth/controller/AuthController.java b/api/src/main/java/writeon/api/auth/controller/AuthController.java similarity index 87% rename from src/main/java/com/writely/auth/controller/AuthController.java rename to api/src/main/java/writeon/api/auth/controller/AuthController.java index 7e234af..fc0980d 100644 --- a/src/main/java/com/writely/auth/controller/AuthController.java +++ b/api/src/main/java/writeon/api/auth/controller/AuthController.java @@ -1,17 +1,17 @@ -package com.writely.auth.controller; - -import com.writely.auth.request.*; -import com.writely.auth.response.AuthTokenResponse; -import com.writely.auth.response.CheckEmailResponse; -import com.writely.auth.service.AuthCommandService; -import com.writely.auth.service.AuthQueryService; -import com.writely.common.domain.MemberSession; +package writeon.api.auth.controller; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import writeon.api.auth.request.*; +import writeon.api.auth.response.AuthTokenResponse; +import writeon.api.auth.response.CheckEmailResponse; +import writeon.api.auth.service.AuthCommandService; +import writeon.api.auth.service.AuthQueryService; +import writeon.domain.common.MemberSession; @RestController @RequiredArgsConstructor diff --git a/src/main/java/com/writely/auth/helper/JwtHelper.java b/api/src/main/java/writeon/api/auth/helper/JwtHelper.java similarity index 95% rename from src/main/java/com/writely/auth/helper/JwtHelper.java rename to api/src/main/java/writeon/api/auth/helper/JwtHelper.java index bd2b337..f69657f 100644 --- a/src/main/java/com/writely/auth/helper/JwtHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/JwtHelper.java @@ -1,16 +1,15 @@ -package com.writely.auth.helper; +package writeon.api.auth.helper; import com.auth0.jwt.JWT; import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.algorithms.Algorithm; -import com.fasterxml.jackson.core.JsonProcessingException; +import com.auth0.jwt.exceptions.JWTVerificationException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.writely.auth.domain.JwtPayload; -import com.writely.common.util.CryptoUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import com.auth0.jwt.exceptions.JWTVerificationException; +import writeon.api.common.util.CryptoUtil; +import writeon.domain.auth.JwtPayload; import java.io.IOException; import java.time.Instant; diff --git a/src/main/java/com/writely/auth/helper/MailHelper.java b/api/src/main/java/writeon/api/auth/helper/MailHelper.java similarity index 98% rename from src/main/java/com/writely/auth/helper/MailHelper.java rename to api/src/main/java/writeon/api/auth/helper/MailHelper.java index 10090b8..6db92d7 100644 --- a/src/main/java/com/writely/auth/helper/MailHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/MailHelper.java @@ -1,4 +1,4 @@ -package com.writely.auth.helper; +package writeon.api.auth.helper; import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; diff --git a/src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java b/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java similarity index 79% rename from src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java rename to api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java index a7519a3..576bde1 100644 --- a/src/main/java/com/writely/auth/request/ChangePasswordCompletionRequest.java +++ b/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java @@ -1,9 +1,12 @@ -package com.writely.auth.request; +package writeon.api.auth.request; -import com.writely.common.validation.IsPassword; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; -import lombok.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.api.common.validation.IsPassword; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/src/main/java/com/writely/auth/request/ChangePasswordRequest.java b/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java similarity index 71% rename from src/main/java/com/writely/auth/request/ChangePasswordRequest.java rename to api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java index 1e31f14..9928fce 100644 --- a/src/main/java/com/writely/auth/request/ChangePasswordRequest.java +++ b/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java @@ -1,8 +1,11 @@ -package com.writely.auth.request; +package writeon.api.auth.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; -import lombok.*; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/src/main/java/com/writely/auth/request/CheckEmailRequest.java b/api/src/main/java/writeon/api/auth/request/CheckEmailRequest.java similarity index 81% rename from src/main/java/com/writely/auth/request/CheckEmailRequest.java rename to api/src/main/java/writeon/api/auth/request/CheckEmailRequest.java index 7dcabc3..1b48760 100644 --- a/src/main/java/com/writely/auth/request/CheckEmailRequest.java +++ b/api/src/main/java/writeon/api/auth/request/CheckEmailRequest.java @@ -1,6 +1,6 @@ -package com.writely.auth.request; +package writeon.api.auth.request; -import com.writely.common.validation.IsEmail; +import writeon.api.common.validation.IsEmail; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Getter; diff --git a/src/main/java/com/writely/auth/request/JoinCompletionRequest.java b/api/src/main/java/writeon/api/auth/request/JoinCompletionRequest.java similarity index 94% rename from src/main/java/com/writely/auth/request/JoinCompletionRequest.java rename to api/src/main/java/writeon/api/auth/request/JoinCompletionRequest.java index a77745e..6327a1a 100644 --- a/src/main/java/com/writely/auth/request/JoinCompletionRequest.java +++ b/api/src/main/java/writeon/api/auth/request/JoinCompletionRequest.java @@ -1,4 +1,4 @@ -package com.writely.auth.request; +package writeon.api.auth.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/writely/auth/request/JoinRequest.java b/api/src/main/java/writeon/api/auth/request/JoinRequest.java similarity index 85% rename from src/main/java/com/writely/auth/request/JoinRequest.java rename to api/src/main/java/writeon/api/auth/request/JoinRequest.java index 5101c75..ec413b1 100644 --- a/src/main/java/com/writely/auth/request/JoinRequest.java +++ b/api/src/main/java/writeon/api/auth/request/JoinRequest.java @@ -1,8 +1,8 @@ -package com.writely.auth.request; +package writeon.api.auth.request; -import com.writely.common.validation.IsEmail; -import com.writely.common.validation.IsPassword; -import com.writely.terms.request.TermsAgreeRequest; +import writeon.api.common.validation.IsEmail; +import writeon.api.common.validation.IsPassword; +import writeon.api.terms.request.TermsAgreeRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/writely/auth/request/LoginRequest.java b/api/src/main/java/writeon/api/auth/request/LoginRequest.java similarity index 75% rename from src/main/java/com/writely/auth/request/LoginRequest.java rename to api/src/main/java/writeon/api/auth/request/LoginRequest.java index 0702b27..3530ffa 100644 --- a/src/main/java/com/writely/auth/request/LoginRequest.java +++ b/api/src/main/java/writeon/api/auth/request/LoginRequest.java @@ -1,10 +1,9 @@ -package com.writely.auth.request; +package writeon.api.auth.request; -import com.writely.common.validation.IsEmail; -import com.writely.common.validation.IsPassword; +import writeon.api.common.validation.IsEmail; +import writeon.api.common.validation.IsPassword; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/writely/auth/request/ReissueRequest.java b/api/src/main/java/writeon/api/auth/request/ReissueRequest.java similarity index 94% rename from src/main/java/com/writely/auth/request/ReissueRequest.java rename to api/src/main/java/writeon/api/auth/request/ReissueRequest.java index 9d460f7..2a8ed03 100644 --- a/src/main/java/com/writely/auth/request/ReissueRequest.java +++ b/api/src/main/java/writeon/api/auth/request/ReissueRequest.java @@ -1,4 +1,4 @@ -package com.writely.auth.request; +package writeon.api.auth.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/writely/auth/response/AuthTokenResponse.java b/api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java similarity index 96% rename from src/main/java/com/writely/auth/response/AuthTokenResponse.java rename to api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java index 512c745..85447a1 100644 --- a/src/main/java/com/writely/auth/response/AuthTokenResponse.java +++ b/api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java @@ -1,4 +1,4 @@ -package com.writely.auth.response; +package writeon.api.auth.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/src/main/java/com/writely/auth/response/CheckEmailResponse.java b/api/src/main/java/writeon/api/auth/response/CheckEmailResponse.java similarity index 93% rename from src/main/java/com/writely/auth/response/CheckEmailResponse.java rename to api/src/main/java/writeon/api/auth/response/CheckEmailResponse.java index 50baca4..f56fabb 100644 --- a/src/main/java/com/writely/auth/response/CheckEmailResponse.java +++ b/api/src/main/java/writeon/api/auth/response/CheckEmailResponse.java @@ -1,4 +1,4 @@ -package com.writely.auth.response; +package writeon.api.auth.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/writely/auth/response/LoginFailResponse.java b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java similarity index 90% rename from src/main/java/com/writely/auth/response/LoginFailResponse.java rename to api/src/main/java/writeon/api/auth/response/LoginFailResponse.java index 31dafde..a8c4e61 100644 --- a/src/main/java/com/writely/auth/response/LoginFailResponse.java +++ b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java @@ -1,4 +1,4 @@ -package com.writely.auth.response; +package writeon.api.auth.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; diff --git a/src/main/java/com/writely/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java similarity index 89% rename from src/main/java/com/writely/auth/service/AuthCommandService.java rename to api/src/main/java/writeon/api/auth/service/AuthCommandService.java index ef39b97..8fb8182 100644 --- a/src/main/java/com/writely/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -1,34 +1,34 @@ -package com.writely.auth.service; - -import com.writely.auth.domain.*; -import com.writely.auth.domain.enums.AuthException; -import com.writely.auth.domain.enums.LoginAttemptResultType; -import com.writely.auth.helper.JwtHelper; -import com.writely.auth.helper.MailHelper; -import com.writely.auth.repository.ChangePasswordTokenRedisRepository; -import com.writely.auth.repository.JoinTokenRedisRepository; -import com.writely.auth.repository.LoginAttemptJpaRepository; -import com.writely.auth.repository.RefreshTokenRedisRepository; -import com.writely.auth.request.*; -import com.writely.auth.response.AuthTokenResponse; -import com.writely.auth.response.LoginFailResponse; -import com.writely.common.enums.code.ResultCodeInfo; -import com.writely.common.exception.BaseException; -import com.writely.common.util.CryptoUtil; -import com.writely.member.domain.Member; -import com.writely.member.domain.MemberPassword; -import com.writely.member.repository.MemberPasswordJpaRepository; -import com.writely.member.repository.MemberJpaRepository; -import com.writely.terms.domain.TermsAgreement; -import com.writely.terms.domain.enums.TermsCode; -import com.writely.terms.repository.TermsAgreeJpaRepository; -import com.writely.terms.request.TermsAgreeRequest; -import com.writely.terms.service.TermsQueryService; +package writeon.api.auth.service; + import jakarta.mail.MessagingException; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import writeon.api.auth.helper.JwtHelper; +import writeon.api.auth.helper.MailHelper; +import writeon.api.auth.request.*; +import writeon.api.auth.response.AuthTokenResponse; +import writeon.api.auth.response.LoginFailResponse; +import writeon.api.common.enums.code.ResultCodeInfo; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.CryptoUtil; +import writeon.api.terms.request.TermsAgreeRequest; +import writeon.api.terms.service.TermsQueryService; +import writeon.domain.auth.*; +import writeon.domain.auth.enums.AuthException; +import writeon.domain.auth.enums.LoginAttemptResultType; +import writeon.domain.auth.repository.ChangePasswordTokenRedisRepository; +import writeon.domain.auth.repository.JoinTokenRedisRepository; +import writeon.domain.auth.repository.LoginAttemptJpaRepository; +import writeon.domain.auth.repository.RefreshTokenRedisRepository; +import writeon.domain.member.Member; +import writeon.domain.member.MemberPassword; +import writeon.domain.member.repository.MemberJpaRepository; +import writeon.domain.member.repository.MemberPasswordJpaRepository; +import writeon.domain.terms.TermsAgreement; +import writeon.domain.terms.enums.TermsCode; +import writeon.domain.terms.repository.TermsAgreeJpaRepository; import java.time.LocalDateTime; import java.util.List; diff --git a/src/main/java/com/writely/auth/service/AuthQueryService.java b/api/src/main/java/writeon/api/auth/service/AuthQueryService.java similarity index 73% rename from src/main/java/com/writely/auth/service/AuthQueryService.java rename to api/src/main/java/writeon/api/auth/service/AuthQueryService.java index 4ba8391..f6b68b9 100644 --- a/src/main/java/com/writely/auth/service/AuthQueryService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthQueryService.java @@ -1,11 +1,11 @@ -package com.writely.auth.service; +package writeon.api.auth.service; -import com.writely.auth.request.CheckEmailRequest; -import com.writely.auth.response.CheckEmailResponse; -import com.writely.member.repository.MemberJpaRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.auth.request.CheckEmailRequest; +import writeon.api.auth.response.CheckEmailResponse; +import writeon.domain.member.repository.MemberJpaRepository; @RequiredArgsConstructor @Transactional(readOnly = true) diff --git a/src/main/java/com/writely/common/audit/CustomAuditorAware.java b/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java similarity index 89% rename from src/main/java/com/writely/common/audit/CustomAuditorAware.java rename to api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java index 207d527..3f865de 100644 --- a/src/main/java/com/writely/common/audit/CustomAuditorAware.java +++ b/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java @@ -1,4 +1,4 @@ -package com.writely.common.audit; +package writeon.api.common.audit; import org.springframework.data.domain.AuditorAware; diff --git a/src/main/java/com/writely/common/config/AuditConfig.java b/api/src/main/java/writeon/api/common/config/AuditConfig.java similarity index 84% rename from src/main/java/com/writely/common/config/AuditConfig.java rename to api/src/main/java/writeon/api/common/config/AuditConfig.java index 8fd8f0c..b08654f 100644 --- a/src/main/java/com/writely/common/config/AuditConfig.java +++ b/api/src/main/java/writeon/api/common/config/AuditConfig.java @@ -1,6 +1,6 @@ -package com.writely.common.config; +package writeon.api.common.config; -import com.writely.common.audit.CustomAuditorAware; +import writeon.api.common.audit.CustomAuditorAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.AuditorAware; diff --git a/src/main/java/com/writely/common/config/WebConfig.java b/api/src/main/java/writeon/api/common/config/WebConfig.java similarity index 53% rename from src/main/java/com/writely/common/config/WebConfig.java rename to api/src/main/java/writeon/api/common/config/WebConfig.java index 331189e..3e1b373 100644 --- a/src/main/java/com/writely/common/config/WebConfig.java +++ b/api/src/main/java/writeon/api/common/config/WebConfig.java @@ -1,7 +1,5 @@ - package com.writely.common.config; +package writeon.api.common.config; -import com.writely.common.resolver.AuthResolver; -import com.writely.terms.domain.enums.TermsCode; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -9,32 +7,34 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import writeon.api.common.resolver.AuthResolver; +import writeon.domain.terms.enums.TermsCode; import java.util.List; @Configuration @RequiredArgsConstructor public class WebConfig implements WebMvcConfigurer { - @Value("${service.cors.origins}") - private final List origins; - private final AuthResolver authResolver; + @Value("${service.cors.origins}") + private final List origins; + private final AuthResolver authResolver; - @Override - public void addArgumentResolvers(List resolvers) { - resolvers.add(authResolver); - } + @Override + public void addArgumentResolvers(List resolvers) { + resolvers.add(authResolver); + } - @Override - public void addFormatters(FormatterRegistry registry) { - registry.addConverter(new TermsCode.SpringConverter()); - } + @Override + public void addFormatters(FormatterRegistry registry) { + registry.addConverter(new TermsCode.SpringConverter()); + } - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") .allowedOrigins(origins.toArray(new String[0])) .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") .allowedHeaders("*") .allowCredentials(true); - } + } } diff --git a/src/main/java/com/writely/common/discord/DiscordLogAppender.java b/api/src/main/java/writeon/api/common/discord/DiscordLogAppender.java similarity index 94% rename from src/main/java/com/writely/common/discord/DiscordLogAppender.java rename to api/src/main/java/writeon/api/common/discord/DiscordLogAppender.java index 68982c5..1e124ee 100644 --- a/src/main/java/com/writely/common/discord/DiscordLogAppender.java +++ b/api/src/main/java/writeon/api/common/discord/DiscordLogAppender.java @@ -1,12 +1,12 @@ -package com.writely.common.discord; +package writeon.api.common.discord; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.UnsynchronizedAppenderBase; -import com.writely.common.discord.model.EmbedObject; -import com.writely.common.enums.exception.InternalServerException; -import com.writely.common.exception.BaseException; -import com.writely.common.util.MDCUtil; +import writeon.api.common.discord.model.EmbedObject; +import writeon.api.common.enums.exception.InternalServerException; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.MDCUtil; import lombok.Setter; import org.springframework.context.annotation.Profile; diff --git a/src/main/java/com/writely/common/discord/DiscordWebHook.java b/api/src/main/java/writeon/api/common/discord/DiscordWebHook.java similarity index 91% rename from src/main/java/com/writely/common/discord/DiscordWebHook.java rename to api/src/main/java/writeon/api/common/discord/DiscordWebHook.java index 51bf174..4f35354 100644 --- a/src/main/java/com/writely/common/discord/DiscordWebHook.java +++ b/api/src/main/java/writeon/api/common/discord/DiscordWebHook.java @@ -1,11 +1,11 @@ -package com.writely.common.discord; - -import com.writely.common.discord.model.EmbedObject; -import com.writely.common.discord.model.Field; -import com.writely.common.discord.model.JsonObject; -import com.writely.common.enums.exception.InternalServerException; -import com.writely.common.exception.BaseException; -import com.writely.common.util.LogUtil; +package writeon.api.common.discord; + +import writeon.api.common.discord.model.EmbedObject; +import writeon.api.common.discord.model.Field; +import writeon.api.common.discord.model.JsonObject; +import writeon.api.common.enums.exception.InternalServerException; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; import org.springframework.web.reactive.function.client.WebClient; import java.awt.*; diff --git a/src/main/java/com/writely/common/discord/model/EmbedObject.java b/api/src/main/java/writeon/api/common/discord/model/EmbedObject.java similarity index 95% rename from src/main/java/com/writely/common/discord/model/EmbedObject.java rename to api/src/main/java/writeon/api/common/discord/model/EmbedObject.java index ac2178d..73f39a0 100644 --- a/src/main/java/com/writely/common/discord/model/EmbedObject.java +++ b/api/src/main/java/writeon/api/common/discord/model/EmbedObject.java @@ -1,4 +1,4 @@ -package com.writely.common.discord.model; +package writeon.api.common.discord.model; import lombok.Getter; diff --git a/src/main/java/com/writely/common/discord/model/Field.java b/api/src/main/java/writeon/api/common/discord/model/Field.java similarity index 87% rename from src/main/java/com/writely/common/discord/model/Field.java rename to api/src/main/java/writeon/api/common/discord/model/Field.java index 8fafb6e..25d3782 100644 --- a/src/main/java/com/writely/common/discord/model/Field.java +++ b/api/src/main/java/writeon/api/common/discord/model/Field.java @@ -1,4 +1,4 @@ -package com.writely.common.discord.model; +package writeon.api.common.discord.model; import lombok.Getter; diff --git a/src/main/java/com/writely/common/discord/model/JsonObject.java b/api/src/main/java/writeon/api/common/discord/model/JsonObject.java similarity index 97% rename from src/main/java/com/writely/common/discord/model/JsonObject.java rename to api/src/main/java/writeon/api/common/discord/model/JsonObject.java index 72f4ffe..91a7531 100644 --- a/src/main/java/com/writely/common/discord/model/JsonObject.java +++ b/api/src/main/java/writeon/api/common/discord/model/JsonObject.java @@ -1,4 +1,4 @@ -package com.writely.common.discord.model; +package writeon.api.common.discord.model; import java.lang.reflect.Array; import java.util.HashMap; diff --git a/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java b/api/src/main/java/writeon/api/common/enums/code/ResultCodeInfo.java similarity index 87% rename from src/main/java/com/writely/common/enums/code/ResultCodeInfo.java rename to api/src/main/java/writeon/api/common/enums/code/ResultCodeInfo.java index 1580931..fd5b228 100644 --- a/src/main/java/com/writely/common/enums/code/ResultCodeInfo.java +++ b/api/src/main/java/writeon/api/common/enums/code/ResultCodeInfo.java @@ -1,8 +1,9 @@ -package com.writely.common.enums.code; +package writeon.api.common.enums.code; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/common/enums/exception/InternalServerException.java b/api/src/main/java/writeon/api/common/enums/exception/InternalServerException.java similarity index 82% rename from src/main/java/com/writely/common/enums/exception/InternalServerException.java rename to api/src/main/java/writeon/api/common/enums/exception/InternalServerException.java index 1d8d8cb..9b1ed1f 100644 --- a/src/main/java/com/writely/common/enums/exception/InternalServerException.java +++ b/api/src/main/java/writeon/api/common/enums/exception/InternalServerException.java @@ -1,9 +1,9 @@ -package com.writely.common.enums.exception; +package writeon.api.common.enums.exception; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/common/enums/exception/ParameterException.java b/api/src/main/java/writeon/api/common/enums/exception/ParameterException.java similarity index 84% rename from src/main/java/com/writely/common/enums/exception/ParameterException.java rename to api/src/main/java/writeon/api/common/enums/exception/ParameterException.java index 408046f..63cde84 100644 --- a/src/main/java/com/writely/common/enums/exception/ParameterException.java +++ b/api/src/main/java/writeon/api/common/enums/exception/ParameterException.java @@ -1,9 +1,9 @@ -package com.writely.common.enums.exception; +package writeon.api.common.enums.exception; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/common/exception/BaseException.java b/api/src/main/java/writeon/api/common/exception/BaseException.java similarity index 87% rename from src/main/java/com/writely/common/exception/BaseException.java rename to api/src/main/java/writeon/api/common/exception/BaseException.java index 13b5a3e..d342082 100644 --- a/src/main/java/com/writely/common/exception/BaseException.java +++ b/api/src/main/java/writeon/api/common/exception/BaseException.java @@ -1,7 +1,7 @@ -package com.writely.common.exception; +package writeon.api.common.exception; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; +import writeon.domain.common.enums.CodeInfo; @Getter public class BaseException extends RuntimeException { diff --git a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java b/api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java similarity index 87% rename from src/main/java/com/writely/common/exception/GlobalExceptionHandler.java rename to api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java index e95a113..3c64ca2 100644 --- a/src/main/java/com/writely/common/exception/GlobalExceptionHandler.java +++ b/api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java @@ -1,14 +1,15 @@ -package com.writely.common.exception; +package writeon.api.common.exception; -import com.writely.common.enums.code.CodeInfo; -import com.writely.common.enums.code.ResultCodeInfo; -import com.writely.common.response.BaseResponse; -import com.writely.common.util.LogUtil; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import writeon.api.common.enums.code.ResultCodeInfo; +import writeon.api.common.response.BaseResponse; +import writeon.api.common.util.LogUtil; +import writeon.domain.common.enums.CodeInfo; + import java.util.stream.Collectors; @RestControllerAdvice diff --git a/src/main/java/com/writely/common/filter/MDCFilter.java b/api/src/main/java/writeon/api/common/filter/MDCFilter.java similarity index 90% rename from src/main/java/com/writely/common/filter/MDCFilter.java rename to api/src/main/java/writeon/api/common/filter/MDCFilter.java index 28ecd41..8c522e8 100644 --- a/src/main/java/com/writely/common/filter/MDCFilter.java +++ b/api/src/main/java/writeon/api/common/filter/MDCFilter.java @@ -1,7 +1,7 @@ -package com.writely.common.filter; +package writeon.api.common.filter; -import com.writely.common.util.HttpRequestUtil; -import com.writely.common.util.MDCUtil; +import writeon.api.common.util.HttpRequestUtil; +import writeon.api.common.util.MDCUtil; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; diff --git a/src/main/java/com/writely/common/resolver/AuthResolver.java b/api/src/main/java/writeon/api/common/resolver/AuthResolver.java similarity index 85% rename from src/main/java/com/writely/common/resolver/AuthResolver.java rename to api/src/main/java/writeon/api/common/resolver/AuthResolver.java index 948f7c2..04edb54 100644 --- a/src/main/java/com/writely/common/resolver/AuthResolver.java +++ b/api/src/main/java/writeon/api/common/resolver/AuthResolver.java @@ -1,10 +1,5 @@ -package com.writely.common.resolver; +package writeon.api.common.resolver; -import com.writely.auth.domain.JwtPayload; -import com.writely.auth.domain.enums.AuthException; -import com.writely.auth.helper.JwtHelper; -import com.writely.common.domain.MemberSession; -import com.writely.common.exception.BaseException; import lombok.AllArgsConstructor; import org.springframework.core.MethodParameter; import org.springframework.stereotype.Component; @@ -12,6 +7,11 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer; +import writeon.api.auth.helper.JwtHelper; +import writeon.api.common.exception.BaseException; +import writeon.domain.auth.JwtPayload; +import writeon.domain.auth.enums.AuthException; +import writeon.domain.common.MemberSession; @AllArgsConstructor @Component diff --git a/src/main/java/com/writely/common/response/BaseResponse.java b/api/src/main/java/writeon/api/common/response/BaseResponse.java similarity index 93% rename from src/main/java/com/writely/common/response/BaseResponse.java rename to api/src/main/java/writeon/api/common/response/BaseResponse.java index 9f947b3..ffb54cf 100644 --- a/src/main/java/com/writely/common/response/BaseResponse.java +++ b/api/src/main/java/writeon/api/common/response/BaseResponse.java @@ -1,12 +1,12 @@ -package com.writely.common.response; +package writeon.api.common.response; import com.fasterxml.jackson.annotation.JsonInclude; -import com.writely.common.enums.code.CodeInfo; -import com.writely.common.enums.code.ResultCodeInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import writeon.api.common.enums.code.ResultCodeInfo; +import writeon.domain.common.enums.CodeInfo; @Getter @ToString diff --git a/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java b/api/src/main/java/writeon/api/common/response/GlobalResponseBodyHandler.java similarity index 93% rename from src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java rename to api/src/main/java/writeon/api/common/response/GlobalResponseBodyHandler.java index d69aa23..86df071 100644 --- a/src/main/java/com/writely/common/response/GlobalResponseBodyHandler.java +++ b/api/src/main/java/writeon/api/common/response/GlobalResponseBodyHandler.java @@ -1,4 +1,4 @@ -package com.writely.common.response; +package writeon.api.common.response; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; -@RestControllerAdvice(basePackages = "com.writely") +@RestControllerAdvice(basePackages = "writeon.api") public class GlobalResponseBodyHandler implements ResponseBodyAdvice { @Override diff --git a/src/main/java/com/writely/common/util/CryptoUtil.java b/api/src/main/java/writeon/api/common/util/CryptoUtil.java similarity index 98% rename from src/main/java/com/writely/common/util/CryptoUtil.java rename to api/src/main/java/writeon/api/common/util/CryptoUtil.java index 4a2b680..5f2e8e2 100644 --- a/src/main/java/com/writely/common/util/CryptoUtil.java +++ b/api/src/main/java/writeon/api/common/util/CryptoUtil.java @@ -1,4 +1,4 @@ -package com.writely.common.util; +package writeon.api.common.util; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/writely/common/util/DateTimeUtil.java b/api/src/main/java/writeon/api/common/util/DateTimeUtil.java similarity index 95% rename from src/main/java/com/writely/common/util/DateTimeUtil.java rename to api/src/main/java/writeon/api/common/util/DateTimeUtil.java index c6eda52..a582dfe 100644 --- a/src/main/java/com/writely/common/util/DateTimeUtil.java +++ b/api/src/main/java/writeon/api/common/util/DateTimeUtil.java @@ -1,7 +1,7 @@ -package com.writely.common.util; +package writeon.api.common.util; -import com.writely.common.enums.exception.ParameterException; -import com.writely.common.exception.BaseException; +import writeon.api.common.enums.exception.ParameterException; +import writeon.api.common.exception.BaseException; import lombok.experimental.UtilityClass; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/com/writely/common/util/HttpRequestUtil.java b/api/src/main/java/writeon/api/common/util/HttpRequestUtil.java similarity index 98% rename from src/main/java/com/writely/common/util/HttpRequestUtil.java rename to api/src/main/java/writeon/api/common/util/HttpRequestUtil.java index d3d8b17..40eea7a 100644 --- a/src/main/java/com/writely/common/util/HttpRequestUtil.java +++ b/api/src/main/java/writeon/api/common/util/HttpRequestUtil.java @@ -1,4 +1,4 @@ -package com.writely.common.util; +package writeon.api.common.util; import jakarta.servlet.http.HttpServletRequest; import lombok.experimental.UtilityClass; diff --git a/src/main/java/com/writely/common/util/LogUtil.java b/api/src/main/java/writeon/api/common/util/LogUtil.java similarity index 97% rename from src/main/java/com/writely/common/util/LogUtil.java rename to api/src/main/java/writeon/api/common/util/LogUtil.java index 338495a..6dea2ae 100644 --- a/src/main/java/com/writely/common/util/LogUtil.java +++ b/api/src/main/java/writeon/api/common/util/LogUtil.java @@ -1,4 +1,4 @@ -package com.writely.common.util; +package writeon.api.common.util; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/writely/common/util/MDCUtil.java b/api/src/main/java/writeon/api/common/util/MDCUtil.java similarity index 97% rename from src/main/java/com/writely/common/util/MDCUtil.java rename to api/src/main/java/writeon/api/common/util/MDCUtil.java index 11b0738..40f014f 100644 --- a/src/main/java/com/writely/common/util/MDCUtil.java +++ b/api/src/main/java/writeon/api/common/util/MDCUtil.java @@ -1,4 +1,4 @@ -package com.writely.common.util; +package writeon.api.common.util; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.experimental.UtilityClass; diff --git a/src/main/java/com/writely/common/util/StringUtil.java b/api/src/main/java/writeon/api/common/util/StringUtil.java similarity index 98% rename from src/main/java/com/writely/common/util/StringUtil.java rename to api/src/main/java/writeon/api/common/util/StringUtil.java index bc869a0..0dbcb45 100644 --- a/src/main/java/com/writely/common/util/StringUtil.java +++ b/api/src/main/java/writeon/api/common/util/StringUtil.java @@ -1,4 +1,4 @@ -package com.writely.common.util; +package writeon.api.common.util; import lombok.experimental.UtilityClass; diff --git a/src/main/java/com/writely/common/validation/IsEmail.java b/api/src/main/java/writeon/api/common/validation/IsEmail.java similarity index 86% rename from src/main/java/com/writely/common/validation/IsEmail.java rename to api/src/main/java/writeon/api/common/validation/IsEmail.java index 61c35f1..bd582fa 100644 --- a/src/main/java/com/writely/common/validation/IsEmail.java +++ b/api/src/main/java/writeon/api/common/validation/IsEmail.java @@ -1,4 +1,4 @@ -package com.writely.common.validation; +package writeon.api.common.validation; import jakarta.validation.Constraint; import jakarta.validation.constraints.Size; @@ -7,7 +7,6 @@ import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) diff --git a/src/main/java/com/writely/common/validation/IsEmailValidator.java b/api/src/main/java/writeon/api/common/validation/IsEmailValidator.java similarity index 92% rename from src/main/java/com/writely/common/validation/IsEmailValidator.java rename to api/src/main/java/writeon/api/common/validation/IsEmailValidator.java index e2ddee5..ac0555a 100644 --- a/src/main/java/com/writely/common/validation/IsEmailValidator.java +++ b/api/src/main/java/writeon/api/common/validation/IsEmailValidator.java @@ -1,4 +1,4 @@ -package com.writely.common.validation; +package writeon.api.common.validation; import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; diff --git a/src/main/java/com/writely/common/validation/IsPassword.java b/api/src/main/java/writeon/api/common/validation/IsPassword.java similarity index 87% rename from src/main/java/com/writely/common/validation/IsPassword.java rename to api/src/main/java/writeon/api/common/validation/IsPassword.java index 771e54e..18f7578 100644 --- a/src/main/java/com/writely/common/validation/IsPassword.java +++ b/api/src/main/java/writeon/api/common/validation/IsPassword.java @@ -1,4 +1,4 @@ -package com.writely.common.validation; +package writeon.api.common.validation; import jakarta.validation.Constraint; import jakarta.validation.constraints.Size; @@ -7,7 +7,6 @@ import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) diff --git a/src/main/java/com/writely/common/validation/IsPasswordValidator.java b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java similarity index 92% rename from src/main/java/com/writely/common/validation/IsPasswordValidator.java rename to api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java index 1ed5c2e..2f01b82 100644 --- a/src/main/java/com/writely/common/validation/IsPasswordValidator.java +++ b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java @@ -1,4 +1,4 @@ -package com.writely.common.validation; +package writeon.api.common.validation; import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; diff --git a/src/main/java/com/writely/member/controller/MemberController.java b/api/src/main/java/writeon/api/member/controller/MemberController.java similarity index 78% rename from src/main/java/com/writely/member/controller/MemberController.java rename to api/src/main/java/writeon/api/member/controller/MemberController.java index d58d032..328fcfe 100644 --- a/src/main/java/com/writely/member/controller/MemberController.java +++ b/api/src/main/java/writeon/api/member/controller/MemberController.java @@ -1,14 +1,14 @@ -package com.writely.member.controller; +package writeon.api.member.controller; -import com.writely.common.domain.MemberSession; -import com.writely.member.response.MyProfileResponse; -import com.writely.member.service.MemberQueryService; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import writeon.api.member.response.MyProfileResponse; +import writeon.api.member.service.MemberQueryService; +import writeon.domain.common.MemberSession; @RestController @RequiredArgsConstructor diff --git a/src/main/java/com/writely/member/response/MyProfileResponse.java b/api/src/main/java/writeon/api/member/response/MyProfileResponse.java similarity index 90% rename from src/main/java/com/writely/member/response/MyProfileResponse.java rename to api/src/main/java/writeon/api/member/response/MyProfileResponse.java index b81cbf2..bc8d495 100644 --- a/src/main/java/com/writely/member/response/MyProfileResponse.java +++ b/api/src/main/java/writeon/api/member/response/MyProfileResponse.java @@ -1,10 +1,10 @@ -package com.writely.member.response; +package writeon.api.member.response; -import com.writely.member.domain.Member; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; +import writeon.domain.member.Member; @Getter @Setter diff --git a/src/main/java/com/writely/member/service/MemberCommandService.java b/api/src/main/java/writeon/api/member/service/MemberCommandService.java similarity index 52% rename from src/main/java/com/writely/member/service/MemberCommandService.java rename to api/src/main/java/writeon/api/member/service/MemberCommandService.java index 86e8994..85c5e77 100644 --- a/src/main/java/com/writely/member/service/MemberCommandService.java +++ b/api/src/main/java/writeon/api/member/service/MemberCommandService.java @@ -1,4 +1,4 @@ -package com.writely.member.service; +package writeon.api.member.service; public class MemberCommandService { } diff --git a/src/main/java/com/writely/member/service/MemberQueryService.java b/api/src/main/java/writeon/api/member/service/MemberQueryService.java similarity index 63% rename from src/main/java/com/writely/member/service/MemberQueryService.java rename to api/src/main/java/writeon/api/member/service/MemberQueryService.java index a7bb326..5f4871c 100644 --- a/src/main/java/com/writely/member/service/MemberQueryService.java +++ b/api/src/main/java/writeon/api/member/service/MemberQueryService.java @@ -1,14 +1,14 @@ -package com.writely.member.service; +package writeon.api.member.service; -import com.writely.common.domain.MemberSession; -import com.writely.common.exception.BaseException; -import com.writely.member.domain.Member; -import com.writely.member.domain.enums.MemberException; -import com.writely.member.repository.MemberJpaRepository; -import com.writely.member.response.MyProfileResponse; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.common.exception.BaseException; +import writeon.api.member.response.MyProfileResponse; +import writeon.domain.common.MemberSession; +import writeon.domain.member.Member; +import writeon.domain.member.enums.MemberException; +import writeon.domain.member.repository.MemberJpaRepository; @Service @RequiredArgsConstructor diff --git a/src/main/java/com/writely/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java similarity index 83% rename from src/main/java/com/writely/product/controller/ProductController.java rename to api/src/main/java/writeon/api/product/controller/ProductController.java index 71e7877..5efa714 100644 --- a/src/main/java/com/writely/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -1,18 +1,18 @@ -package com.writely.product.controller; +package writeon.api.product.controller; -import com.writely.product.request.ProductMemoSaveRequest; -import com.writely.product.request.ProductModifyRequest; -import com.writely.product.request.ProductTemplateSaveRequest; -import com.writely.product.response.ProductDetailResponse; -import com.writely.product.response.ProductMemoResponse; -import com.writely.product.response.ProductResponse; -import com.writely.product.response.ProductTemplateResponse; -import com.writely.product.service.ProductCommandService; -import com.writely.product.service.ProductQueryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import writeon.api.product.request.ProductMemoSaveRequest; +import writeon.api.product.request.ProductModifyRequest; +import writeon.api.product.request.ProductTemplateSaveRequest; +import writeon.api.product.response.ProductDetailResponse; +import writeon.api.product.response.ProductMemoResponse; +import writeon.api.product.response.ProductResponse; +import writeon.api.product.response.ProductTemplateResponse; +import writeon.api.product.service.ProductCommandService; +import writeon.api.product.service.ProductQueryService; import java.util.List; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java similarity index 84% rename from src/main/java/com/writely/product/repository/ProductDao.java rename to api/src/main/java/writeon/api/product/repository/ProductDao.java index 41e3246..972bab7 100644 --- a/src/main/java/com/writely/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -1,6 +1,6 @@ -package com.writely.product.repository; +package writeon.api.product.repository; -import com.writely.product.response.ProductResponse; +import writeon.api.product.response.ProductResponse; import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/writely/product/request/ProductMemoSaveRequest.java b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java similarity index 90% rename from src/main/java/com/writely/product/request/ProductMemoSaveRequest.java rename to api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java index b910a9c..c228751 100644 --- a/src/main/java/com/writely/product/request/ProductMemoSaveRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java @@ -1,4 +1,4 @@ -package com.writely.product.request; +package writeon.api.product.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/src/main/java/com/writely/product/request/ProductModifyRequest.java b/api/src/main/java/writeon/api/product/request/ProductModifyRequest.java similarity index 87% rename from src/main/java/com/writely/product/request/ProductModifyRequest.java rename to api/src/main/java/writeon/api/product/request/ProductModifyRequest.java index 69b0a47..224c461 100644 --- a/src/main/java/com/writely/product/request/ProductModifyRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductModifyRequest.java @@ -1,4 +1,4 @@ -package com.writely.product.request; +package writeon.api.product.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java b/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java similarity index 97% rename from src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java rename to api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java index 7dbe6ad..6d472fe 100644 --- a/src/main/java/com/writely/product/request/ProductTemplateSaveRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java @@ -1,10 +1,10 @@ -package com.writely.product.request; +package writeon.api.product.request; -import com.writely.product.domain.*; -import com.writely.product.domain.enums.ProductSectionType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; +import writeon.domain.product.*; +import writeon.domain.product.enums.ProductSectionType; import java.util.List; import java.util.UUID; diff --git a/src/main/java/com/writely/product/response/ProductDetailResponse.java b/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java similarity index 88% rename from src/main/java/com/writely/product/response/ProductDetailResponse.java rename to api/src/main/java/writeon/api/product/response/ProductDetailResponse.java index 17d1b95..a25f817 100644 --- a/src/main/java/com/writely/product/response/ProductDetailResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java @@ -1,10 +1,10 @@ -package com.writely.product.response; +package writeon.api.product.response; -import com.writely.product.domain.Product; -import com.writely.product.domain.ProductMemo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; +import writeon.domain.product.Product; +import writeon.domain.product.ProductMemo; import java.time.LocalDateTime; import java.util.List; diff --git a/src/main/java/com/writely/product/response/ProductMemoResponse.java b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java similarity index 88% rename from src/main/java/com/writely/product/response/ProductMemoResponse.java rename to api/src/main/java/writeon/api/product/response/ProductMemoResponse.java index dd46010..bc1dffb 100644 --- a/src/main/java/com/writely/product/response/ProductMemoResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java @@ -1,6 +1,6 @@ -package com.writely.product.response; +package writeon.api.product.response; -import com.writely.product.domain.ProductMemo; +import writeon.domain.product.ProductMemo; import lombok.Getter; import java.util.UUID; diff --git a/src/main/java/com/writely/product/response/ProductResponse.java b/api/src/main/java/writeon/api/product/response/ProductResponse.java similarity index 94% rename from src/main/java/com/writely/product/response/ProductResponse.java rename to api/src/main/java/writeon/api/product/response/ProductResponse.java index c96859a..c33e984 100644 --- a/src/main/java/com/writely/product/response/ProductResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductResponse.java @@ -1,4 +1,4 @@ -package com.writely.product.response; +package writeon.api.product.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; diff --git a/src/main/java/com/writely/product/response/ProductTemplateResponse.java b/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java similarity index 98% rename from src/main/java/com/writely/product/response/ProductTemplateResponse.java rename to api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java index 1104de6..35f5abd 100644 --- a/src/main/java/com/writely/product/response/ProductTemplateResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java @@ -1,9 +1,9 @@ -package com.writely.product.response; +package writeon.api.product.response; -import com.writely.product.domain.*; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; +import writeon.domain.product.*; import java.util.List; import java.util.UUID; diff --git a/src/main/java/com/writely/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java similarity index 95% rename from src/main/java/com/writely/product/service/ProductCommandService.java rename to api/src/main/java/writeon/api/product/service/ProductCommandService.java index 860851f..445bedd 100644 --- a/src/main/java/com/writely/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -1,16 +1,16 @@ -package com.writely.product.service; - -import com.writely.common.exception.BaseException; -import com.writely.product.domain.*; -import com.writely.product.domain.enums.ProductException; -import com.writely.product.domain.enums.ProductSectionType; -import com.writely.product.repository.*; -import com.writely.product.request.ProductMemoSaveRequest; -import com.writely.product.request.ProductModifyRequest; -import com.writely.product.request.ProductTemplateSaveRequest; +package writeon.api.product.service; + import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.common.exception.BaseException; +import writeon.api.product.request.ProductMemoSaveRequest; +import writeon.api.product.request.ProductModifyRequest; +import writeon.api.product.request.ProductTemplateSaveRequest; +import writeon.domain.product.*; +import writeon.domain.product.enums.ProductException; +import writeon.domain.product.enums.ProductSectionType; +import writeon.domain.product.repository.*; import java.util.*; import java.util.function.Function; diff --git a/src/main/java/com/writely/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java similarity index 71% rename from src/main/java/com/writely/product/service/ProductQueryService.java rename to api/src/main/java/writeon/api/product/service/ProductQueryService.java index b913a22..e41aeae 100644 --- a/src/main/java/com/writely/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -1,18 +1,18 @@ -package com.writely.product.service; - -import com.writely.common.exception.BaseException; -import com.writely.product.domain.Product; -import com.writely.product.domain.ProductMemo; -import com.writely.product.domain.enums.ProductException; -import com.writely.product.repository.ProductDao; -import com.writely.product.repository.ProductJpaRepository; -import com.writely.product.response.ProductDetailResponse; -import com.writely.product.response.ProductMemoResponse; -import com.writely.product.response.ProductResponse; -import com.writely.product.response.ProductTemplateResponse; +package writeon.api.product.service; + import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.common.exception.BaseException; +import writeon.api.product.repository.ProductDao; +import writeon.api.product.response.ProductDetailResponse; +import writeon.api.product.response.ProductMemoResponse; +import writeon.api.product.response.ProductResponse; +import writeon.api.product.response.ProductTemplateResponse; +import writeon.domain.product.Product; +import writeon.domain.product.ProductMemo; +import writeon.domain.product.enums.ProductException; +import writeon.domain.product.repository.ProductJpaRepository; import java.util.Comparator; import java.util.List; diff --git a/src/main/java/com/writely/terms/controller/TermsController.java b/api/src/main/java/writeon/api/terms/controller/TermsController.java similarity index 61% rename from src/main/java/com/writely/terms/controller/TermsController.java rename to api/src/main/java/writeon/api/terms/controller/TermsController.java index d4be43e..1e31da0 100644 --- a/src/main/java/com/writely/terms/controller/TermsController.java +++ b/api/src/main/java/writeon/api/terms/controller/TermsController.java @@ -1,14 +1,17 @@ -package com.writely.terms.controller; +package writeon.api.terms.controller; -import com.writely.terms.domain.enums.TermsCode; -import com.writely.terms.response.TermsDetailResponse; -import com.writely.terms.response.TermsSummaryResponse; -import com.writely.terms.service.TermsQueryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import writeon.api.terms.response.TermsDetailResponse; +import writeon.api.terms.response.TermsSummaryResponse; +import writeon.api.terms.service.TermsQueryService; +import writeon.domain.terms.enums.TermsCode; import java.util.List; diff --git a/src/main/java/com/writely/terms/repository/TermsDao.java b/api/src/main/java/writeon/api/terms/repository/TermsDao.java similarity index 94% rename from src/main/java/com/writely/terms/repository/TermsDao.java rename to api/src/main/java/writeon/api/terms/repository/TermsDao.java index d218a97..2a8ea0f 100644 --- a/src/main/java/com/writely/terms/repository/TermsDao.java +++ b/api/src/main/java/writeon/api/terms/repository/TermsDao.java @@ -1,10 +1,10 @@ -package com.writely.terms.repository; +package writeon.api.terms.repository; -import com.writely.terms.domain.enums.TermsCode; import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; import writely.tables.records.TermsRecord; +import writeon.domain.terms.enums.TermsCode; import java.util.List; import java.util.Optional; diff --git a/src/main/java/com/writely/terms/request/TermsAgreeRequest.java b/api/src/main/java/writeon/api/terms/request/TermsAgreeRequest.java similarity index 75% rename from src/main/java/com/writely/terms/request/TermsAgreeRequest.java rename to api/src/main/java/writeon/api/terms/request/TermsAgreeRequest.java index a780a1f..f16bb5c 100644 --- a/src/main/java/com/writely/terms/request/TermsAgreeRequest.java +++ b/api/src/main/java/writeon/api/terms/request/TermsAgreeRequest.java @@ -1,9 +1,9 @@ -package com.writely.terms.request; +package writeon.api.terms.request; -import com.writely.terms.domain.enums.TermsCode; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Getter; +import writeon.domain.terms.enums.TermsCode; @AllArgsConstructor @Getter diff --git a/src/main/java/com/writely/terms/response/TermsDetailResponse.java b/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java similarity index 94% rename from src/main/java/com/writely/terms/response/TermsDetailResponse.java rename to api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java index e95b577..2182394 100644 --- a/src/main/java/com/writely/terms/response/TermsDetailResponse.java +++ b/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java @@ -1,10 +1,10 @@ -package com.writely.terms.response; +package writeon.api.terms.response; -import com.writely.terms.domain.enums.TermsCode; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import writely.tables.records.TermsRecord; +import writeon.domain.terms.enums.TermsCode; import java.time.LocalDateTime; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/response/TermsSummaryResponse.java b/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java similarity index 89% rename from src/main/java/com/writely/terms/response/TermsSummaryResponse.java rename to api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java index 59307fc..7b5d5e8 100644 --- a/src/main/java/com/writely/terms/response/TermsSummaryResponse.java +++ b/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java @@ -1,10 +1,10 @@ -package com.writely.terms.response; +package writeon.api.terms.response; -import com.writely.terms.domain.enums.TermsCode; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import writely.tables.records.TermsRecord; +import writeon.domain.terms.enums.TermsCode; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/service/TermsCommandService.java b/api/src/main/java/writeon/api/terms/service/TermsCommandService.java similarity index 82% rename from src/main/java/com/writely/terms/service/TermsCommandService.java rename to api/src/main/java/writeon/api/terms/service/TermsCommandService.java index ec70958..955eb54 100644 --- a/src/main/java/com/writely/terms/service/TermsCommandService.java +++ b/api/src/main/java/writeon/api/terms/service/TermsCommandService.java @@ -1,4 +1,4 @@ -package com.writely.terms.service; +package writeon.api.terms.service; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/writely/terms/service/TermsQueryService.java b/api/src/main/java/writeon/api/terms/service/TermsQueryService.java similarity index 74% rename from src/main/java/com/writely/terms/service/TermsQueryService.java rename to api/src/main/java/writeon/api/terms/service/TermsQueryService.java index fa2ccaf..0e48ddf 100644 --- a/src/main/java/com/writely/terms/service/TermsQueryService.java +++ b/api/src/main/java/writeon/api/terms/service/TermsQueryService.java @@ -1,15 +1,15 @@ -package com.writely.terms.service; - -import com.writely.common.exception.BaseException; -import com.writely.terms.domain.enums.TermsCode; -import com.writely.terms.domain.enums.TermsException; -import com.writely.terms.repository.TermsDao; -import com.writely.terms.response.TermsDetailResponse; -import com.writely.terms.response.TermsSummaryResponse; +package writeon.api.terms.service; + import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writely.tables.records.TermsRecord; +import writeon.api.common.exception.BaseException; +import writeon.api.terms.repository.TermsDao; +import writeon.api.terms.response.TermsDetailResponse; +import writeon.api.terms.response.TermsSummaryResponse; +import writeon.domain.terms.enums.TermsCode; +import writeon.domain.terms.enums.TermsException; import java.util.List; diff --git a/src/main/resources/logback-spring.xml b/api/src/main/resources/logback-spring.xml similarity index 100% rename from src/main/resources/logback-spring.xml rename to api/src/main/resources/logback-spring.xml diff --git a/src/main/resources/templates/mail/change-password.html b/api/src/main/resources/templates/mail/change-password.html similarity index 100% rename from src/main/resources/templates/mail/change-password.html rename to api/src/main/resources/templates/mail/change-password.html diff --git a/src/main/resources/templates/mail/join.html b/api/src/main/resources/templates/mail/join.html similarity index 100% rename from src/main/resources/templates/mail/join.html rename to api/src/main/resources/templates/mail/join.html diff --git a/assistant-api-client/build.gradle b/assistant-api-client/build.gradle new file mode 100644 index 0000000..1518960 --- /dev/null +++ b/assistant-api-client/build.gradle @@ -0,0 +1,17 @@ +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-webflux' + + implementation project(':domain') +} + +bootJar { + enabled = false +} + +task copySecret(type: Copy) { + copy { + from '../BE-secret/assistant' + include "*.yml" + into 'src/main/resources' + } +} \ No newline at end of file diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java new file mode 100644 index 0000000..47893e1 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -0,0 +1,63 @@ +package writeon.assistantapiclient; + +import org.springframework.http.HttpStatusCode; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import writeon.assistantapiclient.request.AutoModifyRequest; +import writeon.assistantapiclient.request.FeedbackRequest; +import writeon.assistantapiclient.request.UserModifyRequest; + +public class AssistantApiClient extends WebApiClient{ + + public AssistantApiClient(String baseUrl, int connectionTimeoutMs, int readTimeoutMs) { + super(baseUrl, connectionTimeoutMs, readTimeoutMs); + } + + public Flux streamAutoModify(AutoModifyRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/auto-modify/stream") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToFlux(String.class); + } + + public Flux streamFeedback(FeedbackRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/feedback/stream") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToFlux(String.class); + } + + public Flux streamUserModify(UserModifyRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/user-modify/stream") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToFlux(String.class); + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java new file mode 100644 index 0000000..1ec17a7 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java @@ -0,0 +1,41 @@ +package writeon.assistantapiclient; + +import io.netty.channel.ChannelOption; +import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty.handler.timeout.WriteTimeoutHandler; +import org.springframework.http.client.reactive.ReactorClientHttpConnector; +import org.springframework.web.reactive.function.client.ExchangeStrategies; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.netty.http.client.HttpClient; + +import java.util.concurrent.TimeUnit; + +public class WebApiClient { + protected final WebClient webClient; + + public WebApiClient( + String baseUrl, + int connectionTimeoutMs, + int readTimeoutMs + ) { + HttpClient httpClient = HttpClient.create() + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeoutMs) + .doOnConnected(conn -> { + conn.addHandlerLast(new ReadTimeoutHandler(readTimeoutMs, TimeUnit.MILLISECONDS)); + conn.addHandlerLast(new WriteTimeoutHandler(readTimeoutMs, TimeUnit.MILLISECONDS)); + }); + + webClient = WebClient.builder() + .clientConnector(new ReactorClientHttpConnector(httpClient)) + .exchangeStrategies(getExchangeStrategies()) + .baseUrl(baseUrl) + .build(); + } + + // 응답 데이터 크기 조정, 기본 256KB + private ExchangeStrategies getExchangeStrategies() { + return ExchangeStrategies.builder() + .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(1024 * 1024 * 10)) // 10MB + .build(); + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantApiClientConfig.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantApiClientConfig.java new file mode 100644 index 0000000..18e5d02 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantApiClientConfig.java @@ -0,0 +1,20 @@ +package writeon.assistantapiclient.config; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import writeon.assistantapiclient.AssistantApiClient; + +@Configuration +@EnableConfigurationProperties({AssistantConfigurationProperties.class}) +public class AssistantApiClientConfig { + + @Bean + public AssistantApiClient assistantApiClient(AssistantConfigurationProperties configurationProperties) { + return new AssistantApiClient( + "http://" + configurationProperties.getIp() + ":" + configurationProperties.getPort(), + configurationProperties.getConnectionTimeoutMs(), + configurationProperties.getReadTimeoutMs() + ); + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantConfigurationProperties.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantConfigurationProperties.java new file mode 100644 index 0000000..bb996b1 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/config/AssistantConfigurationProperties.java @@ -0,0 +1,15 @@ +package writeon.assistantapiclient.config; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@Getter +@Setter +@ConfigurationProperties(prefix = "assistant.server") +public class AssistantConfigurationProperties { + private String ip; + private int port; + private int connectionTimeoutMs; + private int readTimeoutMs; +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java new file mode 100644 index 0000000..ae16b7d --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java @@ -0,0 +1,20 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class AutoModifyRequest { + + private final String tenantId; + private final UserSetting userSetting; + private final String query; + + public AutoModifyRequest(UserSetting userSetting, String query) { + this.tenantId = "1"; + this.userSetting = userSetting; + this.query = query; + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java new file mode 100644 index 0000000..7c98453 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java @@ -0,0 +1,20 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class FeedbackRequest { + + private final String tenantId; + private final UserSetting userSetting; + private final String query; + + public FeedbackRequest(UserSetting userSetting, String query) { + this.tenantId = "1"; + this.userSetting = userSetting; + this.query = query; + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java new file mode 100644 index 0000000..17e7a3e --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java @@ -0,0 +1,22 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class UserModifyRequest { + + private final String tenantId; + private final UserSetting userSetting; + private final String query; + private final String howPolish; + + public UserModifyRequest(UserSetting userSetting, String query, String howPolish) { + this.tenantId = "1"; + this.userSetting = userSetting; + this.query = query; + this.howPolish = howPolish; + } +} diff --git a/src/main/java/com/writely/assistant/request/UserSetting.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java similarity index 67% rename from src/main/java/com/writely/assistant/request/UserSetting.java rename to assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java index 88b9d1c..6d96f36 100644 --- a/src/main/java/com/writely/assistant/request/UserSetting.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java @@ -1,9 +1,8 @@ -package com.writely.assistant.request; +package writeon.assistantapiclient.request; import com.fasterxml.jackson.annotation.JsonInclude; -import com.writely.product.domain.*; -import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; +import writeon.domain.product.*; import java.util.List; @@ -19,37 +18,27 @@ public class UserSetting { public UserSetting(Product product) { this.characters = product.getCharacters().stream() - .map(UserSetting.Character::new) + .map(Character::new) .toList(); - this.ideaNote = product.getIdeaNote() != null ? new UserSetting.IdeaNote(product.getIdeaNote()) : null; - this.plot = product.getPlot() != null ? new UserSetting.Plot(product.getPlot()) : null; - this.synopsis = product.getSynopsis() != null ? new UserSetting.Synopsis(product.getSynopsis()) : null; - this.worldview = product.getWorldview() != null ? new UserSetting.Worldview(product.getWorldview()) : null; + this.ideaNote = product.getIdeaNote() != null ? new IdeaNote(product.getIdeaNote()) : null; + this.plot = product.getPlot() != null ? new Plot(product.getPlot()) : null; + this.synopsis = product.getSynopsis() != null ? new Synopsis(product.getSynopsis()) : null; + this.worldview = product.getWorldview() != null ? new Worldview(product.getWorldview()) : null; } @Getter @JsonInclude(JsonInclude.Include.NON_NULL) public static class Character { - @Schema(title = "소개", nullable = true) private final String intro; - @Schema(name = "이름", nullable = true) private final String character_name; - @Schema(name = "나이", nullable = true) private final String age; - @Schema(name = "성별", nullable = true) private final String gender; - @Schema(name = "직업", nullable = true) private final String character_occupation; - @Schema(name = "외모", nullable = true) private final String appearance; - @Schema(name = "성격", nullable = true) private final String personality; - @Schema(name = "특징", nullable = true) private final String characteristic; - @Schema(name = "주요관계", nullable = true) private final String relationship; - @Schema(name = "커스텀 필드 목록", nullable = true) private final List custom_fields; public Character(ProductCharacter character) { @@ -72,9 +61,7 @@ public Character(ProductCharacter character) { @JsonInclude(JsonInclude.Include.NON_NULL) public static class CustomField { - @Schema(title = "필드 이름") private final String custom_field_name; - @Schema(title = "필드 내용") private final String custom_field_content; public CustomField(ProductCustomField customField) { @@ -87,9 +74,7 @@ public CustomField(ProductCustomField customField) { @JsonInclude(JsonInclude.Include.NON_NULL) public static class IdeaNote { - @Schema(title = "제목", nullable = true) private final String idea_title; - @Schema(title = "내용", nullable = true) private final String idea_content; public IdeaNote(ProductIdeaNote ideaNote) { @@ -102,7 +87,6 @@ public IdeaNote(ProductIdeaNote ideaNote) { @JsonInclude(JsonInclude.Include.NON_NULL) public static class Plot { - @Schema(title = "내용", nullable = true) private final String content; public Plot(ProductPlot plot) { @@ -114,15 +98,10 @@ public Plot(ProductPlot plot) { @JsonInclude(JsonInclude.Include.NON_NULL) public static class Synopsis { - @Schema(title = "장르") private final String genre; - @Schema(title = "분량", nullable = true) private final String length; - @Schema(title = "기획 의도", nullable = true) private final String purpose; - @Schema(title = "로그라인") private final String logline; - @Schema(title = "예시 문장", nullable = true) private final String example; public Synopsis(ProductSynopsis synopsis) { @@ -138,33 +117,19 @@ public Synopsis(ProductSynopsis synopsis) { @JsonInclude(JsonInclude.Include.NON_NULL) public static class Worldview { - @Schema(title = "지리", nullable = true) private final String geography; - @Schema(title = "역사", nullable = true) private final String history; - @Schema(title = "정치", nullable = true) private final String politics; - @Schema(title = "사회", nullable = true) private final String society; - @Schema(title = "종교", nullable = true) private final String religion; - @Schema(title = "경제", nullable = true) private final String economy; - @Schema(title = "기술", nullable = true) private final String technology; - @Schema(title = "생활", nullable = true) private final String lifestyle; - @Schema(title = "언어", nullable = true) private final String language; - @Schema(title = "문화", nullable = true) private final String culture; - @Schema(title = "종족", nullable = true) private final String species; - @Schema(title = "직업", nullable = true) private final String occupation; - @Schema(title = "갈등 관계", nullable = true) private final String conflict; - @Schema(name = "커스텀 필드 목록", nullable = true) private final List custom_fields; public Worldview(ProductWorldview worldview) { diff --git a/build.gradle b/build.gradle index d63d015..0ce3312 100644 --- a/build.gradle +++ b/build.gradle @@ -1,126 +1,50 @@ plugins { id 'java' + id 'java-library' id 'org.springframework.boot' version '3.3.7' id 'io.spring.dependency-management' version '1.1.7' - id 'nu.studer.jooq' version '9.0' } -group = 'com' -version = '0.0.1-SNAPSHOT' - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -configurations { - compileOnly { - extendsFrom annotationProcessor - } -} - -repositories { - mavenCentral() -} - -jar { +bootJar { enabled = false } -dependencies { - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-validation' - - /* DB */ - runtimeOnly 'org.postgresql:postgresql' - implementation 'org.springframework.boot:spring-boot-starter-data-redis' - - /* jooq */ - implementation 'org.springframework.boot:spring-boot-starter-jooq' - jooqGenerator 'org.postgresql:postgresql' - - /* Lombok */ - compileOnly 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - - /* Mail */ - implementation 'org.springframework.boot:spring-boot-starter-mail' - - /* Template engine */ - implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' - implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' - - /* Common Util */ - implementation 'org.apache.commons:commons-lang3:3.12.0' - implementation 'commons-io:commons-io:2.13.0' - implementation 'com.auth0:java-jwt:4.4.0' +allprojects { + group = 'writeon' + version = '0.0.1-SNAPSHOT' - /* Swagger */ - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' + apply plugin: 'java' + apply plugin: 'java-library' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' - implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64' -} - -task copySecret(type: Copy) { - copy { - from './BE-secret' - include "*.yml" - into 'src/main/resources' + java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } } -} -tasks.named('test') { - useJUnitPlatform() -} - -def jooqDir = "src/main/generated" - -sourceSets { - main.java.srcDirs += [ jooqDir ] -} + configurations { + compileOnly { + extendsFrom annotationProcessor + } + } -tasks.withType(JavaCompile).configureEach { - options.getGeneratedSourceOutputDirectory().set(file(jooqDir)) -} + repositories { + mavenCentral() + } -jooq { - version = dependencyManagement.importedProperties['jooq.version'] - edition = nu.studer.gradle.jooq.JooqEdition.OSS + dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' - configurations { - main { - generateSchemaSourceOnCompilation = false + /* Lombok */ + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' - generationTool { - logging = org.jooq.meta.jaxb.Logging.DEBUG - jdbc { - driver = 'org.postgresql.Driver' - url = 'jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service' - user = 'postgres' - password = 'Writely0101%' - } - generator { - name = 'org.jooq.codegen.DefaultGenerator' - database { - name = 'org.jooq.meta.postgres.PostgresDatabase' - inputSchema = 'public' - } - generate { - deprecated = false - records = true - immutablePojos = true - fluentSetters = true - } - target { - packageName = 'writely' - directory = 'src/main/generated' - } - strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy' - } - } - } + /* Common Util */ + implementation 'org.apache.commons:commons-lang3:3.12.0' + implementation 'commons-io:commons-io:2.13.0' + implementation 'com.auth0:java-jwt:4.4.0' } } \ No newline at end of file diff --git a/domain/build.gradle b/domain/build.gradle new file mode 100644 index 0000000..3bd739d --- /dev/null +++ b/domain/build.gradle @@ -0,0 +1,76 @@ +plugins { + id 'nu.studer.jooq' version '9.0' +} + +dependencies { + api 'org.springframework.boot:spring-boot-starter-data-jpa' + + /* DB */ + runtimeOnly 'org.postgresql:postgresql' + api 'org.springframework.boot:spring-boot-starter-data-redis' + + /* jooq */ + api 'org.springframework.boot:spring-boot-starter-jooq' + jooqGenerator 'org.postgresql:postgresql' +} + +bootJar { + enabled = false +} + +task copySecret(type: Copy) { + copy { + from '../BE-secret/domain' + include "*.yml" + into 'src/main/resources' + } +} + +def jooqDir = "src/main/generated" + +sourceSets { + main.java.srcDirs += [ jooqDir ] +} + +tasks.withType(JavaCompile).configureEach { + options.getGeneratedSourceOutputDirectory().set(file(jooqDir)) +} + +jooq { + version = dependencyManagement.importedProperties['jooq.version'] + edition = nu.studer.gradle.jooq.JooqEdition.OSS + + configurations { + main { + generateSchemaSourceOnCompilation = false + + generationTool { + logging = org.jooq.meta.jaxb.Logging.DEBUG + jdbc { + driver = 'org.postgresql.Driver' + url = 'jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service' + user = 'postgres' + password = 'Writely0101%' + } + generator { + name = 'org.jooq.codegen.DefaultGenerator' + database { + name = 'org.jooq.meta.postgres.PostgresDatabase' + inputSchema = 'public' + } + generate { + deprecated = false + records = true + immutablePojos = true + fluentSetters = true + } + target { + packageName = 'writely' + directory = 'src/main/generated' + } + strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy' + } + } + } + } +} diff --git a/src/main/generated/writely/DefaultCatalog.java b/domain/src/main/generated/writely/DefaultCatalog.java similarity index 100% rename from src/main/generated/writely/DefaultCatalog.java rename to domain/src/main/generated/writely/DefaultCatalog.java diff --git a/src/main/generated/writely/Keys.java b/domain/src/main/generated/writely/Keys.java similarity index 94% rename from src/main/generated/writely/Keys.java rename to domain/src/main/generated/writely/Keys.java index 0d93ec2..0f140ee 100644 --- a/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writely/Keys.java @@ -10,6 +10,7 @@ import org.jooq.impl.Internal; import writely.tables.AutoModifyMessage; +import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; @@ -24,6 +25,7 @@ import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.records.AutoModifyMessageRecord; +import writely.tables.records.FeedbackMessageRecord; import writely.tables.records.LoginAttemptRecord; import writely.tables.records.MemberPasswordRecord; import writely.tables.records.MemberRecord; @@ -51,6 +53,7 @@ public class Keys { // ------------------------------------------------------------------------- public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); + public static final UniqueKey FEEDBACK_MESSAGE_PK = Internal.createUniqueKey(FeedbackMessage.FEEDBACK_MESSAGE, DSL.name("feedback_message_pk"), new TableField[] { FeedbackMessage.FEEDBACK_MESSAGE.ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); diff --git a/src/main/generated/writely/Public.java b/domain/src/main/generated/writely/Public.java similarity index 95% rename from src/main/generated/writely/Public.java rename to domain/src/main/generated/writely/Public.java index 811486f..0877c29 100644 --- a/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writely/Public.java @@ -15,6 +15,7 @@ import org.jooq.impl.SchemaImpl; import writely.tables.AutoModifyMessage; +import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; @@ -50,6 +51,11 @@ public class Public extends SchemaImpl { */ public final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * 피드백 메세지 + */ + public final FeedbackMessage FEEDBACK_MESSAGE = FeedbackMessage.FEEDBACK_MESSAGE; + /** * 로그인_시도 */ @@ -171,6 +177,7 @@ public Catalog getCatalog() { public final List> getTables() { return Arrays.asList( AutoModifyMessage.AUTO_MODIFY_MESSAGE, + FeedbackMessage.FEEDBACK_MESSAGE, LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, diff --git a/src/main/generated/writely/Routines.java b/domain/src/main/generated/writely/Routines.java similarity index 100% rename from src/main/generated/writely/Routines.java rename to domain/src/main/generated/writely/Routines.java diff --git a/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java similarity index 95% rename from src/main/generated/writely/Tables.java rename to domain/src/main/generated/writely/Tables.java index 3f0bb88..f02f478 100644 --- a/src/main/generated/writely/Tables.java +++ b/domain/src/main/generated/writely/Tables.java @@ -9,6 +9,7 @@ import org.jooq.Result; import writely.tables.AutoModifyMessage; +import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; import writely.tables.MemberPassword; @@ -37,6 +38,11 @@ public class Tables { */ public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * 피드백 메세지 + */ + public static final FeedbackMessage FEEDBACK_MESSAGE = FeedbackMessage.FEEDBACK_MESSAGE; + /** * 로그인_시도 */ diff --git a/src/main/generated/writely/routines/Armor1.java b/domain/src/main/generated/writely/routines/Armor1.java similarity index 100% rename from src/main/generated/writely/routines/Armor1.java rename to domain/src/main/generated/writely/routines/Armor1.java diff --git a/src/main/generated/writely/routines/Armor2.java b/domain/src/main/generated/writely/routines/Armor2.java similarity index 100% rename from src/main/generated/writely/routines/Armor2.java rename to domain/src/main/generated/writely/routines/Armor2.java diff --git a/src/main/generated/writely/routines/Crypt.java b/domain/src/main/generated/writely/routines/Crypt.java similarity index 100% rename from src/main/generated/writely/routines/Crypt.java rename to domain/src/main/generated/writely/routines/Crypt.java diff --git a/src/main/generated/writely/routines/Dearmor.java b/domain/src/main/generated/writely/routines/Dearmor.java similarity index 100% rename from src/main/generated/writely/routines/Dearmor.java rename to domain/src/main/generated/writely/routines/Dearmor.java diff --git a/src/main/generated/writely/routines/Decrypt.java b/domain/src/main/generated/writely/routines/Decrypt.java similarity index 100% rename from src/main/generated/writely/routines/Decrypt.java rename to domain/src/main/generated/writely/routines/Decrypt.java diff --git a/src/main/generated/writely/routines/DecryptIv.java b/domain/src/main/generated/writely/routines/DecryptIv.java similarity index 100% rename from src/main/generated/writely/routines/DecryptIv.java rename to domain/src/main/generated/writely/routines/DecryptIv.java diff --git a/src/main/generated/writely/routines/Digest1.java b/domain/src/main/generated/writely/routines/Digest1.java similarity index 100% rename from src/main/generated/writely/routines/Digest1.java rename to domain/src/main/generated/writely/routines/Digest1.java diff --git a/src/main/generated/writely/routines/Digest2.java b/domain/src/main/generated/writely/routines/Digest2.java similarity index 100% rename from src/main/generated/writely/routines/Digest2.java rename to domain/src/main/generated/writely/routines/Digest2.java diff --git a/src/main/generated/writely/routines/Encrypt.java b/domain/src/main/generated/writely/routines/Encrypt.java similarity index 100% rename from src/main/generated/writely/routines/Encrypt.java rename to domain/src/main/generated/writely/routines/Encrypt.java diff --git a/src/main/generated/writely/routines/EncryptIv.java b/domain/src/main/generated/writely/routines/EncryptIv.java similarity index 100% rename from src/main/generated/writely/routines/EncryptIv.java rename to domain/src/main/generated/writely/routines/EncryptIv.java diff --git a/src/main/generated/writely/routines/GenRandomBytes.java b/domain/src/main/generated/writely/routines/GenRandomBytes.java similarity index 100% rename from src/main/generated/writely/routines/GenRandomBytes.java rename to domain/src/main/generated/writely/routines/GenRandomBytes.java diff --git a/src/main/generated/writely/routines/GenRandomUuid.java b/domain/src/main/generated/writely/routines/GenRandomUuid.java similarity index 100% rename from src/main/generated/writely/routines/GenRandomUuid.java rename to domain/src/main/generated/writely/routines/GenRandomUuid.java diff --git a/src/main/generated/writely/routines/GenSalt1.java b/domain/src/main/generated/writely/routines/GenSalt1.java similarity index 100% rename from src/main/generated/writely/routines/GenSalt1.java rename to domain/src/main/generated/writely/routines/GenSalt1.java diff --git a/src/main/generated/writely/routines/GenSalt2.java b/domain/src/main/generated/writely/routines/GenSalt2.java similarity index 100% rename from src/main/generated/writely/routines/GenSalt2.java rename to domain/src/main/generated/writely/routines/GenSalt2.java diff --git a/src/main/generated/writely/routines/Hmac1.java b/domain/src/main/generated/writely/routines/Hmac1.java similarity index 100% rename from src/main/generated/writely/routines/Hmac1.java rename to domain/src/main/generated/writely/routines/Hmac1.java diff --git a/src/main/generated/writely/routines/Hmac2.java b/domain/src/main/generated/writely/routines/Hmac2.java similarity index 100% rename from src/main/generated/writely/routines/Hmac2.java rename to domain/src/main/generated/writely/routines/Hmac2.java diff --git a/src/main/generated/writely/routines/PgpKeyId.java b/domain/src/main/generated/writely/routines/PgpKeyId.java similarity index 100% rename from src/main/generated/writely/routines/PgpKeyId.java rename to domain/src/main/generated/writely/routines/PgpKeyId.java diff --git a/src/main/generated/writely/routines/PgpPubDecrypt1.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt1.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecrypt1.java rename to domain/src/main/generated/writely/routines/PgpPubDecrypt1.java diff --git a/src/main/generated/writely/routines/PgpPubDecrypt2.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt2.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecrypt2.java rename to domain/src/main/generated/writely/routines/PgpPubDecrypt2.java diff --git a/src/main/generated/writely/routines/PgpPubDecrypt3.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt3.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecrypt3.java rename to domain/src/main/generated/writely/routines/PgpPubDecrypt3.java diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea1.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecryptBytea1.java rename to domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea2.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecryptBytea2.java rename to domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java diff --git a/src/main/generated/writely/routines/PgpPubDecryptBytea3.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubDecryptBytea3.java rename to domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java diff --git a/src/main/generated/writely/routines/PgpPubEncrypt1.java b/domain/src/main/generated/writely/routines/PgpPubEncrypt1.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubEncrypt1.java rename to domain/src/main/generated/writely/routines/PgpPubEncrypt1.java diff --git a/src/main/generated/writely/routines/PgpPubEncrypt2.java b/domain/src/main/generated/writely/routines/PgpPubEncrypt2.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubEncrypt2.java rename to domain/src/main/generated/writely/routines/PgpPubEncrypt2.java diff --git a/src/main/generated/writely/routines/PgpPubEncryptBytea1.java b/domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubEncryptBytea1.java rename to domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java diff --git a/src/main/generated/writely/routines/PgpPubEncryptBytea2.java b/domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java similarity index 100% rename from src/main/generated/writely/routines/PgpPubEncryptBytea2.java rename to domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java diff --git a/src/main/generated/writely/routines/PgpSymDecrypt1.java b/domain/src/main/generated/writely/routines/PgpSymDecrypt1.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymDecrypt1.java rename to domain/src/main/generated/writely/routines/PgpSymDecrypt1.java diff --git a/src/main/generated/writely/routines/PgpSymDecrypt2.java b/domain/src/main/generated/writely/routines/PgpSymDecrypt2.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymDecrypt2.java rename to domain/src/main/generated/writely/routines/PgpSymDecrypt2.java diff --git a/src/main/generated/writely/routines/PgpSymDecryptBytea1.java b/domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymDecryptBytea1.java rename to domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java diff --git a/src/main/generated/writely/routines/PgpSymDecryptBytea2.java b/domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymDecryptBytea2.java rename to domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java diff --git a/src/main/generated/writely/routines/PgpSymEncrypt1.java b/domain/src/main/generated/writely/routines/PgpSymEncrypt1.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymEncrypt1.java rename to domain/src/main/generated/writely/routines/PgpSymEncrypt1.java diff --git a/src/main/generated/writely/routines/PgpSymEncrypt2.java b/domain/src/main/generated/writely/routines/PgpSymEncrypt2.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymEncrypt2.java rename to domain/src/main/generated/writely/routines/PgpSymEncrypt2.java diff --git a/src/main/generated/writely/routines/PgpSymEncryptBytea1.java b/domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymEncryptBytea1.java rename to domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java diff --git a/src/main/generated/writely/routines/PgpSymEncryptBytea2.java b/domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java similarity index 100% rename from src/main/generated/writely/routines/PgpSymEncryptBytea2.java rename to domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java diff --git a/src/main/generated/writely/tables/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/AutoModifyMessage.java similarity index 100% rename from src/main/generated/writely/tables/AutoModifyMessage.java rename to domain/src/main/generated/writely/tables/AutoModifyMessage.java diff --git a/domain/src/main/generated/writely/tables/FeedbackMessage.java b/domain/src/main/generated/writely/tables/FeedbackMessage.java new file mode 100644 index 0000000..95349c3 --- /dev/null +++ b/domain/src/main/generated/writely/tables/FeedbackMessage.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.FeedbackMessageRecord; + + +/** + * 피드백 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class FeedbackMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.feedback_message + */ + public static final FeedbackMessage FEEDBACK_MESSAGE = new FeedbackMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return FeedbackMessageRecord.class; + } + + /** + * The column public.feedback_message.id. 피드백 메세지 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "피드백 메세지 ID"); + + /** + * The column public.feedback_message.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.feedback_message.role. 메세지 송신자 + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); + + /** + * The column public.feedback_message.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); + + /** + * The column public.feedback_message.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.feedback_message.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.feedback_message.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.feedback_message.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private FeedbackMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private FeedbackMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("피드백 메세지"), TableOptions.table(), where); + } + + /** + * Create an aliased public.feedback_message table reference + */ + public FeedbackMessage(String alias) { + this(DSL.name(alias), FEEDBACK_MESSAGE); + } + + /** + * Create an aliased public.feedback_message table reference + */ + public FeedbackMessage(Name alias) { + this(alias, FEEDBACK_MESSAGE); + } + + /** + * Create a public.feedback_message table reference + */ + public FeedbackMessage() { + this(DSL.name("feedback_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.FEEDBACK_MESSAGE_PK; + } + + @Override + public FeedbackMessage as(String alias) { + return new FeedbackMessage(DSL.name(alias), this); + } + + @Override + public FeedbackMessage as(Name alias) { + return new FeedbackMessage(alias, this); + } + + @Override + public FeedbackMessage as(Table alias) { + return new FeedbackMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public FeedbackMessage rename(String name) { + return new FeedbackMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public FeedbackMessage rename(Name name) { + return new FeedbackMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public FeedbackMessage rename(Table name) { + return new FeedbackMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage where(Condition condition) { + return new FeedbackMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public FeedbackMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public FeedbackMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public FeedbackMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public FeedbackMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public FeedbackMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/generated/writely/tables/LoginAttempt.java b/domain/src/main/generated/writely/tables/LoginAttempt.java similarity index 100% rename from src/main/generated/writely/tables/LoginAttempt.java rename to domain/src/main/generated/writely/tables/LoginAttempt.java diff --git a/src/main/generated/writely/tables/Member.java b/domain/src/main/generated/writely/tables/Member.java similarity index 100% rename from src/main/generated/writely/tables/Member.java rename to domain/src/main/generated/writely/tables/Member.java diff --git a/src/main/generated/writely/tables/MemberPassword.java b/domain/src/main/generated/writely/tables/MemberPassword.java similarity index 100% rename from src/main/generated/writely/tables/MemberPassword.java rename to domain/src/main/generated/writely/tables/MemberPassword.java diff --git a/src/main/generated/writely/tables/PgpArmorHeaders.java b/domain/src/main/generated/writely/tables/PgpArmorHeaders.java similarity index 100% rename from src/main/generated/writely/tables/PgpArmorHeaders.java rename to domain/src/main/generated/writely/tables/PgpArmorHeaders.java diff --git a/src/main/generated/writely/tables/Product.java b/domain/src/main/generated/writely/tables/Product.java similarity index 100% rename from src/main/generated/writely/tables/Product.java rename to domain/src/main/generated/writely/tables/Product.java diff --git a/src/main/generated/writely/tables/ProductCharacter.java b/domain/src/main/generated/writely/tables/ProductCharacter.java similarity index 100% rename from src/main/generated/writely/tables/ProductCharacter.java rename to domain/src/main/generated/writely/tables/ProductCharacter.java diff --git a/src/main/generated/writely/tables/ProductCustomField.java b/domain/src/main/generated/writely/tables/ProductCustomField.java similarity index 100% rename from src/main/generated/writely/tables/ProductCustomField.java rename to domain/src/main/generated/writely/tables/ProductCustomField.java diff --git a/src/main/generated/writely/tables/ProductIdeanote.java b/domain/src/main/generated/writely/tables/ProductIdeanote.java similarity index 100% rename from src/main/generated/writely/tables/ProductIdeanote.java rename to domain/src/main/generated/writely/tables/ProductIdeanote.java diff --git a/src/main/generated/writely/tables/ProductMemo.java b/domain/src/main/generated/writely/tables/ProductMemo.java similarity index 100% rename from src/main/generated/writely/tables/ProductMemo.java rename to domain/src/main/generated/writely/tables/ProductMemo.java diff --git a/src/main/generated/writely/tables/ProductPlot.java b/domain/src/main/generated/writely/tables/ProductPlot.java similarity index 100% rename from src/main/generated/writely/tables/ProductPlot.java rename to domain/src/main/generated/writely/tables/ProductPlot.java diff --git a/src/main/generated/writely/tables/ProductSynopsis.java b/domain/src/main/generated/writely/tables/ProductSynopsis.java similarity index 100% rename from src/main/generated/writely/tables/ProductSynopsis.java rename to domain/src/main/generated/writely/tables/ProductSynopsis.java diff --git a/src/main/generated/writely/tables/ProductWorldview.java b/domain/src/main/generated/writely/tables/ProductWorldview.java similarity index 100% rename from src/main/generated/writely/tables/ProductWorldview.java rename to domain/src/main/generated/writely/tables/ProductWorldview.java diff --git a/src/main/generated/writely/tables/Terms.java b/domain/src/main/generated/writely/tables/Terms.java similarity index 100% rename from src/main/generated/writely/tables/Terms.java rename to domain/src/main/generated/writely/tables/Terms.java diff --git a/src/main/generated/writely/tables/TermsAgreement.java b/domain/src/main/generated/writely/tables/TermsAgreement.java similarity index 100% rename from src/main/generated/writely/tables/TermsAgreement.java rename to domain/src/main/generated/writely/tables/TermsAgreement.java diff --git a/src/main/generated/writely/tables/pojos/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java similarity index 100% rename from src/main/generated/writely/tables/pojos/AutoModifyMessage.java rename to domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java diff --git a/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java b/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java new file mode 100644 index 0000000..a1039fa --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java @@ -0,0 +1,207 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 피드백 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class FeedbackMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String role; + private final String content; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public FeedbackMessage(FeedbackMessage value) { + this.id = value.id; + this.productId = value.productId; + this.role = value.role; + this.content = value.content; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public FeedbackMessage( + UUID id, + UUID productId, + String role, + String content, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.role = role; + this.content = content; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.feedback_message.id. 피드백 메세지 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.feedback_message.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.feedback_message.role. 메세지 송신자 + */ + public String getRole() { + return this.role; + } + + /** + * Getter for public.feedback_message.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.feedback_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.feedback_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.feedback_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.feedback_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final FeedbackMessage other = (FeedbackMessage) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.role == null) { + if (other.role != null) + return false; + } + else if (!this.role.equals(other.role)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("FeedbackMessage ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(role); + sb.append(", ").append(content); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/generated/writely/tables/pojos/LoginAttempt.java b/domain/src/main/generated/writely/tables/pojos/LoginAttempt.java similarity index 100% rename from src/main/generated/writely/tables/pojos/LoginAttempt.java rename to domain/src/main/generated/writely/tables/pojos/LoginAttempt.java diff --git a/src/main/generated/writely/tables/pojos/Member.java b/domain/src/main/generated/writely/tables/pojos/Member.java similarity index 100% rename from src/main/generated/writely/tables/pojos/Member.java rename to domain/src/main/generated/writely/tables/pojos/Member.java diff --git a/src/main/generated/writely/tables/pojos/MemberPassword.java b/domain/src/main/generated/writely/tables/pojos/MemberPassword.java similarity index 100% rename from src/main/generated/writely/tables/pojos/MemberPassword.java rename to domain/src/main/generated/writely/tables/pojos/MemberPassword.java diff --git a/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java b/domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java similarity index 100% rename from src/main/generated/writely/tables/pojos/PgpArmorHeaders.java rename to domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java diff --git a/src/main/generated/writely/tables/pojos/Product.java b/domain/src/main/generated/writely/tables/pojos/Product.java similarity index 100% rename from src/main/generated/writely/tables/pojos/Product.java rename to domain/src/main/generated/writely/tables/pojos/Product.java diff --git a/src/main/generated/writely/tables/pojos/ProductCharacter.java b/domain/src/main/generated/writely/tables/pojos/ProductCharacter.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductCharacter.java rename to domain/src/main/generated/writely/tables/pojos/ProductCharacter.java diff --git a/src/main/generated/writely/tables/pojos/ProductCustomField.java b/domain/src/main/generated/writely/tables/pojos/ProductCustomField.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductCustomField.java rename to domain/src/main/generated/writely/tables/pojos/ProductCustomField.java diff --git a/src/main/generated/writely/tables/pojos/ProductIdeanote.java b/domain/src/main/generated/writely/tables/pojos/ProductIdeanote.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductIdeanote.java rename to domain/src/main/generated/writely/tables/pojos/ProductIdeanote.java diff --git a/src/main/generated/writely/tables/pojos/ProductMemo.java b/domain/src/main/generated/writely/tables/pojos/ProductMemo.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductMemo.java rename to domain/src/main/generated/writely/tables/pojos/ProductMemo.java diff --git a/src/main/generated/writely/tables/pojos/ProductPlot.java b/domain/src/main/generated/writely/tables/pojos/ProductPlot.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductPlot.java rename to domain/src/main/generated/writely/tables/pojos/ProductPlot.java diff --git a/src/main/generated/writely/tables/pojos/ProductSynopsis.java b/domain/src/main/generated/writely/tables/pojos/ProductSynopsis.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductSynopsis.java rename to domain/src/main/generated/writely/tables/pojos/ProductSynopsis.java diff --git a/src/main/generated/writely/tables/pojos/ProductWorldview.java b/domain/src/main/generated/writely/tables/pojos/ProductWorldview.java similarity index 100% rename from src/main/generated/writely/tables/pojos/ProductWorldview.java rename to domain/src/main/generated/writely/tables/pojos/ProductWorldview.java diff --git a/src/main/generated/writely/tables/pojos/Terms.java b/domain/src/main/generated/writely/tables/pojos/Terms.java similarity index 100% rename from src/main/generated/writely/tables/pojos/Terms.java rename to domain/src/main/generated/writely/tables/pojos/Terms.java diff --git a/src/main/generated/writely/tables/pojos/TermsAgreement.java b/domain/src/main/generated/writely/tables/pojos/TermsAgreement.java similarity index 100% rename from src/main/generated/writely/tables/pojos/TermsAgreement.java rename to domain/src/main/generated/writely/tables/pojos/TermsAgreement.java diff --git a/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/AutoModifyMessageRecord.java rename to domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java diff --git a/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java b/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java new file mode 100644 index 0000000..0b3b69b --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java @@ -0,0 +1,199 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.FeedbackMessage; + + +/** + * 피드백 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class FeedbackMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.feedback_message.id. 피드백 메세지 ID + */ + public FeedbackMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.feedback_message.id. 피드백 메세지 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.feedback_message.product_id. 작품 ID + */ + public FeedbackMessageRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.feedback_message.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.feedback_message.role. 메세지 송신자 + */ + public FeedbackMessageRecord setRole(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.feedback_message.role. 메세지 송신자 + */ + public String getRole() { + return (String) get(2); + } + + /** + * Setter for public.feedback_message.content. 내용 + */ + public FeedbackMessageRecord setContent(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.feedback_message.content. 내용 + */ + public String getContent() { + return (String) get(3); + } + + /** + * Setter for public.feedback_message.created_at. 생성일시 + */ + public FeedbackMessageRecord setCreatedAt(LocalDateTime value) { + set(4, value); + return this; + } + + /** + * Getter for public.feedback_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(4); + } + + /** + * Setter for public.feedback_message.created_by. 생성자 ID + */ + public FeedbackMessageRecord setCreatedBy(UUID value) { + set(5, value); + return this; + } + + /** + * Getter for public.feedback_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(5); + } + + /** + * Setter for public.feedback_message.updated_at. 수정일시 + */ + public FeedbackMessageRecord setUpdatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.feedback_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.feedback_message.updated_by. 수정자 ID + */ + public FeedbackMessageRecord setUpdatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.feedback_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(7); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached FeedbackMessageRecord + */ + public FeedbackMessageRecord() { + super(FeedbackMessage.FEEDBACK_MESSAGE); + } + + /** + * Create a detached, initialised FeedbackMessageRecord + */ + public FeedbackMessageRecord(UUID id, UUID productId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(FeedbackMessage.FEEDBACK_MESSAGE); + + setId(id); + setProductId(productId); + setRole(role); + setContent(content); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised FeedbackMessageRecord + */ + public FeedbackMessageRecord(writely.tables.pojos.FeedbackMessage value) { + super(FeedbackMessage.FEEDBACK_MESSAGE); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setRole(value.getRole()); + setContent(value.getContent()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/generated/writely/tables/records/LoginAttemptRecord.java b/domain/src/main/generated/writely/tables/records/LoginAttemptRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/LoginAttemptRecord.java rename to domain/src/main/generated/writely/tables/records/LoginAttemptRecord.java diff --git a/src/main/generated/writely/tables/records/MemberPasswordRecord.java b/domain/src/main/generated/writely/tables/records/MemberPasswordRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/MemberPasswordRecord.java rename to domain/src/main/generated/writely/tables/records/MemberPasswordRecord.java diff --git a/src/main/generated/writely/tables/records/MemberRecord.java b/domain/src/main/generated/writely/tables/records/MemberRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/MemberRecord.java rename to domain/src/main/generated/writely/tables/records/MemberRecord.java diff --git a/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java b/domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java rename to domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java diff --git a/src/main/generated/writely/tables/records/ProductCharacterRecord.java b/domain/src/main/generated/writely/tables/records/ProductCharacterRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductCharacterRecord.java rename to domain/src/main/generated/writely/tables/records/ProductCharacterRecord.java diff --git a/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java b/domain/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductCustomFieldRecord.java rename to domain/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java diff --git a/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java b/domain/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductIdeanoteRecord.java rename to domain/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java diff --git a/src/main/generated/writely/tables/records/ProductMemoRecord.java b/domain/src/main/generated/writely/tables/records/ProductMemoRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductMemoRecord.java rename to domain/src/main/generated/writely/tables/records/ProductMemoRecord.java diff --git a/src/main/generated/writely/tables/records/ProductPlotRecord.java b/domain/src/main/generated/writely/tables/records/ProductPlotRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductPlotRecord.java rename to domain/src/main/generated/writely/tables/records/ProductPlotRecord.java diff --git a/src/main/generated/writely/tables/records/ProductRecord.java b/domain/src/main/generated/writely/tables/records/ProductRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductRecord.java rename to domain/src/main/generated/writely/tables/records/ProductRecord.java diff --git a/src/main/generated/writely/tables/records/ProductSynopsisRecord.java b/domain/src/main/generated/writely/tables/records/ProductSynopsisRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductSynopsisRecord.java rename to domain/src/main/generated/writely/tables/records/ProductSynopsisRecord.java diff --git a/src/main/generated/writely/tables/records/ProductWorldviewRecord.java b/domain/src/main/generated/writely/tables/records/ProductWorldviewRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/ProductWorldviewRecord.java rename to domain/src/main/generated/writely/tables/records/ProductWorldviewRecord.java diff --git a/src/main/generated/writely/tables/records/TermsAgreementRecord.java b/domain/src/main/generated/writely/tables/records/TermsAgreementRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/TermsAgreementRecord.java rename to domain/src/main/generated/writely/tables/records/TermsAgreementRecord.java diff --git a/src/main/generated/writely/tables/records/TermsRecord.java b/domain/src/main/generated/writely/tables/records/TermsRecord.java similarity index 100% rename from src/main/generated/writely/tables/records/TermsRecord.java rename to domain/src/main/generated/writely/tables/records/TermsRecord.java diff --git a/src/main/java/com/writely/assistant/domain/MessageContent.java b/domain/src/main/java/writeon/domain/assistant/MessageContent.java similarity index 73% rename from src/main/java/com/writely/assistant/domain/MessageContent.java rename to domain/src/main/java/writeon/domain/assistant/MessageContent.java index 356c4c0..cbb2462 100644 --- a/src/main/java/com/writely/assistant/domain/MessageContent.java +++ b/domain/src/main/java/writeon/domain/assistant/MessageContent.java @@ -1,9 +1,11 @@ -package com.writely.assistant.domain; +package writeon.domain.assistant; -import com.writely.assistant.domain.enums.MessageSenderRole; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Embeddable; import lombok.Data; import lombok.NoArgsConstructor; +import writeon.domain.assistant.enums.MessageSenderRole; @Data @Embeddable diff --git a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java similarity index 79% rename from src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java rename to domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java index 6ff8bc5..dd1041f 100644 --- a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java @@ -1,11 +1,11 @@ -package com.writely.assistant.domain.automodify; +package writeon.domain.assistant.automodify; -import com.writely.assistant.domain.MessageContent; -import com.writely.assistant.domain.enums.MessageSenderRole; -import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import writeon.domain.assistant.MessageContent; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java similarity index 79% rename from src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java rename to domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java index 7f6fd36..7112ad4 100644 --- a/src/main/java/com/writely/assistant/domain/automodify/AutoModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java @@ -1,4 +1,4 @@ -package com.writely.assistant.domain.automodify; +package writeon.domain.assistant.automodify; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/writely/assistant/domain/enums/AssistantException.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java similarity index 87% rename from src/main/java/com/writely/assistant/domain/enums/AssistantException.java rename to domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java index 0d1b8fa..cc545e3 100644 --- a/src/main/java/com/writely/assistant/domain/enums/AssistantException.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java @@ -1,9 +1,9 @@ -package com.writely.assistant.domain.enums; +package writeon.domain.assistant.enums; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java b/domain/src/main/java/writeon/domain/assistant/enums/MessageSenderRole.java similarity index 79% rename from src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java rename to domain/src/main/java/writeon/domain/assistant/enums/MessageSenderRole.java index 69d5579..b4bbe84 100644 --- a/src/main/java/com/writely/assistant/domain/enums/MessageSenderRole.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/MessageSenderRole.java @@ -1,10 +1,10 @@ -package com.writely.assistant.domain.enums; +package writeon.domain.assistant.enums; -import com.writely.common.converter.AbstractEnumCodeConverter; -import com.writely.common.enums.Codable; import jakarta.persistence.Converter; import lombok.Getter; import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; @Getter @RequiredArgsConstructor diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java new file mode 100644 index 0000000..1f078f1 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java @@ -0,0 +1,40 @@ +package writeon.domain.assistant.feedback; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.assistant.MessageContent; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.common.BaseAuditTimeEntity; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "feedback_message") +public class FeedbackMessage extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Embedded + private MessageContent messageContent; + + public FeedbackMessage(UUID productId, MessageSenderRole role, String content) { + this.productId = productId; + this.messageContent = new MessageContent(role, content); + } + + public MessageSenderRole getRole() { + return messageContent.getRole(); + } + + public String getContent() { + return messageContent.getContent(); + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java new file mode 100644 index 0000000..cd3089a --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java @@ -0,0 +1,8 @@ +package writeon.domain.assistant.feedback; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface FeedbackMessageJpaRepository extends JpaRepository { +} diff --git a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java similarity index 77% rename from src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java rename to domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java index 1f5910d..9a6ef69 100644 --- a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java @@ -1,11 +1,11 @@ -package com.writely.assistant.domain.usermodify; +package writeon.domain.assistant.usermodify; -import com.writely.assistant.domain.MessageContent; -import com.writely.assistant.domain.enums.MessageSenderRole; -import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import writeon.domain.assistant.MessageContent; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; @@ -25,7 +25,7 @@ public class UserModifyMessage extends BaseAuditTimeEntity { @Embedded private MessageContent messageContent; - @Column(name = "prompt", nullable = false) + @Column(name = "prompt") private String prompt; public UserModifyMessage(UUID productId, MessageSenderRole role, String content, String prompt) { diff --git a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java similarity index 79% rename from src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java rename to domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java index b3cde66..37359da 100644 --- a/src/main/java/com/writely/assistant/domain/usermodify/UserModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java @@ -1,4 +1,4 @@ -package com.writely.assistant.domain.usermodify; +package writeon.domain.assistant.usermodify; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/writely/auth/domain/BaseToken.java b/domain/src/main/java/writeon/domain/auth/BaseToken.java similarity index 92% rename from src/main/java/com/writely/auth/domain/BaseToken.java rename to domain/src/main/java/writeon/domain/auth/BaseToken.java index ddc23ed..a250adb 100644 --- a/src/main/java/com/writely/auth/domain/BaseToken.java +++ b/domain/src/main/java/writeon/domain/auth/BaseToken.java @@ -1,4 +1,4 @@ -package com.writely.auth.domain; +package writeon.domain.auth; import jakarta.persistence.MappedSuperclass; import lombok.AccessLevel; diff --git a/src/main/java/com/writely/auth/domain/ChangePasswordToken.java b/domain/src/main/java/writeon/domain/auth/ChangePasswordToken.java similarity index 92% rename from src/main/java/com/writely/auth/domain/ChangePasswordToken.java rename to domain/src/main/java/writeon/domain/auth/ChangePasswordToken.java index f892c5e..40bacea 100644 --- a/src/main/java/com/writely/auth/domain/ChangePasswordToken.java +++ b/domain/src/main/java/writeon/domain/auth/ChangePasswordToken.java @@ -1,4 +1,4 @@ -package com.writely.auth.domain; +package writeon.domain.auth; import lombok.AccessLevel; import lombok.Getter; diff --git a/src/main/java/com/writely/auth/domain/JoinToken.java b/domain/src/main/java/writeon/domain/auth/JoinToken.java similarity index 81% rename from src/main/java/com/writely/auth/domain/JoinToken.java rename to domain/src/main/java/writeon/domain/auth/JoinToken.java index 205f916..f16bae7 100644 --- a/src/main/java/com/writely/auth/domain/JoinToken.java +++ b/domain/src/main/java/writeon/domain/auth/JoinToken.java @@ -1,12 +1,12 @@ -package com.writely.auth.domain; +package writeon.domain.auth; -import com.writely.member.domain.Member; -import com.writely.member.domain.MemberPassword; -import com.writely.terms.domain.TermsAgreement; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import org.springframework.data.redis.core.RedisHash; +import writeon.domain.member.Member; +import writeon.domain.member.MemberPassword; +import writeon.domain.terms.TermsAgreement; import java.util.List; diff --git a/src/main/java/com/writely/auth/domain/JwtPayload.java b/domain/src/main/java/writeon/domain/auth/JwtPayload.java similarity index 87% rename from src/main/java/com/writely/auth/domain/JwtPayload.java rename to domain/src/main/java/writeon/domain/auth/JwtPayload.java index 0ab5d16..463c9f4 100644 --- a/src/main/java/com/writely/auth/domain/JwtPayload.java +++ b/domain/src/main/java/writeon/domain/auth/JwtPayload.java @@ -1,4 +1,4 @@ -package com.writely.auth.domain; +package writeon.domain.auth; import lombok.*; diff --git a/src/main/java/com/writely/auth/domain/LoginAttempt.java b/domain/src/main/java/writeon/domain/auth/LoginAttempt.java similarity index 79% rename from src/main/java/com/writely/auth/domain/LoginAttempt.java rename to domain/src/main/java/writeon/domain/auth/LoginAttempt.java index 1c5c54f..c9d73e9 100644 --- a/src/main/java/com/writely/auth/domain/LoginAttempt.java +++ b/domain/src/main/java/writeon/domain/auth/LoginAttempt.java @@ -1,11 +1,11 @@ -package com.writely.auth.domain; +package writeon.domain.auth; -import com.writely.auth.domain.enums.LoginAttemptResultType; -import com.writely.common.domain.BaseTimeEntity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.auth.enums.LoginAttemptResultType; +import writeon.domain.common.BaseTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/auth/domain/RefreshToken.java b/domain/src/main/java/writeon/domain/auth/RefreshToken.java similarity index 94% rename from src/main/java/com/writely/auth/domain/RefreshToken.java rename to domain/src/main/java/writeon/domain/auth/RefreshToken.java index db298fa..2d07cc5 100644 --- a/src/main/java/com/writely/auth/domain/RefreshToken.java +++ b/domain/src/main/java/writeon/domain/auth/RefreshToken.java @@ -1,4 +1,4 @@ -package com.writely.auth.domain; +package writeon.domain.auth; import lombok.AccessLevel; import lombok.Getter; diff --git a/src/main/java/com/writely/auth/domain/enums/AuthException.java b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java similarity index 94% rename from src/main/java/com/writely/auth/domain/enums/AuthException.java rename to domain/src/main/java/writeon/domain/auth/enums/AuthException.java index bd5981a..640f972 100644 --- a/src/main/java/com/writely/auth/domain/enums/AuthException.java +++ b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java @@ -1,9 +1,9 @@ -package com.writely.auth.domain.enums; +package writeon.domain.auth.enums; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java b/domain/src/main/java/writeon/domain/auth/enums/LoginAttemptResultType.java similarity index 80% rename from src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java rename to domain/src/main/java/writeon/domain/auth/enums/LoginAttemptResultType.java index 38e5370..d834e02 100644 --- a/src/main/java/com/writely/auth/domain/enums/LoginAttemptResultType.java +++ b/domain/src/main/java/writeon/domain/auth/enums/LoginAttemptResultType.java @@ -1,10 +1,10 @@ -package com.writely.auth.domain.enums; +package writeon.domain.auth.enums; -import com.writely.common.converter.AbstractEnumCodeConverter; -import com.writely.common.enums.Codable; import jakarta.persistence.Converter; import lombok.Getter; import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java b/domain/src/main/java/writeon/domain/auth/repository/ChangePasswordTokenRedisRepository.java similarity index 65% rename from src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java rename to domain/src/main/java/writeon/domain/auth/repository/ChangePasswordTokenRedisRepository.java index 6621925..0dd088b 100644 --- a/src/main/java/com/writely/auth/repository/ChangePasswordTokenRedisRepository.java +++ b/domain/src/main/java/writeon/domain/auth/repository/ChangePasswordTokenRedisRepository.java @@ -1,7 +1,7 @@ -package com.writely.auth.repository; +package writeon.domain.auth.repository; -import com.writely.auth.domain.ChangePasswordToken; import org.springframework.data.repository.CrudRepository; +import writeon.domain.auth.ChangePasswordToken; public interface ChangePasswordTokenRedisRepository extends CrudRepository { diff --git a/src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java b/domain/src/main/java/writeon/domain/auth/repository/JoinTokenRedisRepository.java similarity index 65% rename from src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java rename to domain/src/main/java/writeon/domain/auth/repository/JoinTokenRedisRepository.java index 5cfc442..9158065 100644 --- a/src/main/java/com/writely/auth/repository/JoinTokenRedisRepository.java +++ b/domain/src/main/java/writeon/domain/auth/repository/JoinTokenRedisRepository.java @@ -1,7 +1,7 @@ -package com.writely.auth.repository; +package writeon.domain.auth.repository; -import com.writely.auth.domain.JoinToken; import org.springframework.data.repository.CrudRepository; +import writeon.domain.auth.JoinToken; public interface JoinTokenRedisRepository extends CrudRepository { diff --git a/src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java b/domain/src/main/java/writeon/domain/auth/repository/LoginAttemptJpaRepository.java similarity index 76% rename from src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java rename to domain/src/main/java/writeon/domain/auth/repository/LoginAttemptJpaRepository.java index 9112911..957c773 100644 --- a/src/main/java/com/writely/auth/repository/LoginAttemptJpaRepository.java +++ b/domain/src/main/java/writeon/domain/auth/repository/LoginAttemptJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.auth.repository; +package writeon.domain.auth.repository; -import com.writely.auth.domain.LoginAttempt; import org.springframework.data.repository.CrudRepository; +import writeon.domain.auth.LoginAttempt; import java.util.List; import java.util.UUID; diff --git a/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java b/domain/src/main/java/writeon/domain/auth/repository/RefreshTokenRedisRepository.java similarity index 76% rename from src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java rename to domain/src/main/java/writeon/domain/auth/repository/RefreshTokenRedisRepository.java index 73354db..0344f9e 100644 --- a/src/main/java/com/writely/auth/repository/RefreshTokenRedisRepository.java +++ b/domain/src/main/java/writeon/domain/auth/repository/RefreshTokenRedisRepository.java @@ -1,7 +1,7 @@ -package com.writely.auth.repository; +package writeon.domain.auth.repository; -import com.writely.auth.domain.RefreshToken; import org.springframework.data.repository.CrudRepository; +import writeon.domain.auth.RefreshToken; import java.util.Optional; import java.util.UUID; diff --git a/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java b/domain/src/main/java/writeon/domain/common/BaseAuditTimeEntity.java similarity index 84% rename from src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java rename to domain/src/main/java/writeon/domain/common/BaseAuditTimeEntity.java index cd7ee6c..390eed5 100644 --- a/src/main/java/com/writely/common/domain/BaseAuditTimeEntity.java +++ b/domain/src/main/java/writeon/domain/common/BaseAuditTimeEntity.java @@ -1,6 +1,5 @@ -package com.writely.common.domain; +package writeon.domain.common; -import com.writely.common.util.DateTimeUtil; import jakarta.persistence.*; import lombok.Getter; import org.springframework.data.annotation.CreatedBy; @@ -32,12 +31,12 @@ public class BaseAuditTimeEntity implements Serializable { @PrePersist protected void onPrePersist() { - this.createdAt = DateTimeUtil.getDateTime(); + this.createdAt = LocalDateTime.now(); this.updatedAt = this.createdAt; } @PreUpdate protected void onPreUpdate() { - this.updatedAt = DateTimeUtil.getDateTime(); + this.updatedAt = LocalDateTime.now(); } } diff --git a/src/main/java/com/writely/common/domain/BaseTimeEntity.java b/domain/src/main/java/writeon/domain/common/BaseTimeEntity.java similarity index 78% rename from src/main/java/com/writely/common/domain/BaseTimeEntity.java rename to domain/src/main/java/writeon/domain/common/BaseTimeEntity.java index 345b047..265b858 100644 --- a/src/main/java/com/writely/common/domain/BaseTimeEntity.java +++ b/domain/src/main/java/writeon/domain/common/BaseTimeEntity.java @@ -1,6 +1,5 @@ -package com.writely.common.domain; +package writeon.domain.common; -import com.writely.common.util.DateTimeUtil; import jakarta.persistence.*; import lombok.Getter; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -21,12 +20,12 @@ public class BaseTimeEntity implements Serializable { @PrePersist protected void onPrePersist() { - this.createdAt = DateTimeUtil.getDateTime(); + this.createdAt = LocalDateTime.now(); this.updatedAt = this.createdAt; } @PreUpdate protected void onPreUpdate() { - this.updatedAt = DateTimeUtil.getDateTime(); + this.updatedAt = LocalDateTime.now(); } } diff --git a/src/main/java/com/writely/common/domain/MemberSession.java b/domain/src/main/java/writeon/domain/common/MemberSession.java similarity index 85% rename from src/main/java/com/writely/common/domain/MemberSession.java rename to domain/src/main/java/writeon/domain/common/MemberSession.java index 8b17088..13e14e2 100644 --- a/src/main/java/com/writely/common/domain/MemberSession.java +++ b/domain/src/main/java/writeon/domain/common/MemberSession.java @@ -1,4 +1,4 @@ -package com.writely.common.domain; +package writeon.domain.common; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java b/domain/src/main/java/writeon/domain/common/converter/AbstractEnumCodeConverter.java similarity index 88% rename from src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java rename to domain/src/main/java/writeon/domain/common/converter/AbstractEnumCodeConverter.java index d51fab1..e575d05 100644 --- a/src/main/java/com/writely/common/converter/AbstractEnumCodeConverter.java +++ b/domain/src/main/java/writeon/domain/common/converter/AbstractEnumCodeConverter.java @@ -1,8 +1,8 @@ -package com.writely.common.converter; +package writeon.domain.common.converter; -import com.writely.common.enums.Codable; import jakarta.persistence.AttributeConverter; import org.apache.commons.lang3.StringUtils; +import writeon.domain.common.enums.Codable; public abstract class AbstractEnumCodeConverter & Codable> implements AttributeConverter { diff --git a/src/main/java/com/writely/common/enums/Codable.java b/domain/src/main/java/writeon/domain/common/enums/Codable.java similarity index 93% rename from src/main/java/com/writely/common/enums/Codable.java rename to domain/src/main/java/writeon/domain/common/enums/Codable.java index 8a1da58..ad70e1a 100644 --- a/src/main/java/com/writely/common/enums/Codable.java +++ b/domain/src/main/java/writeon/domain/common/enums/Codable.java @@ -1,4 +1,4 @@ -package com.writely.common.enums; +package writeon.domain.common.enums; import java.util.stream.Stream; diff --git a/src/main/java/com/writely/common/enums/code/CodeInfo.java b/domain/src/main/java/writeon/domain/common/enums/CodeInfo.java similarity index 79% rename from src/main/java/com/writely/common/enums/code/CodeInfo.java rename to domain/src/main/java/writeon/domain/common/enums/CodeInfo.java index 5a71050..ba7e232 100644 --- a/src/main/java/com/writely/common/enums/code/CodeInfo.java +++ b/domain/src/main/java/writeon/domain/common/enums/CodeInfo.java @@ -1,4 +1,4 @@ -package com.writely.common.enums.code; +package writeon.domain.common.enums; import org.springframework.http.HttpStatus; diff --git a/src/main/java/com/writely/member/domain/Member.java b/domain/src/main/java/writeon/domain/member/Member.java similarity index 70% rename from src/main/java/com/writely/member/domain/Member.java rename to domain/src/main/java/writeon/domain/member/Member.java index bd9a81d..0e32b68 100644 --- a/src/main/java/com/writely/member/domain/Member.java +++ b/domain/src/main/java/writeon/domain/member/Member.java @@ -1,9 +1,11 @@ -package com.writely.member.domain; +package writeon.domain.member; -import com.writely.common.domain.BaseTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.*; -import org.springframework.data.redis.core.RedisHash; +import writeon.domain.common.BaseTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/member/domain/MemberPassword.java b/domain/src/main/java/writeon/domain/member/MemberPassword.java similarity index 63% rename from src/main/java/com/writely/member/domain/MemberPassword.java rename to domain/src/main/java/writeon/domain/member/MemberPassword.java index bc05f0d..c424527 100644 --- a/src/main/java/com/writely/member/domain/MemberPassword.java +++ b/domain/src/main/java/writeon/domain/member/MemberPassword.java @@ -1,9 +1,11 @@ -package com.writely.member.domain; +package writeon.domain.member; -import com.writely.common.domain.BaseTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.*; -import org.springframework.data.redis.core.RedisHash; +import writeon.domain.common.BaseTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/member/domain/enums/MemberException.java b/domain/src/main/java/writeon/domain/member/enums/MemberException.java similarity index 81% rename from src/main/java/com/writely/member/domain/enums/MemberException.java rename to domain/src/main/java/writeon/domain/member/enums/MemberException.java index 00b1afa..72b6a2e 100644 --- a/src/main/java/com/writely/member/domain/enums/MemberException.java +++ b/domain/src/main/java/writeon/domain/member/enums/MemberException.java @@ -1,9 +1,9 @@ -package com.writely.member.domain.enums; +package writeon.domain.member.enums; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/member/repository/MemberJpaRepository.java b/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java similarity index 75% rename from src/main/java/com/writely/member/repository/MemberJpaRepository.java rename to domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java index 4da3732..f4841b5 100644 --- a/src/main/java/com/writely/member/repository/MemberJpaRepository.java +++ b/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.member.repository; +package writeon.domain.member.repository; -import com.writely.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.member.Member; import java.util.Optional; import java.util.UUID; diff --git a/src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java b/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java similarity index 75% rename from src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java rename to domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java index 8249b62..e86c769 100644 --- a/src/main/java/com/writely/member/repository/MemberPasswordJpaRepository.java +++ b/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.member.repository; +package writeon.domain.member.repository; -import com.writely.member.domain.MemberPassword; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.member.MemberPassword; import java.util.Optional; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/Product.java b/domain/src/main/java/writeon/domain/product/Product.java similarity index 94% rename from src/main/java/com/writely/product/domain/Product.java rename to domain/src/main/java/writeon/domain/product/Product.java index 3964ae1..7360a87 100644 --- a/src/main/java/com/writely/product/domain/Product.java +++ b/domain/src/main/java/writeon/domain/product/Product.java @@ -1,9 +1,9 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/writely/product/domain/ProductCharacter.java b/domain/src/main/java/writeon/domain/product/ProductCharacter.java similarity index 96% rename from src/main/java/com/writely/product/domain/ProductCharacter.java rename to domain/src/main/java/writeon/domain/product/ProductCharacter.java index 0df3ab3..a87b91f 100644 --- a/src/main/java/com/writely/product/domain/ProductCharacter.java +++ b/domain/src/main/java/writeon/domain/product/ProductCharacter.java @@ -1,12 +1,12 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.hibernate.annotations.SQLRestriction; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/writely/product/domain/ProductCustomField.java b/domain/src/main/java/writeon/domain/product/ProductCustomField.java similarity index 90% rename from src/main/java/com/writely/product/domain/ProductCustomField.java rename to domain/src/main/java/writeon/domain/product/ProductCustomField.java index 7f999e2..e3745c0 100644 --- a/src/main/java/com/writely/product/domain/ProductCustomField.java +++ b/domain/src/main/java/writeon/domain/product/ProductCustomField.java @@ -1,12 +1,12 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; -import com.writely.product.domain.enums.ProductSectionType; import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; +import writeon.domain.product.enums.ProductSectionType; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/ProductIdeaNote.java b/domain/src/main/java/writeon/domain/product/ProductIdeaNote.java similarity index 76% rename from src/main/java/com/writely/product/domain/ProductIdeaNote.java rename to domain/src/main/java/writeon/domain/product/ProductIdeaNote.java index 04b692d..0304bf9 100644 --- a/src/main/java/com/writely/product/domain/ProductIdeaNote.java +++ b/domain/src/main/java/writeon/domain/product/ProductIdeaNote.java @@ -1,10 +1,13 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/ProductMemo.java b/domain/src/main/java/writeon/domain/product/ProductMemo.java similarity index 87% rename from src/main/java/com/writely/product/domain/ProductMemo.java rename to domain/src/main/java/writeon/domain/product/ProductMemo.java index 30e967f..70987d6 100644 --- a/src/main/java/com/writely/product/domain/ProductMemo.java +++ b/domain/src/main/java/writeon/domain/product/ProductMemo.java @@ -1,10 +1,13 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/ProductPlot.java b/domain/src/main/java/writeon/domain/product/ProductPlot.java similarity index 72% rename from src/main/java/com/writely/product/domain/ProductPlot.java rename to domain/src/main/java/writeon/domain/product/ProductPlot.java index 846d24a..6b87abf 100644 --- a/src/main/java/com/writely/product/domain/ProductPlot.java +++ b/domain/src/main/java/writeon/domain/product/ProductPlot.java @@ -1,11 +1,14 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/ProductSynopsis.java b/domain/src/main/java/writeon/domain/product/ProductSynopsis.java similarity index 85% rename from src/main/java/com/writely/product/domain/ProductSynopsis.java rename to domain/src/main/java/writeon/domain/product/ProductSynopsis.java index 73adca0..a32b65a 100644 --- a/src/main/java/com/writely/product/domain/ProductSynopsis.java +++ b/domain/src/main/java/writeon/domain/product/ProductSynopsis.java @@ -1,11 +1,14 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.UUID; diff --git a/src/main/java/com/writely/product/domain/ProductWorldview.java b/domain/src/main/java/writeon/domain/product/ProductWorldview.java similarity index 97% rename from src/main/java/com/writely/product/domain/ProductWorldview.java rename to domain/src/main/java/writeon/domain/product/ProductWorldview.java index 9f96f85..9876134 100644 --- a/src/main/java/com/writely/product/domain/ProductWorldview.java +++ b/domain/src/main/java/writeon/domain/product/ProductWorldview.java @@ -1,12 +1,12 @@ -package com.writely.product.domain; +package writeon.domain.product; -import com.writely.common.domain.BaseAuditTimeEntity; import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.hibernate.annotations.SQLRestriction; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/writely/product/domain/enums/ProductException.java b/domain/src/main/java/writeon/domain/product/enums/ProductException.java similarity index 88% rename from src/main/java/com/writely/product/domain/enums/ProductException.java rename to domain/src/main/java/writeon/domain/product/enums/ProductException.java index ca95128..b5ff25c 100644 --- a/src/main/java/com/writely/product/domain/enums/ProductException.java +++ b/domain/src/main/java/writeon/domain/product/enums/ProductException.java @@ -1,9 +1,9 @@ -package com.writely.product.domain.enums; +package writeon.domain.product.enums; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/product/domain/enums/ProductSectionType.java b/domain/src/main/java/writeon/domain/product/enums/ProductSectionType.java similarity index 88% rename from src/main/java/com/writely/product/domain/enums/ProductSectionType.java rename to domain/src/main/java/writeon/domain/product/enums/ProductSectionType.java index daa9608..aa56f8b 100644 --- a/src/main/java/com/writely/product/domain/enums/ProductSectionType.java +++ b/domain/src/main/java/writeon/domain/product/enums/ProductSectionType.java @@ -1,12 +1,12 @@ -package com.writely.product.domain.enums; +package writeon.domain.product.enums; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.writely.common.converter.AbstractEnumCodeConverter; -import com.writely.common.enums.Codable; import jakarta.persistence.Converter; import lombok.Getter; import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; import java.util.EnumSet; diff --git a/src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductCharacterJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductCharacterJpaRepository.java index 2d7f120..90a3c22 100644 --- a/src/main/java/com/writely/product/repository/ProductCharacterJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductCharacterJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductCharacter; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductCharacter; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductCustomFieldJpaRepository.java similarity index 87% rename from src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductCustomFieldJpaRepository.java index efa1100..d9b00af 100644 --- a/src/main/java/com/writely/product/repository/ProductCustomFieldJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductCustomFieldJpaRepository.java @@ -1,10 +1,10 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductCustomField; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import writeon.domain.product.ProductCustomField; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductIdeaNoteJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductIdeaNoteJpaRepository.java index ee0d145..6a8b741 100644 --- a/src/main/java/com/writely/product/repository/ProductIdeaNoteJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductIdeaNoteJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductIdeaNote; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductIdeaNote; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java index 7807d35..0b68e0a 100644 --- a/src/main/java/com/writely/product/repository/ProductJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.Product; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.Product; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java index c4e24f3..0025fd2 100644 --- a/src/main/java/com/writely/product/repository/ProductMemoJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductMemo; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductMemo; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductPlotJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductPlotJpaRepository.java index aa75dbc..38f4678 100644 --- a/src/main/java/com/writely/product/repository/ProductPlotJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductPlotJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductPlot; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductPlot; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductSynopsisJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductSynopsisJpaRepository.java index ddba930..6813eaf 100644 --- a/src/main/java/com/writely/product/repository/ProductSynopsisJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductSynopsisJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductSynopsis; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductSynopsis; import java.util.UUID; diff --git a/src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductWorldviewJpaRepository.java similarity index 66% rename from src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java rename to domain/src/main/java/writeon/domain/product/repository/ProductWorldviewJpaRepository.java index 141d374..da9066a 100644 --- a/src/main/java/com/writely/product/repository/ProductWorldviewJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductWorldviewJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.product.repository; +package writeon.domain.product.repository; -import com.writely.product.domain.ProductWorldview; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductWorldview; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/domain/Terms.java b/domain/src/main/java/writeon/domain/terms/Terms.java similarity index 85% rename from src/main/java/com/writely/terms/domain/Terms.java rename to domain/src/main/java/writeon/domain/terms/Terms.java index c717fe7..9380d7b 100644 --- a/src/main/java/com/writely/terms/domain/Terms.java +++ b/domain/src/main/java/writeon/domain/terms/Terms.java @@ -1,12 +1,12 @@ -package com.writely.terms.domain; +package writeon.domain.terms; -import com.writely.common.domain.BaseTimeEntity; -import com.writely.terms.domain.enums.TermsCode; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import writely.tables.records.TermsRecord; +import writeon.domain.common.BaseTimeEntity; +import writeon.domain.terms.enums.TermsCode; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/domain/TermsAgreement.java b/domain/src/main/java/writeon/domain/terms/TermsAgreement.java similarity index 78% rename from src/main/java/com/writely/terms/domain/TermsAgreement.java rename to domain/src/main/java/writeon/domain/terms/TermsAgreement.java index 35ecffc..317783d 100644 --- a/src/main/java/com/writely/terms/domain/TermsAgreement.java +++ b/domain/src/main/java/writeon/domain/terms/TermsAgreement.java @@ -1,9 +1,9 @@ -package com.writely.terms.domain; +package writeon.domain.terms; -import com.writely.common.domain.BaseTimeEntity; -import com.writely.terms.domain.enums.TermsCode; import jakarta.persistence.*; import lombok.*; +import writeon.domain.common.BaseTimeEntity; +import writeon.domain.terms.enums.TermsCode; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/domain/TermsAgreementId.java b/domain/src/main/java/writeon/domain/terms/TermsAgreementId.java similarity index 87% rename from src/main/java/com/writely/terms/domain/TermsAgreementId.java rename to domain/src/main/java/writeon/domain/terms/TermsAgreementId.java index bfe4e9c..4f2eb65 100644 --- a/src/main/java/com/writely/terms/domain/TermsAgreementId.java +++ b/domain/src/main/java/writeon/domain/terms/TermsAgreementId.java @@ -1,12 +1,12 @@ -package com.writely.terms.domain; +package writeon.domain.terms; -import com.writely.terms.domain.enums.TermsCode; import jakarta.persistence.Column; import jakarta.persistence.Convert; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import writeon.domain.terms.enums.TermsCode; import java.io.Serializable; import java.util.UUID; diff --git a/src/main/java/com/writely/terms/domain/enums/TermsCode.java b/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java similarity index 88% rename from src/main/java/com/writely/terms/domain/enums/TermsCode.java rename to domain/src/main/java/writeon/domain/terms/enums/TermsCode.java index 914ff10..c997e0b 100644 --- a/src/main/java/com/writely/terms/domain/enums/TermsCode.java +++ b/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java @@ -1,13 +1,13 @@ -package com.writely.terms.domain.enums; +package writeon.domain.terms.enums; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import com.writely.common.converter.AbstractEnumCodeConverter; -import com.writely.common.enums.Codable; import jakarta.persistence.Converter; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/terms/domain/enums/TermsException.java b/domain/src/main/java/writeon/domain/terms/enums/TermsException.java similarity index 81% rename from src/main/java/com/writely/terms/domain/enums/TermsException.java rename to domain/src/main/java/writeon/domain/terms/enums/TermsException.java index c0cddfe..82daeba 100644 --- a/src/main/java/com/writely/terms/domain/enums/TermsException.java +++ b/domain/src/main/java/writeon/domain/terms/enums/TermsException.java @@ -1,9 +1,9 @@ -package com.writely.terms.domain.enums; +package writeon.domain.terms.enums; -import com.writely.common.enums.code.CodeInfo; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; @Getter @RequiredArgsConstructor diff --git a/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java b/domain/src/main/java/writeon/domain/terms/repository/TermsAgreeJpaRepository.java similarity index 64% rename from src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java rename to domain/src/main/java/writeon/domain/terms/repository/TermsAgreeJpaRepository.java index 621a805..e937c32 100644 --- a/src/main/java/com/writely/terms/repository/TermsAgreeJpaRepository.java +++ b/domain/src/main/java/writeon/domain/terms/repository/TermsAgreeJpaRepository.java @@ -1,7 +1,7 @@ -package com.writely.terms.repository; +package writeon.domain.terms.repository; -import com.writely.terms.domain.TermsAgreement; import org.springframework.data.repository.CrudRepository; +import writeon.domain.terms.TermsAgreement; public interface TermsAgreeJpaRepository extends CrudRepository { diff --git a/src/main/java/com/writely/terms/repository/TermsJpaRepository.java b/domain/src/main/java/writeon/domain/terms/repository/TermsJpaRepository.java similarity index 72% rename from src/main/java/com/writely/terms/repository/TermsJpaRepository.java rename to domain/src/main/java/writeon/domain/terms/repository/TermsJpaRepository.java index bd9b9f7..7655b3c 100644 --- a/src/main/java/com/writely/terms/repository/TermsJpaRepository.java +++ b/domain/src/main/java/writeon/domain/terms/repository/TermsJpaRepository.java @@ -1,8 +1,8 @@ -package com.writely.terms.repository; +package writeon.domain.terms.repository; -import com.writely.terms.domain.Terms; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import writeon.domain.terms.Terms; @Repository public interface TermsJpaRepository extends CrudRepository { diff --git a/settings.gradle b/settings.gradle index 1e86aa5..b090ebe 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,4 @@ -rootProject.name = 'writely' +rootProject.name = 'writeon' +include 'api' +include 'assistant-api-client' +include 'domain' \ No newline at end of file diff --git a/sql/init.sql b/sql/init.sql index 1d79718..6c05e1e 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -371,7 +371,7 @@ create table user_modify_message product_id uuid not null, role varchar(10) not null, content text not null, - prompt text not null, + prompt text, created_at timestamp not null, created_by uuid not null, updated_at timestamp not null, @@ -380,3 +380,31 @@ create table user_modify_message alter table user_modify_message owner to postgres; + +create table feedback_message +( + id uuid default gen_random_uuid() not null + constraint feedback_message_pk + primary key, + product_id uuid not null, + role varchar(10) not null, + content text not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null +); + +comment on table feedback_message is '피드백 메세지'; +comment on column feedback_message.id is '피드백 메세지 ID'; +comment on column feedback_message.product_id is '작품 ID'; +comment on column feedback_message.role is '메세지 송신자'; +comment on column feedback_message.content is '내용'; +comment on column feedback_message.created_at is '생성일시'; +comment on column feedback_message.created_by is '생성자 ID'; +comment on column feedback_message.updated_at is '수정일시'; +comment on column feedback_message.updated_by is '수정자 ID'; + +alter table feedback_message + owner to postgres; + diff --git a/src/main/java/com/writely/WritelyApplication.java b/src/main/java/com/writely/WritelyApplication.java deleted file mode 100644 index 2590cef..0000000 --- a/src/main/java/com/writely/WritelyApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.writely; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.FilterType; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; - -@SpringBootApplication -@EnableJpaRepositories( - includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*JpaRepository") -) -@EnableRedisRepositories( - includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*RedisRepository") -) -public class WritelyApplication { - - public static void main(String[] args) { - SpringApplication.run(WritelyApplication.class, args); - } - -} diff --git a/src/main/java/com/writely/assistant/service/AutoModifyService.java b/src/main/java/com/writely/assistant/service/AutoModifyService.java deleted file mode 100644 index 393b708..0000000 --- a/src/main/java/com/writely/assistant/service/AutoModifyService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.writely.assistant.service; - -import com.writely.assistant.domain.automodify.AutoModifyMessage; -import com.writely.assistant.domain.automodify.AutoModifyMessageJpaRepository; -import com.writely.assistant.domain.enums.AssistantException; -import com.writely.assistant.domain.enums.MessageSenderRole; -import com.writely.assistant.request.AutoModifyMessageRequest; -import com.writely.assistant.request.UserSetting; -import com.writely.common.exception.BaseException; -import com.writely.common.util.LogUtil; -import com.writely.product.service.ProductQueryService; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatusCode; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -@Service -@RequiredArgsConstructor -public class AutoModifyService { - - @Value("${service.assistant.url}") - private String assistantUrl; - - private final long TIMEOUT = 180_000L; - - private final AutoModifyMessageJpaRepository autoModifyMessageRepository; - private final ProductQueryService productQueryService; - - @Transactional - public UUID createMessage(AutoModifyMessageRequest request) { - productQueryService.verifyExist(request.getProductId()); - - AutoModifyMessage autoModifyMemberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); - return autoModifyMessageRepository.save(autoModifyMemberMessage).getId(); - } - - public SseEmitter sendMessage(UUID productId, UUID messageId) { - productQueryService.verifyExist(productId); - AutoModifyMessage message = getById(messageId); - - Map requestMap = new HashMap<>(); - requestMap.put("tenant_id", "1"); - requestMap.put("query", message.getContent()); - requestMap.put("user_setting", new UserSetting(productQueryService.getById(productId))); - - SseEmitter emitter = new SseEmitter(TIMEOUT); - WebClient.create(assistantUrl + "/v1/assistant/auto-modify/stream") - .post() - .bodyValue(requestMap) - .retrieve() - .onStatus(HttpStatusCode::isError, response -> - response.bodyToMono(String.class) - .doOnNext(errorBody -> LogUtil.error("Error response: " + errorBody)) // 오류 응답 출력 - .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) // 예외로 변환 - ) - .bodyToFlux(String.class) - .subscribe( - data -> { - try { - emitter.send(SseEmitter.event().data(data)); - } catch (IOException e) { - emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); - } - }, - error -> { - LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; - }, - emitter::complete - ); - - return emitter; - } - - private AutoModifyMessage getById(UUID messageId) { - return autoModifyMessageRepository.findById(messageId) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } -} diff --git a/src/main/java/com/writely/assistant/service/UserModifyService.java b/src/main/java/com/writely/assistant/service/UserModifyService.java deleted file mode 100644 index 4d38cb1..0000000 --- a/src/main/java/com/writely/assistant/service/UserModifyService.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.writely.assistant.service; - -import com.writely.assistant.domain.enums.AssistantException; -import com.writely.assistant.domain.enums.MessageSenderRole; -import com.writely.assistant.domain.usermodify.UserModifyMessage; -import com.writely.assistant.domain.usermodify.UserModifyMessageJpaRepository; -import com.writely.assistant.request.UserModifyMessageRequest; -import com.writely.assistant.request.UserSetting; -import com.writely.common.exception.BaseException; -import com.writely.common.util.LogUtil; -import com.writely.product.service.ProductQueryService; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatusCode; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -@Service -@RequiredArgsConstructor -public class UserModifyService { - - @Value("${service.assistant.url}") - private String assistantUrl; - - private final long TIMEOUT = 180_000L; - - private final UserModifyMessageJpaRepository userModifyMessageJpaRepository; - private final ProductQueryService productQueryService; - - @Transactional - public UUID createMessage(UserModifyMessageRequest request) { - productQueryService.verifyExist(request.getProductId()); - - UserModifyMessage userModifyMemberMessage = - new UserModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); - return userModifyMessageJpaRepository.save(userModifyMemberMessage).getId(); - } - - public SseEmitter sendMessage(UUID productId, UUID messageId) { - productQueryService.verifyExist(productId); - UserModifyMessage message = getById(messageId); - - Map requestMap = new HashMap<>(); - requestMap.put("tenant_id", "1"); - requestMap.put("user_setting", new UserSetting(productQueryService.getById(productId))); - requestMap.put("query", message.getContent()); - requestMap.put("how_polish", message.getPrompt()); - - SseEmitter emitter = new SseEmitter(TIMEOUT); - WebClient.create(assistantUrl + "/v1/assistant/user-modify/stream") - .post() - .bodyValue(requestMap) - .retrieve() - .onStatus(HttpStatusCode::isError, response -> - response.bodyToMono(String.class) - .doOnNext(errorBody -> LogUtil.error("Error response: " + errorBody)) // 오류 응답 출력 - .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) // 예외로 변환 - ) - .bodyToFlux(String.class) - .subscribe( - data -> { - try { - emitter.send(SseEmitter.event().data(data)); - } catch (IOException e) { - emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); - } - }, - error -> { - LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; - }, - emitter::complete - ); - - return emitter; - } - - private UserModifyMessage getById(UUID messageId) { - return userModifyMessageJpaRepository.findById(messageId) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } -} diff --git a/src/main/java/com/writely/common/config/WebClientConfig.java b/src/main/java/com/writely/common/config/WebClientConfig.java deleted file mode 100644 index e65827c..0000000 --- a/src/main/java/com/writely/common/config/WebClientConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.writely.common.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.reactive.function.client.WebClient; - -@Configuration -public class WebClientConfig { - - @Bean - public WebClient.Builder webClientBuilder() { - return WebClient.builder(); - } -} From 6c530bd718d8d7f10ca2aaa8dc37f0835b312271 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 8 Mar 2025 23:33:40 +0900 Subject: [PATCH 039/107] fix: discord appender load error (#38) --- api/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/resources/logback-spring.xml b/api/src/main/resources/logback-spring.xml index 8311eab..dff7ca8 100644 --- a/api/src/main/resources/logback-spring.xml +++ b/api/src/main/resources/logback-spring.xml @@ -70,7 +70,7 @@ - + ${DISCORD_WEBHOOK_URL} From f3f3c8167d5688ff19c52802352012916abb1331 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 9 Mar 2025 00:13:42 +0900 Subject: [PATCH 040/107] =?UTF-8?q?fix:=20private=20method=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20transactional=20=EC=96=B4=EB=85=B8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=82=AD=EC=A0=9C=20(#39)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/writeon/api/auth/service/AuthCommandService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index 8fb8182..517a062 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -278,7 +278,6 @@ public void completeChangePassword(ChangePasswordCompletionRequest request) { /** * 인증 토큰 발급 (액세스 + 리프래시) */ - @Transactional private AuthTokenResponse generateAuthTokens(UUID memberId) { JwtPayload jwtPayload = JwtPayload.builder() .memberId(memberId) @@ -293,7 +292,6 @@ private AuthTokenResponse generateAuthTokens(UUID memberId) { /** * 토큰 무효화 (Redis에서 관리하는 토큰의 경우) */ - @Transactional private void invalidateToken(BaseToken token) { if (token instanceof RefreshToken refreshToken) { refreshTokenRedisRepository.delete(refreshToken); From ad47b2b91701b384fcd8fe5e9c4394dbf4b4bb6b Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 9 Mar 2025 12:39:36 +0900 Subject: [PATCH 041/107] =?UTF-8?q?feat:=20Add=20assistant=20research(?= =?UTF-8?q?=EC=9E=90=EC=9C=A0=20=EB=8C=80=ED=99=94)=20api=20(#40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssistantController.java | 22 +- ...=> AssistantAutoModifyMessageRequest.java} | 2 +- ...a => AssistantFeedbackMessageRequest.java} | 2 +- ...est.java => AssistantResearchRequest.java} | 4 +- .../AssistantUserModifyMessageRequest.java | 19 ++ .../assistant/response/AssistantResponse.java | 20 ++ .../assistant/service/AutoModifyService.java | 8 +- .../assistant/service/FeedbackService.java | 8 +- .../assistant/service/ResearchService.java | 48 ++++ .../assistant/service/UserModifyService.java | 8 +- .../api/product/repository/ProductDao.java | 1 + assistant-api-client/build.gradle | 1 + .../AssistantApiClient.java | 19 ++ .../request/ResearchRequest.java | 20 ++ domain/src/main/generated/writely/Keys.java | 6 + domain/src/main/generated/writely/Public.java | 16 +- domain/src/main/generated/writely/Tables.java | 12 + .../writely/tables/AutoModifyMessage.java | 2 +- .../writely/tables/ResearchMessage.java | 265 ++++++++++++++++++ .../writely/tables/UserModifyMessage.java | 265 ++++++++++++++++++ .../writely/tables/pojos/ResearchMessage.java | 245 ++++++++++++++++ .../tables/pojos/UserModifyMessage.java | 245 ++++++++++++++++ .../tables/records/ResearchMessageRecord.java | 233 +++++++++++++++ .../records/UserModifyMessageRecord.java | 233 +++++++++++++++ .../domain/assistant/MessageContent.java | 2 +- .../automodify/AutoModifyMessage.java | 8 +- .../assistant/feedback/FeedbackMessage.java | 8 +- .../assistant/research/ResearchMessage.java | 48 ++++ .../ResearchMessageJpaRepository.java | 8 + .../usermodify/UserModifyMessage.java | 8 +- sql/init.sql | 88 ++++-- 31 files changed, 1817 insertions(+), 57 deletions(-) rename api/src/main/java/writeon/api/assistant/request/{FeedbackMessageRequest.java => AssistantAutoModifyMessageRequest.java} (85%) rename api/src/main/java/writeon/api/assistant/request/{AutoModifyMessageRequest.java => AssistantFeedbackMessageRequest.java} (86%) rename api/src/main/java/writeon/api/assistant/request/{UserModifyMessageRequest.java => AssistantResearchRequest.java} (79%) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java create mode 100644 api/src/main/java/writeon/api/assistant/response/AssistantResponse.java create mode 100644 api/src/main/java/writeon/api/assistant/service/ResearchService.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java create mode 100644 domain/src/main/generated/writely/tables/ResearchMessage.java create mode 100644 domain/src/main/generated/writely/tables/UserModifyMessage.java create mode 100644 domain/src/main/generated/writely/tables/pojos/ResearchMessage.java create mode 100644 domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java create mode 100644 domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java create mode 100644 domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java create mode 100644 domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java create mode 100644 domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 86a2611..3388cba 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -8,11 +8,14 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AutoModifyMessageRequest; -import writeon.api.assistant.request.FeedbackMessageRequest; -import writeon.api.assistant.request.UserModifyMessageRequest; +import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.service.AutoModifyService; import writeon.api.assistant.service.FeedbackService; +import writeon.api.assistant.service.ResearchService; import writeon.api.assistant.service.UserModifyService; import java.util.UUID; @@ -26,25 +29,32 @@ public class AssistantController { private final AutoModifyService autoModifyService; private final FeedbackService feedbackService; private final UserModifyService userModifyService; + private final ResearchService researchService; @Operation(summary = "자동 수정 메세지 저장") @PostMapping("/auto-modify/messages") - public UUID createAutoModifyMessage(@RequestBody AutoModifyMessageRequest request) { + public UUID createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { return autoModifyService.createMessage(request); } @Operation(summary = "구간 피드백 메세지 저장") @PostMapping("/feedback/messages") - public UUID createFeedbackMessage(@RequestBody FeedbackMessageRequest request) { + public UUID createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { return feedbackService.createMessage(request); } @Operation(summary = "수동 수정 메세지 저장") @PostMapping("/user-modify/messages") - public UUID createUserModifyMessage(@RequestBody UserModifyMessageRequest request) { + public UUID createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { return userModifyService.createMessage(request); } + @Operation(summary = "자유 대화") + @PostMapping("/research") + public AssistantResponse research(@RequestBody AssistantResearchRequest request) { + return researchService.research(request); + } + @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") public SseEmitter streamAutoModify( diff --git a/api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java similarity index 85% rename from api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java index 2639721..02b04bb 100644 --- a/api/src/main/java/writeon/api/assistant/request/FeedbackMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class FeedbackMessageRequest { +public class AssistantAutoModifyMessageRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java similarity index 86% rename from api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java index 94b71f4..ff880f7 100644 --- a/api/src/main/java/writeon/api/assistant/request/AutoModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AutoModifyMessageRequest { +public class AssistantFeedbackMessageRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java similarity index 79% rename from api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java index 7111219..1870e2f 100644 --- a/api/src/main/java/writeon/api/assistant/request/UserModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java @@ -8,11 +8,11 @@ @Getter @Setter -public class UserModifyMessageRequest { +public class AssistantResearchRequest { @Schema(title = "작품 ID") private UUID productId; - @Schema(title = "내용") + @Schema(title = "내용", nullable = true) private String content; @Schema(title = "프롬프트") private String prompt; diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java new file mode 100644 index 0000000..a39889b --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java @@ -0,0 +1,19 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class AssistantUserModifyMessageRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "내용") + private String content; + @Schema(title = "프롬프트", nullable = true) + private String prompt; +} diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java new file mode 100644 index 0000000..1b0bd39 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java @@ -0,0 +1,20 @@ +package writeon.api.assistant.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +import java.util.UUID; + +@Getter +public class AssistantResponse { + + @Schema(title = "어시스턴트 ID") + private final UUID assistantId; + @Schema(title = "답변 내용") + private final String answer; + + public AssistantResponse(UUID assistantId, String answer) { + this.assistantId = assistantId; + this.answer = answer; + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index bb71ad5..c93e434 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; @@ -30,10 +30,10 @@ public class AutoModifyService { private final AssistantApiClient assistantApiClient; @Transactional - public UUID createMessage(AutoModifyMessageRequest request) { + public UUID createMessage(AssistantAutoModifyMessageRequest request) { productQueryService.verifyExist(request.getProductId()); - AutoModifyMessage memberMessage = new AutoModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); + AutoModifyMessage memberMessage = new AutoModifyMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent()); return autoModifyMessageRepository.save(memberMessage).getId(); } @@ -64,7 +64,7 @@ public SseEmitter streamAutoModify(UUID productId, UUID messageId) { throw exception; }, () -> { - AutoModifyMessage assistantMessage = new AutoModifyMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); + AutoModifyMessage assistantMessage = new AutoModifyMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); autoModifyMessageRepository.save(assistantMessage); emitter.complete(); } diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index f246d4f..b5e5024 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.FeedbackMessageRequest; +import writeon.api.assistant.request.AssistantFeedbackMessageRequest; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; @@ -30,10 +30,10 @@ public class FeedbackService { private final AssistantApiClient assistantApiClient; @Transactional - public UUID createMessage(FeedbackMessageRequest request) { + public UUID createMessage(AssistantFeedbackMessageRequest request) { productQueryService.verifyExist(request.getProductId()); - FeedbackMessage memberMessage = new FeedbackMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent()); + FeedbackMessage memberMessage = new FeedbackMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent()); return feedbackMessageRepository.save(memberMessage).getId(); } @@ -64,7 +64,7 @@ public SseEmitter streamFeedback(UUID productId, UUID messageId) { throw exception; }, () -> { - FeedbackMessage assistantMessage = new FeedbackMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); + FeedbackMessage assistantMessage = new FeedbackMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); feedbackMessageRepository.save(assistantMessage); emitter.complete(); } diff --git a/api/src/main/java/writeon/api/assistant/service/ResearchService.java b/api/src/main/java/writeon/api/assistant/service/ResearchService.java new file mode 100644 index 0000000..0a11e18 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/ResearchService.java @@ -0,0 +1,48 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.response.AssistantResponse; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.ResearchRequest; +import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.assistant.research.ResearchMessage; +import writeon.domain.assistant.research.ResearchMessageJpaRepository; + +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class ResearchService { + + private final long TIMEOUT = 180_000L; + + private final ResearchMessageJpaRepository researchMessageRepository; + private final ProductQueryService productQueryService; + private final AssistantApiClient assistantApiClient; + + @Transactional + public AssistantResponse research(AssistantResearchRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = UUID.randomUUID(); + ResearchMessage memberMessage = + new ResearchMessage(request.getProductId(), assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + researchMessageRepository.save(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + ResearchRequest researchRequest = new ResearchRequest("1", userSetting, request.getContent()); + + String answer = assistantApiClient.research(researchRequest).block(); + + ResearchMessage assistantMessage = + new ResearchMessage(request.getProductId(), assistantId, MessageSenderRole.ASSISTANT, answer, null); + researchMessageRepository.save(assistantMessage); + + return new AssistantResponse(assistantId, answer); + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 544a64d..9146cfc 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.UserModifyMessageRequest; +import writeon.api.assistant.request.AssistantUserModifyMessageRequest; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; @@ -30,11 +30,11 @@ public class UserModifyService { private final AssistantApiClient assistantApiClient; @Transactional - public UUID createMessage(UserModifyMessageRequest request) { + public UUID createMessage(AssistantUserModifyMessageRequest request) { productQueryService.verifyExist(request.getProductId()); UserModifyMessage memberMessage = - new UserModifyMessage(request.getProductId(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + new UserModifyMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); return userModifyMessageRepository.save(memberMessage).getId(); } @@ -65,7 +65,7 @@ public SseEmitter streamUserModify(UUID productId, UUID messageId) { throw exception; }, () -> { - UserModifyMessage assistantMessage = new UserModifyMessage(productId, MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + UserModifyMessage assistantMessage = new UserModifyMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); userModifyMessageRepository.save(assistantMessage); emitter.complete(); } diff --git a/api/src/main/java/writeon/api/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java index 972bab7..69aac8f 100644 --- a/api/src/main/java/writeon/api/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -9,6 +9,7 @@ import static writely.tables.Product.PRODUCT; + @Repository @RequiredArgsConstructor public class ProductDao { diff --git a/assistant-api-client/build.gradle b/assistant-api-client/build.gradle index 1518960..856259e 100644 --- a/assistant-api-client/build.gradle +++ b/assistant-api-client/build.gradle @@ -1,5 +1,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-webflux' + implementation 'com.jayway.jsonpath:json-path:2.9.0' implementation project(':domain') } diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 47893e1..18f2c1a 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -1,10 +1,12 @@ package writeon.assistantapiclient; +import com.jayway.jsonpath.JsonPath; import org.springframework.http.HttpStatusCode; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import writeon.assistantapiclient.request.AutoModifyRequest; import writeon.assistantapiclient.request.FeedbackRequest; +import writeon.assistantapiclient.request.ResearchRequest; import writeon.assistantapiclient.request.UserModifyRequest; public class AssistantApiClient extends WebApiClient{ @@ -13,6 +15,23 @@ public AssistantApiClient(String baseUrl, int connectionTimeoutMs, int readTimeo super(baseUrl, connectionTimeoutMs, readTimeoutMs); } + public Mono research(ResearchRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/research") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamAutoModify(AutoModifyRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java new file mode 100644 index 0000000..9164a4f --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java @@ -0,0 +1,20 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class ResearchRequest { + + private final String sessionId; + private final UserSetting userSetting; + private final String query; + + public ResearchRequest(String sessionId, UserSetting userSetting, String query) { + this.sessionId = sessionId; + this.userSetting = userSetting; + this.query = query; + } +} diff --git a/domain/src/main/generated/writely/Keys.java b/domain/src/main/generated/writely/Keys.java index 0f140ee..44a75ec 100644 --- a/domain/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writely/Keys.java @@ -22,8 +22,10 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; +import writely.tables.UserModifyMessage; import writely.tables.records.AutoModifyMessageRecord; import writely.tables.records.FeedbackMessageRecord; import writely.tables.records.LoginAttemptRecord; @@ -37,8 +39,10 @@ import writely.tables.records.ProductRecord; import writely.tables.records.ProductSynopsisRecord; import writely.tables.records.ProductWorldviewRecord; +import writely.tables.records.ResearchMessageRecord; import writely.tables.records.TermsAgreementRecord; import writely.tables.records.TermsRecord; +import writely.tables.records.UserModifyMessageRecord; /** @@ -67,6 +71,8 @@ public class Keys { public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); public static final UniqueKey PRODUCT_SYNOPSIS_PK = Internal.createUniqueKey(ProductSynopsis.PRODUCT_SYNOPSIS, DSL.name("product_synopsis_pk"), new TableField[] { ProductSynopsis.PRODUCT_SYNOPSIS.ID }, true); public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); + public static final UniqueKey RESEARCH_MESSAGE_PK = Internal.createUniqueKey(ResearchMessage.RESEARCH_MESSAGE, DSL.name("research_message_pk"), new TableField[] { ResearchMessage.RESEARCH_MESSAGE.ID }, true); public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); public static final UniqueKey TERMS_AGREEMENT_PK = Internal.createUniqueKey(TermsAgreement.TERMS_AGREEMENT, DSL.name("terms_agreement_pk"), new TableField[] { TermsAgreement.TERMS_AGREEMENT.TERMS_CD, TermsAgreement.TERMS_AGREEMENT.MEMBER_ID }, true); + public static final UniqueKey USER_MODIFY_MESSAGE_PK = Internal.createUniqueKey(UserModifyMessage.USER_MODIFY_MESSAGE, DSL.name("user_modify_message_pk"), new TableField[] { UserModifyMessage.USER_MODIFY_MESSAGE.ID }, true); } diff --git a/domain/src/main/generated/writely/Public.java b/domain/src/main/generated/writely/Public.java index 0877c29..1af3680 100644 --- a/domain/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writely/Public.java @@ -28,8 +28,10 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; +import writely.tables.UserModifyMessage; import writely.tables.records.PgpArmorHeadersRecord; @@ -150,6 +152,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + /** + * 자유 대화 메세지 + */ + public final ResearchMessage RESEARCH_MESSAGE = ResearchMessage.RESEARCH_MESSAGE; + /** * 약관 */ @@ -160,6 +167,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; + /** + * The table public.user_modify_message. + */ + public final UserModifyMessage USER_MODIFY_MESSAGE = UserModifyMessage.USER_MODIFY_MESSAGE; + /** * No further instances allowed */ @@ -190,8 +202,10 @@ public final List> getTables() { ProductPlot.PRODUCT_PLOT, ProductSynopsis.PRODUCT_SYNOPSIS, ProductWorldview.PRODUCT_WORLDVIEW, + ResearchMessage.RESEARCH_MESSAGE, Terms.TERMS, - TermsAgreement.TERMS_AGREEMENT + TermsAgreement.TERMS_AGREEMENT, + UserModifyMessage.USER_MODIFY_MESSAGE ); } } diff --git a/domain/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java index f02f478..9bc5a8d 100644 --- a/domain/src/main/generated/writely/Tables.java +++ b/domain/src/main/generated/writely/Tables.java @@ -22,8 +22,10 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; +import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; +import writely.tables.UserModifyMessage; import writely.tables.records.PgpArmorHeadersRecord; @@ -137,6 +139,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + /** + * 자유 대화 메세지 + */ + public static final ResearchMessage RESEARCH_MESSAGE = ResearchMessage.RESEARCH_MESSAGE; + /** * 약관 */ @@ -146,4 +153,9 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( * 약관_동의 */ public static final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; + + /** + * The table public.user_modify_message. + */ + public static final UserModifyMessage USER_MODIFY_MESSAGE = UserModifyMessage.USER_MODIFY_MESSAGE; } diff --git a/domain/src/main/generated/writely/tables/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/AutoModifyMessage.java index d1ac424..ae2b0af 100644 --- a/domain/src/main/generated/writely/tables/AutoModifyMessage.java +++ b/domain/src/main/generated/writely/tables/AutoModifyMessage.java @@ -69,7 +69,7 @@ public Class getRecordType() { /** * The column public.auto_modify_message.content. 내용 */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); /** * The column public.auto_modify_message.created_at. 생성일시 diff --git a/domain/src/main/generated/writely/tables/ResearchMessage.java b/domain/src/main/generated/writely/tables/ResearchMessage.java new file mode 100644 index 0000000..1a06251 --- /dev/null +++ b/domain/src/main/generated/writely/tables/ResearchMessage.java @@ -0,0 +1,265 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ResearchMessageRecord; + + +/** + * 자유 대화 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ResearchMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.research_message + */ + public static final ResearchMessage RESEARCH_MESSAGE = new ResearchMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ResearchMessageRecord.class; + } + + /** + * The column public.research_message.id. 자유 대화 메세지 ID + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "자유 대화 메세지 ID"); + + /** + * The column public.research_message.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.research_message.assistant_id. 어시스턴트 ID + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); + + /** + * The column public.research_message.role. 메세지 송신자 + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); + + /** + * The column public.research_message.content. 내용 + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); + + /** + * The column public.research_message.prompt. 프롬프트 + */ + public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, "프롬프트"); + + /** + * The column public.research_message.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.research_message.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + /** + * The column public.research_message.updated_at. 수정일시 + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.research_message.updated_by. 수정자 ID + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + private ResearchMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ResearchMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("자유 대화 메세지"), TableOptions.table(), where); + } + + /** + * Create an aliased public.research_message table reference + */ + public ResearchMessage(String alias) { + this(DSL.name(alias), RESEARCH_MESSAGE); + } + + /** + * Create an aliased public.research_message table reference + */ + public ResearchMessage(Name alias) { + this(alias, RESEARCH_MESSAGE); + } + + /** + * Create a public.research_message table reference + */ + public ResearchMessage() { + this(DSL.name("research_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.RESEARCH_MESSAGE_PK; + } + + @Override + public ResearchMessage as(String alias) { + return new ResearchMessage(DSL.name(alias), this); + } + + @Override + public ResearchMessage as(Name alias) { + return new ResearchMessage(alias, this); + } + + @Override + public ResearchMessage as(Table alias) { + return new ResearchMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ResearchMessage rename(String name) { + return new ResearchMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ResearchMessage rename(Name name) { + return new ResearchMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public ResearchMessage rename(Table name) { + return new ResearchMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage where(Condition condition) { + return new ResearchMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ResearchMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ResearchMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ResearchMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ResearchMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ResearchMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/UserModifyMessage.java b/domain/src/main/generated/writely/tables/UserModifyMessage.java new file mode 100644 index 0000000..8312d12 --- /dev/null +++ b/domain/src/main/generated/writely/tables/UserModifyMessage.java @@ -0,0 +1,265 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.UserModifyMessageRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class UserModifyMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.user_modify_message + */ + public static final UserModifyMessage USER_MODIFY_MESSAGE = new UserModifyMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return UserModifyMessageRecord.class; + } + + /** + * The column public.user_modify_message.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); + + /** + * The column public.user_modify_message.product_id. + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.user_modify_message.assistant_id. + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.user_modify_message.role. + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, ""); + + /** + * The column public.user_modify_message.content. + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.user_modify_message.prompt. + */ + public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, ""); + + /** + * The column public.user_modify_message.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.user_modify_message.created_by. + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.user_modify_message.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.user_modify_message.updated_by. + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); + + private UserModifyMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private UserModifyMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.user_modify_message table reference + */ + public UserModifyMessage(String alias) { + this(DSL.name(alias), USER_MODIFY_MESSAGE); + } + + /** + * Create an aliased public.user_modify_message table reference + */ + public UserModifyMessage(Name alias) { + this(alias, USER_MODIFY_MESSAGE); + } + + /** + * Create a public.user_modify_message table reference + */ + public UserModifyMessage() { + this(DSL.name("user_modify_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.USER_MODIFY_MESSAGE_PK; + } + + @Override + public UserModifyMessage as(String alias) { + return new UserModifyMessage(DSL.name(alias), this); + } + + @Override + public UserModifyMessage as(Name alias) { + return new UserModifyMessage(alias, this); + } + + @Override + public UserModifyMessage as(Table alias) { + return new UserModifyMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public UserModifyMessage rename(String name) { + return new UserModifyMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public UserModifyMessage rename(Name name) { + return new UserModifyMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public UserModifyMessage rename(Table name) { + return new UserModifyMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage where(Condition condition) { + return new UserModifyMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public UserModifyMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public UserModifyMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public UserModifyMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public UserModifyMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public UserModifyMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java b/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java new file mode 100644 index 0000000..62ea6fd --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java @@ -0,0 +1,245 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 자유 대화 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ResearchMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final UUID assistantId; + private final String role; + private final String content; + private final String prompt; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ResearchMessage(ResearchMessage value) { + this.id = value.id; + this.productId = value.productId; + this.assistantId = value.assistantId; + this.role = value.role; + this.content = value.content; + this.prompt = value.prompt; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ResearchMessage( + UUID id, + UUID productId, + UUID assistantId, + String role, + String content, + String prompt, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.assistantId = assistantId; + this.role = role; + this.content = content; + this.prompt = prompt; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.research_message.id. 자유 대화 메세지 ID + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.research_message.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.research_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return this.assistantId; + } + + /** + * Getter for public.research_message.role. 메세지 송신자 + */ + public String getRole() { + return this.role; + } + + /** + * Getter for public.research_message.content. 내용 + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.research_message.prompt. 프롬프트 + */ + public String getPrompt() { + return this.prompt; + } + + /** + * Getter for public.research_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.research_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.research_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.research_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ResearchMessage other = (ResearchMessage) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; + if (this.role == null) { + if (other.role != null) + return false; + } + else if (!this.role.equals(other.role)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.prompt == null) { + if (other.prompt != null) + return false; + } + else if (!this.prompt.equals(other.prompt)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); + result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ResearchMessage ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(assistantId); + sb.append(", ").append(role); + sb.append(", ").append(content); + sb.append(", ").append(prompt); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java new file mode 100644 index 0000000..1357eb1 --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java @@ -0,0 +1,245 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class UserModifyMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final UUID assistantId; + private final String role; + private final String content; + private final String prompt; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public UserModifyMessage(UserModifyMessage value) { + this.id = value.id; + this.productId = value.productId; + this.assistantId = value.assistantId; + this.role = value.role; + this.content = value.content; + this.prompt = value.prompt; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public UserModifyMessage( + UUID id, + UUID productId, + UUID assistantId, + String role, + String content, + String prompt, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.assistantId = assistantId; + this.role = role; + this.content = content; + this.prompt = prompt; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.user_modify_message.id. + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.user_modify_message.product_id. + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.user_modify_message.assistant_id. + */ + public UUID getAssistantId() { + return this.assistantId; + } + + /** + * Getter for public.user_modify_message.role. + */ + public String getRole() { + return this.role; + } + + /** + * Getter for public.user_modify_message.content. + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.user_modify_message.prompt. + */ + public String getPrompt() { + return this.prompt; + } + + /** + * Getter for public.user_modify_message.created_at. + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.user_modify_message.created_by. + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.user_modify_message.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.user_modify_message.updated_by. + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final UserModifyMessage other = (UserModifyMessage) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; + if (this.role == null) { + if (other.role != null) + return false; + } + else if (!this.role.equals(other.role)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.prompt == null) { + if (other.prompt != null) + return false; + } + else if (!this.prompt.equals(other.prompt)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); + result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserModifyMessage ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(assistantId); + sb.append(", ").append(role); + sb.append(", ").append(content); + sb.append(", ").append(prompt); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java b/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java new file mode 100644 index 0000000..0b665fd --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java @@ -0,0 +1,233 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ResearchMessage; + + +/** + * 자유 대화 메세지 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ResearchMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.research_message.id. 자유 대화 메세지 ID + */ + public ResearchMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.research_message.id. 자유 대화 메세지 ID + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.research_message.product_id. 작품 ID + */ + public ResearchMessageRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.research_message.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.research_message.assistant_id. 어시스턴트 ID + */ + public ResearchMessageRecord setAssistantId(UUID value) { + set(2, value); + return this; + } + + /** + * Getter for public.research_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return (UUID) get(2); + } + + /** + * Setter for public.research_message.role. 메세지 송신자 + */ + public ResearchMessageRecord setRole(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.research_message.role. 메세지 송신자 + */ + public String getRole() { + return (String) get(3); + } + + /** + * Setter for public.research_message.content. 내용 + */ + public ResearchMessageRecord setContent(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.research_message.content. 내용 + */ + public String getContent() { + return (String) get(4); + } + + /** + * Setter for public.research_message.prompt. 프롬프트 + */ + public ResearchMessageRecord setPrompt(String value) { + set(5, value); + return this; + } + + /** + * Getter for public.research_message.prompt. 프롬프트 + */ + public String getPrompt() { + return (String) get(5); + } + + /** + * Setter for public.research_message.created_at. 생성일시 + */ + public ResearchMessageRecord setCreatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.research_message.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.research_message.created_by. 생성자 ID + */ + public ResearchMessageRecord setCreatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.research_message.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(7); + } + + /** + * Setter for public.research_message.updated_at. 수정일시 + */ + public ResearchMessageRecord setUpdatedAt(LocalDateTime value) { + set(8, value); + return this; + } + + /** + * Getter for public.research_message.updated_at. 수정일시 + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(8); + } + + /** + * Setter for public.research_message.updated_by. 수정자 ID + */ + public ResearchMessageRecord setUpdatedBy(UUID value) { + set(9, value); + return this; + } + + /** + * Getter for public.research_message.updated_by. 수정자 ID + */ + public UUID getUpdatedBy() { + return (UUID) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ResearchMessageRecord + */ + public ResearchMessageRecord() { + super(ResearchMessage.RESEARCH_MESSAGE); + } + + /** + * Create a detached, initialised ResearchMessageRecord + */ + public ResearchMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ResearchMessage.RESEARCH_MESSAGE); + + setId(id); + setProductId(productId); + setAssistantId(assistantId); + setRole(role); + setContent(content); + setPrompt(prompt); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ResearchMessageRecord + */ + public ResearchMessageRecord(writely.tables.pojos.ResearchMessage value) { + super(ResearchMessage.RESEARCH_MESSAGE); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setAssistantId(value.getAssistantId()); + setRole(value.getRole()); + setContent(value.getContent()); + setPrompt(value.getPrompt()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java new file mode 100644 index 0000000..b142a02 --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java @@ -0,0 +1,233 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.UserModifyMessage; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class UserModifyMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.user_modify_message.id. + */ + public UserModifyMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.user_modify_message.id. + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.user_modify_message.product_id. + */ + public UserModifyMessageRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.user_modify_message.product_id. + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.user_modify_message.assistant_id. + */ + public UserModifyMessageRecord setAssistantId(UUID value) { + set(2, value); + return this; + } + + /** + * Getter for public.user_modify_message.assistant_id. + */ + public UUID getAssistantId() { + return (UUID) get(2); + } + + /** + * Setter for public.user_modify_message.role. + */ + public UserModifyMessageRecord setRole(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.user_modify_message.role. + */ + public String getRole() { + return (String) get(3); + } + + /** + * Setter for public.user_modify_message.content. + */ + public UserModifyMessageRecord setContent(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.user_modify_message.content. + */ + public String getContent() { + return (String) get(4); + } + + /** + * Setter for public.user_modify_message.prompt. + */ + public UserModifyMessageRecord setPrompt(String value) { + set(5, value); + return this; + } + + /** + * Getter for public.user_modify_message.prompt. + */ + public String getPrompt() { + return (String) get(5); + } + + /** + * Setter for public.user_modify_message.created_at. + */ + public UserModifyMessageRecord setCreatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.user_modify_message.created_at. + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.user_modify_message.created_by. + */ + public UserModifyMessageRecord setCreatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.user_modify_message.created_by. + */ + public UUID getCreatedBy() { + return (UUID) get(7); + } + + /** + * Setter for public.user_modify_message.updated_at. + */ + public UserModifyMessageRecord setUpdatedAt(LocalDateTime value) { + set(8, value); + return this; + } + + /** + * Getter for public.user_modify_message.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(8); + } + + /** + * Setter for public.user_modify_message.updated_by. + */ + public UserModifyMessageRecord setUpdatedBy(UUID value) { + set(9, value); + return this; + } + + /** + * Getter for public.user_modify_message.updated_by. + */ + public UUID getUpdatedBy() { + return (UUID) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached UserModifyMessageRecord + */ + public UserModifyMessageRecord() { + super(UserModifyMessage.USER_MODIFY_MESSAGE); + } + + /** + * Create a detached, initialised UserModifyMessageRecord + */ + public UserModifyMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(UserModifyMessage.USER_MODIFY_MESSAGE); + + setId(id); + setProductId(productId); + setAssistantId(assistantId); + setRole(role); + setContent(content); + setPrompt(prompt); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised UserModifyMessageRecord + */ + public UserModifyMessageRecord(writely.tables.pojos.UserModifyMessage value) { + super(UserModifyMessage.USER_MODIFY_MESSAGE); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setAssistantId(value.getAssistantId()); + setRole(value.getRole()); + setContent(value.getContent()); + setPrompt(value.getPrompt()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/MessageContent.java b/domain/src/main/java/writeon/domain/assistant/MessageContent.java index cbb2462..bb112a4 100644 --- a/domain/src/main/java/writeon/domain/assistant/MessageContent.java +++ b/domain/src/main/java/writeon/domain/assistant/MessageContent.java @@ -16,7 +16,7 @@ public class MessageContent { @Column(name = "role", nullable = false) private MessageSenderRole role; - @Column(name = "content", nullable = false) + @Column(name = "content") private String content; public MessageContent(MessageSenderRole role, String content) { diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java index dd1041f..8023d30 100644 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java @@ -17,16 +17,20 @@ public class AutoModifyMessage extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private final UUID id = UUID.randomUUID(); @Column(name = "product_id", nullable = false) private UUID productId; + @Column(name = "assistant_id", nullable = false) + private UUID assistantId; + @Embedded private MessageContent messageContent; - public AutoModifyMessage(UUID productId, MessageSenderRole role, String content) { + public AutoModifyMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content) { this.productId = productId; + this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); } diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java index 1f078f1..30eb0bc 100644 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java @@ -17,16 +17,20 @@ public class FeedbackMessage extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private final UUID id = UUID.randomUUID(); @Column(name = "product_id", nullable = false) private UUID productId; + @Column(name = "assistant_id", nullable = false) + private UUID assistantId; + @Embedded private MessageContent messageContent; - public FeedbackMessage(UUID productId, MessageSenderRole role, String content) { + public FeedbackMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content) { this.productId = productId; + this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); } diff --git a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java new file mode 100644 index 0000000..05c04d3 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java @@ -0,0 +1,48 @@ +package writeon.domain.assistant.research; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.assistant.MessageContent; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.common.BaseAuditTimeEntity; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "research_message") +public class ResearchMessage extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private final UUID id = UUID.randomUUID(); + + @Column(name = "product_id", nullable = false) + private UUID productId; + + @Column(name = "assistant_id", nullable = false) + private UUID assistantId; + + @Embedded + private MessageContent messageContent; + + @Column(name = "prompt") + private String prompt; + + public ResearchMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content, String prompt) { + this.productId = productId; + this.assistantId = assistantId; + this.messageContent = new MessageContent(role, content); + this.prompt = prompt; + } + + public MessageSenderRole getRole() { + return messageContent.getRole(); + } + + public String getContent() { + return messageContent.getContent(); + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java new file mode 100644 index 0000000..0f49154 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java @@ -0,0 +1,8 @@ +package writeon.domain.assistant.research; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface ResearchMessageJpaRepository extends JpaRepository { +} diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java index 9a6ef69..d2721ad 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java @@ -17,19 +17,23 @@ public class UserModifyMessage extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private final UUID id = UUID.randomUUID(); @Column(name = "product_id", nullable = false) private UUID productId; + @Column(name = "assistant_id", nullable = false) + private UUID assistantId; + @Embedded private MessageContent messageContent; @Column(name = "prompt") private String prompt; - public UserModifyMessage(UUID productId, MessageSenderRole role, String content, String prompt) { + public UserModifyMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content, String prompt) { this.productId = productId; + this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; } diff --git a/sql/init.sql b/sql/init.sql index 6c05e1e..b71a61c 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -335,24 +335,25 @@ comment on column product_worldview.updated_by is '수정자 ID'; alter table product_worldview owner to postgres; --- auto_modify_message create table auto_modify_message ( - id uuid default gen_random_uuid() not null + id uuid default gen_random_uuid() not null constraint auto_modify_message_pk primary key, - product_id uuid not null, - role varchar(10) not null, - content text, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + product_id uuid not null, + assistant_id uuid not null, + role varchar(10) not null, + content text not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table auto_modify_message is '자동 수정 메세지'; comment on column auto_modify_message.id is '자동 수정 메세지 ID'; comment on column auto_modify_message.product_id is '작품 ID'; +comment on column auto_modify_message.assistant_id is '어시스턴트 ID'; comment on column auto_modify_message.role is '메세지 송신자'; comment on column auto_modify_message.content is '내용'; comment on column auto_modify_message.created_at is '생성일시'; @@ -365,17 +366,18 @@ alter table auto_modify_message create table user_modify_message ( - id uuid default gen_random_uuid() not null + id uuid default gen_random_uuid() not null constraint user_modify_message_pk primary key, - product_id uuid not null, - role varchar(10) not null, - content text not null, - prompt text, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + product_id uuid not null, + assistant_id uuid not null, + role varchar(10) not null, + content text not null, + prompt text, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); alter table user_modify_message @@ -383,21 +385,23 @@ alter table user_modify_message create table feedback_message ( - id uuid default gen_random_uuid() not null + id uuid default gen_random_uuid() not null constraint feedback_message_pk primary key, - product_id uuid not null, - role varchar(10) not null, - content text not null, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + product_id uuid not null, + assistant_id uuid not null, + role varchar(10) not null, + content text not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null ); comment on table feedback_message is '피드백 메세지'; comment on column feedback_message.id is '피드백 메세지 ID'; comment on column feedback_message.product_id is '작품 ID'; +comment on column feedback_message.assistant_id is '어시스턴트 ID'; comment on column feedback_message.role is '메세지 송신자'; comment on column feedback_message.content is '내용'; comment on column feedback_message.created_at is '생성일시'; @@ -408,3 +412,35 @@ comment on column feedback_message.updated_by is '수정자 ID'; alter table feedback_message owner to postgres; +create table research_message +( + id uuid default gen_random_uuid() not null + constraint research_message_pk + primary key, + product_id uuid not null, + assistant_id uuid not null, + role varchar(10) not null, + content text, + prompt text, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null +); + +comment on table research_message is '자유 대화 메세지'; +comment on column research_message.id is '자유 대화 메세지 ID'; +comment on column research_message.product_id is '작품 ID'; +comment on column research_message.assistant_id is '어시스턴트 ID'; +comment on column research_message.role is '메세지 송신자'; +comment on column research_message.content is '내용'; +comment on column research_message.prompt is '프롬프트'; +comment on column research_message.created_at is '생성일시'; +comment on column research_message.created_by is '생성자 ID'; +comment on column research_message.updated_at is '수정일시'; +comment on column research_message.updated_by is '수정자 ID'; + +alter table research_message + owner to postgres; + + From 047b06dac60f78b273cd45f68676a8ff04a41f83 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 9 Mar 2025 18:35:30 +0900 Subject: [PATCH 042/107] =?UTF-8?q?feat:=20Add=20assistant=20evaluation(?= =?UTF-8?q?=ED=8F=89=EA=B0=80)=20api=20(#41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssistantController.java | 43 +-- .../request/AssistantEvaluationRequest.java | 22 ++ .../response/MessageCreateResponse.java | 20 ++ .../service/AssistantEvaluationService.java | 48 ++++ .../assistant/service/AssistantService.java | 45 ++++ .../assistant/service/AutoModifyService.java | 35 ++- .../assistant/service/FeedbackService.java | 35 ++- .../assistant/service/ResearchService.java | 12 +- .../assistant/service/UserModifyService.java | 35 ++- domain/src/main/generated/writely/Keys.java | 6 + domain/src/main/generated/writely/Public.java | 14 + domain/src/main/generated/writely/Tables.java | 12 + .../generated/writely/tables/Assistant.java | 255 ++++++++++++++++++ .../writely/tables/AssistantEvaluation.java | 243 +++++++++++++++++ .../writely/tables/AutoModifyMessage.java | 5 + .../writely/tables/FeedbackMessage.java | 5 + .../writely/tables/ResearchMessage.java | 5 - .../writely/tables/UserModifyMessage.java | 5 - .../writely/tables/pojos/Assistant.java | 207 ++++++++++++++ .../tables/pojos/AssistantEvaluation.java | 151 +++++++++++ .../tables/pojos/AutoModifyMessage.java | 19 ++ .../writely/tables/pojos/FeedbackMessage.java | 19 ++ .../writely/tables/pojos/ResearchMessage.java | 19 -- .../tables/pojos/UserModifyMessage.java | 19 -- .../records/AssistantEvaluationRecord.java | 150 +++++++++++ .../tables/records/AssistantRecord.java | 199 ++++++++++++++ .../records/AutoModifyMessageRecord.java | 43 ++- .../tables/records/FeedbackMessageRecord.java | 43 ++- .../tables/records/ResearchMessageRecord.java | 51 ++-- .../records/UserModifyMessageRecord.java | 51 ++-- .../writeon/domain/assistant/Assistant.java | 43 +++ .../domain/assistant/AssistantEvaluation.java | 44 +++ .../AssistantEvaluationJpaRepository.java | 8 + .../assistant/AssistantJpaRepository.java | 8 + .../automodify/AutoModifyMessage.java | 6 +- .../AutoModifyMessageJpaRepository.java | 3 + .../assistant/enums/AssistantException.java | 9 +- .../assistant/enums/AssistantStatus.java | 26 ++ .../domain/assistant/enums/AssistantType.java | 27 ++ .../domain/assistant/enums/FeedbackType.java | 27 ++ .../assistant/feedback/FeedbackMessage.java | 6 +- .../FeedbackMessageJpaRepository.java | 3 + .../assistant/research/ResearchMessage.java | 6 +- .../usermodify/UserModifyMessage.java | 6 +- .../UserModifyMessageJpaRepository.java | 3 + sql/init.sql | 56 +++- 46 files changed, 1876 insertions(+), 221 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java create mode 100644 api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java create mode 100644 api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java create mode 100644 api/src/main/java/writeon/api/assistant/service/AssistantService.java create mode 100644 domain/src/main/generated/writely/tables/Assistant.java create mode 100644 domain/src/main/generated/writely/tables/AssistantEvaluation.java create mode 100644 domain/src/main/generated/writely/tables/pojos/Assistant.java create mode 100644 domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java create mode 100644 domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java create mode 100644 domain/src/main/generated/writely/tables/records/AssistantRecord.java create mode 100644 domain/src/main/java/writeon/domain/assistant/Assistant.java create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java create mode 100644 domain/src/main/java/writeon/domain/assistant/enums/AssistantStatus.java create mode 100644 domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java create mode 100644 domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 3388cba..2c46c71 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -8,15 +8,10 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; -import writeon.api.assistant.request.AssistantFeedbackMessageRequest; -import writeon.api.assistant.request.AssistantResearchRequest; -import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.request.*; import writeon.api.assistant.response.AssistantResponse; -import writeon.api.assistant.service.AutoModifyService; -import writeon.api.assistant.service.FeedbackService; -import writeon.api.assistant.service.ResearchService; -import writeon.api.assistant.service.UserModifyService; +import writeon.api.assistant.response.MessageCreateResponse; +import writeon.api.assistant.service.*; import java.util.UUID; @@ -26,6 +21,8 @@ @Tag(name = "AI 어시스턴트") public class AssistantController { + private final AssistantService assistantService; + private final AssistantEvaluationService assistantEvaluationService; private final AutoModifyService autoModifyService; private final FeedbackService feedbackService; private final UserModifyService userModifyService; @@ -33,19 +30,25 @@ public class AssistantController { @Operation(summary = "자동 수정 메세지 저장") @PostMapping("/auto-modify/messages") - public UUID createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { + public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { return autoModifyService.createMessage(request); } + @Operation(summary = "평가") + @PostMapping("/evaluations") + public void evaluate(@RequestBody AssistantEvaluationRequest request) { + assistantEvaluationService.evaluate(request); + } + @Operation(summary = "구간 피드백 메세지 저장") @PostMapping("/feedback/messages") - public UUID createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { + public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { return feedbackService.createMessage(request); } @Operation(summary = "수동 수정 메세지 저장") @PostMapping("/user-modify/messages") - public UUID createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { + public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { return userModifyService.createMessage(request); } @@ -58,10 +61,10 @@ public AssistantResponse research(@RequestBody AssistantResearchRequest request) @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") public SseEmitter streamAutoModify( - @RequestParam UUID productId, + @RequestParam UUID assistantId, @RequestParam UUID messageId ) { - SseEmitter emitter = autoModifyService.streamAutoModify(productId, messageId); + SseEmitter emitter = autoModifyService.streamAutoModify(assistantId, messageId); setResponseHeaderForSSE(); return emitter; } @@ -69,10 +72,10 @@ public SseEmitter streamAutoModify( @Operation(summary = "구간 피드백 스트리밍") @GetMapping("/feedback/stream") public SseEmitter streamFeedback( - @RequestParam UUID productId, + @RequestParam UUID assistantId, @RequestParam UUID messageId ) { - SseEmitter emitter = feedbackService.streamFeedback(productId, messageId); + SseEmitter emitter = feedbackService.streamFeedback(assistantId, messageId); setResponseHeaderForSSE(); return emitter; } @@ -80,14 +83,20 @@ public SseEmitter streamFeedback( @Operation(summary = "수동 수정 스트리밍") @GetMapping("/user-modify/stream") public SseEmitter streamUserModify( - @RequestParam UUID productId, + @RequestParam UUID assistantId, @RequestParam UUID messageId ) { - SseEmitter emitter = userModifyService.streamUserModify(productId, messageId); + SseEmitter emitter = userModifyService.streamUserModify(assistantId, messageId); setResponseHeaderForSSE(); return emitter; } + @Operation(summary = "응답 반영") + @PutMapping("/reflections/{assistantId}") + public void reflect(@PathVariable UUID assistantId) { + assistantService.reflect(assistantId); + } + private void setResponseHeaderForSSE() { HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); if (response != null) { diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java new file mode 100644 index 0000000..87b60f0 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java @@ -0,0 +1,22 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import writeon.domain.assistant.enums.FeedbackType; + +import java.util.UUID; + +@Getter +@Setter +public class AssistantEvaluationRequest { + + @Schema(title = "어시스턴트 ID") + private UUID assistantId; + @Schema(title = "만족 여부") + private Boolean isGood; + @Schema(title = "피드백 타입", nullable = true) + private FeedbackType feedbackType; + @Schema(title = "피드백", nullable = true) + private String feedback; +} diff --git a/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java b/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java new file mode 100644 index 0000000..9fbaead --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java @@ -0,0 +1,20 @@ +package writeon.api.assistant.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +import java.util.UUID; + +@Getter +public class MessageCreateResponse { + + @Schema(title = "어시스턴트 ID") + private final UUID assistantId; + @Schema(title = "메세지 ID") + private final UUID messageId; + + public MessageCreateResponse(UUID assistantId, UUID messageId) { + this.assistantId = assistantId; + this.messageId = messageId; + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java new file mode 100644 index 0000000..c620201 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java @@ -0,0 +1,48 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import writeon.api.assistant.request.AssistantEvaluationRequest; +import writeon.api.common.exception.BaseException; +import writeon.domain.assistant.AssistantEvaluation; +import writeon.domain.assistant.AssistantEvaluationJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.FeedbackType; + +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class AssistantEvaluationService { + + private final AssistantEvaluationJpaRepository assistantEvaluationRepository; + private final AssistantService assistantService; + + @Transactional + public void evaluate(AssistantEvaluationRequest request) { + assistantService.verifyExist(request.getAssistantId()); + verifyEvaluated(request.getAssistantId()); + + String feedback = null; + + if (!request.getIsGood()) { + feedback = request.getFeedbackType() == FeedbackType.ETC + ? request.getFeedback() : request.getFeedbackType().getCode(); + } + + AssistantEvaluation assistantEvaluation = AssistantEvaluation.builder() + .assistantId(request.getAssistantId()) + .isGood(request.getIsGood()) + .feedback(feedback) + .build(); + + assistantEvaluationRepository.save(assistantEvaluation); + } + + private void verifyEvaluated(UUID assistantId) { + if (assistantEvaluationRepository.existsById(assistantId)) { + throw new BaseException(AssistantException.ALREADY_EVALUATED); + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java new file mode 100644 index 0000000..ca5fe4e --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -0,0 +1,45 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import writeon.api.common.exception.BaseException; +import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; + +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class AssistantService { + + private final AssistantJpaRepository assistantRepository; + + @Transactional + public UUID create(UUID productId, AssistantType type) { + Assistant assistant = new Assistant(productId, type); + return assistantRepository.save(assistant).getId(); + } + + @Transactional + public void reflect(UUID assistantId) { + Assistant assistant = getById(assistantId); + assistant.updateStatus(AssistantStatus.COMPLETED); + } + + @Transactional(readOnly = true) + public Assistant getById(UUID assistantId) { + return assistantRepository.findById(assistantId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); + } + + @Transactional(readOnly = true) + public void verifyExist(UUID assistantId) { + if (!assistantRepository.existsById(assistantId)) { + throw new BaseException(AssistantException.NOT_EXIST); + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index c93e434..3f80d86 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -5,15 +5,19 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.AutoModifyRequest; import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.Assistant; import writeon.domain.assistant.automodify.AutoModifyMessage; import writeon.domain.assistant.automodify.AutoModifyMessageJpaRepository; import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; import java.io.IOException; @@ -26,22 +30,30 @@ public class AutoModifyService { private final long TIMEOUT = 180_000L; private final AutoModifyMessageJpaRepository autoModifyMessageRepository; - private final ProductQueryService productQueryService; private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; @Transactional - public UUID createMessage(AssistantAutoModifyMessageRequest request) { + public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest request) { productQueryService.verifyExist(request.getProductId()); - AutoModifyMessage memberMessage = new AutoModifyMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent()); - return autoModifyMessageRepository.save(memberMessage).getId(); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); + AutoModifyMessage memberMessage = new AutoModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); + UUID messageId = autoModifyMessageRepository.save(memberMessage).getId(); + + return new MessageCreateResponse(assistantId, messageId); } - public SseEmitter streamAutoModify(UUID productId, UUID messageId) { - productQueryService.verifyExist(productId); + public SseEmitter streamAutoModify(UUID assistantId, UUID messageId) { + Assistant assistant = assistantService.getById(assistantId); + + verifyAnswered(assistantId); + productQueryService.verifyExist(assistant.getProductId()); + AutoModifyMessage message = getById(messageId); - UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); AutoModifyRequest request = new AutoModifyRequest(userSetting, message.getContent()); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -64,8 +76,9 @@ public SseEmitter streamAutoModify(UUID productId, UUID messageId) { throw exception; }, () -> { - AutoModifyMessage assistantMessage = new AutoModifyMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); + AutoModifyMessage assistantMessage = new AutoModifyMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); autoModifyMessageRepository.save(assistantMessage); + assistant.updateStatus(AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -77,4 +90,10 @@ private AutoModifyMessage getById(UUID messageId) { return autoModifyMessageRepository.findById(messageId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } + + private void verifyAnswered(UUID assistantId) { + if (autoModifyMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } } diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index b5e5024..5303bfc 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -5,13 +5,17 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.FeedbackRequest; import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.Assistant; import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; import writeon.domain.assistant.feedback.FeedbackMessage; import writeon.domain.assistant.feedback.FeedbackMessageJpaRepository; @@ -26,22 +30,30 @@ public class FeedbackService { private final long TIMEOUT = 180_000L; private final FeedbackMessageJpaRepository feedbackMessageRepository; - private final ProductQueryService productQueryService; private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; @Transactional - public UUID createMessage(AssistantFeedbackMessageRequest request) { + public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest request) { productQueryService.verifyExist(request.getProductId()); - FeedbackMessage memberMessage = new FeedbackMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent()); - return feedbackMessageRepository.save(memberMessage).getId(); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); + FeedbackMessage memberMessage = new FeedbackMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); + UUID messageId = feedbackMessageRepository.save(memberMessage).getId(); + + return new MessageCreateResponse(assistantId, messageId); } - public SseEmitter streamFeedback(UUID productId, UUID messageId) { - productQueryService.verifyExist(productId); + public SseEmitter streamFeedback(UUID assistantId, UUID messageId) { + Assistant assistant = assistantService.getById(assistantId); + + verifyAnswered(assistantId); + productQueryService.verifyExist(assistant.getProductId()); + FeedbackMessage message = getById(messageId); - UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); FeedbackRequest request = new FeedbackRequest(userSetting, message.getContent()); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -64,8 +76,9 @@ public SseEmitter streamFeedback(UUID productId, UUID messageId) { throw exception; }, () -> { - FeedbackMessage assistantMessage = new FeedbackMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); + FeedbackMessage assistantMessage = new FeedbackMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); feedbackMessageRepository.save(assistantMessage); + assistant.updateStatus(AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -77,4 +90,10 @@ private FeedbackMessage getById(UUID messageId) { return feedbackMessageRepository.findById(messageId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } + + private void verifyAnswered(UUID assistantId) { + if (feedbackMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } } diff --git a/api/src/main/java/writeon/api/assistant/service/ResearchService.java b/api/src/main/java/writeon/api/assistant/service/ResearchService.java index 0a11e18..b14f964 100644 --- a/api/src/main/java/writeon/api/assistant/service/ResearchService.java +++ b/api/src/main/java/writeon/api/assistant/service/ResearchService.java @@ -9,6 +9,7 @@ import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.ResearchRequest; import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; import writeon.domain.assistant.research.ResearchMessage; import writeon.domain.assistant.research.ResearchMessageJpaRepository; @@ -19,19 +20,18 @@ @RequiredArgsConstructor public class ResearchService { - private final long TIMEOUT = 180_000L; - private final ResearchMessageJpaRepository researchMessageRepository; - private final ProductQueryService productQueryService; private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; @Transactional public AssistantResponse research(AssistantResearchRequest request) { productQueryService.verifyExist(request.getProductId()); - UUID assistantId = UUID.randomUUID(); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.RESEARCH); ResearchMessage memberMessage = - new ResearchMessage(request.getProductId(), assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + new ResearchMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); researchMessageRepository.save(memberMessage); UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); @@ -40,7 +40,7 @@ public AssistantResponse research(AssistantResearchRequest request) { String answer = assistantApiClient.research(researchRequest).block(); ResearchMessage assistantMessage = - new ResearchMessage(request.getProductId(), assistantId, MessageSenderRole.ASSISTANT, answer, null); + new ResearchMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null); researchMessageRepository.save(assistantMessage); return new AssistantResponse(assistantId, answer); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 9146cfc..8e69c8b 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -5,13 +5,17 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.UserModifyRequest; import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.Assistant; import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; import writeon.domain.assistant.usermodify.UserModifyMessage; import writeon.domain.assistant.usermodify.UserModifyMessageJpaRepository; @@ -26,23 +30,31 @@ public class UserModifyService { private final long TIMEOUT = 180_000L; private final UserModifyMessageJpaRepository userModifyMessageRepository; - private final ProductQueryService productQueryService; private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; @Transactional - public UUID createMessage(AssistantUserModifyMessageRequest request) { + public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest request) { productQueryService.verifyExist(request.getProductId()); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); UserModifyMessage memberMessage = - new UserModifyMessage(request.getProductId(), UUID.randomUUID(), MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); - return userModifyMessageRepository.save(memberMessage).getId(); + new UserModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + UUID messagedId = userModifyMessageRepository.save(memberMessage).getId(); + + return new MessageCreateResponse(assistantId, messagedId); } - public SseEmitter streamUserModify(UUID productId, UUID messageId) { - productQueryService.verifyExist(productId); + public SseEmitter streamUserModify(UUID assistantId, UUID messageId) { + Assistant assistant = assistantService.getById(assistantId); + + verifyAnswered(assistantId); + productQueryService.verifyExist(assistant.getProductId()); + UserModifyMessage message = getById(messageId); - UserSetting userSetting = new UserSetting(productQueryService.getById(productId)); + UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); UserModifyRequest request = new UserModifyRequest(userSetting, message.getContent(), message.getPrompt()); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -65,8 +77,9 @@ public SseEmitter streamUserModify(UUID productId, UUID messageId) { throw exception; }, () -> { - UserModifyMessage assistantMessage = new UserModifyMessage(productId, message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + UserModifyMessage assistantMessage = new UserModifyMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); userModifyMessageRepository.save(assistantMessage); + assistant.updateStatus(AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -78,4 +91,10 @@ private UserModifyMessage getById(UUID messageId) { return userModifyMessageRepository.findById(messageId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } + + private void verifyAnswered(UUID assistantId) { + if (userModifyMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } } diff --git a/domain/src/main/generated/writely/Keys.java b/domain/src/main/generated/writely/Keys.java index 44a75ec..d4d4541 100644 --- a/domain/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writely/Keys.java @@ -9,6 +9,8 @@ import org.jooq.impl.DSL; import org.jooq.impl.Internal; +import writely.tables.Assistant; +import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; @@ -26,6 +28,8 @@ import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.UserModifyMessage; +import writely.tables.records.AssistantEvaluationRecord; +import writely.tables.records.AssistantRecord; import writely.tables.records.AutoModifyMessageRecord; import writely.tables.records.FeedbackMessageRecord; import writely.tables.records.LoginAttemptRecord; @@ -56,6 +60,8 @@ public class Keys { // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- + public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); + public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); public static final UniqueKey FEEDBACK_MESSAGE_PK = Internal.createUniqueKey(FeedbackMessage.FEEDBACK_MESSAGE, DSL.name("feedback_message_pk"), new TableField[] { FeedbackMessage.FEEDBACK_MESSAGE.ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); diff --git a/domain/src/main/generated/writely/Public.java b/domain/src/main/generated/writely/Public.java index 1af3680..8bfe56d 100644 --- a/domain/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writely/Public.java @@ -14,6 +14,8 @@ import org.jooq.Table; import org.jooq.impl.SchemaImpl; +import writely.tables.Assistant; +import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; @@ -48,6 +50,16 @@ public class Public extends SchemaImpl { */ public static final Public PUBLIC = new Public(); + /** + * 어시스턴트 + */ + public final Assistant ASSISTANT = Assistant.ASSISTANT; + + /** + * 어시스턴트 평가 + */ + public final AssistantEvaluation ASSISTANT_EVALUATION = AssistantEvaluation.ASSISTANT_EVALUATION; + /** * 자동 수정 메세지 */ @@ -188,6 +200,8 @@ public Catalog getCatalog() { @Override public final List> getTables() { return Arrays.asList( + Assistant.ASSISTANT, + AssistantEvaluation.ASSISTANT_EVALUATION, AutoModifyMessage.AUTO_MODIFY_MESSAGE, FeedbackMessage.FEEDBACK_MESSAGE, LoginAttempt.LOGIN_ATTEMPT, diff --git a/domain/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java index 9bc5a8d..665c2d5 100644 --- a/domain/src/main/generated/writely/Tables.java +++ b/domain/src/main/generated/writely/Tables.java @@ -8,6 +8,8 @@ import org.jooq.Field; import org.jooq.Result; +import writely.tables.Assistant; +import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; @@ -35,6 +37,16 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Tables { + /** + * 어시스턴트 + */ + public static final Assistant ASSISTANT = Assistant.ASSISTANT; + + /** + * 어시스턴트 평가 + */ + public static final AssistantEvaluation ASSISTANT_EVALUATION = AssistantEvaluation.ASSISTANT_EVALUATION; + /** * 자동 수정 메세지 */ diff --git a/domain/src/main/generated/writely/tables/Assistant.java b/domain/src/main/generated/writely/tables/Assistant.java new file mode 100644 index 0000000..02a2c44 --- /dev/null +++ b/domain/src/main/generated/writely/tables/Assistant.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.AssistantRecord; + + +/** + * 어시스턴트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Assistant extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.assistant + */ + public static final Assistant ASSISTANT = new Assistant(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AssistantRecord.class; + } + + /** + * The column public.assistant.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.assistant.product_id. 작품 ID + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + + /** + * The column public.assistant.type. 기능 종류 + */ + public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR(20).nullable(false), this, "기능 종류"); + + /** + * The column public.assistant.status. 진행 상태 + */ + public final TableField STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(20).nullable(false), this, "진행 상태"); + + /** + * The column public.assistant.created_at. 수정일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + + /** + * The column public.assistant.created_by. 수정자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + + /** + * The column public.assistant.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.assistant.updated_by. + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); + + private Assistant(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private Assistant(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("어시스턴트"), TableOptions.table(), where); + } + + /** + * Create an aliased public.assistant table reference + */ + public Assistant(String alias) { + this(DSL.name(alias), ASSISTANT); + } + + /** + * Create an aliased public.assistant table reference + */ + public Assistant(Name alias) { + this(alias, ASSISTANT); + } + + /** + * Create a public.assistant table reference + */ + public Assistant() { + this(DSL.name("assistant"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.ASSISTANT_PK; + } + + @Override + public Assistant as(String alias) { + return new Assistant(DSL.name(alias), this); + } + + @Override + public Assistant as(Name alias) { + return new Assistant(alias, this); + } + + @Override + public Assistant as(Table alias) { + return new Assistant(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Assistant rename(String name) { + return new Assistant(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Assistant rename(Name name) { + return new Assistant(name, null); + } + + /** + * Rename this table + */ + @Override + public Assistant rename(Table name) { + return new Assistant(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant where(Condition condition) { + return new Assistant(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Assistant where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Assistant where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Assistant where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public Assistant where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public Assistant whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/AssistantEvaluation.java b/domain/src/main/generated/writely/tables/AssistantEvaluation.java new file mode 100644 index 0000000..8cf083e --- /dev/null +++ b/domain/src/main/generated/writely/tables/AssistantEvaluation.java @@ -0,0 +1,243 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.AssistantEvaluationRecord; + + +/** + * 어시스턴트 평가 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantEvaluation extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.assistant_evaluation + */ + public static final AssistantEvaluation ASSISTANT_EVALUATION = new AssistantEvaluation(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AssistantEvaluationRecord.class; + } + + /** + * The column public.assistant_evaluation.assistant_id. 어시스턴트 + * ID + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); + + /** + * The column public.assistant_evaluation.is_good. 만족 여부 + */ + public final TableField IS_GOOD = createField(DSL.name("is_good"), SQLDataType.BOOLEAN.nullable(false), this, "만족 여부"); + + /** + * The column public.assistant_evaluation.feedback. 피드백 + */ + public final TableField FEEDBACK = createField(DSL.name("feedback"), SQLDataType.VARCHAR(255), this, "피드백"); + + /** + * The column public.assistant_evaluation.created_at. 생성일시 + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); + + /** + * The column public.assistant_evaluation.created_by. 생성자 ID + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + + private AssistantEvaluation(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private AssistantEvaluation(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment("어시스턴트 평가"), TableOptions.table(), where); + } + + /** + * Create an aliased public.assistant_evaluation table + * reference + */ + public AssistantEvaluation(String alias) { + this(DSL.name(alias), ASSISTANT_EVALUATION); + } + + /** + * Create an aliased public.assistant_evaluation table + * reference + */ + public AssistantEvaluation(Name alias) { + this(alias, ASSISTANT_EVALUATION); + } + + /** + * Create a public.assistant_evaluation table reference + */ + public AssistantEvaluation() { + this(DSL.name("assistant_evaluation"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.ASSISTANT_EVALUATION_PK; + } + + @Override + public AssistantEvaluation as(String alias) { + return new AssistantEvaluation(DSL.name(alias), this); + } + + @Override + public AssistantEvaluation as(Name alias) { + return new AssistantEvaluation(alias, this); + } + + @Override + public AssistantEvaluation as(Table alias) { + return new AssistantEvaluation(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public AssistantEvaluation rename(String name) { + return new AssistantEvaluation(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public AssistantEvaluation rename(Name name) { + return new AssistantEvaluation(name, null); + } + + /** + * Rename this table + */ + @Override + public AssistantEvaluation rename(Table name) { + return new AssistantEvaluation(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation where(Condition condition) { + return new AssistantEvaluation(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantEvaluation where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantEvaluation where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantEvaluation where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantEvaluation where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantEvaluation whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/AutoModifyMessage.java index ae2b0af..85dad76 100644 --- a/domain/src/main/generated/writely/tables/AutoModifyMessage.java +++ b/domain/src/main/generated/writely/tables/AutoModifyMessage.java @@ -61,6 +61,11 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + /** + * The column public.auto_modify_message.assistant_id. 어시스턴트 ID + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); + /** * The column public.auto_modify_message.role. 메세지 송신자 */ diff --git a/domain/src/main/generated/writely/tables/FeedbackMessage.java b/domain/src/main/generated/writely/tables/FeedbackMessage.java index 95349c3..9d7ce3a 100644 --- a/domain/src/main/generated/writely/tables/FeedbackMessage.java +++ b/domain/src/main/generated/writely/tables/FeedbackMessage.java @@ -61,6 +61,11 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + /** + * The column public.feedback_message.assistant_id. 어시스턴트 ID + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); + /** * The column public.feedback_message.role. 메세지 송신자 */ diff --git a/domain/src/main/generated/writely/tables/ResearchMessage.java b/domain/src/main/generated/writely/tables/ResearchMessage.java index 1a06251..7605115 100644 --- a/domain/src/main/generated/writely/tables/ResearchMessage.java +++ b/domain/src/main/generated/writely/tables/ResearchMessage.java @@ -56,11 +56,6 @@ public Class getRecordType() { */ public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "자유 대화 메세지 ID"); - /** - * The column public.research_message.product_id. 작품 ID - */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); - /** * The column public.research_message.assistant_id. 어시스턴트 ID */ diff --git a/domain/src/main/generated/writely/tables/UserModifyMessage.java b/domain/src/main/generated/writely/tables/UserModifyMessage.java index 8312d12..f6a9933 100644 --- a/domain/src/main/generated/writely/tables/UserModifyMessage.java +++ b/domain/src/main/generated/writely/tables/UserModifyMessage.java @@ -56,11 +56,6 @@ public Class getRecordType() { */ public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); - /** - * The column public.user_modify_message.product_id. - */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, ""); - /** * The column public.user_modify_message.assistant_id. */ diff --git a/domain/src/main/generated/writely/tables/pojos/Assistant.java b/domain/src/main/generated/writely/tables/pojos/Assistant.java new file mode 100644 index 0000000..0c46fb4 --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/Assistant.java @@ -0,0 +1,207 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 어시스턴트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Assistant implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String type; + private final String status; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public Assistant(Assistant value) { + this.id = value.id; + this.productId = value.productId; + this.type = value.type; + this.status = value.status; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public Assistant( + UUID id, + UUID productId, + String type, + String status, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.productId = productId; + this.type = type; + this.status = status; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.assistant.id. + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.assistant.product_id. 작품 ID + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.assistant.type. 기능 종류 + */ + public String getType() { + return this.type; + } + + /** + * Getter for public.assistant.status. 진행 상태 + */ + public String getStatus() { + return this.status; + } + + /** + * Getter for public.assistant.created_at. 수정일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.assistant.created_by. 수정자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.assistant.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.assistant.updated_by. + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Assistant other = (Assistant) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.type == null) { + if (other.type != null) + return false; + } + else if (!this.type.equals(other.type)) + return false; + if (this.status == null) { + if (other.status != null) + return false; + } + else if (!this.status.equals(other.status)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.type == null) ? 0 : this.type.hashCode()); + result = prime * result + ((this.status == null) ? 0 : this.status.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Assistant ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(type); + sb.append(", ").append(status); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java b/domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java new file mode 100644 index 0000000..4f04f5c --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java @@ -0,0 +1,151 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * 어시스턴트 평가 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantEvaluation implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID assistantId; + private final Boolean isGood; + private final String feedback; + private final LocalDateTime createdAt; + private final UUID createdBy; + + public AssistantEvaluation(AssistantEvaluation value) { + this.assistantId = value.assistantId; + this.isGood = value.isGood; + this.feedback = value.feedback; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + } + + public AssistantEvaluation( + UUID assistantId, + Boolean isGood, + String feedback, + LocalDateTime createdAt, + UUID createdBy + ) { + this.assistantId = assistantId; + this.isGood = isGood; + this.feedback = feedback; + this.createdAt = createdAt; + this.createdBy = createdBy; + } + + /** + * Getter for public.assistant_evaluation.assistant_id. 어시스턴트 + * ID + */ + public UUID getAssistantId() { + return this.assistantId; + } + + /** + * Getter for public.assistant_evaluation.is_good. 만족 여부 + */ + public Boolean getIsGood() { + return this.isGood; + } + + /** + * Getter for public.assistant_evaluation.feedback. 피드백 + */ + public String getFeedback() { + return this.feedback; + } + + /** + * Getter for public.assistant_evaluation.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.assistant_evaluation.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final AssistantEvaluation other = (AssistantEvaluation) obj; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; + if (this.isGood == null) { + if (other.isGood != null) + return false; + } + else if (!this.isGood.equals(other.isGood)) + return false; + if (this.feedback == null) { + if (other.feedback != null) + return false; + } + else if (!this.feedback.equals(other.feedback)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); + result = prime * result + ((this.isGood == null) ? 0 : this.isGood.hashCode()); + result = prime * result + ((this.feedback == null) ? 0 : this.feedback.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("AssistantEvaluation ("); + + sb.append(assistantId); + sb.append(", ").append(isGood); + sb.append(", ").append(feedback); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java index 5ed9f70..3c57f22 100644 --- a/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java +++ b/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java @@ -19,6 +19,7 @@ public class AutoModifyMessage implements Serializable { private final UUID id; private final UUID productId; + private final UUID assistantId; private final String role; private final String content; private final LocalDateTime createdAt; @@ -29,6 +30,7 @@ public class AutoModifyMessage implements Serializable { public AutoModifyMessage(AutoModifyMessage value) { this.id = value.id; this.productId = value.productId; + this.assistantId = value.assistantId; this.role = value.role; this.content = value.content; this.createdAt = value.createdAt; @@ -40,6 +42,7 @@ public AutoModifyMessage(AutoModifyMessage value) { public AutoModifyMessage( UUID id, UUID productId, + UUID assistantId, String role, String content, LocalDateTime createdAt, @@ -49,6 +52,7 @@ public AutoModifyMessage( ) { this.id = id; this.productId = productId; + this.assistantId = assistantId; this.role = role; this.content = content; this.createdAt = createdAt; @@ -71,6 +75,13 @@ public UUID getProductId() { return this.productId; } + /** + * Getter for public.auto_modify_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return this.assistantId; + } + /** * Getter for public.auto_modify_message.role. 메세지 송신자 */ @@ -134,6 +145,12 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; if (this.role == null) { if (other.role != null) return false; @@ -179,6 +196,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); @@ -194,6 +212,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); + sb.append(", ").append(assistantId); sb.append(", ").append(role); sb.append(", ").append(content); sb.append(", ").append(createdAt); diff --git a/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java b/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java index a1039fa..619bbef 100644 --- a/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java +++ b/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java @@ -19,6 +19,7 @@ public class FeedbackMessage implements Serializable { private final UUID id; private final UUID productId; + private final UUID assistantId; private final String role; private final String content; private final LocalDateTime createdAt; @@ -29,6 +30,7 @@ public class FeedbackMessage implements Serializable { public FeedbackMessage(FeedbackMessage value) { this.id = value.id; this.productId = value.productId; + this.assistantId = value.assistantId; this.role = value.role; this.content = value.content; this.createdAt = value.createdAt; @@ -40,6 +42,7 @@ public FeedbackMessage(FeedbackMessage value) { public FeedbackMessage( UUID id, UUID productId, + UUID assistantId, String role, String content, LocalDateTime createdAt, @@ -49,6 +52,7 @@ public FeedbackMessage( ) { this.id = id; this.productId = productId; + this.assistantId = assistantId; this.role = role; this.content = content; this.createdAt = createdAt; @@ -71,6 +75,13 @@ public UUID getProductId() { return this.productId; } + /** + * Getter for public.feedback_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return this.assistantId; + } + /** * Getter for public.feedback_message.role. 메세지 송신자 */ @@ -134,6 +145,12 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; if (this.role == null) { if (other.role != null) return false; @@ -179,6 +196,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); @@ -194,6 +212,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); + sb.append(", ").append(assistantId); sb.append(", ").append(role); sb.append(", ").append(content); sb.append(", ").append(createdAt); diff --git a/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java b/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java index 62ea6fd..1036b51 100644 --- a/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java +++ b/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java @@ -18,7 +18,6 @@ public class ResearchMessage implements Serializable { private static final long serialVersionUID = 1L; private final UUID id; - private final UUID productId; private final UUID assistantId; private final String role; private final String content; @@ -30,7 +29,6 @@ public class ResearchMessage implements Serializable { public ResearchMessage(ResearchMessage value) { this.id = value.id; - this.productId = value.productId; this.assistantId = value.assistantId; this.role = value.role; this.content = value.content; @@ -43,7 +41,6 @@ public ResearchMessage(ResearchMessage value) { public ResearchMessage( UUID id, - UUID productId, UUID assistantId, String role, String content, @@ -54,7 +51,6 @@ public ResearchMessage( UUID updatedBy ) { this.id = id; - this.productId = productId; this.assistantId = assistantId; this.role = role; this.content = content; @@ -72,13 +68,6 @@ public UUID getId() { return this.id; } - /** - * Getter for public.research_message.product_id. 작품 ID - */ - public UUID getProductId() { - return this.productId; - } - /** * Getter for public.research_message.assistant_id. 어시스턴트 ID */ @@ -150,12 +139,6 @@ public boolean equals(Object obj) { } else if (!this.id.equals(other.id)) return false; - if (this.productId == null) { - if (other.productId != null) - return false; - } - else if (!this.productId.equals(other.productId)) - return false; if (this.assistantId == null) { if (other.assistantId != null) return false; @@ -212,7 +195,6 @@ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); @@ -229,7 +211,6 @@ public String toString() { StringBuilder sb = new StringBuilder("ResearchMessage ("); sb.append(id); - sb.append(", ").append(productId); sb.append(", ").append(assistantId); sb.append(", ").append(role); sb.append(", ").append(content); diff --git a/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java index 1357eb1..6549290 100644 --- a/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java +++ b/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java @@ -18,7 +18,6 @@ public class UserModifyMessage implements Serializable { private static final long serialVersionUID = 1L; private final UUID id; - private final UUID productId; private final UUID assistantId; private final String role; private final String content; @@ -30,7 +29,6 @@ public class UserModifyMessage implements Serializable { public UserModifyMessage(UserModifyMessage value) { this.id = value.id; - this.productId = value.productId; this.assistantId = value.assistantId; this.role = value.role; this.content = value.content; @@ -43,7 +41,6 @@ public UserModifyMessage(UserModifyMessage value) { public UserModifyMessage( UUID id, - UUID productId, UUID assistantId, String role, String content, @@ -54,7 +51,6 @@ public UserModifyMessage( UUID updatedBy ) { this.id = id; - this.productId = productId; this.assistantId = assistantId; this.role = role; this.content = content; @@ -72,13 +68,6 @@ public UUID getId() { return this.id; } - /** - * Getter for public.user_modify_message.product_id. - */ - public UUID getProductId() { - return this.productId; - } - /** * Getter for public.user_modify_message.assistant_id. */ @@ -150,12 +139,6 @@ public boolean equals(Object obj) { } else if (!this.id.equals(other.id)) return false; - if (this.productId == null) { - if (other.productId != null) - return false; - } - else if (!this.productId.equals(other.productId)) - return false; if (this.assistantId == null) { if (other.assistantId != null) return false; @@ -212,7 +195,6 @@ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); @@ -229,7 +211,6 @@ public String toString() { StringBuilder sb = new StringBuilder("UserModifyMessage ("); sb.append(id); - sb.append(", ").append(productId); sb.append(", ").append(assistantId); sb.append(", ").append(role); sb.append(", ").append(content); diff --git a/domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java b/domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java new file mode 100644 index 0000000..a16bf14 --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java @@ -0,0 +1,150 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.AssistantEvaluation; + + +/** + * 어시스턴트 평가 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantEvaluationRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.assistant_evaluation.assistant_id. 어시스턴트 + * ID + */ + public AssistantEvaluationRecord setAssistantId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.assistant_evaluation.assistant_id. 어시스턴트 + * ID + */ + public UUID getAssistantId() { + return (UUID) get(0); + } + + /** + * Setter for public.assistant_evaluation.is_good. 만족 여부 + */ + public AssistantEvaluationRecord setIsGood(Boolean value) { + set(1, value); + return this; + } + + /** + * Getter for public.assistant_evaluation.is_good. 만족 여부 + */ + public Boolean getIsGood() { + return (Boolean) get(1); + } + + /** + * Setter for public.assistant_evaluation.feedback. 피드백 + */ + public AssistantEvaluationRecord setFeedback(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.assistant_evaluation.feedback. 피드백 + */ + public String getFeedback() { + return (String) get(2); + } + + /** + * Setter for public.assistant_evaluation.created_at. 생성일시 + */ + public AssistantEvaluationRecord setCreatedAt(LocalDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.assistant_evaluation.created_at. 생성일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(3); + } + + /** + * Setter for public.assistant_evaluation.created_by. 생성자 ID + */ + public AssistantEvaluationRecord setCreatedBy(UUID value) { + set(4, value); + return this; + } + + /** + * Getter for public.assistant_evaluation.created_by. 생성자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(4); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AssistantEvaluationRecord + */ + public AssistantEvaluationRecord() { + super(AssistantEvaluation.ASSISTANT_EVALUATION); + } + + /** + * Create a detached, initialised AssistantEvaluationRecord + */ + public AssistantEvaluationRecord(UUID assistantId, Boolean isGood, String feedback, LocalDateTime createdAt, UUID createdBy) { + super(AssistantEvaluation.ASSISTANT_EVALUATION); + + setAssistantId(assistantId); + setIsGood(isGood); + setFeedback(feedback); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised AssistantEvaluationRecord + */ + public AssistantEvaluationRecord(writely.tables.pojos.AssistantEvaluation value) { + super(AssistantEvaluation.ASSISTANT_EVALUATION); + + if (value != null) { + setAssistantId(value.getAssistantId()); + setIsGood(value.getIsGood()); + setFeedback(value.getFeedback()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/generated/writely/tables/records/AssistantRecord.java b/domain/src/main/generated/writely/tables/records/AssistantRecord.java new file mode 100644 index 0000000..8f20853 --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/AssistantRecord.java @@ -0,0 +1,199 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.Assistant; + + +/** + * 어시스턴트 + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.assistant.id. + */ + public AssistantRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.assistant.id. + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.assistant.product_id. 작품 ID + */ + public AssistantRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.assistant.product_id. 작품 ID + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.assistant.type. 기능 종류 + */ + public AssistantRecord setType(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.assistant.type. 기능 종류 + */ + public String getType() { + return (String) get(2); + } + + /** + * Setter for public.assistant.status. 진행 상태 + */ + public AssistantRecord setStatus(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.assistant.status. 진행 상태 + */ + public String getStatus() { + return (String) get(3); + } + + /** + * Setter for public.assistant.created_at. 수정일시 + */ + public AssistantRecord setCreatedAt(LocalDateTime value) { + set(4, value); + return this; + } + + /** + * Getter for public.assistant.created_at. 수정일시 + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(4); + } + + /** + * Setter for public.assistant.created_by. 수정자 ID + */ + public AssistantRecord setCreatedBy(UUID value) { + set(5, value); + return this; + } + + /** + * Getter for public.assistant.created_by. 수정자 ID + */ + public UUID getCreatedBy() { + return (UUID) get(5); + } + + /** + * Setter for public.assistant.updated_at. + */ + public AssistantRecord setUpdatedAt(LocalDateTime value) { + set(6, value); + return this; + } + + /** + * Getter for public.assistant.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(6); + } + + /** + * Setter for public.assistant.updated_by. + */ + public AssistantRecord setUpdatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.assistant.updated_by. + */ + public UUID getUpdatedBy() { + return (UUID) get(7); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AssistantRecord + */ + public AssistantRecord() { + super(Assistant.ASSISTANT); + } + + /** + * Create a detached, initialised AssistantRecord + */ + public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(Assistant.ASSISTANT); + + setId(id); + setProductId(productId); + setType(type); + setStatus(status); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised AssistantRecord + */ + public AssistantRecord(writely.tables.pojos.Assistant value) { + super(Assistant.ASSISTANT); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setType(value.getType()); + setStatus(value.getStatus()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java index 7510837..5365967 100644 --- a/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java +++ b/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java @@ -51,11 +51,26 @@ public UUID getProductId() { return (UUID) get(1); } + /** + * Setter for public.auto_modify_message.assistant_id. 어시스턴트 ID + */ + public AutoModifyMessageRecord setAssistantId(UUID value) { + set(2, value); + return this; + } + + /** + * Getter for public.auto_modify_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return (UUID) get(2); + } + /** * Setter for public.auto_modify_message.role. 메세지 송신자 */ public AutoModifyMessageRecord setRole(String value) { - set(2, value); + set(3, value); return this; } @@ -63,14 +78,14 @@ public AutoModifyMessageRecord setRole(String value) { * Getter for public.auto_modify_message.role. 메세지 송신자 */ public String getRole() { - return (String) get(2); + return (String) get(3); } /** * Setter for public.auto_modify_message.content. 내용 */ public AutoModifyMessageRecord setContent(String value) { - set(3, value); + set(4, value); return this; } @@ -78,14 +93,14 @@ public AutoModifyMessageRecord setContent(String value) { * Getter for public.auto_modify_message.content. 내용 */ public String getContent() { - return (String) get(3); + return (String) get(4); } /** * Setter for public.auto_modify_message.created_at. 생성일시 */ public AutoModifyMessageRecord setCreatedAt(LocalDateTime value) { - set(4, value); + set(5, value); return this; } @@ -93,14 +108,14 @@ public AutoModifyMessageRecord setCreatedAt(LocalDateTime value) { * Getter for public.auto_modify_message.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(4); + return (LocalDateTime) get(5); } /** * Setter for public.auto_modify_message.created_by. 생성자 ID */ public AutoModifyMessageRecord setCreatedBy(UUID value) { - set(5, value); + set(6, value); return this; } @@ -108,14 +123,14 @@ public AutoModifyMessageRecord setCreatedBy(UUID value) { * Getter for public.auto_modify_message.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(5); + return (UUID) get(6); } /** * Setter for public.auto_modify_message.updated_at. 수정일시 */ public AutoModifyMessageRecord setUpdatedAt(LocalDateTime value) { - set(6, value); + set(7, value); return this; } @@ -123,14 +138,14 @@ public AutoModifyMessageRecord setUpdatedAt(LocalDateTime value) { * Getter for public.auto_modify_message.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(6); + return (LocalDateTime) get(7); } /** * Setter for public.auto_modify_message.updated_by. 수정자 ID */ public AutoModifyMessageRecord setUpdatedBy(UUID value) { - set(7, value); + set(8, value); return this; } @@ -138,7 +153,7 @@ public AutoModifyMessageRecord setUpdatedBy(UUID value) { * Getter for public.auto_modify_message.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(7); + return (UUID) get(8); } // ------------------------------------------------------------------------- @@ -164,11 +179,12 @@ public AutoModifyMessageRecord() { /** * Create a detached, initialised AutoModifyMessageRecord */ - public AutoModifyMessageRecord(UUID id, UUID productId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public AutoModifyMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); setId(id); setProductId(productId); + setAssistantId(assistantId); setRole(role); setContent(content); setCreatedAt(createdAt); @@ -187,6 +203,7 @@ public AutoModifyMessageRecord(writely.tables.pojos.AutoModifyMessage value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); + setAssistantId(value.getAssistantId()); setRole(value.getRole()); setContent(value.getContent()); setCreatedAt(value.getCreatedAt()); diff --git a/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java b/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java index 0b3b69b..20592d1 100644 --- a/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java +++ b/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java @@ -51,11 +51,26 @@ public UUID getProductId() { return (UUID) get(1); } + /** + * Setter for public.feedback_message.assistant_id. 어시스턴트 ID + */ + public FeedbackMessageRecord setAssistantId(UUID value) { + set(2, value); + return this; + } + + /** + * Getter for public.feedback_message.assistant_id. 어시스턴트 ID + */ + public UUID getAssistantId() { + return (UUID) get(2); + } + /** * Setter for public.feedback_message.role. 메세지 송신자 */ public FeedbackMessageRecord setRole(String value) { - set(2, value); + set(3, value); return this; } @@ -63,14 +78,14 @@ public FeedbackMessageRecord setRole(String value) { * Getter for public.feedback_message.role. 메세지 송신자 */ public String getRole() { - return (String) get(2); + return (String) get(3); } /** * Setter for public.feedback_message.content. 내용 */ public FeedbackMessageRecord setContent(String value) { - set(3, value); + set(4, value); return this; } @@ -78,14 +93,14 @@ public FeedbackMessageRecord setContent(String value) { * Getter for public.feedback_message.content. 내용 */ public String getContent() { - return (String) get(3); + return (String) get(4); } /** * Setter for public.feedback_message.created_at. 생성일시 */ public FeedbackMessageRecord setCreatedAt(LocalDateTime value) { - set(4, value); + set(5, value); return this; } @@ -93,14 +108,14 @@ public FeedbackMessageRecord setCreatedAt(LocalDateTime value) { * Getter for public.feedback_message.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(4); + return (LocalDateTime) get(5); } /** * Setter for public.feedback_message.created_by. 생성자 ID */ public FeedbackMessageRecord setCreatedBy(UUID value) { - set(5, value); + set(6, value); return this; } @@ -108,14 +123,14 @@ public FeedbackMessageRecord setCreatedBy(UUID value) { * Getter for public.feedback_message.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(5); + return (UUID) get(6); } /** * Setter for public.feedback_message.updated_at. 수정일시 */ public FeedbackMessageRecord setUpdatedAt(LocalDateTime value) { - set(6, value); + set(7, value); return this; } @@ -123,14 +138,14 @@ public FeedbackMessageRecord setUpdatedAt(LocalDateTime value) { * Getter for public.feedback_message.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(6); + return (LocalDateTime) get(7); } /** * Setter for public.feedback_message.updated_by. 수정자 ID */ public FeedbackMessageRecord setUpdatedBy(UUID value) { - set(7, value); + set(8, value); return this; } @@ -138,7 +153,7 @@ public FeedbackMessageRecord setUpdatedBy(UUID value) { * Getter for public.feedback_message.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(7); + return (UUID) get(8); } // ------------------------------------------------------------------------- @@ -164,11 +179,12 @@ public FeedbackMessageRecord() { /** * Create a detached, initialised FeedbackMessageRecord */ - public FeedbackMessageRecord(UUID id, UUID productId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public FeedbackMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(FeedbackMessage.FEEDBACK_MESSAGE); setId(id); setProductId(productId); + setAssistantId(assistantId); setRole(role); setContent(content); setCreatedAt(createdAt); @@ -187,6 +203,7 @@ public FeedbackMessageRecord(writely.tables.pojos.FeedbackMessage value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); + setAssistantId(value.getAssistantId()); setRole(value.getRole()); setContent(value.getContent()); setCreatedAt(value.getCreatedAt()); diff --git a/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java b/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java index 0b665fd..45da83f 100644 --- a/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java +++ b/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java @@ -36,26 +36,11 @@ public UUID getId() { return (UUID) get(0); } - /** - * Setter for public.research_message.product_id. 작품 ID - */ - public ResearchMessageRecord setProductId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.research_message.product_id. 작품 ID - */ - public UUID getProductId() { - return (UUID) get(1); - } - /** * Setter for public.research_message.assistant_id. 어시스턴트 ID */ public ResearchMessageRecord setAssistantId(UUID value) { - set(2, value); + set(1, value); return this; } @@ -63,14 +48,14 @@ public ResearchMessageRecord setAssistantId(UUID value) { * Getter for public.research_message.assistant_id. 어시스턴트 ID */ public UUID getAssistantId() { - return (UUID) get(2); + return (UUID) get(1); } /** * Setter for public.research_message.role. 메세지 송신자 */ public ResearchMessageRecord setRole(String value) { - set(3, value); + set(2, value); return this; } @@ -78,14 +63,14 @@ public ResearchMessageRecord setRole(String value) { * Getter for public.research_message.role. 메세지 송신자 */ public String getRole() { - return (String) get(3); + return (String) get(2); } /** * Setter for public.research_message.content. 내용 */ public ResearchMessageRecord setContent(String value) { - set(4, value); + set(3, value); return this; } @@ -93,14 +78,14 @@ public ResearchMessageRecord setContent(String value) { * Getter for public.research_message.content. 내용 */ public String getContent() { - return (String) get(4); + return (String) get(3); } /** * Setter for public.research_message.prompt. 프롬프트 */ public ResearchMessageRecord setPrompt(String value) { - set(5, value); + set(4, value); return this; } @@ -108,14 +93,14 @@ public ResearchMessageRecord setPrompt(String value) { * Getter for public.research_message.prompt. 프롬프트 */ public String getPrompt() { - return (String) get(5); + return (String) get(4); } /** * Setter for public.research_message.created_at. 생성일시 */ public ResearchMessageRecord setCreatedAt(LocalDateTime value) { - set(6, value); + set(5, value); return this; } @@ -123,14 +108,14 @@ public ResearchMessageRecord setCreatedAt(LocalDateTime value) { * Getter for public.research_message.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(6); + return (LocalDateTime) get(5); } /** * Setter for public.research_message.created_by. 생성자 ID */ public ResearchMessageRecord setCreatedBy(UUID value) { - set(7, value); + set(6, value); return this; } @@ -138,14 +123,14 @@ public ResearchMessageRecord setCreatedBy(UUID value) { * Getter for public.research_message.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(7); + return (UUID) get(6); } /** * Setter for public.research_message.updated_at. 수정일시 */ public ResearchMessageRecord setUpdatedAt(LocalDateTime value) { - set(8, value); + set(7, value); return this; } @@ -153,14 +138,14 @@ public ResearchMessageRecord setUpdatedAt(LocalDateTime value) { * Getter for public.research_message.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(8); + return (LocalDateTime) get(7); } /** * Setter for public.research_message.updated_by. 수정자 ID */ public ResearchMessageRecord setUpdatedBy(UUID value) { - set(9, value); + set(8, value); return this; } @@ -168,7 +153,7 @@ public ResearchMessageRecord setUpdatedBy(UUID value) { * Getter for public.research_message.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(9); + return (UUID) get(8); } // ------------------------------------------------------------------------- @@ -194,11 +179,10 @@ public ResearchMessageRecord() { /** * Create a detached, initialised ResearchMessageRecord */ - public ResearchMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ResearchMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ResearchMessage.RESEARCH_MESSAGE); setId(id); - setProductId(productId); setAssistantId(assistantId); setRole(role); setContent(content); @@ -218,7 +202,6 @@ public ResearchMessageRecord(writely.tables.pojos.ResearchMessage value) { if (value != null) { setId(value.getId()); - setProductId(value.getProductId()); setAssistantId(value.getAssistantId()); setRole(value.getRole()); setContent(value.getContent()); diff --git a/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java index b142a02..f3de132 100644 --- a/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java +++ b/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java @@ -36,26 +36,11 @@ public UUID getId() { return (UUID) get(0); } - /** - * Setter for public.user_modify_message.product_id. - */ - public UserModifyMessageRecord setProductId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.user_modify_message.product_id. - */ - public UUID getProductId() { - return (UUID) get(1); - } - /** * Setter for public.user_modify_message.assistant_id. */ public UserModifyMessageRecord setAssistantId(UUID value) { - set(2, value); + set(1, value); return this; } @@ -63,14 +48,14 @@ public UserModifyMessageRecord setAssistantId(UUID value) { * Getter for public.user_modify_message.assistant_id. */ public UUID getAssistantId() { - return (UUID) get(2); + return (UUID) get(1); } /** * Setter for public.user_modify_message.role. */ public UserModifyMessageRecord setRole(String value) { - set(3, value); + set(2, value); return this; } @@ -78,14 +63,14 @@ public UserModifyMessageRecord setRole(String value) { * Getter for public.user_modify_message.role. */ public String getRole() { - return (String) get(3); + return (String) get(2); } /** * Setter for public.user_modify_message.content. */ public UserModifyMessageRecord setContent(String value) { - set(4, value); + set(3, value); return this; } @@ -93,14 +78,14 @@ public UserModifyMessageRecord setContent(String value) { * Getter for public.user_modify_message.content. */ public String getContent() { - return (String) get(4); + return (String) get(3); } /** * Setter for public.user_modify_message.prompt. */ public UserModifyMessageRecord setPrompt(String value) { - set(5, value); + set(4, value); return this; } @@ -108,14 +93,14 @@ public UserModifyMessageRecord setPrompt(String value) { * Getter for public.user_modify_message.prompt. */ public String getPrompt() { - return (String) get(5); + return (String) get(4); } /** * Setter for public.user_modify_message.created_at. */ public UserModifyMessageRecord setCreatedAt(LocalDateTime value) { - set(6, value); + set(5, value); return this; } @@ -123,14 +108,14 @@ public UserModifyMessageRecord setCreatedAt(LocalDateTime value) { * Getter for public.user_modify_message.created_at. */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(6); + return (LocalDateTime) get(5); } /** * Setter for public.user_modify_message.created_by. */ public UserModifyMessageRecord setCreatedBy(UUID value) { - set(7, value); + set(6, value); return this; } @@ -138,14 +123,14 @@ public UserModifyMessageRecord setCreatedBy(UUID value) { * Getter for public.user_modify_message.created_by. */ public UUID getCreatedBy() { - return (UUID) get(7); + return (UUID) get(6); } /** * Setter for public.user_modify_message.updated_at. */ public UserModifyMessageRecord setUpdatedAt(LocalDateTime value) { - set(8, value); + set(7, value); return this; } @@ -153,14 +138,14 @@ public UserModifyMessageRecord setUpdatedAt(LocalDateTime value) { * Getter for public.user_modify_message.updated_at. */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(8); + return (LocalDateTime) get(7); } /** * Setter for public.user_modify_message.updated_by. */ public UserModifyMessageRecord setUpdatedBy(UUID value) { - set(9, value); + set(8, value); return this; } @@ -168,7 +153,7 @@ public UserModifyMessageRecord setUpdatedBy(UUID value) { * Getter for public.user_modify_message.updated_by. */ public UUID getUpdatedBy() { - return (UUID) get(9); + return (UUID) get(8); } // ------------------------------------------------------------------------- @@ -194,11 +179,10 @@ public UserModifyMessageRecord() { /** * Create a detached, initialised UserModifyMessageRecord */ - public UserModifyMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public UserModifyMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(UserModifyMessage.USER_MODIFY_MESSAGE); setId(id); - setProductId(productId); setAssistantId(assistantId); setRole(role); setContent(content); @@ -218,7 +202,6 @@ public UserModifyMessageRecord(writely.tables.pojos.UserModifyMessage value) { if (value != null) { setId(value.getId()); - setProductId(value.getProductId()); setAssistantId(value.getAssistantId()); setRole(value.getRole()); setContent(value.getContent()); diff --git a/domain/src/main/java/writeon/domain/assistant/Assistant.java b/domain/src/main/java/writeon/domain/assistant/Assistant.java new file mode 100644 index 0000000..10c59e1 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/Assistant.java @@ -0,0 +1,43 @@ +package writeon.domain.assistant; + +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.common.BaseAuditTimeEntity; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "assistant") +public class Assistant extends BaseAuditTimeEntity { + + @Id + @Column(name = "id", updatable = false) + private final UUID id = UUID.randomUUID(); + + @Column(name = "product_id", updatable = false, nullable = false) + private UUID productId; + + @Convert(converter = AssistantType.TypeCodeConverter.class) + @Column(name = "type", nullable = false) + private AssistantType type; + + @Convert(converter = AssistantStatus.TypeCodeConverter.class) + @Column(name = "status", nullable = false) + private AssistantStatus status = AssistantStatus.DRAFT; + + @Builder + public Assistant(UUID productId, AssistantType type) { + this.productId = productId; + this.type = type; + } + + public void updateStatus(AssistantStatus status) { + this.status = status; + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java new file mode 100644 index 0000000..63f8fcd --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java @@ -0,0 +1,44 @@ +package writeon.domain.assistant; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.CreatedBy; + +import java.time.LocalDateTime; +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "assistant_evaluation") +public class AssistantEvaluation { + + @Id + @Column(name = "assistant_id", updatable = false) + private UUID assistantId; + + @Column(name = "is_good", nullable = false) + private Boolean isGood; + + @Column(name = "feedback") + private String feedback; + + @Column(name = "created_at", updatable = false, nullable = false) + protected final LocalDateTime createdAt = LocalDateTime.now(); + + @CreatedBy + @Column(name = "created_by", updatable = false, nullable = false) + protected UUID createdBy = UUID.randomUUID(); + + @Builder + public AssistantEvaluation(UUID assistantId, Boolean isGood, String feedback) { + this.assistantId = assistantId; + this.isGood = isGood; + this.feedback = feedback; + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java new file mode 100644 index 0000000..b368042 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java @@ -0,0 +1,8 @@ +package writeon.domain.assistant; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface AssistantEvaluationJpaRepository extends JpaRepository { +} diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java new file mode 100644 index 0000000..a8b39a7 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java @@ -0,0 +1,8 @@ +package writeon.domain.assistant; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface AssistantJpaRepository extends JpaRepository { +} diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java index 8023d30..971c148 100644 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java @@ -19,17 +19,13 @@ public class AutoModifyMessage extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private final UUID id = UUID.randomUUID(); - @Column(name = "product_id", nullable = false) - private UUID productId; - @Column(name = "assistant_id", nullable = false) private UUID assistantId; @Embedded private MessageContent messageContent; - public AutoModifyMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content) { - this.productId = productId; + public AutoModifyMessage(UUID assistantId, MessageSenderRole role, String content) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); } diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java index 7112ad4..618c148 100644 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java @@ -1,8 +1,11 @@ package writeon.domain.assistant.automodify; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.assistant.enums.MessageSenderRole; import java.util.UUID; public interface AutoModifyMessageJpaRepository extends JpaRepository { + + boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java index cc545e3..3c2c714 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java @@ -9,9 +9,12 @@ @RequiredArgsConstructor public enum AssistantException implements CodeInfo { - NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 메세지입니다."), - SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-002", "SSE 데이터 전송 중 오류가 발생했습니다."), - WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "WebClient 요청 중 오류가 발생했습니다."); + NOT_EXIST(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 Assistant입니다."), + NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-002", "존재하지 않는 메세지입니다."), + SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "SSE 데이터 전송 중 오류가 발생했습니다."), + ALREADY_ANSWERED(HttpStatus.BAD_REQUEST, "AI-004", "이미 응답된 메세지입니다."), + ALREADY_EVALUATED(HttpStatus.BAD_REQUEST, "AI-005", "이미 평가되었습니다."), + WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-006", "WebClient 요청 중 오류가 발생했습니다."); private final HttpStatus status; private final String code; diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantStatus.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantStatus.java new file mode 100644 index 0000000..6839dae --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantStatus.java @@ -0,0 +1,26 @@ +package writeon.domain.assistant.enums; + +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; + +@Getter +@RequiredArgsConstructor +public enum AssistantStatus implements Codable { + + DRAFT("draft"), + IN_PROGRESS("in progress"), + COMPLETED("completed"); + + private final String code; + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public AssistantStatus convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(AssistantStatus.class, dbData); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java new file mode 100644 index 0000000..cff8cb8 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java @@ -0,0 +1,27 @@ +package writeon.domain.assistant.enums; + +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; + +@Getter +@RequiredArgsConstructor +public enum AssistantType implements Codable { + + AUTO_MODIFY("auto modify"), + FEEDBACK("feedback"), + RESEARCH("research"), + USER_MODIFY("user modify"); + + private final String code; + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public AssistantType convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(AssistantType.class, dbData); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java b/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java new file mode 100644 index 0000000..63812f5 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java @@ -0,0 +1,27 @@ +package writeon.domain.assistant.enums; + +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; + +@Getter +@RequiredArgsConstructor +public enum FeedbackType implements Codable { + + AWKWARD_SENTENCE("Awkward sentence"), + INACCURATE_INFO("Inaccurate information"), + UNAPPLIED_SETTING("Unapplied settings"), + ETC("ETC"); + + private final String code; + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public FeedbackType convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(FeedbackType.class, dbData); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java index 30eb0bc..32ccd4b 100644 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java @@ -19,17 +19,13 @@ public class FeedbackMessage extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private final UUID id = UUID.randomUUID(); - @Column(name = "product_id", nullable = false) - private UUID productId; - @Column(name = "assistant_id", nullable = false) private UUID assistantId; @Embedded private MessageContent messageContent; - public FeedbackMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content) { - this.productId = productId; + public FeedbackMessage(UUID assistantId, MessageSenderRole role, String content) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); } diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java index cd3089a..023b5fa 100644 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java @@ -1,8 +1,11 @@ package writeon.domain.assistant.feedback; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.assistant.enums.MessageSenderRole; import java.util.UUID; public interface FeedbackMessageJpaRepository extends JpaRepository { + + boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } diff --git a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java index 05c04d3..5e47d83 100644 --- a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java @@ -19,9 +19,6 @@ public class ResearchMessage extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private final UUID id = UUID.randomUUID(); - @Column(name = "product_id", nullable = false) - private UUID productId; - @Column(name = "assistant_id", nullable = false) private UUID assistantId; @@ -31,8 +28,7 @@ public class ResearchMessage extends BaseAuditTimeEntity { @Column(name = "prompt") private String prompt; - public ResearchMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content, String prompt) { - this.productId = productId; + public ResearchMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java index d2721ad..a1b2cde 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java @@ -19,9 +19,6 @@ public class UserModifyMessage extends BaseAuditTimeEntity { @Column(updatable = false, nullable = false) private final UUID id = UUID.randomUUID(); - @Column(name = "product_id", nullable = false) - private UUID productId; - @Column(name = "assistant_id", nullable = false) private UUID assistantId; @@ -31,8 +28,7 @@ public class UserModifyMessage extends BaseAuditTimeEntity { @Column(name = "prompt") private String prompt; - public UserModifyMessage(UUID productId, UUID assistantId, MessageSenderRole role, String content, String prompt) { - this.productId = productId; + public UserModifyMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java index 37359da..d39fae4 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java @@ -1,8 +1,11 @@ package writeon.domain.assistant.usermodify; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.assistant.enums.MessageSenderRole; import java.util.UUID; public interface UserModifyMessageJpaRepository extends JpaRepository { + + boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } diff --git a/sql/init.sql b/sql/init.sql index b71a61c..4ac2ebe 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -335,12 +335,58 @@ comment on column product_worldview.updated_by is '수정자 ID'; alter table product_worldview owner to postgres; +create table assistant +( + id uuid not null + constraint assistant_pk + primary key, + product_id uuid not null, + type varchar(20) not null , + status varchar(20) not null , + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null, + updated_by uuid not null +); + +comment on table assistant is '어시스턴트'; +comment on column assistant.product_id is '작품 ID'; +comment on column assistant.type is '기능 종류'; +comment on column assistant.status is '진행 상태'; +comment on column assistant.created_at is '생성일시'; +comment on column assistant.created_by is '생성자 ID'; +comment on column assistant.created_at is '수정일시'; +comment on column assistant.created_by is '수정자 ID'; + +alter table assistant + owner to postgres; + +create table assistant_evaluation +( + assistant_id uuid not null + constraint assistant_evaluation_pk + primary key, + is_good boolean not null, + feedback varchar(255), + created_at timestamp not null, + created_by uuid not null +); + +comment on table assistant_evaluation is '어시스턴트 평가'; +comment on column assistant_evaluation.assistant_id is '어시스턴트 ID'; +comment on column assistant_evaluation.is_good is '만족 여부'; +comment on column assistant_evaluation.feedback is '피드백'; +comment on column assistant_evaluation.created_at is '생성일시'; +comment on column assistant_evaluation.created_by is '생성자 ID'; + +alter table assistant_evaluation + owner to postgres; + create table auto_modify_message ( id uuid default gen_random_uuid() not null constraint auto_modify_message_pk primary key, - product_id uuid not null, assistant_id uuid not null, role varchar(10) not null, content text not null, @@ -352,7 +398,6 @@ create table auto_modify_message comment on table auto_modify_message is '자동 수정 메세지'; comment on column auto_modify_message.id is '자동 수정 메세지 ID'; -comment on column auto_modify_message.product_id is '작품 ID'; comment on column auto_modify_message.assistant_id is '어시스턴트 ID'; comment on column auto_modify_message.role is '메세지 송신자'; comment on column auto_modify_message.content is '내용'; @@ -369,7 +414,6 @@ create table user_modify_message id uuid default gen_random_uuid() not null constraint user_modify_message_pk primary key, - product_id uuid not null, assistant_id uuid not null, role varchar(10) not null, content text not null, @@ -388,7 +432,6 @@ create table feedback_message id uuid default gen_random_uuid() not null constraint feedback_message_pk primary key, - product_id uuid not null, assistant_id uuid not null, role varchar(10) not null, content text not null, @@ -400,7 +443,6 @@ create table feedback_message comment on table feedback_message is '피드백 메세지'; comment on column feedback_message.id is '피드백 메세지 ID'; -comment on column feedback_message.product_id is '작품 ID'; comment on column feedback_message.assistant_id is '어시스턴트 ID'; comment on column feedback_message.role is '메세지 송신자'; comment on column feedback_message.content is '내용'; @@ -417,7 +459,6 @@ create table research_message id uuid default gen_random_uuid() not null constraint research_message_pk primary key, - product_id uuid not null, assistant_id uuid not null, role varchar(10) not null, content text, @@ -430,7 +471,6 @@ create table research_message comment on table research_message is '자유 대화 메세지'; comment on column research_message.id is '자유 대화 메세지 ID'; -comment on column research_message.product_id is '작품 ID'; comment on column research_message.assistant_id is '어시스턴트 ID'; comment on column research_message.role is '메세지 송신자'; comment on column research_message.content is '내용'; @@ -442,5 +482,3 @@ comment on column research_message.updated_by is '수정자 ID'; alter table research_message owner to postgres; - - From 5a2aae677ae8c54a447c5bc1d9b176b0a143c929 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 10 Mar 2025 21:43:38 +0900 Subject: [PATCH 043/107] =?UTF-8?q?feat:=20s3=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20api=20(presigned-url)=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- api/build.gradle | 3 + .../api/common/config/S3ClientConfig.java | 36 +++++++++ .../writeon/api/common/util/FileUtil.java | 21 ++++++ .../api/file/controller/FileController.java | 27 +++++++ .../request/PresignedUrlIssueRequest.java | 24 ++++++ .../response/PresignedUrlIssueResponse.java | 17 +++++ .../writeon/api/file/service/FileService.java | 73 +++++++++++++++++++ .../domain/file/enums/FileException.java | 17 +++++ .../domain/file/enums/FileUploadType.java | 42 +++++++++++ 10 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 api/src/main/java/writeon/api/common/config/S3ClientConfig.java create mode 100644 api/src/main/java/writeon/api/common/util/FileUtil.java create mode 100644 api/src/main/java/writeon/api/file/controller/FileController.java create mode 100644 api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java create mode 100644 api/src/main/java/writeon/api/file/response/PresignedUrlIssueResponse.java create mode 100644 api/src/main/java/writeon/api/file/service/FileService.java create mode 100644 domain/src/main/java/writeon/domain/file/enums/FileException.java create mode 100644 domain/src/main/java/writeon/domain/file/enums/FileUploadType.java diff --git a/BE-secret b/BE-secret index 794ad02..b2ccdfe 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 794ad02dd1d2a8b6c8bf8744d5bc4d80c1ec3283 +Subproject commit b2ccdfe61928033eb8d7919e935ae521baee9155 diff --git a/api/build.gradle b/api/build.gradle index 71e8667..8d30267 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -8,6 +8,9 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' + /* AWS SDK */ + implementation 'software.amazon.awssdk:s3:2.30.31' + /* Swagger */ implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' diff --git a/api/src/main/java/writeon/api/common/config/S3ClientConfig.java b/api/src/main/java/writeon/api/common/config/S3ClientConfig.java new file mode 100644 index 0000000..746fdc9 --- /dev/null +++ b/api/src/main/java/writeon/api/common/config/S3ClientConfig.java @@ -0,0 +1,36 @@ +package writeon.api.common.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; + +@Configuration +public class S3ClientConfig { + @Value("${cloud.aws.credentials.access-key}") + private String accessKey; + @Value("${cloud.aws.credentials.secret-key}") + private String secretKey; + @Value("${cloud.aws.region.static}") + private String region; + + @Bean + public S3Client s3Client() { + return S3Client.builder() + .region(Region.of(region)) + .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey))) + .build(); + } + + @Bean + public S3Presigner s3Presigner() { + return S3Presigner.builder() + .region(Region.of(region)) + .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey))) + .build(); + } +} \ No newline at end of file diff --git a/api/src/main/java/writeon/api/common/util/FileUtil.java b/api/src/main/java/writeon/api/common/util/FileUtil.java new file mode 100644 index 0000000..d78047e --- /dev/null +++ b/api/src/main/java/writeon/api/common/util/FileUtil.java @@ -0,0 +1,21 @@ +package writeon.api.common.util; + +import lombok.experimental.UtilityClass; + +@UtilityClass +public class FileUtil { + public String getFileExtension(String fileName) { + if (fileName == null || fileName.trim().isEmpty()) { + return ""; + } + + int lastDotIndex = fileName.lastIndexOf('.'); + + // 확장자가 없는 경우 + if (lastDotIndex == -1 || lastDotIndex == 0 || lastDotIndex == fileName.length() - 1) { + return ""; + } + + return fileName.substring(lastDotIndex + 1); + } +} diff --git a/api/src/main/java/writeon/api/file/controller/FileController.java b/api/src/main/java/writeon/api/file/controller/FileController.java new file mode 100644 index 0000000..f2fe49f --- /dev/null +++ b/api/src/main/java/writeon/api/file/controller/FileController.java @@ -0,0 +1,27 @@ +package writeon.api.file.controller; + +import writeon.api.file.request.PresignedUrlIssueRequest; +import writeon.api.file.response.PresignedUrlIssueResponse; +import writeon.api.file.service.FileService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +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; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/files") +@Tag(name = "파일") +public class FileController { + private final FileService fileService; + + @Operation(summary = "presigned url 발급") + @PostMapping("/presigned-url") + public PresignedUrlIssueResponse issuePresignedUrl(@RequestBody PresignedUrlIssueRequest params) { + return fileService.issuePresignedUrl(params); + } + +} diff --git a/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java b/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java new file mode 100644 index 0000000..abe4f1d --- /dev/null +++ b/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java @@ -0,0 +1,24 @@ +package writeon.api.file.request; + +import writeon.domain.file.enums.FileUploadType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class PresignedUrlIssueRequest { + @Schema(title = "업로드 타입", requiredMode = Schema.RequiredMode.REQUIRED, example = "idea-note, ...") + private FileUploadType fileUploadType; + + @Schema(title = "원본 파일 이름", requiredMode = Schema.RequiredMode.REQUIRED, example = "download.png") + private String originalFileName; + + @Schema(title = "Content-Type", requiredMode = Schema.RequiredMode.REQUIRED, example = "image/png, image/jpeg") + private String contentType; + + @Schema(title = "Content-Length", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457280 (30MB)") + private Long contentLength; +} diff --git a/api/src/main/java/writeon/api/file/response/PresignedUrlIssueResponse.java b/api/src/main/java/writeon/api/file/response/PresignedUrlIssueResponse.java new file mode 100644 index 0000000..cf6e739 --- /dev/null +++ b/api/src/main/java/writeon/api/file/response/PresignedUrlIssueResponse.java @@ -0,0 +1,17 @@ +package writeon.api.file.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter +@AllArgsConstructor +public class PresignedUrlIssueResponse { + @Schema(title = "파일 업로드 url (presigned)", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://writely-bucket.s3.ap-northeast-2.amazonaws.com/idea-note/...") + private String filePutUrl; + + @Schema(title = "파일 조회 url", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://writely-bucket.s3.ap-northeast-2.amazonaws.com/idea-note/...") + private String fileGetUrl; +} diff --git a/api/src/main/java/writeon/api/file/service/FileService.java b/api/src/main/java/writeon/api/file/service/FileService.java new file mode 100644 index 0000000..d0e3d89 --- /dev/null +++ b/api/src/main/java/writeon/api/file/service/FileService.java @@ -0,0 +1,73 @@ +package writeon.api.file.service; + +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.FileUtil; +import writeon.api.file.request.PresignedUrlIssueRequest; +import writeon.api.file.response.PresignedUrlIssueResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; +import software.amazon.awssdk.services.s3.presigner.model.PresignedPutObjectRequest; +import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignRequest; +import writeon.domain.file.enums.FileException; +import writeon.domain.file.enums.FileUploadType; + +import java.time.Duration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +@Slf4j +public class FileService { + private final S3Presigner s3Presigner; + + @Value("${cloud.aws.s3.bucket}") + private String bucketName; + + @Value("${cloud.aws.s3.host}") + private String hostUrl; + + @Value("${cloud.aws.s3.presigned-url.expiration-seconds}") + private Long expirationSeconds; + + public PresignedUrlIssueResponse issuePresignedUrl(PresignedUrlIssueRequest params) { + final FileUploadType uploadType = params.getFileUploadType(); + + final String fileOriginalName = params.getOriginalFileName(); + final String fileExtension = FileUtil.getFileExtension(fileOriginalName); + final String fileGetPath = uploadType.getPath() + "/" + UUID.randomUUID() + "." + fileExtension; + final String fileGetUrl = hostUrl + "/" + fileGetPath; + + // 컨텐츠타입 허용 여부 검사 + if (!uploadType.getAllowedContentType().contains(params.getContentType())) { + throw new BaseException(FileException.UNSUPPORTED_CONTENT_TYPE); + } + // 파일 사이즈 검사 + if (uploadType.getMaxFileSize() < params.getContentLength()) { + throw new BaseException(FileException.MAX_FILE_SIZE_EXCEEDED); + } + + PutObjectRequest objectRequest = PutObjectRequest.builder() + .bucket(bucketName) + .key(fileGetPath) + .contentType(params.getContentType()) + .contentLength(params.getContentLength()) + .build(); + + PutObjectPresignRequest presignRequest = PutObjectPresignRequest.builder() + .signatureDuration(Duration.ofSeconds(expirationSeconds)) + .putObjectRequest(objectRequest) + .build(); + + PresignedPutObjectRequest presignedRequest = s3Presigner.presignPutObject(presignRequest); + + return new PresignedUrlIssueResponse(presignedRequest.url().toExternalForm(), fileGetUrl); + } + +} diff --git a/domain/src/main/java/writeon/domain/file/enums/FileException.java b/domain/src/main/java/writeon/domain/file/enums/FileException.java new file mode 100644 index 0000000..8e2192c --- /dev/null +++ b/domain/src/main/java/writeon/domain/file/enums/FileException.java @@ -0,0 +1,17 @@ +package writeon.domain.file.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import writeon.domain.common.enums.CodeInfo; + +@Getter +@RequiredArgsConstructor +public enum FileException implements CodeInfo { + UNSUPPORTED_CONTENT_TYPE(HttpStatus.BAD_REQUEST, "FILE-001", "지원하지 않는 컨텐츠 타입입니다."), + MAX_FILE_SIZE_EXCEEDED(HttpStatus.BAD_REQUEST, "FILE-002", "업로드 가능한 파일 최대 크기를 초과했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/domain/src/main/java/writeon/domain/file/enums/FileUploadType.java b/domain/src/main/java/writeon/domain/file/enums/FileUploadType.java new file mode 100644 index 0000000..d4f7128 --- /dev/null +++ b/domain/src/main/java/writeon/domain/file/enums/FileUploadType.java @@ -0,0 +1,42 @@ +package writeon.domain.file.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import jakarta.persistence.Converter; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import writeon.domain.common.converter.AbstractEnumCodeConverter; +import writeon.domain.common.enums.Codable; + +import java.util.List; + +@Getter +@RequiredArgsConstructor +@Slf4j +public enum FileUploadType implements Codable { + IDEA_NOTE("idea-note", "idea-note", List.of("image/png", "image/jpeg", "image/webp"), 31457280L); + + private final String code; + private final String path; + private final List allowedContentType; + private final Long maxFileSize; + + @JsonCreator + public static FileUploadType fromCode(final String code) { + return Codable.fromCode(FileUploadType.class, code); + } + + @Converter + public static class TypeCodeConverter extends AbstractEnumCodeConverter { + @Override + public FileUploadType convertToEntityAttribute(String dbData) { + return this.toEntityAttribute(FileUploadType.class, dbData); + } + } + + @JsonValue + public String getCode() { + return code; + } +} From 014497a6c33c0de4d68f3cc53b5ee7d0aa6f58f4 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:18:21 +0900 Subject: [PATCH 044/107] refactor: Modify res structure for get product list (#43) --- .../java/writeon/api/product/repository/ProductDao.java | 9 ++++++--- .../writeon/api/product/response/ProductResponse.java | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/writeon/api/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java index 69aac8f..8662606 100644 --- a/api/src/main/java/writeon/api/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -8,6 +8,7 @@ import java.util.List; import static writely.tables.Product.PRODUCT; +import static writely.tables.ProductSynopsis.PRODUCT_SYNOPSIS; @Repository @@ -18,9 +19,11 @@ public class ProductDao { public List select() { return dsl - .selectFrom(PRODUCT) + .select(PRODUCT, PRODUCT_SYNOPSIS.GENRE) + .from(PRODUCT) + .leftJoin(PRODUCT_SYNOPSIS) + .on(PRODUCT.ID.eq(PRODUCT_SYNOPSIS.ID)) .orderBy(PRODUCT.UPDATED_AT.desc()) - .fetch() - .map(ProductResponse::new); + .fetchInto(ProductResponse.class); } } diff --git a/api/src/main/java/writeon/api/product/response/ProductResponse.java b/api/src/main/java/writeon/api/product/response/ProductResponse.java index c33e984..72751f6 100644 --- a/api/src/main/java/writeon/api/product/response/ProductResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductResponse.java @@ -13,14 +13,17 @@ public class ProductResponse { private final UUID id; - @Schema(title = "제목") + @Schema(title = "제목", nullable = true) private final String title; + @Schema(title = "장르", nullable = true) + private final String genre; @Schema(title = "수정일시") private final LocalDateTime updatedAt; - public ProductResponse(ProductRecord product) { + public ProductResponse(ProductRecord product, String genre) { this.id = product.getId(); this.title = product.getContent(); + this.genre = genre; this.updatedAt = product.getUpdatedAt(); } } From 0b7c8cd73c602b639861a8ab8ed31d1b4ebe883b Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:34:04 +0900 Subject: [PATCH 045/107] =?UTF-8?q?feat:=20document=20embedding=20API=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20(#44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assistant/service/AutoModifyService.java | 4 +++- .../service/DocumentUploadService.java | 22 +++++++++++++++++++ .../assistant/service/FeedbackService.java | 4 +++- .../assistant/service/UserModifyService.java | 4 +++- .../product/controller/ProductController.java | 6 ++--- ...fyRequest.java => ProductSaveRequest.java} | 4 +++- .../service/ProductCommandService.java | 13 +++++++++-- .../AssistantApiClient.java | 22 +++++++++++++++---- .../request/AutoModifyRequest.java | 4 ++-- .../request/DocumentUploadRequest.java | 18 +++++++++++++++ .../request/FeedbackRequest.java | 4 ++-- .../request/UserModifyRequest.java | 4 ++-- 12 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java rename api/src/main/java/writeon/api/product/request/{ProductModifyRequest.java => ProductSaveRequest.java} (71%) create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/DocumentUploadRequest.java diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index 3f80d86..d22155f 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -54,7 +54,9 @@ public SseEmitter streamAutoModify(UUID assistantId, UUID messageId) { AutoModifyMessage message = getById(messageId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); - AutoModifyRequest request = new AutoModifyRequest(userSetting, message.getContent()); + AutoModifyRequest request = new AutoModifyRequest( + assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent() + ); SseEmitter emitter = new SseEmitter(TIMEOUT); StringBuilder responseBuilder = new StringBuilder(); diff --git a/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java b/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java new file mode 100644 index 0000000..a0e7a5a --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java @@ -0,0 +1,22 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.DocumentUploadRequest; + +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class DocumentUploadService { + + private final AssistantApiClient assistantApiClient; + + public void documentUpload(UUID productId, String content) { + DocumentUploadRequest request = + new DocumentUploadRequest(productId.toString().replaceAll("-", ""), content); + assistantApiClient.documentUpload(request) + .subscribe(); + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index 5303bfc..d8a7ee1 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -54,7 +54,9 @@ public SseEmitter streamFeedback(UUID assistantId, UUID messageId) { FeedbackMessage message = getById(messageId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); - FeedbackRequest request = new FeedbackRequest(userSetting, message.getContent()); + FeedbackRequest request = new FeedbackRequest( + assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent() + ); SseEmitter emitter = new SseEmitter(TIMEOUT); StringBuilder responseBuilder = new StringBuilder(); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 8e69c8b..35006bd 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -55,7 +55,9 @@ public SseEmitter streamUserModify(UUID assistantId, UUID messageId) { UserModifyMessage message = getById(messageId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); - UserModifyRequest request = new UserModifyRequest(userSetting, message.getContent(), message.getPrompt()); + UserModifyRequest request = new UserModifyRequest( + assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent(), message.getPrompt() + ); SseEmitter emitter = new SseEmitter(TIMEOUT); StringBuilder responseBuilder = new StringBuilder(); diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index 5efa714..cd514d4 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -5,7 +5,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import writeon.api.product.request.ProductMemoSaveRequest; -import writeon.api.product.request.ProductModifyRequest; +import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; import writeon.api.product.response.ProductDetailResponse; import writeon.api.product.response.ProductMemoResponse; @@ -36,8 +36,8 @@ public UUID create() { @PostMapping("/{productId}") public UUID modify( @PathVariable UUID productId, - @RequestBody ProductModifyRequest request) { - return productCommandService.modify(productId, request); + @RequestBody ProductSaveRequest request) { + return productCommandService.save(productId, request); } @Operation(summary = "템플릿 저장") diff --git a/api/src/main/java/writeon/api/product/request/ProductModifyRequest.java b/api/src/main/java/writeon/api/product/request/ProductSaveRequest.java similarity index 71% rename from api/src/main/java/writeon/api/product/request/ProductModifyRequest.java rename to api/src/main/java/writeon/api/product/request/ProductSaveRequest.java index 224c461..8ba2cbe 100644 --- a/api/src/main/java/writeon/api/product/request/ProductModifyRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductSaveRequest.java @@ -6,10 +6,12 @@ @Getter @Setter -public class ProductModifyRequest { +public class ProductSaveRequest { @Schema(title = "제목") private String title; @Schema(title = "내용") private String content; + @Schema(title = "자동저장 여부") + private Boolean isAutoSave; } diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 445bedd..504a6e9 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -3,9 +3,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.assistant.service.DocumentUploadService; import writeon.api.common.exception.BaseException; import writeon.api.product.request.ProductMemoSaveRequest; -import writeon.api.product.request.ProductModifyRequest; +import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; import writeon.domain.product.*; import writeon.domain.product.enums.ProductException; @@ -30,6 +31,8 @@ public class ProductCommandService { private final ProductSynopsisJpaRepository productSynopsisRepository; private final ProductWorldviewJpaRepository productWorldviewRepository; + private final DocumentUploadService documentUploadService; + @Transactional public UUID create() { return productRepository.save(new Product()).getId(); @@ -55,10 +58,16 @@ public void saveTemplate(UUID productId, ProductTemplateSaveRequest request) { } @Transactional - public UUID modify(UUID productId, ProductModifyRequest request) { + public UUID save(UUID productId, ProductSaveRequest request) { Product product = productQueryService.getById(productId); product.update(request.getTitle(), request.getContent()); + + // 수동 저장 시 작품 내용 임베딩 + if (!request.getIsAutoSave()) { + documentUploadService.documentUpload(productId, product.getContent()); + } + return product.getId(); } diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 18f2c1a..927f464 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -4,10 +4,7 @@ import org.springframework.http.HttpStatusCode; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import writeon.assistantapiclient.request.AutoModifyRequest; -import writeon.assistantapiclient.request.FeedbackRequest; -import writeon.assistantapiclient.request.ResearchRequest; -import writeon.assistantapiclient.request.UserModifyRequest; +import writeon.assistantapiclient.request.*; public class AssistantApiClient extends WebApiClient{ @@ -15,6 +12,23 @@ public AssistantApiClient(String baseUrl, int connectionTimeoutMs, int readTimeo super(baseUrl, connectionTimeoutMs, readTimeoutMs); } + public Mono documentUpload(DocumentUploadRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/document/upload") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .then(); + } + public Mono research(ResearchRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java index ae16b7d..c40774d 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/AutoModifyRequest.java @@ -12,8 +12,8 @@ public class AutoModifyRequest { private final UserSetting userSetting; private final String query; - public AutoModifyRequest(UserSetting userSetting, String query) { - this.tenantId = "1"; + public AutoModifyRequest(String tenantId, UserSetting userSetting, String query) { + this.tenantId = tenantId; this.userSetting = userSetting; this.query = query; } diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/DocumentUploadRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/DocumentUploadRequest.java new file mode 100644 index 0000000..2c9ddf9 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/DocumentUploadRequest.java @@ -0,0 +1,18 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class DocumentUploadRequest { + + private final String tenantId; + private final String content; + + public DocumentUploadRequest(String tenantId, String content) { + this.tenantId = tenantId; + this.content = content; + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java index 7c98453..92b3551 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/FeedbackRequest.java @@ -12,8 +12,8 @@ public class FeedbackRequest { private final UserSetting userSetting; private final String query; - public FeedbackRequest(UserSetting userSetting, String query) { - this.tenantId = "1"; + public FeedbackRequest(String tenantId, UserSetting userSetting, String query) { + this.tenantId = tenantId; this.userSetting = userSetting; this.query = query; } diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java index 17e7a3e..067a33d 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserModifyRequest.java @@ -13,8 +13,8 @@ public class UserModifyRequest { private final String query; private final String howPolish; - public UserModifyRequest(UserSetting userSetting, String query, String howPolish) { - this.tenantId = "1"; + public UserModifyRequest(String tenantId, UserSetting userSetting, String query, String howPolish) { + this.tenantId = tenantId; this.userSetting = userSetting; this.query = query; this.howPolish = howPolish; From 5eb06f243b0859a43a2bf8a814860ecd3209c467 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 16 Mar 2025 21:57:30 +0900 Subject: [PATCH 046/107] feat: spring security (#45) --- .../writeon/api/auth/helper/MemberHelper.java | 19 +++++ .../api/common/config/SecurityConfig.java | 78 +++++++++++++++++++ .../writeon/api/common/config/WebConfig.java | 22 ------ .../CustomAuthenticationEntryPoint.java | 38 +++++++++ .../filter/CustomAuthenticationFilter.java | 53 +++++++++++++ .../api/common/resolver/AuthResolver.java | 48 ------------ .../member/controller/MemberController.java | 4 +- .../member/service/MemberQueryService.java | 5 +- build.gradle | 1 + .../writeon/domain/common/MemberSession.java | 42 +++++++++- 10 files changed, 236 insertions(+), 74 deletions(-) create mode 100644 api/src/main/java/writeon/api/auth/helper/MemberHelper.java create mode 100644 api/src/main/java/writeon/api/common/config/SecurityConfig.java create mode 100644 api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java create mode 100644 api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java delete mode 100644 api/src/main/java/writeon/api/common/resolver/AuthResolver.java diff --git a/api/src/main/java/writeon/api/auth/helper/MemberHelper.java b/api/src/main/java/writeon/api/auth/helper/MemberHelper.java new file mode 100644 index 0000000..25daa50 --- /dev/null +++ b/api/src/main/java/writeon/api/auth/helper/MemberHelper.java @@ -0,0 +1,19 @@ +package writeon.api.auth.helper; + +import lombok.experimental.UtilityClass; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import writeon.domain.common.MemberSession; + +@UtilityClass +public class MemberHelper { + + public MemberSession getMemberSession() { + SecurityContext context = SecurityContextHolder.getContext(); + if (context.getAuthentication().getPrincipal() instanceof MemberSession memberSession) { + return memberSession; + } + return null; + } + +} diff --git a/api/src/main/java/writeon/api/common/config/SecurityConfig.java b/api/src/main/java/writeon/api/common/config/SecurityConfig.java new file mode 100644 index 0000000..820ae15 --- /dev/null +++ b/api/src/main/java/writeon/api/common/config/SecurityConfig.java @@ -0,0 +1,78 @@ +package writeon.api.common.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import writeon.api.common.exception.CustomAuthenticationEntryPoint; +import writeon.api.common.filter.CustomAuthenticationFilter; + +import java.util.List; + +@Configuration +@EnableWebSecurity +@RequiredArgsConstructor +public class SecurityConfig { + private final CustomAuthenticationFilter customAuthenticationFilter; + private final CustomAuthenticationEntryPoint customAuthenticationEntryPoint; + + @Value("${service.cors.origins}") + private List origins; + + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + return http + .cors(Customizer.withDefaults()) + .csrf(AbstractHttpConfigurer::disable) + .formLogin(AbstractHttpConfigurer::disable) + .httpBasic(AbstractHttpConfigurer::disable) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(auth -> auth + .requestMatchers("/swagger-ui/**", "/doc/**", "/v3/api-docs/**").permitAll() + .requestMatchers("/health-check/**").permitAll() + .requestMatchers("/auth/**").permitAll() + .requestMatchers("/auth/logout").authenticated() + .requestMatchers("/terms/**").permitAll() + .anyRequest().authenticated() + ) + .addFilterBefore(customAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) + .exceptionHandling(configurer -> { + configurer.authenticationEntryPoint(customAuthenticationEntryPoint); + } + ) + .build(); + } + + @Bean + public CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(origins); + configuration.setAllowedMethods(List.of("*")); + configuration.setAllowedHeaders(List.of("*")); + configuration.setAllowCredentials(true); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", configuration); + return source; + } + + @Bean + public AuthenticationManager noopAuthenticationManager() { + return authentication -> { + throw new AuthenticationServiceException("Authentication is disabled"); + }; + } + +} \ No newline at end of file diff --git a/api/src/main/java/writeon/api/common/config/WebConfig.java b/api/src/main/java/writeon/api/common/config/WebConfig.java index 3e1b373..3901e89 100644 --- a/api/src/main/java/writeon/api/common/config/WebConfig.java +++ b/api/src/main/java/writeon/api/common/config/WebConfig.java @@ -1,40 +1,18 @@ package writeon.api.common.config; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import writeon.api.common.resolver.AuthResolver; import writeon.domain.terms.enums.TermsCode; -import java.util.List; - @Configuration @RequiredArgsConstructor public class WebConfig implements WebMvcConfigurer { - @Value("${service.cors.origins}") - private final List origins; - private final AuthResolver authResolver; - - @Override - public void addArgumentResolvers(List resolvers) { - resolvers.add(authResolver); - } @Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new TermsCode.SpringConverter()); } - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOrigins(origins.toArray(new String[0])) - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .allowCredentials(true); - } } diff --git a/api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java b/api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java new file mode 100644 index 0000000..a575ebd --- /dev/null +++ b/api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java @@ -0,0 +1,38 @@ +package writeon.api.common.exception; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; +import writeon.api.common.response.BaseResponse; +import writeon.api.common.util.LogUtil; +import writeon.domain.auth.enums.AuthException; + +import java.io.IOException; + +@RequiredArgsConstructor +@Component +public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint { + private final ObjectMapper objectMapper; + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { + response.setContentType("application/json"); + response.setCharacterEncoding("UTF-8"); + response.setStatus(AuthException.ACCESS_TOKEN_NOT_VALID.getStatus().value()); + + try { + String jsonResponse = objectMapper.writeValueAsString( + BaseResponse.failure(AuthException.ACCESS_TOKEN_NOT_VALID) + ); + response.getWriter().write(jsonResponse); + response.getWriter().flush(); + } catch (Exception exception) { + LogUtil.error(exception); + } + } +} diff --git a/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java b/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java new file mode 100644 index 0000000..46ffefa --- /dev/null +++ b/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java @@ -0,0 +1,53 @@ +package writeon.api.common.filter; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import writeon.api.auth.helper.JwtHelper; +import writeon.domain.auth.JwtPayload; +import writeon.domain.common.MemberSession; + +import java.io.IOException; + +@RequiredArgsConstructor +@Component +public class CustomAuthenticationFilter extends OncePerRequestFilter { + private final JwtHelper jwtHelper; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + String authorization = request.getHeader("Authorization"); + + if (authorization == null) { + filterChain.doFilter(request, response); + return; + } + + String[] parts = authorization.split(" "); + if (parts.length != 2) { + filterChain.doFilter(request, response); + return; + } + + String accessToken = parts[1]; + if (!jwtHelper.isTokenValid(accessToken)) { + filterChain.doFilter(request, response); + return; + } + + JwtPayload payload = jwtHelper.getPayload(accessToken); + MemberSession memberSession = new MemberSession(payload.getMemberId()); + Authentication authentication = new UsernamePasswordAuthenticationToken(memberSession, accessToken, memberSession.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); + + filterChain.doFilter(request, response); + } + +} diff --git a/api/src/main/java/writeon/api/common/resolver/AuthResolver.java b/api/src/main/java/writeon/api/common/resolver/AuthResolver.java deleted file mode 100644 index 04edb54..0000000 --- a/api/src/main/java/writeon/api/common/resolver/AuthResolver.java +++ /dev/null @@ -1,48 +0,0 @@ -package writeon.api.common.resolver; - -import lombok.AllArgsConstructor; -import org.springframework.core.MethodParameter; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.support.WebDataBinderFactory; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.method.support.ModelAndViewContainer; -import writeon.api.auth.helper.JwtHelper; -import writeon.api.common.exception.BaseException; -import writeon.domain.auth.JwtPayload; -import writeon.domain.auth.enums.AuthException; -import writeon.domain.common.MemberSession; - -@AllArgsConstructor -@Component -public class AuthResolver implements HandlerMethodArgumentResolver { - private final JwtHelper jwtHelper; - - @Override - public boolean supportsParameter(MethodParameter parameter) { - return parameter.getParameterType().equals(MemberSession.class); - } - - @Override - public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { - String authorization = webRequest.getHeader("Authorization"); - if (authorization == null) { - throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); - } - - String[] parts = authorization.split(" "); - if (parts.length != 2) { - throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); - } - - String accessToken = parts[1]; - if (!jwtHelper.isTokenValid(accessToken)) { - throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); - } - - JwtPayload payload = jwtHelper.getPayload(accessToken); - return MemberSession.builder() - .memberId(payload.getMemberId()) - .build(); - } -} diff --git a/api/src/main/java/writeon/api/member/controller/MemberController.java b/api/src/main/java/writeon/api/member/controller/MemberController.java index 328fcfe..7aed325 100644 --- a/api/src/main/java/writeon/api/member/controller/MemberController.java +++ b/api/src/main/java/writeon/api/member/controller/MemberController.java @@ -18,8 +18,8 @@ public class MemberController { private final MemberQueryService memberQueryService; @GetMapping("/me/profile") - public MyProfileResponse getMyProfile(@Parameter(hidden = true) MemberSession memberSession) { - return memberQueryService.getMyProfile(memberSession); + public MyProfileResponse getMyProfile() { + return memberQueryService.getMyProfile(); } } diff --git a/api/src/main/java/writeon/api/member/service/MemberQueryService.java b/api/src/main/java/writeon/api/member/service/MemberQueryService.java index 5f4871c..a36135e 100644 --- a/api/src/main/java/writeon/api/member/service/MemberQueryService.java +++ b/api/src/main/java/writeon/api/member/service/MemberQueryService.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.auth.helper.MemberHelper; import writeon.api.common.exception.BaseException; import writeon.api.member.response.MyProfileResponse; import writeon.domain.common.MemberSession; @@ -16,7 +17,9 @@ public class MemberQueryService { private final MemberJpaRepository memberJpaRepository; - public MyProfileResponse getMyProfile(MemberSession memberSession) { + public MyProfileResponse getMyProfile() { + MemberSession memberSession = MemberHelper.getMemberSession(); + Member member = memberJpaRepository.findById(memberSession.getMemberId()) .orElseThrow(() -> new BaseException(MemberException.NOT_EXIST)); diff --git a/build.gradle b/build.gradle index 0ce3312..1980beb 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,7 @@ allprojects { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-security' /* Lombok */ compileOnly 'org.projectlombok:lombok' diff --git a/domain/src/main/java/writeon/domain/common/MemberSession.java b/domain/src/main/java/writeon/domain/common/MemberSession.java index 13e14e2..4ea66c3 100644 --- a/domain/src/main/java/writeon/domain/common/MemberSession.java +++ b/domain/src/main/java/writeon/domain/common/MemberSession.java @@ -3,12 +3,52 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import java.util.Collection; +import java.util.List; import java.util.UUID; @Getter @AllArgsConstructor @Builder -public class MemberSession { +public class MemberSession implements UserDetails { private UUID memberId; + + @Override + public Collection getAuthorities() { + return List.of(new SimpleGrantedAuthority("ROLE_USER")); + } + + @Override + public String getPassword() { + return null; + } + + @Override + public String getUsername() { + return null; + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } } From f783b7e44ef4ebbf40febb7bda2ec46c90e0b0df Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 20 Mar 2025 22:41:42 +0900 Subject: [PATCH 047/107] =?UTF-8?q?fix:=20AI=20=EC=96=B4=EC=8B=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EB=8B=A8=EA=B3=84=EB=B3=84=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EC=A0=80=EC=9E=A5=20=EA=B8=B0=EB=8A=A5=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssistantController.java | 29 +++++++------------ .../request/AssistantCompletedRequest.java | 13 +++++++++ .../request/AssistantResearchRequest.java | 2 ++ .../response/MessageCreateResponse.java | 5 +--- .../assistant/service/AssistantService.java | 15 +++++++++- .../assistant/service/AutoModifyService.java | 17 ++++++----- .../assistant/service/FeedbackService.java | 15 +++++----- .../assistant/service/ResearchService.java | 5 +++- .../assistant/service/UserModifyService.java | 15 +++++----- .../AutoModifyMessageJpaRepository.java | 3 ++ .../assistant/enums/AssistantException.java | 3 +- .../FeedbackMessageJpaRepository.java | 3 ++ .../UserModifyMessageJpaRepository.java | 3 ++ 13 files changed, 80 insertions(+), 48 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 2c46c71..3e028a1 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -60,41 +60,32 @@ public AssistantResponse research(@RequestBody AssistantResearchRequest request) @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") - public SseEmitter streamAutoModify( - @RequestParam UUID assistantId, - @RequestParam UUID messageId - ) { - SseEmitter emitter = autoModifyService.streamAutoModify(assistantId, messageId); + public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { + SseEmitter emitter = autoModifyService.streamAutoModify(assistantId); setResponseHeaderForSSE(); return emitter; } @Operation(summary = "구간 피드백 스트리밍") @GetMapping("/feedback/stream") - public SseEmitter streamFeedback( - @RequestParam UUID assistantId, - @RequestParam UUID messageId - ) { - SseEmitter emitter = feedbackService.streamFeedback(assistantId, messageId); + public SseEmitter streamFeedback(@RequestParam UUID assistantId) { + SseEmitter emitter = feedbackService.streamFeedback(assistantId); setResponseHeaderForSSE(); return emitter; } @Operation(summary = "수동 수정 스트리밍") @GetMapping("/user-modify/stream") - public SseEmitter streamUserModify( - @RequestParam UUID assistantId, - @RequestParam UUID messageId - ) { - SseEmitter emitter = userModifyService.streamUserModify(assistantId, messageId); + public SseEmitter streamUserModify(@RequestParam UUID assistantId) { + SseEmitter emitter = userModifyService.streamUserModify(assistantId); setResponseHeaderForSSE(); return emitter; } - @Operation(summary = "응답 반영") - @PutMapping("/reflections/{assistantId}") - public void reflect(@PathVariable UUID assistantId) { - assistantService.reflect(assistantId); + @Operation(summary = "AI 어시 기능 완료 처리") + @PutMapping("/{assistantId}/completed") + public void completed(@PathVariable UUID assistantId, @RequestBody AssistantCompletedRequest request) { + assistantService.completed(assistantId, request); } private void setResponseHeaderForSSE() { diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java new file mode 100644 index 0000000..4744762 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java @@ -0,0 +1,13 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class AssistantCompletedRequest { + + @Schema(title = "응답 반영 여부") + private Boolean isReflected; +} diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java index 1870e2f..7c0b2ea 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java @@ -12,6 +12,8 @@ public class AssistantResearchRequest { @Schema(title = "작품 ID") private UUID productId; + @Schema(title = "세션 ID") + private String sessionId; @Schema(title = "내용", nullable = true) private String content; @Schema(title = "프롬프트") diff --git a/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java b/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java index 9fbaead..90d9f74 100644 --- a/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/MessageCreateResponse.java @@ -10,11 +10,8 @@ public class MessageCreateResponse { @Schema(title = "어시스턴트 ID") private final UUID assistantId; - @Schema(title = "메세지 ID") - private final UUID messageId; - public MessageCreateResponse(UUID assistantId, UUID messageId) { + public MessageCreateResponse(UUID assistantId) { this.assistantId = assistantId; - this.messageId = messageId; } } diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index ca5fe4e..4687ecf 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.assistant.request.AssistantCompletedRequest; import writeon.api.common.exception.BaseException; import writeon.domain.assistant.Assistant; import writeon.domain.assistant.AssistantJpaRepository; @@ -25,11 +26,23 @@ public UUID create(UUID productId, AssistantType type) { } @Transactional - public void reflect(UUID assistantId) { + public void completed(UUID assistantId, AssistantCompletedRequest request) { Assistant assistant = getById(assistantId); + + if (assistant.getStatus() != AssistantStatus.IN_PROGRESS) { + throw new BaseException(AssistantException.CANNOT_BE_COMPLETED); + } + assistant.updateStatus(AssistantStatus.COMPLETED); } + @Transactional + public void modifyStatus(UUID assistantId, AssistantStatus status) { + Assistant assistant = getById(assistantId); + + assistant.updateStatus(status); + } + @Transactional(readOnly = true) public Assistant getById(UUID assistantId) { return assistantRepository.findById(assistantId) diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index d22155f..6dbe6cb 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -40,18 +40,18 @@ public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest req UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); AutoModifyMessage memberMessage = new AutoModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); - UUID messageId = autoModifyMessageRepository.save(memberMessage).getId(); + autoModifyMessageRepository.save(memberMessage); - return new MessageCreateResponse(assistantId, messageId); + return new MessageCreateResponse(assistantId); } - public SseEmitter streamAutoModify(UUID assistantId, UUID messageId) { + public SseEmitter streamAutoModify(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AutoModifyMessage message = getById(messageId); + AutoModifyMessage message = getMemberMessage(assistantId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); AutoModifyRequest request = new AutoModifyRequest( @@ -78,9 +78,10 @@ public SseEmitter streamAutoModify(UUID assistantId, UUID messageId) { throw exception; }, () -> { - AutoModifyMessage assistantMessage = new AutoModifyMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); + AutoModifyMessage assistantMessage = new AutoModifyMessage(assistantId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); autoModifyMessageRepository.save(assistantMessage); - assistant.updateStatus(AssistantStatus.IN_PROGRESS); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -88,8 +89,8 @@ public SseEmitter streamAutoModify(UUID assistantId, UUID messageId) { return emitter; } - private AutoModifyMessage getById(UUID messageId) { - return autoModifyMessageRepository.findById(messageId) + private AutoModifyMessage getMemberMessage(UUID assistantId) { + return autoModifyMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index d8a7ee1..2bfb638 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -40,18 +40,18 @@ public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest reque UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); FeedbackMessage memberMessage = new FeedbackMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); - UUID messageId = feedbackMessageRepository.save(memberMessage).getId(); + feedbackMessageRepository.save(memberMessage); - return new MessageCreateResponse(assistantId, messageId); + return new MessageCreateResponse(assistantId); } - public SseEmitter streamFeedback(UUID assistantId, UUID messageId) { + public SseEmitter streamFeedback(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - FeedbackMessage message = getById(messageId); + FeedbackMessage message = getMemberMessage(assistantId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); FeedbackRequest request = new FeedbackRequest( @@ -80,7 +80,8 @@ public SseEmitter streamFeedback(UUID assistantId, UUID messageId) { () -> { FeedbackMessage assistantMessage = new FeedbackMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); feedbackMessageRepository.save(assistantMessage); - assistant.updateStatus(AssistantStatus.IN_PROGRESS); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -88,8 +89,8 @@ public SseEmitter streamFeedback(UUID assistantId, UUID messageId) { return emitter; } - private FeedbackMessage getById(UUID messageId) { - return feedbackMessageRepository.findById(messageId) + private FeedbackMessage getMemberMessage(UUID assistantId) { + return feedbackMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } diff --git a/api/src/main/java/writeon/api/assistant/service/ResearchService.java b/api/src/main/java/writeon/api/assistant/service/ResearchService.java index b14f964..554f99f 100644 --- a/api/src/main/java/writeon/api/assistant/service/ResearchService.java +++ b/api/src/main/java/writeon/api/assistant/service/ResearchService.java @@ -29,16 +29,19 @@ public class ResearchService { public AssistantResponse research(AssistantResearchRequest request) { productQueryService.verifyExist(request.getProductId()); + // assistant 및 message 생성 UUID assistantId = assistantService.create(request.getProductId(), AssistantType.RESEARCH); ResearchMessage memberMessage = new ResearchMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); researchMessageRepository.save(memberMessage); UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); - ResearchRequest researchRequest = new ResearchRequest("1", userSetting, request.getContent()); + ResearchRequest researchRequest = new ResearchRequest(request.getSessionId(), userSetting, request.getPrompt()); + // 자유 대화 요청 String answer = assistantApiClient.research(researchRequest).block(); + // assistant 응답 저장 ResearchMessage assistantMessage = new ResearchMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null); researchMessageRepository.save(assistantMessage); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 35006bd..8e386da 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -41,18 +41,18 @@ public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest req UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); UserModifyMessage memberMessage = new UserModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); - UUID messagedId = userModifyMessageRepository.save(memberMessage).getId(); + userModifyMessageRepository.save(memberMessage); - return new MessageCreateResponse(assistantId, messagedId); + return new MessageCreateResponse(assistantId); } - public SseEmitter streamUserModify(UUID assistantId, UUID messageId) { + public SseEmitter streamUserModify(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - UserModifyMessage message = getById(messageId); + UserModifyMessage message = getMemberMessage(assistantId); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); UserModifyRequest request = new UserModifyRequest( @@ -81,7 +81,8 @@ public SseEmitter streamUserModify(UUID assistantId, UUID messageId) { () -> { UserModifyMessage assistantMessage = new UserModifyMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); userModifyMessageRepository.save(assistantMessage); - assistant.updateStatus(AssistantStatus.IN_PROGRESS); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); } ); @@ -89,8 +90,8 @@ public SseEmitter streamUserModify(UUID assistantId, UUID messageId) { return emitter; } - private UserModifyMessage getById(UUID messageId) { - return userModifyMessageRepository.findById(messageId) + private UserModifyMessage getMemberMessage(UUID assistantId) { + return userModifyMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java index 618c148..79c8265 100644 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java @@ -3,9 +3,12 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.assistant.enums.MessageSenderRole; +import java.util.Optional; import java.util.UUID; public interface AutoModifyMessageJpaRepository extends JpaRepository { boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); + + Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java index 3c2c714..72d5db0 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java @@ -14,7 +14,8 @@ public enum AssistantException implements CodeInfo { SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "SSE 데이터 전송 중 오류가 발생했습니다."), ALREADY_ANSWERED(HttpStatus.BAD_REQUEST, "AI-004", "이미 응답된 메세지입니다."), ALREADY_EVALUATED(HttpStatus.BAD_REQUEST, "AI-005", "이미 평가되었습니다."), - WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-006", "WebClient 요청 중 오류가 발생했습니다."); + CANNOT_BE_COMPLETED(HttpStatus.BAD_REQUEST, "AI-006", "완료처리 할 수 없는 상태입니다."), + WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-007", "WebClient 요청 중 오류가 발생했습니다."); private final HttpStatus status; private final String code; diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java index 023b5fa..27663d1 100644 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java @@ -3,9 +3,12 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.assistant.enums.MessageSenderRole; +import java.util.Optional; import java.util.UUID; public interface FeedbackMessageJpaRepository extends JpaRepository { boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); + + Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java index d39fae4..44c23d4 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java @@ -3,9 +3,12 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.assistant.enums.MessageSenderRole; +import java.util.Optional; import java.util.UUID; public interface UserModifyMessageJpaRepository extends JpaRepository { boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); + + Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); } From 5302ce89d5993dab7109ab05d4b37c47011d80d4 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 22 Mar 2025 17:29:26 +0900 Subject: [PATCH 048/107] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EA=B7=9C=EC=B9=99,=20swagger=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20(#47)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../writeon/api/auth/request/JoinRequest.java | 3 ++- .../api/common/validation/IsPassword.java | 2 +- .../common/validation/IsPasswordValidator.java | 18 +++++++++++++++++- .../file/request/PresignedUrlIssueRequest.java | 6 +++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/writeon/api/auth/request/JoinRequest.java b/api/src/main/java/writeon/api/auth/request/JoinRequest.java index ec413b1..4004cba 100644 --- a/api/src/main/java/writeon/api/auth/request/JoinRequest.java +++ b/api/src/main/java/writeon/api/auth/request/JoinRequest.java @@ -1,5 +1,6 @@ package writeon.api.auth.request; +import io.swagger.v3.oas.annotations.media.ArraySchema; import writeon.api.common.validation.IsEmail; import writeon.api.common.validation.IsPassword; import writeon.api.terms.request.TermsAgreeRequest; @@ -31,7 +32,7 @@ public class JoinRequest { private String nickname; @NotNull - @Schema(title = "약관 동의 목록", requiredMode = Schema.RequiredMode.REQUIRED, example = "[{termsCd: \"1001\", isAgreed: true}, {termsCd: \"1002\", isAgreed: false}]") + @ArraySchema(schema = @Schema(implementation = TermsAgreeRequest.class)) private List termsList; } diff --git a/api/src/main/java/writeon/api/common/validation/IsPassword.java b/api/src/main/java/writeon/api/common/validation/IsPassword.java index 18f7578..1f986f2 100644 --- a/api/src/main/java/writeon/api/common/validation/IsPassword.java +++ b/api/src/main/java/writeon/api/common/validation/IsPassword.java @@ -14,7 +14,7 @@ @Constraint(validatedBy = IsPasswordValidator.class) @Size(min = 8, max = 255) public @interface IsPassword { - String message() default "최소 8자 이상이며, 대문자, 소문자, 숫자, 특수문자 중 3가지를 포함해야 합니다."; + String message() default "최소 8자 이상이며, 대문자, 소문자, 숫자, 특수문자(@$!%*?&) 중 3가지를 포함해야 합니다."; Class[] groups() default {}; Class[] payload() default {}; } \ No newline at end of file diff --git a/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java index 2f01b82..b0a96ac 100644 --- a/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java +++ b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java @@ -3,12 +3,28 @@ import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; +import java.util.stream.Stream; + public class IsPasswordValidator implements ConstraintValidator { + + final String digit = "0-9"; + final String uppercase = "A-Z"; + final String lowercase = "a-z"; + final String specialCharacters = "@$!%*?&"; + @Override public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { if (s == null) return true; - return s.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]*$"); + final String otherCharacterMatcher = String.format(".*[^%s%s%s%s].*", digit, uppercase, lowercase, specialCharacters); + if (s.matches(otherCharacterMatcher)) + return false; + + long matchCount = Stream.of(digit, uppercase, lowercase, specialCharacters) + .filter(regex -> s.matches(String.format(".*[%s].*", regex))) + .count(); + + return matchCount >= 3; } } \ No newline at end of file diff --git a/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java b/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java index abe4f1d..de85f69 100644 --- a/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java +++ b/api/src/main/java/writeon/api/file/request/PresignedUrlIssueRequest.java @@ -10,15 +10,15 @@ @Setter @NoArgsConstructor public class PresignedUrlIssueRequest { - @Schema(title = "업로드 타입", requiredMode = Schema.RequiredMode.REQUIRED, example = "idea-note, ...") + @Schema(title = "업로드 타입", requiredMode = Schema.RequiredMode.REQUIRED, example = "idea-note") private FileUploadType fileUploadType; @Schema(title = "원본 파일 이름", requiredMode = Schema.RequiredMode.REQUIRED, example = "download.png") private String originalFileName; - @Schema(title = "Content-Type", requiredMode = Schema.RequiredMode.REQUIRED, example = "image/png, image/jpeg") + @Schema(title = "Content-Type", requiredMode = Schema.RequiredMode.REQUIRED, example = "image/png") private String contentType; - @Schema(title = "Content-Length", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457280 (30MB)") + @Schema(title = "Content-Length", description = "Byte", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457280") private Long contentLength; } From c624d9a9c0649104289b7cfe4b47ecb56d848bfd Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 22 Mar 2025 22:11:12 +0900 Subject: [PATCH 049/107] =?UTF-8?q?feat:=20=EC=9E=90=EC=9C=A0=20=EB=8C=80?= =?UTF-8?q?=ED=99=94=20API=20=EC=97=B0=EB=8F=99=20(#48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssistantController.java | 20 +- .../AssistantAutoModifyMessageRequest.java | 2 +- .../request/AssistantChatMessageRequest.java | 19 ++ .../AssistantFeedbackMessageRequest.java | 2 +- .../request/AssistantResearchRequest.java | 2 +- .../AssistantUserModifyMessageRequest.java | 2 +- .../api/assistant/service/ChatService.java | 101 +++++++ .../api/common/config/SecurityConfig.java | 4 +- .../CustomAuthenticationEntryPoint.java | 2 +- .../{ => handler}/GlobalExceptionHandler.java | 3 +- .../filter/CustomAuthenticationFilter.java | 7 + .../AssistantApiClient.java | 16 ++ .../assistantapiclient/WebApiClient.java | 1 + .../request/ChatRequest.java | 22 ++ docker-compose-db.yml => docker-compose.yml | 9 +- domain/src/main/generated/writely/Keys.java | 3 + domain/src/main/generated/writely/Public.java | 7 + domain/src/main/generated/writely/Tables.java | 6 + .../generated/writely/tables/ChatMessage.java | 260 ++++++++++++++++++ .../writely/tables/pojos/ChatMessage.java | 226 +++++++++++++++ .../tables/records/ChatMessageRecord.java | 216 +++++++++++++++ .../domain/assistant/chat/ChatMessage.java | 44 +++ .../chat/ChatMessageJpaRepository.java | 14 + 23 files changed, 979 insertions(+), 9 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java create mode 100644 api/src/main/java/writeon/api/assistant/service/ChatService.java rename api/src/main/java/writeon/api/common/exception/{ => handler}/CustomAuthenticationEntryPoint.java (96%) rename api/src/main/java/writeon/api/common/exception/{ => handler}/GlobalExceptionHandler.java (94%) create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/ChatRequest.java rename docker-compose-db.yml => docker-compose.yml (61%) create mode 100644 domain/src/main/generated/writely/tables/ChatMessage.java create mode 100644 domain/src/main/generated/writely/tables/pojos/ChatMessage.java create mode 100644 domain/src/main/generated/writely/tables/records/ChatMessageRecord.java create mode 100644 domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java create mode 100644 domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 3e028a1..5aa03a2 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -24,6 +24,7 @@ public class AssistantController { private final AssistantService assistantService; private final AssistantEvaluationService assistantEvaluationService; private final AutoModifyService autoModifyService; + private final ChatService chatService; private final FeedbackService feedbackService; private final UserModifyService userModifyService; private final ResearchService researchService; @@ -34,6 +35,12 @@ public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoM return autoModifyService.createMessage(request); } + @Operation(summary = "자유 대화 메세지 저장") + @PostMapping("/chat/messages") + public MessageCreateResponse createChatMessage(@RequestBody AssistantChatMessageRequest request) { + return chatService.createMessage(request); + } + @Operation(summary = "평가") @PostMapping("/evaluations") public void evaluate(@RequestBody AssistantEvaluationRequest request) { @@ -52,7 +59,7 @@ public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserM return userModifyService.createMessage(request); } - @Operation(summary = "자유 대화") + @Operation(summary = "검색") @PostMapping("/research") public AssistantResponse research(@RequestBody AssistantResearchRequest request) { return researchService.research(request); @@ -66,6 +73,17 @@ public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { return emitter; } + @Operation(summary = "자유 대화 스트리밍") + @GetMapping("/chat/stream") + public SseEmitter streamChat( + @RequestParam UUID assistantId, + @RequestParam String sessionId + ) { + SseEmitter emitter = chatService.streamChat(assistantId, sessionId); + setResponseHeaderForSSE(); + return emitter; + } + @Operation(summary = "구간 피드백 스트리밍") @GetMapping("/feedback/stream") public SseEmitter streamFeedback(@RequestParam UUID assistantId) { diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java index 02b04bb..938108e 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java @@ -12,6 +12,6 @@ public class AssistantAutoModifyMessageRequest { @Schema(title = "작품 ID") private UUID productId; - @Schema(title = "내용") + @Schema(title = "선택 구간") private String content; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java new file mode 100644 index 0000000..0212f9a --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java @@ -0,0 +1,19 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class AssistantChatMessageRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "선택 구간", nullable = true) + private String content; + @Schema(title = "프롬프트") + private String prompt; +} diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java index ff880f7..698ec7e 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java @@ -12,6 +12,6 @@ public class AssistantFeedbackMessageRequest { @Schema(title = "작품 ID") private UUID productId; - @Schema(title = "내용") + @Schema(title = "선택 구간") private String content; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java index 7c0b2ea..77dc218 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java @@ -14,7 +14,7 @@ public class AssistantResearchRequest { private UUID productId; @Schema(title = "세션 ID") private String sessionId; - @Schema(title = "내용", nullable = true) + @Schema(title = "선택 구간", nullable = true) private String content; @Schema(title = "프롬프트") private String prompt; diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java index a39889b..fcc5b32 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java @@ -12,7 +12,7 @@ public class AssistantUserModifyMessageRequest { @Schema(title = "작품 ID") private UUID productId; - @Schema(title = "내용") + @Schema(title = "선택 구간") private String content; @Schema(title = "프롬프트", nullable = true) private String prompt; diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java new file mode 100644 index 0000000..97c552a --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -0,0 +1,101 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.response.MessageCreateResponse; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.ChatRequest; +import writeon.assistantapiclient.request.UserSetting; +import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.chat.ChatMessage; +import writeon.domain.assistant.chat.ChatMessageJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class ChatService { + + private final long TIMEOUT = 180_000L; + + private final ChatMessageJpaRepository chatMessageRepository; + private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; + + @Transactional + public MessageCreateResponse createMessage(AssistantChatMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); + ChatMessage memberMessage = + new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + chatMessageRepository.save(memberMessage); + + return new MessageCreateResponse(assistantId); + } + + public SseEmitter streamChat(UUID assistantId, String sessionId) { + Assistant assistant = assistantService.getById(assistantId); + + verifyAnswered(assistantId); + productQueryService.verifyExist(assistant.getProductId()); + + ChatMessage message = getMemberMessage(assistantId); + + UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + ChatRequest request = new ChatRequest( + userSetting, message.getContent(), message.getPrompt(), sessionId + ); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + StringBuilder responseBuilder = new StringBuilder(); + + assistantApiClient.streamChat(request) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + responseBuilder.append(data); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error.getMessage()); + emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); + }, + () -> { + ChatMessage assistantMessage = new ChatMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + chatMessageRepository.save(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + emitter.complete(); + } + ); + + return emitter; + } + + private ChatMessage getMemberMessage(UUID assistantId) { + return chatMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } + + private void verifyAnswered(UUID assistantId) { + if (chatMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } +} diff --git a/api/src/main/java/writeon/api/common/config/SecurityConfig.java b/api/src/main/java/writeon/api/common/config/SecurityConfig.java index 820ae15..b31a7a4 100644 --- a/api/src/main/java/writeon/api/common/config/SecurityConfig.java +++ b/api/src/main/java/writeon/api/common/config/SecurityConfig.java @@ -13,10 +13,11 @@ import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import writeon.api.common.exception.CustomAuthenticationEntryPoint; +import writeon.api.common.exception.handler.CustomAuthenticationEntryPoint; import writeon.api.common.filter.CustomAuthenticationFilter; import java.util.List; @@ -45,6 +46,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .requestMatchers("/auth/**").permitAll() .requestMatchers("/auth/logout").authenticated() .requestMatchers("/terms/**").permitAll() + .requestMatchers(AntPathRequestMatcher.antMatcher("/assistant/**/stream")).permitAll() .anyRequest().authenticated() ) .addFilterBefore(customAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) diff --git a/api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java b/api/src/main/java/writeon/api/common/exception/handler/CustomAuthenticationEntryPoint.java similarity index 96% rename from api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java rename to api/src/main/java/writeon/api/common/exception/handler/CustomAuthenticationEntryPoint.java index a575ebd..25122a7 100644 --- a/api/src/main/java/writeon/api/common/exception/CustomAuthenticationEntryPoint.java +++ b/api/src/main/java/writeon/api/common/exception/handler/CustomAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package writeon.api.common.exception; +package writeon.api.common.exception.handler; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.servlet.ServletException; diff --git a/api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java b/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java similarity index 94% rename from api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java rename to api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java index 3c64ca2..1c3f8bc 100644 --- a/api/src/main/java/writeon/api/common/exception/GlobalExceptionHandler.java +++ b/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java @@ -1,4 +1,4 @@ -package writeon.api.common.exception; +package writeon.api.common.exception.handler; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import writeon.api.common.enums.code.ResultCodeInfo; +import writeon.api.common.exception.BaseException; import writeon.api.common.response.BaseResponse; import writeon.api.common.util.LogUtil; import writeon.domain.common.enums.CodeInfo; diff --git a/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java b/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java index 46ffefa..e6fb7ad 100644 --- a/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java +++ b/api/src/main/java/writeon/api/common/filter/CustomAuthenticationFilter.java @@ -11,7 +11,9 @@ import org.springframework.stereotype.Component; import org.springframework.web.filter.OncePerRequestFilter; import writeon.api.auth.helper.JwtHelper; +import writeon.api.common.exception.BaseException; import writeon.domain.auth.JwtPayload; +import writeon.domain.auth.enums.AuthException; import writeon.domain.common.MemberSession; import java.io.IOException; @@ -24,8 +26,13 @@ public class CustomAuthenticationFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String authorization = request.getHeader("Authorization"); + String path = request.getRequestURI(); if (authorization == null) { + if (path.matches("/assistant/.*/stream")) { + throw new BaseException(AuthException.ACCESS_TOKEN_NOT_VALID); + } + filterChain.doFilter(request, response); return; } diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 927f464..3387cd4 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -62,6 +62,22 @@ public Flux streamAutoModify(AutoModifyRequest request) { .bodyToFlux(String.class); } + public Flux streamChat(ChatRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/chat/stream") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToFlux(String.class); + } + public Flux streamFeedback(FeedbackRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java index 1ec17a7..3938665 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/WebApiClient.java @@ -19,6 +19,7 @@ public WebApiClient( int readTimeoutMs ) { HttpClient httpClient = HttpClient.create() + .keepAlive(true) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeoutMs) .doOnConnected(conn -> { conn.addHandlerLast(new ReadTimeoutHandler(readTimeoutMs, TimeUnit.MILLISECONDS)); diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ChatRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ChatRequest.java new file mode 100644 index 0000000..a261fd5 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ChatRequest.java @@ -0,0 +1,22 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class ChatRequest { + + private final UserSetting userSetting; + private final String query; + private final String userInput; + private final String sessionId; + + public ChatRequest(UserSetting userSetting, String query, String userInput, String sessionId) { + this.userSetting = userSetting; + this.query = query; + this.userInput = userInput; + this.sessionId = sessionId; + } +} diff --git a/docker-compose-db.yml b/docker-compose.yml similarity index 61% rename from docker-compose-db.yml rename to docker-compose.yml index 3d4ba4e..d194fda 100644 --- a/docker-compose-db.yml +++ b/docker-compose.yml @@ -12,4 +12,11 @@ services: ports: - "5432:5432" volumes: - - ./db:/var/lib/postgresql/data \ No newline at end of file + - ./db:/var/lib/postgresql/data + + redis: + image: redis:7.2.4-alpine3.19 + container_name: redis + restart: always + ports: + - "6379:6379" \ No newline at end of file diff --git a/domain/src/main/generated/writely/Keys.java b/domain/src/main/generated/writely/Keys.java index d4d4541..59c6c0b 100644 --- a/domain/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writely/Keys.java @@ -12,6 +12,7 @@ import writely.tables.Assistant; import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; +import writely.tables.ChatMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; @@ -31,6 +32,7 @@ import writely.tables.records.AssistantEvaluationRecord; import writely.tables.records.AssistantRecord; import writely.tables.records.AutoModifyMessageRecord; +import writely.tables.records.ChatMessageRecord; import writely.tables.records.FeedbackMessageRecord; import writely.tables.records.LoginAttemptRecord; import writely.tables.records.MemberPasswordRecord; @@ -63,6 +65,7 @@ public class Keys { public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); + public static final UniqueKey CHAT_MESSAGE_PK = Internal.createUniqueKey(ChatMessage.CHAT_MESSAGE, DSL.name("chat_message_pk"), new TableField[] { ChatMessage.CHAT_MESSAGE.ID }, true); public static final UniqueKey FEEDBACK_MESSAGE_PK = Internal.createUniqueKey(FeedbackMessage.FEEDBACK_MESSAGE, DSL.name("feedback_message_pk"), new TableField[] { FeedbackMessage.FEEDBACK_MESSAGE.ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); diff --git a/domain/src/main/generated/writely/Public.java b/domain/src/main/generated/writely/Public.java index 8bfe56d..676bc9d 100644 --- a/domain/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writely/Public.java @@ -17,6 +17,7 @@ import writely.tables.Assistant; import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; +import writely.tables.ChatMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; @@ -65,6 +66,11 @@ public class Public extends SchemaImpl { */ public final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * The table public.chat_message. + */ + public final ChatMessage CHAT_MESSAGE = ChatMessage.CHAT_MESSAGE; + /** * 피드백 메세지 */ @@ -203,6 +209,7 @@ public final List> getTables() { Assistant.ASSISTANT, AssistantEvaluation.ASSISTANT_EVALUATION, AutoModifyMessage.AUTO_MODIFY_MESSAGE, + ChatMessage.CHAT_MESSAGE, FeedbackMessage.FEEDBACK_MESSAGE, LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, diff --git a/domain/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java index 665c2d5..d9dfacc 100644 --- a/domain/src/main/generated/writely/Tables.java +++ b/domain/src/main/generated/writely/Tables.java @@ -11,6 +11,7 @@ import writely.tables.Assistant; import writely.tables.AssistantEvaluation; import writely.tables.AutoModifyMessage; +import writely.tables.ChatMessage; import writely.tables.FeedbackMessage; import writely.tables.LoginAttempt; import writely.tables.Member; @@ -52,6 +53,11 @@ public class Tables { */ public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; + /** + * The table public.chat_message. + */ + public static final ChatMessage CHAT_MESSAGE = ChatMessage.CHAT_MESSAGE; + /** * 피드백 메세지 */ diff --git a/domain/src/main/generated/writely/tables/ChatMessage.java b/domain/src/main/generated/writely/tables/ChatMessage.java new file mode 100644 index 0000000..7dffc0e --- /dev/null +++ b/domain/src/main/generated/writely/tables/ChatMessage.java @@ -0,0 +1,260 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writely.Keys; +import writely.Public; +import writely.tables.records.ChatMessageRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ChatMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.chat_message + */ + public static final ChatMessage CHAT_MESSAGE = new ChatMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ChatMessageRecord.class; + } + + /** + * The column public.chat_message.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); + + /** + * The column public.chat_message.assistant_id. + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.chat_message.role. + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, ""); + + /** + * The column public.chat_message.content. + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.chat_message.prompt. + */ + public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, ""); + + /** + * The column public.chat_message.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.chat_message.created_by. + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.chat_message.updated_at. + */ + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.chat_message.updated_by. + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); + + private ChatMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ChatMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.chat_message table reference + */ + public ChatMessage(String alias) { + this(DSL.name(alias), CHAT_MESSAGE); + } + + /** + * Create an aliased public.chat_message table reference + */ + public ChatMessage(Name alias) { + this(alias, CHAT_MESSAGE); + } + + /** + * Create a public.chat_message table reference + */ + public ChatMessage() { + this(DSL.name("chat_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.CHAT_MESSAGE_PK; + } + + @Override + public ChatMessage as(String alias) { + return new ChatMessage(DSL.name(alias), this); + } + + @Override + public ChatMessage as(Name alias) { + return new ChatMessage(alias, this); + } + + @Override + public ChatMessage as(Table alias) { + return new ChatMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ChatMessage rename(String name) { + return new ChatMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ChatMessage rename(Name name) { + return new ChatMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public ChatMessage rename(Table name) { + return new ChatMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage where(Condition condition) { + return new ChatMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ChatMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ChatMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ChatMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ChatMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ChatMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/pojos/ChatMessage.java b/domain/src/main/generated/writely/tables/pojos/ChatMessage.java new file mode 100644 index 0000000..02d65bf --- /dev/null +++ b/domain/src/main/generated/writely/tables/pojos/ChatMessage.java @@ -0,0 +1,226 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ChatMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID assistantId; + private final String role; + private final String content; + private final String prompt; + private final LocalDateTime createdAt; + private final UUID createdBy; + private final LocalDateTime updatedAt; + private final UUID updatedBy; + + public ChatMessage(ChatMessage value) { + this.id = value.id; + this.assistantId = value.assistantId; + this.role = value.role; + this.content = value.content; + this.prompt = value.prompt; + this.createdAt = value.createdAt; + this.createdBy = value.createdBy; + this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; + } + + public ChatMessage( + UUID id, + UUID assistantId, + String role, + String content, + String prompt, + LocalDateTime createdAt, + UUID createdBy, + LocalDateTime updatedAt, + UUID updatedBy + ) { + this.id = id; + this.assistantId = assistantId; + this.role = role; + this.content = content; + this.prompt = prompt; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + /** + * Getter for public.chat_message.id. + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.chat_message.assistant_id. + */ + public UUID getAssistantId() { + return this.assistantId; + } + + /** + * Getter for public.chat_message.role. + */ + public String getRole() { + return this.role; + } + + /** + * Getter for public.chat_message.content. + */ + public String getContent() { + return this.content; + } + + /** + * Getter for public.chat_message.prompt. + */ + public String getPrompt() { + return this.prompt; + } + + /** + * Getter for public.chat_message.created_at. + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Getter for public.chat_message.created_by. + */ + public UUID getCreatedBy() { + return this.createdBy; + } + + /** + * Getter for public.chat_message.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Getter for public.chat_message.updated_by. + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ChatMessage other = (ChatMessage) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; + if (this.role == null) { + if (other.role != null) + return false; + } + else if (!this.role.equals(other.role)) + return false; + if (this.content == null) { + if (other.content != null) + return false; + } + else if (!this.content.equals(other.content)) + return false; + if (this.prompt == null) { + if (other.prompt != null) + return false; + } + else if (!this.prompt.equals(other.prompt)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + if (this.createdBy == null) { + if (other.createdBy != null) + return false; + } + else if (!this.createdBy.equals(other.createdBy)) + return false; + if (this.updatedAt == null) { + if (other.updatedAt != null) + return false; + } + else if (!this.updatedAt.equals(other.updatedAt)) + return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); + result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); + result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); + result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); + result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ChatMessage ("); + + sb.append(id); + sb.append(", ").append(assistantId); + sb.append(", ").append(role); + sb.append(", ").append(content); + sb.append(", ").append(prompt); + sb.append(", ").append(createdAt); + sb.append(", ").append(createdBy); + sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java b/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java new file mode 100644 index 0000000..0964d13 --- /dev/null +++ b/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java @@ -0,0 +1,216 @@ +/* + * This file is generated by jOOQ. + */ +package writely.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writely.tables.ChatMessage; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ChatMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.chat_message.id. + */ + public ChatMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.chat_message.id. + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.chat_message.assistant_id. + */ + public ChatMessageRecord setAssistantId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.chat_message.assistant_id. + */ + public UUID getAssistantId() { + return (UUID) get(1); + } + + /** + * Setter for public.chat_message.role. + */ + public ChatMessageRecord setRole(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.chat_message.role. + */ + public String getRole() { + return (String) get(2); + } + + /** + * Setter for public.chat_message.content. + */ + public ChatMessageRecord setContent(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.chat_message.content. + */ + public String getContent() { + return (String) get(3); + } + + /** + * Setter for public.chat_message.prompt. + */ + public ChatMessageRecord setPrompt(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.chat_message.prompt. + */ + public String getPrompt() { + return (String) get(4); + } + + /** + * Setter for public.chat_message.created_at. + */ + public ChatMessageRecord setCreatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.chat_message.created_at. + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.chat_message.created_by. + */ + public ChatMessageRecord setCreatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.chat_message.created_by. + */ + public UUID getCreatedBy() { + return (UUID) get(6); + } + + /** + * Setter for public.chat_message.updated_at. + */ + public ChatMessageRecord setUpdatedAt(LocalDateTime value) { + set(7, value); + return this; + } + + /** + * Getter for public.chat_message.updated_at. + */ + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(7); + } + + /** + * Setter for public.chat_message.updated_by. + */ + public ChatMessageRecord setUpdatedBy(UUID value) { + set(8, value); + return this; + } + + /** + * Getter for public.chat_message.updated_by. + */ + public UUID getUpdatedBy() { + return (UUID) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ChatMessageRecord + */ + public ChatMessageRecord() { + super(ChatMessage.CHAT_MESSAGE); + } + + /** + * Create a detached, initialised ChatMessageRecord + */ + public ChatMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + super(ChatMessage.CHAT_MESSAGE); + + setId(id); + setAssistantId(assistantId); + setRole(role); + setContent(content); + setPrompt(prompt); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ChatMessageRecord + */ + public ChatMessageRecord(writely.tables.pojos.ChatMessage value) { + super(ChatMessage.CHAT_MESSAGE); + + if (value != null) { + setId(value.getId()); + setAssistantId(value.getAssistantId()); + setRole(value.getRole()); + setContent(value.getContent()); + setPrompt(value.getPrompt()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java new file mode 100644 index 0000000..34770c6 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java @@ -0,0 +1,44 @@ +package writeon.domain.assistant.chat; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.assistant.MessageContent; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.domain.common.BaseAuditTimeEntity; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "chat_message") +public class ChatMessage extends BaseAuditTimeEntity { + + @Id + @Column(updatable = false, nullable = false) + private final UUID id = UUID.randomUUID(); + + @Column(name = "assistant_id", nullable = false) + private UUID assistantId; + + @Embedded + private MessageContent messageContent; + + @Column(name = "prompt", nullable = false) + private String prompt; + + public ChatMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { + this.assistantId = assistantId; + this.messageContent = new MessageContent(role, content); + this.prompt = prompt; + } + + public MessageSenderRole getRole() { + return messageContent.getRole(); + } + + public String getContent() { + return messageContent.getContent(); + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java new file mode 100644 index 0000000..48f2b44 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java @@ -0,0 +1,14 @@ +package writeon.domain.assistant.chat; + +import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.assistant.enums.MessageSenderRole; + +import java.util.Optional; +import java.util.UUID; + +public interface ChatMessageJpaRepository extends JpaRepository { + + boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); + + Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); +} From d3eb7928d8fe2b64563562411a9d036ad68f1260 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 22 Mar 2025 23:00:22 +0900 Subject: [PATCH 050/107] =?UTF-8?q?feat:=20let's=20encrypt=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EC=9D=B8=EC=A6=9D=EC=84=9C=20=EA=B0=B1=EC=8B=A0=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20(#49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 +- .../schedule-for-refresh-certification.yml | 47 +++++++++++++++++++ BE-secret | 2 +- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/schedule-for-refresh-certification.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d983fc7..3b00433 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -57,9 +57,9 @@ jobs: --parameters commands='[ "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }}", "cd /root", - "[ $(docker ps --filter 'publish=8080' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=8080' -q)", + "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", "[ $(docker images -q ${{ secrets.ECR_REGISTRY_URI }}:latest | wc -l) -gt 0 ] && docker rmi ${{ secrets.ECR_REGISTRY_URI }}:latest", "docker pull ${{ secrets.ECR_REGISTRY_URI }}:latest", - "docker run --rm -d -p 8080:8080 --name writely-api -v /writely/logs:/writely/logs ${{ secrets.ECR_REGISTRY_URI }}:latest" + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:latest" ]' \ --comment "Deploying Docker container" \ No newline at end of file diff --git a/.github/workflows/schedule-for-refresh-certification.yml b/.github/workflows/schedule-for-refresh-certification.yml new file mode 100644 index 0000000..318f044 --- /dev/null +++ b/.github/workflows/schedule-for-refresh-certification.yml @@ -0,0 +1,47 @@ +name: Schedule for refresh certification + +on: + schedule: + - cron: "0 0 */2 * *" + workflow_dispatch: + +jobs: + run-script: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Refresh let's encrypt certification + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ + --parameters commands='[ + "docker run -it --rm --name writeon-certbot -p 80:80 -v \"/etc/letsencrypt:/etc/letsencrypt\" -v \"/var/lib/letsencrypt:/var/lib/letsencrypt\" certbot/certbot certonly --standalone --force-renewal -d dev-api.writeon.ai.kr", + "sudo su", + "cd /etc/letsencrypt/live/dev-api.writeon.ai.kr", + "openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -CAfile chain.pem -caname root -password pass:${{ secrets.TLS_KEYSTORE_PASSWORD }}" + ]' \ + --comment "Refresh let's encrypt certification" + + - name: Login to Amazon ECR + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }} + + - name: Restart API Server + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ + --parameters commands='[ + "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:latest" + ]' \ + --comment "Restart API Server for apply new certification" \ No newline at end of file diff --git a/BE-secret b/BE-secret index b2ccdfe..cdfc193 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit b2ccdfe61928033eb8d7919e935ae521baee9155 +Subproject commit cdfc19302bdbb7cab7cee8e23a5603e85912f97e From 0573cac3b70bb8a44366c22fbd3d903172b67772 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 22 Mar 2025 23:58:23 +0900 Subject: [PATCH 051/107] feat: Integrate research API with chat service (#50) --- .../controller/AssistantController.java | 7 +- .../api/assistant/service/ChatService.java | 27 ++ .../assistant/service/ResearchService.java | 51 ---- .../request/ResearchRequest.java | 8 +- domain/src/main/generated/writely/Keys.java | 3 - domain/src/main/generated/writely/Public.java | 7 - domain/src/main/generated/writely/Tables.java | 6 - .../writely/tables/ResearchMessage.java | 260 ------------------ .../writely/tables/pojos/ResearchMessage.java | 226 --------------- .../tables/records/ResearchMessageRecord.java | 216 --------------- .../assistant/research/ResearchMessage.java | 44 --- .../ResearchMessageJpaRepository.java | 8 - 12 files changed, 35 insertions(+), 828 deletions(-) delete mode 100644 api/src/main/java/writeon/api/assistant/service/ResearchService.java delete mode 100644 domain/src/main/generated/writely/tables/ResearchMessage.java delete mode 100644 domain/src/main/generated/writely/tables/pojos/ResearchMessage.java delete mode 100644 domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 5aa03a2..2d3f7e7 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -27,7 +27,6 @@ public class AssistantController { private final ChatService chatService; private final FeedbackService feedbackService; private final UserModifyService userModifyService; - private final ResearchService researchService; @Operation(summary = "자동 수정 메세지 저장") @PostMapping("/auto-modify/messages") @@ -59,10 +58,10 @@ public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserM return userModifyService.createMessage(request); } - @Operation(summary = "검색") - @PostMapping("/research") + @Operation(summary = "자유 대화 - 웹 검색 모드") + @PostMapping("/chat/research") public AssistantResponse research(@RequestBody AssistantResearchRequest request) { - return researchService.research(request); + return chatService.research(request); } @Operation(summary = "자동 수정 스트리밍") diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index 97c552a..96c8654 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -5,12 +5,15 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.ChatRequest; +import writeon.assistantapiclient.request.ResearchRequest; import writeon.assistantapiclient.request.UserSetting; import writeon.domain.assistant.Assistant; import writeon.domain.assistant.chat.ChatMessage; @@ -88,6 +91,30 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { return emitter; } + @Transactional + public AssistantResponse research(AssistantResearchRequest request) { + productQueryService.verifyExist(request.getProductId()); + + // assistant 및 message 생성 + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.RESEARCH); + ChatMessage memberMessage = + new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + chatMessageRepository.save(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + ResearchRequest researchRequest = new ResearchRequest(userSetting, request.getContent(), request.getPrompt(), request.getSessionId()); + + // 웹 검색 요청 + String answer = assistantApiClient.research(researchRequest).block(); + + // assistant 응답 저장 + ChatMessage assistantMessage = + new ChatMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null); + chatMessageRepository.save(assistantMessage); + + return new AssistantResponse(assistantId, answer); + } + private ChatMessage getMemberMessage(UUID assistantId) { return chatMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); diff --git a/api/src/main/java/writeon/api/assistant/service/ResearchService.java b/api/src/main/java/writeon/api/assistant/service/ResearchService.java deleted file mode 100644 index 554f99f..0000000 --- a/api/src/main/java/writeon/api/assistant/service/ResearchService.java +++ /dev/null @@ -1,51 +0,0 @@ -package writeon.api.assistant.service; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import writeon.api.assistant.request.AssistantResearchRequest; -import writeon.api.assistant.response.AssistantResponse; -import writeon.api.product.service.ProductQueryService; -import writeon.assistantapiclient.AssistantApiClient; -import writeon.assistantapiclient.request.ResearchRequest; -import writeon.assistantapiclient.request.UserSetting; -import writeon.domain.assistant.enums.AssistantType; -import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.assistant.research.ResearchMessage; -import writeon.domain.assistant.research.ResearchMessageJpaRepository; - -import java.util.UUID; - -@Service -@RequiredArgsConstructor -public class ResearchService { - - private final ResearchMessageJpaRepository researchMessageRepository; - private final AssistantApiClient assistantApiClient; - private final AssistantService assistantService; - private final ProductQueryService productQueryService; - - @Transactional - public AssistantResponse research(AssistantResearchRequest request) { - productQueryService.verifyExist(request.getProductId()); - - // assistant 및 message 생성 - UUID assistantId = assistantService.create(request.getProductId(), AssistantType.RESEARCH); - ResearchMessage memberMessage = - new ResearchMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); - researchMessageRepository.save(memberMessage); - - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); - ResearchRequest researchRequest = new ResearchRequest(request.getSessionId(), userSetting, request.getPrompt()); - - // 자유 대화 요청 - String answer = assistantApiClient.research(researchRequest).block(); - - // assistant 응답 저장 - ResearchMessage assistantMessage = - new ResearchMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null); - researchMessageRepository.save(assistantMessage); - - return new AssistantResponse(assistantId, answer); - } -} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java index 9164a4f..2c5c6a9 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/ResearchRequest.java @@ -8,13 +8,15 @@ @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class ResearchRequest { - private final String sessionId; private final UserSetting userSetting; private final String query; + private final String userInput; + private final String sessionId; - public ResearchRequest(String sessionId, UserSetting userSetting, String query) { - this.sessionId = sessionId; + public ResearchRequest(UserSetting userSetting, String query, String userInput, String sessionId) { this.userSetting = userSetting; this.query = query; + this.userInput = userInput; + this.sessionId = sessionId; } } diff --git a/domain/src/main/generated/writely/Keys.java b/domain/src/main/generated/writely/Keys.java index 59c6c0b..e971ef4 100644 --- a/domain/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writely/Keys.java @@ -25,7 +25,6 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; -import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.UserModifyMessage; @@ -45,7 +44,6 @@ import writely.tables.records.ProductRecord; import writely.tables.records.ProductSynopsisRecord; import writely.tables.records.ProductWorldviewRecord; -import writely.tables.records.ResearchMessageRecord; import writely.tables.records.TermsAgreementRecord; import writely.tables.records.TermsRecord; import writely.tables.records.UserModifyMessageRecord; @@ -80,7 +78,6 @@ public class Keys { public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); public static final UniqueKey PRODUCT_SYNOPSIS_PK = Internal.createUniqueKey(ProductSynopsis.PRODUCT_SYNOPSIS, DSL.name("product_synopsis_pk"), new TableField[] { ProductSynopsis.PRODUCT_SYNOPSIS.ID }, true); public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); - public static final UniqueKey RESEARCH_MESSAGE_PK = Internal.createUniqueKey(ResearchMessage.RESEARCH_MESSAGE, DSL.name("research_message_pk"), new TableField[] { ResearchMessage.RESEARCH_MESSAGE.ID }, true); public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); public static final UniqueKey TERMS_AGREEMENT_PK = Internal.createUniqueKey(TermsAgreement.TERMS_AGREEMENT, DSL.name("terms_agreement_pk"), new TableField[] { TermsAgreement.TERMS_AGREEMENT.TERMS_CD, TermsAgreement.TERMS_AGREEMENT.MEMBER_ID }, true); public static final UniqueKey USER_MODIFY_MESSAGE_PK = Internal.createUniqueKey(UserModifyMessage.USER_MODIFY_MESSAGE, DSL.name("user_modify_message_pk"), new TableField[] { UserModifyMessage.USER_MODIFY_MESSAGE.ID }, true); diff --git a/domain/src/main/generated/writely/Public.java b/domain/src/main/generated/writely/Public.java index 676bc9d..9569f3b 100644 --- a/domain/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writely/Public.java @@ -31,7 +31,6 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; -import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.UserModifyMessage; @@ -170,11 +169,6 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; - /** - * 자유 대화 메세지 - */ - public final ResearchMessage RESEARCH_MESSAGE = ResearchMessage.RESEARCH_MESSAGE; - /** * 약관 */ @@ -223,7 +217,6 @@ public final List> getTables() { ProductPlot.PRODUCT_PLOT, ProductSynopsis.PRODUCT_SYNOPSIS, ProductWorldview.PRODUCT_WORLDVIEW, - ResearchMessage.RESEARCH_MESSAGE, Terms.TERMS, TermsAgreement.TERMS_AGREEMENT, UserModifyMessage.USER_MODIFY_MESSAGE diff --git a/domain/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java index d9dfacc..fddf66f 100644 --- a/domain/src/main/generated/writely/Tables.java +++ b/domain/src/main/generated/writely/Tables.java @@ -25,7 +25,6 @@ import writely.tables.ProductPlot; import writely.tables.ProductSynopsis; import writely.tables.ProductWorldview; -import writely.tables.ResearchMessage; import writely.tables.Terms; import writely.tables.TermsAgreement; import writely.tables.UserModifyMessage; @@ -157,11 +156,6 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; - /** - * 자유 대화 메세지 - */ - public static final ResearchMessage RESEARCH_MESSAGE = ResearchMessage.RESEARCH_MESSAGE; - /** * 약관 */ diff --git a/domain/src/main/generated/writely/tables/ResearchMessage.java b/domain/src/main/generated/writely/tables/ResearchMessage.java deleted file mode 100644 index 7605115..0000000 --- a/domain/src/main/generated/writely/tables/ResearchMessage.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.ResearchMessageRecord; - - -/** - * 자유 대화 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ResearchMessage extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.research_message - */ - public static final ResearchMessage RESEARCH_MESSAGE = new ResearchMessage(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return ResearchMessageRecord.class; - } - - /** - * The column public.research_message.id. 자유 대화 메세지 ID - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "자유 대화 메세지 ID"); - - /** - * The column public.research_message.assistant_id. 어시스턴트 ID - */ - public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); - - /** - * The column public.research_message.role. 메세지 송신자 - */ - public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); - - /** - * The column public.research_message.content. 내용 - */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, "내용"); - - /** - * The column public.research_message.prompt. 프롬프트 - */ - public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, "프롬프트"); - - /** - * The column public.research_message.created_at. 생성일시 - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); - - /** - * The column public.research_message.created_by. 생성자 ID - */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); - - /** - * The column public.research_message.updated_at. 수정일시 - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); - - /** - * The column public.research_message.updated_by. 수정자 ID - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); - - private ResearchMessage(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private ResearchMessage(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("자유 대화 메세지"), TableOptions.table(), where); - } - - /** - * Create an aliased public.research_message table reference - */ - public ResearchMessage(String alias) { - this(DSL.name(alias), RESEARCH_MESSAGE); - } - - /** - * Create an aliased public.research_message table reference - */ - public ResearchMessage(Name alias) { - this(alias, RESEARCH_MESSAGE); - } - - /** - * Create a public.research_message table reference - */ - public ResearchMessage() { - this(DSL.name("research_message"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.RESEARCH_MESSAGE_PK; - } - - @Override - public ResearchMessage as(String alias) { - return new ResearchMessage(DSL.name(alias), this); - } - - @Override - public ResearchMessage as(Name alias) { - return new ResearchMessage(alias, this); - } - - @Override - public ResearchMessage as(Table alias) { - return new ResearchMessage(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public ResearchMessage rename(String name) { - return new ResearchMessage(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public ResearchMessage rename(Name name) { - return new ResearchMessage(name, null); - } - - /** - * Rename this table - */ - @Override - public ResearchMessage rename(Table name) { - return new ResearchMessage(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage where(Condition condition) { - return new ResearchMessage(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ResearchMessage where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ResearchMessage where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ResearchMessage where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ResearchMessage where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ResearchMessage whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java b/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java deleted file mode 100644 index 1036b51..0000000 --- a/domain/src/main/generated/writely/tables/pojos/ResearchMessage.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.pojos; - - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - - -/** - * 자유 대화 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ResearchMessage implements Serializable { - - private static final long serialVersionUID = 1L; - - private final UUID id; - private final UUID assistantId; - private final String role; - private final String content; - private final String prompt; - private final LocalDateTime createdAt; - private final UUID createdBy; - private final LocalDateTime updatedAt; - private final UUID updatedBy; - - public ResearchMessage(ResearchMessage value) { - this.id = value.id; - this.assistantId = value.assistantId; - this.role = value.role; - this.content = value.content; - this.prompt = value.prompt; - this.createdAt = value.createdAt; - this.createdBy = value.createdBy; - this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; - } - - public ResearchMessage( - UUID id, - UUID assistantId, - String role, - String content, - String prompt, - LocalDateTime createdAt, - UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy - ) { - this.id = id; - this.assistantId = assistantId; - this.role = role; - this.content = content; - this.prompt = prompt; - this.createdAt = createdAt; - this.createdBy = createdBy; - this.updatedAt = updatedAt; - this.updatedBy = updatedBy; - } - - /** - * Getter for public.research_message.id. 자유 대화 메세지 ID - */ - public UUID getId() { - return this.id; - } - - /** - * Getter for public.research_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return this.assistantId; - } - - /** - * Getter for public.research_message.role. 메세지 송신자 - */ - public String getRole() { - return this.role; - } - - /** - * Getter for public.research_message.content. 내용 - */ - public String getContent() { - return this.content; - } - - /** - * Getter for public.research_message.prompt. 프롬프트 - */ - public String getPrompt() { - return this.prompt; - } - - /** - * Getter for public.research_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return this.createdAt; - } - - /** - * Getter for public.research_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return this.createdBy; - } - - /** - * Getter for public.research_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Getter for public.research_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final ResearchMessage other = (ResearchMessage) obj; - if (this.id == null) { - if (other.id != null) - return false; - } - else if (!this.id.equals(other.id)) - return false; - if (this.assistantId == null) { - if (other.assistantId != null) - return false; - } - else if (!this.assistantId.equals(other.assistantId)) - return false; - if (this.role == null) { - if (other.role != null) - return false; - } - else if (!this.role.equals(other.role)) - return false; - if (this.content == null) { - if (other.content != null) - return false; - } - else if (!this.content.equals(other.content)) - return false; - if (this.prompt == null) { - if (other.prompt != null) - return false; - } - else if (!this.prompt.equals(other.prompt)) - return false; - if (this.createdAt == null) { - if (other.createdAt != null) - return false; - } - else if (!this.createdAt.equals(other.createdAt)) - return false; - if (this.createdBy == null) { - if (other.createdBy != null) - return false; - } - else if (!this.createdBy.equals(other.createdBy)) - return false; - if (this.updatedAt == null) { - if (other.updatedAt != null) - return false; - } - else if (!this.updatedAt.equals(other.updatedAt)) - return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); - result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); - result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); - result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); - result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); - result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); - result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("ResearchMessage ("); - - sb.append(id); - sb.append(", ").append(assistantId); - sb.append(", ").append(role); - sb.append(", ").append(content); - sb.append(", ").append(prompt); - sb.append(", ").append(createdAt); - sb.append(", ").append(createdBy); - sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java b/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java deleted file mode 100644 index 45da83f..0000000 --- a/domain/src/main/generated/writely/tables/records/ResearchMessageRecord.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; - -import writely.tables.ResearchMessage; - - -/** - * 자유 대화 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ResearchMessageRecord extends UpdatableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.research_message.id. 자유 대화 메세지 ID - */ - public ResearchMessageRecord setId(UUID value) { - set(0, value); - return this; - } - - /** - * Getter for public.research_message.id. 자유 대화 메세지 ID - */ - public UUID getId() { - return (UUID) get(0); - } - - /** - * Setter for public.research_message.assistant_id. 어시스턴트 ID - */ - public ResearchMessageRecord setAssistantId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.research_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return (UUID) get(1); - } - - /** - * Setter for public.research_message.role. 메세지 송신자 - */ - public ResearchMessageRecord setRole(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.research_message.role. 메세지 송신자 - */ - public String getRole() { - return (String) get(2); - } - - /** - * Setter for public.research_message.content. 내용 - */ - public ResearchMessageRecord setContent(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.research_message.content. 내용 - */ - public String getContent() { - return (String) get(3); - } - - /** - * Setter for public.research_message.prompt. 프롬프트 - */ - public ResearchMessageRecord setPrompt(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.research_message.prompt. 프롬프트 - */ - public String getPrompt() { - return (String) get(4); - } - - /** - * Setter for public.research_message.created_at. 생성일시 - */ - public ResearchMessageRecord setCreatedAt(LocalDateTime value) { - set(5, value); - return this; - } - - /** - * Getter for public.research_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); - } - - /** - * Setter for public.research_message.created_by. 생성자 ID - */ - public ResearchMessageRecord setCreatedBy(UUID value) { - set(6, value); - return this; - } - - /** - * Getter for public.research_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return (UUID) get(6); - } - - /** - * Setter for public.research_message.updated_at. 수정일시 - */ - public ResearchMessageRecord setUpdatedAt(LocalDateTime value) { - set(7, value); - return this; - } - - /** - * Getter for public.research_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); - } - - /** - * Setter for public.research_message.updated_by. 수정자 ID - */ - public ResearchMessageRecord setUpdatedBy(UUID value) { - set(8, value); - return this; - } - - /** - * Getter for public.research_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return (UUID) get(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached ResearchMessageRecord - */ - public ResearchMessageRecord() { - super(ResearchMessage.RESEARCH_MESSAGE); - } - - /** - * Create a detached, initialised ResearchMessageRecord - */ - public ResearchMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { - super(ResearchMessage.RESEARCH_MESSAGE); - - setId(id); - setAssistantId(assistantId); - setRole(role); - setContent(content); - setPrompt(prompt); - setCreatedAt(createdAt); - setCreatedBy(createdBy); - setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised ResearchMessageRecord - */ - public ResearchMessageRecord(writely.tables.pojos.ResearchMessage value) { - super(ResearchMessage.RESEARCH_MESSAGE); - - if (value != null) { - setId(value.getId()); - setAssistantId(value.getAssistantId()); - setRole(value.getRole()); - setContent(value.getContent()); - setPrompt(value.getPrompt()); - setCreatedAt(value.getCreatedAt()); - setCreatedBy(value.getCreatedBy()); - setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java deleted file mode 100644 index 5e47d83..0000000 --- a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessage.java +++ /dev/null @@ -1,44 +0,0 @@ -package writeon.domain.assistant.research; - -import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.assistant.MessageContent; -import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.common.BaseAuditTimeEntity; - -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor -@Table(name = "research_message") -public class ResearchMessage extends BaseAuditTimeEntity { - - @Id - @Column(updatable = false, nullable = false) - private final UUID id = UUID.randomUUID(); - - @Column(name = "assistant_id", nullable = false) - private UUID assistantId; - - @Embedded - private MessageContent messageContent; - - @Column(name = "prompt") - private String prompt; - - public ResearchMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { - this.assistantId = assistantId; - this.messageContent = new MessageContent(role, content); - this.prompt = prompt; - } - - public MessageSenderRole getRole() { - return messageContent.getRole(); - } - - public String getContent() { - return messageContent.getContent(); - } -} diff --git a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java deleted file mode 100644 index 0f49154..0000000 --- a/domain/src/main/java/writeon/domain/assistant/research/ResearchMessageJpaRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package writeon.domain.assistant.research; - -import org.springframework.data.jpa.repository.JpaRepository; - -import java.util.UUID; - -public interface ResearchMessageJpaRepository extends JpaRepository { -} From 8c525b3afdf2e4aecf4f2120685ed02acd663eab Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 23 Mar 2025 02:14:13 +0900 Subject: [PATCH 052/107] feat: Apply security to product and assistant APIs (#51) --- .../assistant/service/AssistantService.java | 5 ++-- .../api/common/audit/CustomAuditorAware.java | 4 ++- .../writeon/api/common/util/MemberUtil.java | 25 +++++++++++++++++++ .../api/product/repository/ProductDao.java | 2 ++ .../service/ProductCommandService.java | 15 ++++------- .../product/service/ProductQueryService.java | 5 ++-- .../assistant/AssistantJpaRepository.java | 5 ++++ .../writeon/domain/common/MemberSession.java | 2 +- .../repository/ProductJpaRepository.java | 5 ++++ .../repository/ProductMemoJpaRepository.java | 3 +++ 10 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 api/src/main/java/writeon/api/common/util/MemberUtil.java diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 4687ecf..9dfdb57 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -5,6 +5,7 @@ import org.springframework.transaction.annotation.Transactional; import writeon.api.assistant.request.AssistantCompletedRequest; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.MemberUtil; import writeon.domain.assistant.Assistant; import writeon.domain.assistant.AssistantJpaRepository; import writeon.domain.assistant.enums.AssistantException; @@ -45,13 +46,13 @@ public void modifyStatus(UUID assistantId, AssistantStatus status) { @Transactional(readOnly = true) public Assistant getById(UUID assistantId) { - return assistantRepository.findById(assistantId) + return assistantRepository.findByIdAndCreatedBy(assistantId, MemberUtil.getMemberId()) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); } @Transactional(readOnly = true) public void verifyExist(UUID assistantId) { - if (!assistantRepository.existsById(assistantId)) { + if (!assistantRepository.existsByIdAndCreatedBy(assistantId, MemberUtil.getMemberId())) { throw new BaseException(AssistantException.NOT_EXIST); } } diff --git a/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java b/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java index 3f865de..832fcfe 100644 --- a/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java +++ b/api/src/main/java/writeon/api/common/audit/CustomAuditorAware.java @@ -1,6 +1,7 @@ package writeon.api.common.audit; import org.springframework.data.domain.AuditorAware; +import writeon.api.common.util.MemberUtil; import java.util.Optional; import java.util.UUID; @@ -9,6 +10,7 @@ public class CustomAuditorAware implements AuditorAware { @Override public Optional getCurrentAuditor() { - return Optional.of(UUID.randomUUID()); + UUID memberId = MemberUtil.getMemberId(); + return memberId != null ? Optional.of(memberId) : Optional.empty(); } } diff --git a/api/src/main/java/writeon/api/common/util/MemberUtil.java b/api/src/main/java/writeon/api/common/util/MemberUtil.java new file mode 100644 index 0000000..06541e6 --- /dev/null +++ b/api/src/main/java/writeon/api/common/util/MemberUtil.java @@ -0,0 +1,25 @@ +package writeon.api.common.util; + +import lombok.experimental.UtilityClass; +import org.springframework.security.core.context.SecurityContextHolder; +import writeon.domain.common.MemberSession; + +import java.util.UUID; + +@UtilityClass +public class MemberUtil { + + public MemberSession getMember() { + if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() instanceof MemberSession member) { + return member; + } + return null; + } + + public UUID getMemberId() { + if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() instanceof MemberSession member) { + return member.getMemberId(); + } + return null; + } +} diff --git a/api/src/main/java/writeon/api/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java index 8662606..8dadeef 100644 --- a/api/src/main/java/writeon/api/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -1,5 +1,6 @@ package writeon.api.product.repository; +import writeon.api.common.util.MemberUtil; import writeon.api.product.response.ProductResponse; import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; @@ -23,6 +24,7 @@ public List select() { .from(PRODUCT) .leftJoin(PRODUCT_SYNOPSIS) .on(PRODUCT.ID.eq(PRODUCT_SYNOPSIS.ID)) + .where(PRODUCT.CREATED_BY.eq(MemberUtil.getMemberId())) .orderBy(PRODUCT.UPDATED_AT.desc()) .fetchInto(ProductResponse.class); } diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 504a6e9..7cdc263 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -5,6 +5,7 @@ import org.springframework.transaction.annotation.Transactional; import writeon.api.assistant.service.DocumentUploadService; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.MemberUtil; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; @@ -40,7 +41,7 @@ public UUID create() { @Transactional public void createMemo(UUID productId, ProductMemoSaveRequest request) { - verifyExistProduct(productId); + productQueryService.verifyExist(productId); productMemoRepository.save(new ProductMemo(productId, request.getContent(), request.getSelectedText(), request.getStartIndex(), request.getEndIndex())); @@ -73,7 +74,7 @@ public UUID save(UUID productId, ProductSaveRequest request) { @Transactional public void modifyMemo(UUID productId, UUID memoId, ProductMemoSaveRequest request) { - verifyExistProduct(productId); + productQueryService.verifyExist(productId); ProductMemo memo = getMemoById(memoId); @@ -83,7 +84,7 @@ public void modifyMemo(UUID productId, UUID memoId, ProductMemoSaveRequest reque @Transactional public void deleteMemo(UUID productId, UUID memoId) { - verifyExistProduct(productId); + productQueryService.verifyExist(productId); ProductMemo memo = getMemoById(memoId); @@ -91,7 +92,7 @@ public void deleteMemo(UUID productId, UUID memoId) { } private ProductMemo getMemoById(UUID memoId) { - return productMemoRepository.findById(memoId) + return productMemoRepository.findByIdAndCreatedBy(memoId, MemberUtil.getMemberId()) .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); } @@ -256,10 +257,4 @@ private void modifyWorldview(Product product, ProductTemplateSaveRequest.Worldvi requestInfo.getCustomFields(), savedWorldview.getCustomFields()); } } - - private void verifyExistProduct(UUID productId) { - if (!productRepository.existsById(productId)) { - throw new BaseException(ProductException.NOT_EXIST); - } - } } diff --git a/api/src/main/java/writeon/api/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java index e41aeae..d45c71d 100644 --- a/api/src/main/java/writeon/api/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.MemberUtil; import writeon.api.product.repository.ProductDao; import writeon.api.product.response.ProductDetailResponse; import writeon.api.product.response.ProductMemoResponse; @@ -35,7 +36,7 @@ public List getList() { } public Product getById(UUID productId) { - return productRepository.findById(productId) + return productRepository.findByIdAndCreatedBy(productId, MemberUtil.getMemberId()) .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST)); } @@ -53,7 +54,7 @@ public List getMemos(UUID productId) { } public void verifyExist(UUID productId) { - if (!productRepository.existsById(productId)) { + if (!productRepository.existsByIdAndCreatedBy(productId, MemberUtil.getMemberId())) { throw new BaseException(ProductException.NOT_EXIST); } } diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java index a8b39a7..d4b8d9b 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java @@ -2,7 +2,12 @@ import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; import java.util.UUID; public interface AssistantJpaRepository extends JpaRepository { + + Optional findByIdAndCreatedBy(UUID assistantId, UUID createdBy); + + boolean existsByIdAndCreatedBy(UUID assistantId, UUID createdBy); } diff --git a/domain/src/main/java/writeon/domain/common/MemberSession.java b/domain/src/main/java/writeon/domain/common/MemberSession.java index 4ea66c3..2a6bc0f 100644 --- a/domain/src/main/java/writeon/domain/common/MemberSession.java +++ b/domain/src/main/java/writeon/domain/common/MemberSession.java @@ -29,7 +29,7 @@ public String getPassword() { @Override public String getUsername() { - return null; + return memberId.toString(); } @Override diff --git a/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java index 0b68e0a..c0f48ce 100644 --- a/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductJpaRepository.java @@ -3,7 +3,12 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.product.Product; +import java.util.Optional; import java.util.UUID; public interface ProductJpaRepository extends JpaRepository { + + Optional findByIdAndCreatedBy(UUID productId, UUID createdBy); + + boolean existsByIdAndCreatedBy(UUID productId, UUID createdBy); } diff --git a/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java index 0025fd2..25a42be 100644 --- a/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java +++ b/domain/src/main/java/writeon/domain/product/repository/ProductMemoJpaRepository.java @@ -3,7 +3,10 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.product.ProductMemo; +import java.util.Optional; import java.util.UUID; public interface ProductMemoJpaRepository extends JpaRepository { + + Optional findByIdAndCreatedBy(UUID memoId, UUID createdBy); } From 110062f2b9c84f56f8d8ca0dd2d26c92cad29afd Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 23 Mar 2025 12:52:19 +0900 Subject: [PATCH 053/107] =?UTF-8?q?fix:=20cert=20=EA=B0=B1=EC=8B=A0=20?= =?UTF-8?q?=EC=8A=A4=EC=BC=80=EC=A5=B4=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/schedule-for-refresh-certification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/schedule-for-refresh-certification.yml b/.github/workflows/schedule-for-refresh-certification.yml index 318f044..c6b0368 100644 --- a/.github/workflows/schedule-for-refresh-certification.yml +++ b/.github/workflows/schedule-for-refresh-certification.yml @@ -2,7 +2,7 @@ name: Schedule for refresh certification on: schedule: - - cron: "0 0 */2 * *" + - cron: "0 15 1 */2 *" workflow_dispatch: jobs: From c278fe26188eb84e7dedc0b2db741d4c9f363a3f Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 23 Mar 2025 13:11:39 +0900 Subject: [PATCH 054/107] feat: add auth header button to swagger (#53) --- .../api/common/config/SwaggerConfig.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 api/src/main/java/writeon/api/common/config/SwaggerConfig.java diff --git a/api/src/main/java/writeon/api/common/config/SwaggerConfig.java b/api/src/main/java/writeon/api/common/config/SwaggerConfig.java new file mode 100644 index 0000000..14d8c1f --- /dev/null +++ b/api/src/main/java/writeon/api/common/config/SwaggerConfig.java @@ -0,0 +1,28 @@ +package writeon.api.common.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Arrays; +import java.util.Collections; + +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI openAPI(){ + SecurityScheme securityScheme = new SecurityScheme() + .type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT") + .in(SecurityScheme.In.HEADER).name("Authorization"); + SecurityRequirement securityRequirement = new SecurityRequirement().addList("bearer token"); + + return new OpenAPI() + .components(new Components().addSecuritySchemes("bearer token", securityScheme)) + .security(Collections.singletonList(securityRequirement)); + } + +} From 94f7be984a052cf29acb11d965e8e70199558939 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Tue, 25 Mar 2025 22:10:54 +0900 Subject: [PATCH 055/107] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=B3=80=EA=B2=BD=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#54)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/main/resources/templates/mail/change-password.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/resources/templates/mail/change-password.html b/api/src/main/resources/templates/mail/change-password.html index 8c16d87..e4ec10e 100644 --- a/api/src/main/resources/templates/mail/change-password.html +++ b/api/src/main/resources/templates/mail/change-password.html @@ -10,7 +10,7 @@

비밀번호 재설정을 요청하셨나요? 아래 링크를 클릭하여 새 비밀번호를 설정해 주세요.
- 비밀번호 재설정하기 + 비밀번호 재설정하기

⚠️보안 주의사항 From aa5f1e313fa7c245ab91ebb03dc29f8d60020a12 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 26 Mar 2025 21:27:07 +0900 Subject: [PATCH 056/107] =?UTF-8?q?feat:=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=EC=A1=B0=ED=9A=8C=20API=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95=20(#55)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: 닉네임 중복조회 API 추가 fix: 닉네임 관련 기획 수정내용 반영 비밀번호 관련 Bcrypt 사용 --- .../api/auth/controller/AuthController.java | 7 ++++ .../auth/request/CheckNicknameRequest.java | 16 ++++++++ .../writeon/api/auth/request/JoinRequest.java | 4 +- .../auth/response/CheckNicknameResponse.java | 16 ++++++++ .../api/auth/service/AuthCommandService.java | 38 ++++++++++-------- .../api/auth/service/AuthQueryService.java | 7 ++++ .../api/common/validation/IsNickname.java | 20 ++++++++++ .../validation/IsNicknameValidator.java | 40 +++++++++++++++++++ .../domain/auth/enums/AuthException.java | 4 +- .../repository/MemberJpaRepository.java | 1 + .../MemberPasswordJpaRepository.java | 3 +- sql/init.sql | 2 +- 12 files changed, 137 insertions(+), 21 deletions(-) create mode 100644 api/src/main/java/writeon/api/auth/request/CheckNicknameRequest.java create mode 100644 api/src/main/java/writeon/api/auth/response/CheckNicknameResponse.java create mode 100644 api/src/main/java/writeon/api/common/validation/IsNickname.java create mode 100644 api/src/main/java/writeon/api/common/validation/IsNicknameValidator.java diff --git a/api/src/main/java/writeon/api/auth/controller/AuthController.java b/api/src/main/java/writeon/api/auth/controller/AuthController.java index fc0980d..d4b9a90 100644 --- a/api/src/main/java/writeon/api/auth/controller/AuthController.java +++ b/api/src/main/java/writeon/api/auth/controller/AuthController.java @@ -76,4 +76,11 @@ public CheckEmailResponse checkEmail(@Valid CheckEmailRequest request) { return authQueryService.checkEmail(request); } + + @Operation(summary = "닉네임 중복 조회") + @GetMapping("/check-nickname") + public CheckEmailResponse checkNickname(@Valid CheckNicknameRequest request) { + + return authQueryService.checkNickname(request); + } } diff --git a/api/src/main/java/writeon/api/auth/request/CheckNicknameRequest.java b/api/src/main/java/writeon/api/auth/request/CheckNicknameRequest.java new file mode 100644 index 0000000..e7d2376 --- /dev/null +++ b/api/src/main/java/writeon/api/auth/request/CheckNicknameRequest.java @@ -0,0 +1,16 @@ +package writeon.api.auth.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Getter; +import lombok.Setter; +import writeon.api.common.validation.IsNickname; + +@Getter +@Setter +public class CheckNicknameRequest { + @NotBlank + @IsNickname + @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED, example = "노래하는뱁새") + private String nickname; +} diff --git a/api/src/main/java/writeon/api/auth/request/JoinRequest.java b/api/src/main/java/writeon/api/auth/request/JoinRequest.java index 4004cba..3664d1d 100644 --- a/api/src/main/java/writeon/api/auth/request/JoinRequest.java +++ b/api/src/main/java/writeon/api/auth/request/JoinRequest.java @@ -2,6 +2,7 @@ import io.swagger.v3.oas.annotations.media.ArraySchema; import writeon.api.common.validation.IsEmail; +import writeon.api.common.validation.IsNickname; import writeon.api.common.validation.IsPassword; import writeon.api.terms.request.TermsAgreeRequest; import io.swagger.v3.oas.annotations.media.Schema; @@ -27,7 +28,8 @@ public class JoinRequest { private String password; @NotBlank - @Size(max = 10) + @Size(min = 2, max = 20) + @IsNickname @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED, example = "노래하는뱁새") private String nickname; diff --git a/api/src/main/java/writeon/api/auth/response/CheckNicknameResponse.java b/api/src/main/java/writeon/api/auth/response/CheckNicknameResponse.java new file mode 100644 index 0000000..d5f6737 --- /dev/null +++ b/api/src/main/java/writeon/api/auth/response/CheckNicknameResponse.java @@ -0,0 +1,16 @@ +package writeon.api.auth.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class CheckNicknameResponse { + @Schema(title = "닉네임", requiredMode = Schema.RequiredMode.REQUIRED, example = "노래하는뱁새") + private String email; + @Schema(title = "존재 여부", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private boolean exists; +} diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index 517a062..ceeb28c 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -4,6 +4,7 @@ import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.security.crypto.bcrypt.BCrypt; import org.springframework.stereotype.Service; import writeon.api.auth.helper.JwtHelper; import writeon.api.auth.helper.MailHelper; @@ -11,6 +12,7 @@ import writeon.api.auth.response.AuthTokenResponse; import writeon.api.auth.response.LoginFailResponse; import writeon.api.common.enums.code.ResultCodeInfo; +import writeon.api.common.enums.exception.InternalServerException; import writeon.api.common.exception.BaseException; import writeon.api.common.util.CryptoUtil; import writeon.api.terms.request.TermsAgreeRequest; @@ -38,6 +40,7 @@ @RequiredArgsConstructor @Slf4j public class AuthCommandService { + private final AuthQueryService authQueryService; private final TermsQueryService termsQueryService; private final MemberJpaRepository memberJpaRepository; private final MemberPasswordJpaRepository memberPasswordJpaRepository; @@ -48,7 +51,6 @@ public class AuthCommandService { private final LoginAttemptJpaRepository loginAttemptJpaRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; - private final CryptoUtil cryptoUtil; /** * 토큰 재발급 @@ -73,12 +75,12 @@ public AuthTokenResponse reissueToken(ReissueRequest request) { * 로그인 */ public AuthTokenResponse login(LoginRequest request) { - List lastFiveAttempts = loginAttemptJpaRepository.findTop5ByEmailOrderByCreatedAtDesc(request.getEmail()); - - // 있는 이메일인지 검사 - memberJpaRepository.findByEmail(request.getEmail()) + Member member = memberJpaRepository.findByEmail(request.getEmail()) .orElseThrow(() -> new BaseException(AuthException.LOGIN_FAILED)); + MemberPassword memberPassword = memberPasswordJpaRepository.findById(member.getId()) + .orElseThrow(() -> new BaseException(AuthException.AUTH_FAILED_BY_UNKNOWN_ERROR)); + List lastFiveAttempts = loginAttemptJpaRepository.findTop5ByEmailOrderByCreatedAtDesc(request.getEmail()); // 로그인 시도가 블락 상태이고, 블락 시간으로부터 1시간이 지나지 않은 경우 if ( !lastFiveAttempts.isEmpty() @@ -88,13 +90,11 @@ public AuthTokenResponse login(LoginRequest request) { throw new BaseException(AuthException.LOGIN_BLOCKED); } - String passwordHash = cryptoUtil.hash(request.getPassword()); - MemberPassword memberPassword = memberPasswordJpaRepository.findByPassword(passwordHash).orElse(null); - LoginAttempt newLoginAttempt = new LoginAttempt(); newLoginAttempt.setEmail(request.getEmail()); - if (memberPassword == null) { + final boolean isPasswordCorrect = BCrypt.checkpw(request.getPassword(), memberPassword.getPassword()); + if (!isPasswordCorrect) { int attemptsRemaining = 5 - 1; // 남은 시도 횟수 계산 for (LoginAttempt attempt : lastFiveAttempts) { @@ -136,17 +136,23 @@ public void join(JoinRequest request) { .filter(TermsAgreeRequest::getIsAgreed) .map(TermsAgreeRequest::getTermsCd) .toList(); + + // 필수 약관 검사 if (!termsQueryService.isContainingAllRequiredTerms(agreedTermsList)) { throw new BaseException(AuthException.TERMS_AGREE_REQUIRED); } - - // 이미 있는 회원인지 검사 + // 이메일 중복 검사 if (memberJpaRepository.findByEmail(request.getEmail()).isPresent()) { throw new BaseException(AuthException.JOIN_ALREADY_EXIST_MEMBER); } + // 닉네임 중복 검사 + if (memberJpaRepository.findByNickname(request.getNickname()).isPresent()) { + throw new BaseException(AuthException.NICKNAME_ALREADY_EXIST); + } // 회원 정보 설정 - String passwordHash = cryptoUtil.hash(request.getPassword()); + String passwordHash = BCrypt.hashpw(request.getPassword(), BCrypt.gensalt()); + Member member = Member.builder() .email(request.getEmail()) .nickname(request.getNickname()) @@ -260,15 +266,15 @@ public void completeChangePassword(ChangePasswordCompletionRequest request) { // 비밀번호 조회 MemberPassword memberPassword = memberPasswordJpaRepository.findById(payload.getMemberId()) - .orElseThrow(() -> new BaseException(ResultCodeInfo.FAILURE)); - String passwordHash = cryptoUtil.hash(request.getPassword()); + .orElseThrow(() -> new BaseException(AuthException.AUTH_FAILED_BY_UNKNOWN_ERROR)); - // 이전 비밀번호와 동일한 경우 - if (passwordHash.equals(memberPassword.getPassword())) { + final boolean isPasswordUsedBefore = BCrypt.checkpw(request.getPassword(), memberPassword.getPassword()); + if (isPasswordUsedBefore) { throw new BaseException(AuthException.CHANGE_PASSWORD_USED_PASSWORD_BEFORE); } // 비밀번호 변경 + final String passwordHash = BCrypt.hashpw(request.getPassword(), BCrypt.gensalt()); memberPassword.setPassword(passwordHash); // 토큰 무효화 diff --git a/api/src/main/java/writeon/api/auth/service/AuthQueryService.java b/api/src/main/java/writeon/api/auth/service/AuthQueryService.java index f6b68b9..740d0dd 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthQueryService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthQueryService.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writeon.api.auth.request.CheckEmailRequest; +import writeon.api.auth.request.CheckNicknameRequest; import writeon.api.auth.response.CheckEmailResponse; import writeon.domain.member.repository.MemberJpaRepository; @@ -19,4 +20,10 @@ public CheckEmailResponse checkEmail(CheckEmailRequest request) { return new CheckEmailResponse(request.getEmail(), exists); } + public CheckEmailResponse checkNickname(CheckNicknameRequest request) { + boolean exists = memberJpaRepository.findByNickname(request.getNickname()).isPresent(); + + return new CheckEmailResponse(request.getNickname(), exists); + } + } diff --git a/api/src/main/java/writeon/api/common/validation/IsNickname.java b/api/src/main/java/writeon/api/common/validation/IsNickname.java new file mode 100644 index 0000000..f9dc2d5 --- /dev/null +++ b/api/src/main/java/writeon/api/common/validation/IsNickname.java @@ -0,0 +1,20 @@ +package writeon.api.common.validation; + +import jakarta.validation.Constraint; +import jakarta.validation.constraints.Size; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) +@Retention(RUNTIME) +@Constraint(validatedBy = IsNicknameValidator.class) +@Size(min = 2, max = 20) +public @interface IsNickname { + String message() default "한글, 영문(대소문자), 숫자, 일부 특수문자(_ , .)로 이루어진 2자 이상 20자 이하의 문자여야 합니다."; + Class[] groups() default {}; + Class[] payload() default {}; +} \ No newline at end of file diff --git a/api/src/main/java/writeon/api/common/validation/IsNicknameValidator.java b/api/src/main/java/writeon/api/common/validation/IsNicknameValidator.java new file mode 100644 index 0000000..a55106e --- /dev/null +++ b/api/src/main/java/writeon/api/common/validation/IsNicknameValidator.java @@ -0,0 +1,40 @@ +package writeon.api.common.validation; + +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; + +public class IsNicknameValidator implements ConstraintValidator { + + final String digit = "0-9"; + final String english = "a-zA-Z"; + final String korean = "가-힣"; + final String specialCharacters = "_,."; + + @Override + public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { + if (s == null) + return true; + + final String otherCharacterMatcher = String.format(".*[^%s%s%s%s].*", digit, english, korean, specialCharacters); + if (s.matches(otherCharacterMatcher)) + return false; + + final String digitOnlyMatcher = String.format("[%s]*", digit); + if (s.matches(digitOnlyMatcher)) + return false; + + final String startsWithSpecialCharacterMatcher = String.format("^[%s].*", specialCharacters); + if (s.matches(startsWithSpecialCharacterMatcher)) + return false; + + final String endsWithSpecialCharacterMatcher = String.format("[%s].*$", specialCharacters); + if (s.matches(endsWithSpecialCharacterMatcher)) + return false; + + final String sequentialSpecialCharacterMatcher = String.format(".*[%s]{2,}.*", specialCharacters); + if (s.matches(sequentialSpecialCharacterMatcher)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java index 640f972..8ec56c1 100644 --- a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java +++ b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java @@ -18,7 +18,9 @@ public enum AuthException implements CodeInfo { CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), CHANGE_PASSWORD_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), CHANGE_PASSWORD_USED_PASSWORD_BEFORE(HttpStatus.BAD_REQUEST, "AUTH-403", "이전에 사용된 비밀번호입니다."), - TERMS_AGREE_REQUIRED(HttpStatus.BAD_REQUEST, "AUTH-404", "필수 약관 동의가 필요합니다."); + TERMS_AGREE_REQUIRED(HttpStatus.BAD_REQUEST, "AUTH-404", "필수 약관 동의가 필요합니다."), + NICKNAME_ALREADY_EXIST(HttpStatus.CONFLICT, "AUTH-501", "이미 존재하는 닉네임입니다."), + AUTH_FAILED_BY_UNKNOWN_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AUTH-901", "알 수 없는 오류로 인증에 실패했습니다."); private final HttpStatus status; private final String code; diff --git a/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java b/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java index f4841b5..9900a3a 100644 --- a/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java +++ b/domain/src/main/java/writeon/domain/member/repository/MemberJpaRepository.java @@ -8,4 +8,5 @@ public interface MemberJpaRepository extends JpaRepository { Optional findByEmail(String email); + Optional findByNickname(String nickname); } diff --git a/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java b/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java index e86c769..725d6fd 100644 --- a/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java +++ b/domain/src/main/java/writeon/domain/member/repository/MemberPasswordJpaRepository.java @@ -3,9 +3,8 @@ import org.springframework.data.jpa.repository.JpaRepository; import writeon.domain.member.MemberPassword; -import java.util.Optional; import java.util.UUID; public interface MemberPasswordJpaRepository extends JpaRepository { - Optional findByPassword(String password); + } diff --git a/sql/init.sql b/sql/init.sql index 4ac2ebe..e55c23d 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -5,7 +5,7 @@ create table member ( id uuid default gen_random_uuid() constraint member_pk primary key, email varchar(255) constraint email_uk unique not null, - nickname varchar(10) constraint nickname_uk unique not null, + nickname varchar(20) constraint nickname_uk unique not null, profile_image varchar(255), created_at timestamp with time zone not null, updated_at timestamp with time zone not null From cac8935d1b7021533af602f4b45cc546666f6710 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Fri, 28 Mar 2025 17:44:44 +0900 Subject: [PATCH 057/107] fix: Update product response structure (#56) --- .../request/ProductMemoSaveRequest.java | 3 +++ .../response/ProductDetailResponse.java | 21 +++++-------------- .../product/response/ProductMemoResponse.java | 2 ++ .../api/product/response/ProductResponse.java | 2 +- .../service/ProductCommandService.java | 6 +++--- docker-compose.yml | 3 ++- .../writeon/domain/product/ProductMemo.java | 11 +++++++--- sql/init.sql | 8 ++++--- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java index c228751..5fc5be9 100644 --- a/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java @@ -8,10 +8,13 @@ @Setter public class ProductMemoSaveRequest { + @Schema(title = "제목", nullable = true) + private String title; @Schema(title = "내용") private String content; private String selectedText; private Integer startIndex; private Integer endIndex; + @Schema(title = "완료 여부", description = "메모 생성 시, false로 저장됩니다.", nullable = true) private Boolean isCompleted; } diff --git a/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java b/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java index a25f817..3b1c9d7 100644 --- a/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductDetailResponse.java @@ -15,32 +15,21 @@ public class ProductDetailResponse { private final UUID id; + @Schema(title = "제목") + private final String title; @Schema(title = "내용") private final String content; @Schema(title = "수정일시") private final LocalDateTime updatedAt; - private final List memos; + private final List memos; public ProductDetailResponse(Product product) { this.id = product.getId(); + this.title = product.getTitle(); this.content = product.getContent(); this.updatedAt = product.getUpdatedAt(); this.memos = product.getMemos().stream() - .map(Memo::new) + .map(ProductMemoResponse::new) .toList(); } - - @Getter - @Setter - public static class Memo { - - private final UUID id; - @Schema(title = "내용") - private final String content; - - public Memo(ProductMemo memo) { - this.id = memo.getId(); - this.content = memo.getContent(); - } - } } diff --git a/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java index bc1dffb..0e57a3c 100644 --- a/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java @@ -9,6 +9,7 @@ public class ProductMemoResponse { private final UUID id; + private final String title; private final String content; private final String selectedText; private final Integer startIndex; @@ -17,6 +18,7 @@ public class ProductMemoResponse { public ProductMemoResponse(ProductMemo memo) { this.id = memo.getId(); + this.title = memo.getTitle(); this.content = memo.getContent(); this.selectedText = memo.getSelectedText(); this.startIndex = memo.getStartIndex(); diff --git a/api/src/main/java/writeon/api/product/response/ProductResponse.java b/api/src/main/java/writeon/api/product/response/ProductResponse.java index 72751f6..d943f14 100644 --- a/api/src/main/java/writeon/api/product/response/ProductResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductResponse.java @@ -22,7 +22,7 @@ public class ProductResponse { public ProductResponse(ProductRecord product, String genre) { this.id = product.getId(); - this.title = product.getContent(); + this.title = product.getTitle(); this.genre = genre; this.updatedAt = product.getUpdatedAt(); } diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 7cdc263..cb93481 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -43,7 +43,7 @@ public UUID create() { public void createMemo(UUID productId, ProductMemoSaveRequest request) { productQueryService.verifyExist(productId); - productMemoRepository.save(new ProductMemo(productId, request.getContent(), + productMemoRepository.save(new ProductMemo(productId, request.getTitle(), request.getContent(), request.getSelectedText(), request.getStartIndex(), request.getEndIndex())); } @@ -78,8 +78,8 @@ public void modifyMemo(UUID productId, UUID memoId, ProductMemoSaveRequest reque ProductMemo memo = getMemoById(memoId); - memo.update(request.getContent(), request.getSelectedText(), request.getStartIndex() - , request.getEndIndex(), request.getIsCompleted()); + memo.update(request.getTitle(), request.getContent(), request.getSelectedText(), + request.getStartIndex(), request.getEndIndex(), request.getIsCompleted()); } @Transactional diff --git a/docker-compose.yml b/docker-compose.yml index d194fda..05bec5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.1' +version: '3.8' services: postgres: @@ -13,6 +13,7 @@ services: - "5432:5432" volumes: - ./db:/var/lib/postgresql/data + - ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql redis: image: redis:7.2.4-alpine3.19 diff --git a/domain/src/main/java/writeon/domain/product/ProductMemo.java b/domain/src/main/java/writeon/domain/product/ProductMemo.java index 70987d6..6713774 100644 --- a/domain/src/main/java/writeon/domain/product/ProductMemo.java +++ b/domain/src/main/java/writeon/domain/product/ProductMemo.java @@ -25,6 +25,9 @@ public class ProductMemo extends BaseAuditTimeEntity { @Column(name = "product_id", nullable = false) private UUID productId; + @Column(name = "title") + private String title; + @Column(name = "content", nullable = false) private String content; @@ -40,16 +43,18 @@ public class ProductMemo extends BaseAuditTimeEntity { @Column(name = "is_completed", nullable = false) private Boolean isCompleted = Boolean.FALSE; - public ProductMemo(UUID productId, String content, String selected_text, - Integer startIndex, Integer endIndex) { + public ProductMemo(UUID productId, String title, String content, + String selected_text, Integer startIndex, Integer endIndex) { this.productId = productId; + this.title = title; this.content = content; this.selectedText = selected_text; this.startIndex = startIndex; this.endIndex = endIndex; } - public void update(String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted) { + public void update(String title, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted) { + this.title = title; this.content = content; this.selectedText = selectedText; this.startIndex = startIndex; diff --git a/sql/init.sql b/sql/init.sql index e55c23d..ded5894 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -205,13 +205,14 @@ create table product_memo ( id uuid default gen_random_uuid() not null constraint product_memo_pk - primary key, + primary key, product_id uuid not null, + title varchar(100), content text not null, selected_text text not null, start_index integer not null, end_index integer not null, - status varchar(10) not null, + is_completed boolean default false not null, created_at timestamp not null, created_by uuid not null, updated_at timestamp not null, @@ -221,8 +222,9 @@ create table product_memo comment on table product_memo is '작품 메모'; comment on column product_memo.id is '메모 ID'; comment on column product_memo.product_id is '작품 ID'; +comment on column product_memo.title is '제목'; comment on column product_memo.content is '내용'; -comment on column product_memo.status is '상태'; +comment on column product_memo.is_completed is '완료 여부'; comment on column product_memo.created_at is '생성일시'; comment on column product_memo.created_by is '생성자 ID'; comment on column product_memo.updated_at is '수정일시'; From 042aad628df4f1f3ab0eefac20bced59b68b7b21 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 30 Mar 2025 23:46:13 +0900 Subject: [PATCH 058/107] fix: transaction error in Assistant API WebClient (#57) --- .../assistant/service/AssistantService.java | 14 +++-- .../assistant/service/AutoModifyService.java | 18 +++++-- .../api/assistant/service/ChatService.java | 27 +++++++--- .../assistant/service/FeedbackService.java | 19 +++++-- .../assistant/service/UserModifyService.java | 21 ++++++-- .../writeon/domain/assistant/Assistant.java | 10 ++-- .../assistant/AssistantJpaRepository.java | 8 +++ .../automodify/AutoModifyMessage.java | 15 ++++-- .../domain/assistant/chat/ChatMessage.java | 15 ++++-- .../domain/assistant/enums/AssistantType.java | 2 +- .../assistant/feedback/FeedbackMessage.java | 15 ++++-- .../usermodify/UserModifyMessage.java | 15 ++++-- sql/init.sql | 52 +++++-------------- 13 files changed, 154 insertions(+), 77 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 9dfdb57..60fefd9 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -22,7 +22,7 @@ public class AssistantService { @Transactional public UUID create(UUID productId, AssistantType type) { - Assistant assistant = new Assistant(productId, type); + Assistant assistant = new Assistant(productId, type, MemberUtil.getMemberId()); return assistantRepository.save(assistant).getId(); } @@ -39,14 +39,18 @@ public void completed(UUID assistantId, AssistantCompletedRequest request) { @Transactional public void modifyStatus(UUID assistantId, AssistantStatus status) { - Assistant assistant = getById(assistantId); - - assistant.updateStatus(status); + assistantRepository.updateStatus(assistantId, status); } @Transactional(readOnly = true) public Assistant getById(UUID assistantId) { - return assistantRepository.findByIdAndCreatedBy(assistantId, MemberUtil.getMemberId()) + return assistantRepository.findById(assistantId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); + } + + @Transactional(readOnly = true) + public Assistant getById(UUID assistantId, UUID memberId) { + return assistantRepository.findByIdAndCreatedBy(assistantId, memberId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); } diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index 6dbe6cb..76504a9 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -8,6 +8,7 @@ import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; +import writeon.api.common.util.MemberUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.AutoModifyRequest; @@ -39,14 +40,20 @@ public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest req productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); - AutoModifyMessage memberMessage = new AutoModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); + AutoModifyMessage memberMessage = AutoModifyMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .createdBy(MemberUtil.getMemberId()) + .build(); + autoModifyMessageRepository.save(memberMessage); return new MessageCreateResponse(assistantId); } public SseEmitter streamAutoModify(UUID assistantId) { - Assistant assistant = assistantService.getById(assistantId); + Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); @@ -78,7 +85,12 @@ public SseEmitter streamAutoModify(UUID assistantId) { throw exception; }, () -> { - AutoModifyMessage assistantMessage = new AutoModifyMessage(assistantId, MessageSenderRole.ASSISTANT, responseBuilder.toString()); + AutoModifyMessage assistantMessage = AutoModifyMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(responseBuilder.toString()) + .createdBy(message.getCreatedBy()) + .build(); autoModifyMessageRepository.save(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index 96c8654..11852bd 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -10,6 +10,7 @@ import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; +import writeon.api.common.util.MemberUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.ChatRequest; @@ -41,16 +42,21 @@ public class ChatService { public MessageCreateResponse createMessage(AssistantChatMessageRequest request) { productQueryService.verifyExist(request.getProductId()); - UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); - ChatMessage memberMessage = - new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); + ChatMessage memberMessage = ChatMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .prompt(request.getPrompt()) + .createdBy(MemberUtil.getMemberId()) + .build(); chatMessageRepository.save(memberMessage); return new MessageCreateResponse(assistantId); } public SseEmitter streamChat(UUID assistantId, String sessionId) { - Assistant assistant = assistantService.getById(assistantId); + Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); @@ -80,7 +86,12 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { - ChatMessage assistantMessage = new ChatMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + ChatMessage assistantMessage = ChatMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(responseBuilder.toString()) + .createdBy(message.getCreatedBy()) + .build(); chatMessageRepository.save(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); @@ -96,9 +107,9 @@ public AssistantResponse research(AssistantResearchRequest request) { productQueryService.verifyExist(request.getProductId()); // assistant 및 message 생성 - UUID assistantId = assistantService.create(request.getProductId(), AssistantType.RESEARCH); + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); ChatMessage memberMessage = - new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt(), MemberUtil.getMemberId()); chatMessageRepository.save(memberMessage); UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); @@ -109,7 +120,7 @@ public AssistantResponse research(AssistantResearchRequest request) { // assistant 응답 저장 ChatMessage assistantMessage = - new ChatMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null); + new ChatMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null, MemberUtil.getMemberId()); chatMessageRepository.save(assistantMessage); return new AssistantResponse(assistantId, answer); diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index 2bfb638..f0244d6 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -8,6 +8,7 @@ import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; +import writeon.api.common.util.MemberUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.FeedbackRequest; @@ -39,14 +40,20 @@ public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest reque productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); - FeedbackMessage memberMessage = new FeedbackMessage(assistantId, MessageSenderRole.MEMBER, request.getContent()); + FeedbackMessage memberMessage = FeedbackMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .createdBy(MemberUtil.getMemberId()) + .build(); + feedbackMessageRepository.save(memberMessage); return new MessageCreateResponse(assistantId); } public SseEmitter streamFeedback(UUID assistantId) { - Assistant assistant = assistantService.getById(assistantId); + Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); @@ -78,7 +85,13 @@ public SseEmitter streamFeedback(UUID assistantId) { throw exception; }, () -> { - FeedbackMessage assistantMessage = new FeedbackMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString()); + FeedbackMessage assistantMessage = FeedbackMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(responseBuilder.toString()) + .createdBy(message.getCreatedBy()) + .build(); + feedbackMessageRepository.save(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 8e386da..faf9435 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -8,6 +8,7 @@ import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; +import writeon.api.common.util.MemberUtil; import writeon.api.product.service.ProductQueryService; import writeon.assistantapiclient.AssistantApiClient; import writeon.assistantapiclient.request.UserModifyRequest; @@ -39,15 +40,21 @@ public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest req productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); - UserModifyMessage memberMessage = - new UserModifyMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt()); + UserModifyMessage memberMessage = UserModifyMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .prompt(request.getPrompt()) + .createdBy(MemberUtil.getMemberId()) + .build(); + userModifyMessageRepository.save(memberMessage); return new MessageCreateResponse(assistantId); } public SseEmitter streamUserModify(UUID assistantId) { - Assistant assistant = assistantService.getById(assistantId); + Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); @@ -79,7 +86,13 @@ public SseEmitter streamUserModify(UUID assistantId) { throw exception; }, () -> { - UserModifyMessage assistantMessage = new UserModifyMessage(message.getAssistantId(), MessageSenderRole.ASSISTANT, responseBuilder.toString(), null); + UserModifyMessage assistantMessage = UserModifyMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(responseBuilder.toString()) + .createdBy(message.getCreatedBy()) + .build(); + userModifyMessageRepository.save(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); diff --git a/domain/src/main/java/writeon/domain/assistant/Assistant.java b/domain/src/main/java/writeon/domain/assistant/Assistant.java index 10c59e1..49b4e23 100644 --- a/domain/src/main/java/writeon/domain/assistant/Assistant.java +++ b/domain/src/main/java/writeon/domain/assistant/Assistant.java @@ -6,7 +6,7 @@ import lombok.NoArgsConstructor; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; -import writeon.domain.common.BaseAuditTimeEntity; +import writeon.domain.common.BaseTimeEntity; import java.util.UUID; @@ -14,7 +14,7 @@ @Entity @NoArgsConstructor @Table(name = "assistant") -public class Assistant extends BaseAuditTimeEntity { +public class Assistant extends BaseTimeEntity { @Id @Column(name = "id", updatable = false) @@ -31,10 +31,14 @@ public class Assistant extends BaseAuditTimeEntity { @Column(name = "status", nullable = false) private AssistantStatus status = AssistantStatus.DRAFT; + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + @Builder - public Assistant(UUID productId, AssistantType type) { + public Assistant(UUID productId, AssistantType type, UUID createdBy) { this.productId = productId; this.type = type; + this.createdBy = createdBy; } public void updateStatus(AssistantStatus status) { diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java index d4b8d9b..ab3a534 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantJpaRepository.java @@ -1,6 +1,10 @@ package writeon.domain.assistant; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import writeon.domain.assistant.enums.AssistantStatus; import java.util.Optional; import java.util.UUID; @@ -10,4 +14,8 @@ public interface AssistantJpaRepository extends JpaRepository { Optional findByIdAndCreatedBy(UUID assistantId, UUID createdBy); boolean existsByIdAndCreatedBy(UUID assistantId, UUID createdBy); + + @Modifying + @Query("UPDATE Assistant a SET a.status = :status WHERE a.id = :assistantId") + void updateStatus(@Param("assistantId") UUID assistantId, @Param("status") AssistantStatus status); } diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java index 971c148..8dbb3c0 100644 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java @@ -1,19 +1,20 @@ package writeon.domain.assistant.automodify; import jakarta.persistence.*; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.MessageContent; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.common.BaseAuditTimeEntity; +import java.time.LocalDateTime; import java.util.UUID; @Getter @Entity @NoArgsConstructor @Table(name = "auto_modify_message") -public class AutoModifyMessage extends BaseAuditTimeEntity { +public class AutoModifyMessage { @Id @Column(updatable = false, nullable = false) @@ -25,9 +26,17 @@ public class AutoModifyMessage extends BaseAuditTimeEntity { @Embedded private MessageContent messageContent; - public AutoModifyMessage(UUID assistantId, MessageSenderRole role, String content) { + @Column(name = "created_at", updatable = false, nullable = false) + private final LocalDateTime createdAt = LocalDateTime.now(); + + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + + @Builder + public AutoModifyMessage(UUID assistantId, MessageSenderRole role, String content, UUID createdBy) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); + this.createdBy = createdBy; } public MessageSenderRole getRole() { diff --git a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java index 34770c6..7e83800 100644 --- a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java @@ -1,19 +1,20 @@ package writeon.domain.assistant.chat; import jakarta.persistence.*; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.MessageContent; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.common.BaseAuditTimeEntity; +import java.time.LocalDateTime; import java.util.UUID; @Getter @Entity @NoArgsConstructor @Table(name = "chat_message") -public class ChatMessage extends BaseAuditTimeEntity { +public class ChatMessage { @Id @Column(updatable = false, nullable = false) @@ -28,10 +29,18 @@ public class ChatMessage extends BaseAuditTimeEntity { @Column(name = "prompt", nullable = false) private String prompt; - public ChatMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { + @Column(name = "created_at", updatable = false, nullable = false) + private final LocalDateTime createdAt = LocalDateTime.now(); + + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + + @Builder + public ChatMessage(UUID assistantId, MessageSenderRole role, String content, String prompt, UUID createdBy) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; + this.createdBy = createdBy; } public MessageSenderRole getRole() { diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java index cff8cb8..8488fef 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java @@ -12,7 +12,7 @@ public enum AssistantType implements Codable { AUTO_MODIFY("auto modify"), FEEDBACK("feedback"), - RESEARCH("research"), + CHAT("chat"), USER_MODIFY("user modify"); private final String code; diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java index 32ccd4b..0ee3b7c 100644 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java @@ -1,19 +1,20 @@ package writeon.domain.assistant.feedback; import jakarta.persistence.*; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.MessageContent; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.common.BaseAuditTimeEntity; +import java.time.LocalDateTime; import java.util.UUID; @Getter @Entity @NoArgsConstructor @Table(name = "feedback_message") -public class FeedbackMessage extends BaseAuditTimeEntity { +public class FeedbackMessage { @Id @Column(updatable = false, nullable = false) @@ -25,9 +26,17 @@ public class FeedbackMessage extends BaseAuditTimeEntity { @Embedded private MessageContent messageContent; - public FeedbackMessage(UUID assistantId, MessageSenderRole role, String content) { + @Column(name = "created_at", updatable = false, nullable = false) + private final LocalDateTime createdAt = LocalDateTime.now(); + + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + + @Builder + public FeedbackMessage(UUID assistantId, MessageSenderRole role, String content, UUID createdBy) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); + this.createdBy = createdBy; } public MessageSenderRole getRole() { diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java index a1b2cde..b2e1461 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java @@ -1,19 +1,20 @@ package writeon.domain.assistant.usermodify; import jakarta.persistence.*; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.MessageContent; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.common.BaseAuditTimeEntity; +import java.time.LocalDateTime; import java.util.UUID; @Getter @Entity @NoArgsConstructor @Table(name = "user_modify_message") -public class UserModifyMessage extends BaseAuditTimeEntity { +public class UserModifyMessage { @Id @Column(updatable = false, nullable = false) @@ -28,10 +29,18 @@ public class UserModifyMessage extends BaseAuditTimeEntity { @Column(name = "prompt") private String prompt; - public UserModifyMessage(UUID assistantId, MessageSenderRole role, String content, String prompt) { + @Column(name = "created_at", updatable = false, nullable = false) + private final LocalDateTime createdAt = LocalDateTime.now(); + + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + + @Builder + public UserModifyMessage(UUID assistantId, MessageSenderRole role, String content, String prompt, UUID createdBy) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; + this.createdBy = createdBy; } public MessageSenderRole getRole() { diff --git a/sql/init.sql b/sql/init.sql index ded5894..5ab42cf 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -347,8 +347,7 @@ create table assistant status varchar(20) not null , created_at timestamp not null, created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + updated_at timestamp not null ); comment on table assistant is '어시스턴트'; @@ -358,7 +357,6 @@ comment on column assistant.status is '진행 상태'; comment on column assistant.created_at is '생성일시'; comment on column assistant.created_by is '생성자 ID'; comment on column assistant.created_at is '수정일시'; -comment on column assistant.created_by is '수정자 ID'; alter table assistant owner to postgres; @@ -393,9 +391,7 @@ create table auto_modify_message role varchar(10) not null, content text not null, created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + created_by uuid not null ); comment on table auto_modify_message is '자동 수정 메세지'; @@ -405,28 +401,24 @@ comment on column auto_modify_message.role is '메세지 송신자'; comment on column auto_modify_message.content is '내용'; comment on column auto_modify_message.created_at is '생성일시'; comment on column auto_modify_message.created_by is '생성자 ID'; -comment on column auto_modify_message.updated_at is '수정일시'; -comment on column auto_modify_message.updated_by is '수정자 ID'; alter table auto_modify_message owner to postgres; -create table user_modify_message +create table chat_message ( id uuid default gen_random_uuid() not null - constraint user_modify_message_pk + constraint chat_message_pk primary key, assistant_id uuid not null, role varchar(10) not null, - content text not null, + content text, prompt text, created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + created_by uuid not null ); -alter table user_modify_message +alter table chat_message owner to postgres; create table feedback_message @@ -438,9 +430,7 @@ create table feedback_message role varchar(10) not null, content text not null, created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + created_by uuid not null ); comment on table feedback_message is '피드백 메세지'; @@ -450,37 +440,23 @@ comment on column feedback_message.role is '메세지 송신자'; comment on column feedback_message.content is '내용'; comment on column feedback_message.created_at is '생성일시'; comment on column feedback_message.created_by is '생성자 ID'; -comment on column feedback_message.updated_at is '수정일시'; -comment on column feedback_message.updated_by is '수정자 ID'; alter table feedback_message owner to postgres; -create table research_message +create table user_modify_message ( id uuid default gen_random_uuid() not null - constraint research_message_pk + constraint user_modify_message_pk primary key, assistant_id uuid not null, role varchar(10) not null, - content text, + content text not null, prompt text, created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null, - updated_by uuid not null + created_by uuid not null ); -comment on table research_message is '자유 대화 메세지'; -comment on column research_message.id is '자유 대화 메세지 ID'; -comment on column research_message.assistant_id is '어시스턴트 ID'; -comment on column research_message.role is '메세지 송신자'; -comment on column research_message.content is '내용'; -comment on column research_message.prompt is '프롬프트'; -comment on column research_message.created_at is '생성일시'; -comment on column research_message.created_by is '생성자 ID'; -comment on column research_message.updated_at is '수정일시'; -comment on column research_message.updated_by is '수정자 ID'; - -alter table research_message +alter table user_modify_message owner to postgres; + From 125eb5ec5acec1015fa28aaf4062bd837008a716 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:22:39 +0900 Subject: [PATCH 059/107] feat: Add get assistant histories API (#58) --- .../controller/AssistantController.java | 43 +- .../assistant/repository/AssistantDao.java | 53 + .../response/AssistantHistoryResponse.java | 39 + .../assistant/response/AssistantResponse.java | 11 +- .../assistant/service/AssistantService.java | 43 +- .../assistant/service/AutoModifyService.java | 45 +- .../api/assistant/service/ChatService.java | 65 +- .../assistant/service/FeedbackService.java | 46 +- .../assistant/service/UserModifyService.java | 46 +- .../api/product/repository/ProductDao.java | 11 +- .../api/product/response/ProductResponse.java | 8 +- .../api/terms/repository/TermsDao.java | 9 +- .../terms/response/TermsDetailResponse.java | 8 +- .../terms/response/TermsSummaryResponse.java | 6 +- .../api/terms/service/TermsQueryService.java | 2 +- domain/build.gradle | 6 +- .../src/main/generated/writely/Routines.java | 1704 ----------------- domain/src/main/generated/writely/Tables.java | 173 -- .../generated/writely/routines/Armor1.java | 60 - .../generated/writely/routines/Armor2.java | 104 - .../generated/writely/routines/Crypt.java | 81 - .../generated/writely/routines/Dearmor.java | 59 - .../generated/writely/routines/Decrypt.java | 103 - .../generated/writely/routines/DecryptIv.java | 125 -- .../generated/writely/routines/Digest1.java | 82 - .../generated/writely/routines/Digest2.java | 82 - .../generated/writely/routines/Encrypt.java | 103 - .../generated/writely/routines/EncryptIv.java | 125 -- .../writely/routines/GenRandomBytes.java | 59 - .../writely/routines/GenRandomUuid.java | 38 - .../generated/writely/routines/GenSalt1.java | 60 - .../generated/writely/routines/GenSalt2.java | 82 - .../generated/writely/routines/Hmac1.java | 104 - .../generated/writely/routines/Hmac2.java | 104 - .../generated/writely/routines/PgpKeyId.java | 59 - .../writely/routines/PgpPubDecrypt1.java | 82 - .../writely/routines/PgpPubDecrypt2.java | 104 - .../writely/routines/PgpPubDecrypt3.java | 126 -- .../writely/routines/PgpPubDecryptBytea1.java | 82 - .../writely/routines/PgpPubDecryptBytea2.java | 104 - .../writely/routines/PgpPubDecryptBytea3.java | 126 -- .../writely/routines/PgpPubEncrypt1.java | 82 - .../writely/routines/PgpPubEncrypt2.java | 104 - .../writely/routines/PgpPubEncryptBytea1.java | 82 - .../writely/routines/PgpPubEncryptBytea2.java | 104 - .../writely/routines/PgpSymDecrypt1.java | 82 - .../writely/routines/PgpSymDecrypt2.java | 104 - .../writely/routines/PgpSymDecryptBytea1.java | 82 - .../writely/routines/PgpSymDecryptBytea2.java | 104 - .../writely/routines/PgpSymEncrypt1.java | 82 - .../writely/routines/PgpSymEncrypt2.java | 104 - .../writely/routines/PgpSymEncryptBytea1.java | 82 - .../writely/routines/PgpSymEncryptBytea2.java | 104 - .../writely/tables/AutoModifyMessage.java | 260 --- .../generated/writely/tables/ChatMessage.java | 260 --- .../writely/tables/FeedbackMessage.java | 260 --- .../writely/tables/PgpArmorHeaders.java | 157 -- .../writely/tables/UserModifyMessage.java | 260 --- .../tables/pojos/AutoModifyMessage.java | 226 --- .../writely/tables/pojos/FeedbackMessage.java | 226 --- .../writely/tables/pojos/PgpArmorHeaders.java | 91 - .../tables/pojos/UserModifyMessage.java | 226 --- .../records/AutoModifyMessageRecord.java | 216 --- .../tables/records/ChatMessageRecord.java | 216 --- .../tables/records/FeedbackMessageRecord.java | 216 --- .../tables/records/PgpArmorHeadersRecord.java | 84 - .../records/UserModifyMessageRecord.java | 216 --- .../{writely => writeon}/DefaultCatalog.java | 2 +- .../generated/{writely => writeon}/Keys.java | 77 +- .../{writely => writeon}/Public.java | 108 +- domain/src/main/generated/writeon/Tables.java | 110 ++ .../tables/Assistant.java | 17 +- .../tables/AssistantEvaluation.java | 8 +- .../writeon/tables/AssistantMessage.java | 250 +++ .../tables/LoginAttempt.java | 8 +- .../{writely => writeon}/tables/Member.java | 10 +- .../tables/MemberPassword.java | 8 +- .../{writely => writeon}/tables/Product.java | 8 +- .../tables/ProductCharacter.java | 8 +- .../tables/ProductCustomField.java | 8 +- .../tables/ProductIdeanote.java | 8 +- .../tables/ProductMemo.java | 17 +- .../tables/ProductPlot.java | 8 +- .../tables/ProductSynopsis.java | 8 +- .../tables/ProductWorldview.java | 8 +- .../{writely => writeon}/tables/Terms.java | 8 +- .../tables/TermsAgreement.java | 8 +- .../tables/pojos/Assistant.java | 25 +- .../tables/pojos/AssistantEvaluation.java | 2 +- .../tables/pojos/AssistantMessage.java} | 66 +- .../tables/pojos/LoginAttempt.java | 2 +- .../tables/pojos/Member.java | 2 +- .../tables/pojos/MemberPassword.java | 2 +- .../tables/pojos/Product.java | 2 +- .../tables/pojos/ProductCharacter.java | 2 +- .../tables/pojos/ProductCustomField.java | 2 +- .../tables/pojos/ProductIdeanote.java | 2 +- .../tables/pojos/ProductMemo.java | 23 +- .../tables/pojos/ProductPlot.java | 2 +- .../tables/pojos/ProductSynopsis.java | 2 +- .../tables/pojos/ProductWorldview.java | 2 +- .../tables/pojos/Terms.java | 2 +- .../tables/pojos/TermsAgreement.java | 2 +- .../records/AssistantEvaluationRecord.java | 6 +- .../records/AssistantMessageRecord.java | 182 ++ .../tables/records/AssistantRecord.java | 29 +- .../tables/records/LoginAttemptRecord.java | 6 +- .../tables/records/MemberPasswordRecord.java | 6 +- .../tables/records/MemberRecord.java | 6 +- .../records/ProductCharacterRecord.java | 6 +- .../records/ProductCustomFieldRecord.java | 6 +- .../tables/records/ProductIdeanoteRecord.java | 6 +- .../tables/records/ProductMemoRecord.java | 65 +- .../tables/records/ProductPlotRecord.java | 6 +- .../tables/records/ProductRecord.java | 6 +- .../tables/records/ProductSynopsisRecord.java | 6 +- .../records/ProductWorldviewRecord.java | 6 +- .../tables/records/TermsAgreementRecord.java | 6 +- .../tables/records/TermsRecord.java | 6 +- ...difyMessage.java => AssistantMessage.java} | 21 +- .../AssistantMessageJpaRepository.java | 15 + .../automodify/AutoModifyMessage.java | 49 - .../AutoModifyMessageJpaRepository.java | 14 - .../domain/assistant/chat/ChatMessage.java | 53 - .../chat/ChatMessageJpaRepository.java | 14 - .../assistant/feedback/FeedbackMessage.java | 49 - .../FeedbackMessageJpaRepository.java | 14 - .../UserModifyMessageJpaRepository.java | 14 - .../main/java/writeon/domain/terms/Terms.java | 12 +- sql/init.sql | 69 +- 130 files changed, 1124 insertions(+), 8783 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/repository/AssistantDao.java create mode 100644 api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java delete mode 100644 domain/src/main/generated/writely/Routines.java delete mode 100644 domain/src/main/generated/writely/Tables.java delete mode 100644 domain/src/main/generated/writely/routines/Armor1.java delete mode 100644 domain/src/main/generated/writely/routines/Armor2.java delete mode 100644 domain/src/main/generated/writely/routines/Crypt.java delete mode 100644 domain/src/main/generated/writely/routines/Dearmor.java delete mode 100644 domain/src/main/generated/writely/routines/Decrypt.java delete mode 100644 domain/src/main/generated/writely/routines/DecryptIv.java delete mode 100644 domain/src/main/generated/writely/routines/Digest1.java delete mode 100644 domain/src/main/generated/writely/routines/Digest2.java delete mode 100644 domain/src/main/generated/writely/routines/Encrypt.java delete mode 100644 domain/src/main/generated/writely/routines/EncryptIv.java delete mode 100644 domain/src/main/generated/writely/routines/GenRandomBytes.java delete mode 100644 domain/src/main/generated/writely/routines/GenRandomUuid.java delete mode 100644 domain/src/main/generated/writely/routines/GenSalt1.java delete mode 100644 domain/src/main/generated/writely/routines/GenSalt2.java delete mode 100644 domain/src/main/generated/writely/routines/Hmac1.java delete mode 100644 domain/src/main/generated/writely/routines/Hmac2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpKeyId.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecrypt1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecrypt2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecrypt3.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubEncrypt1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubEncrypt2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymDecrypt1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymDecrypt2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymEncrypt1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymEncrypt2.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java delete mode 100644 domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java delete mode 100644 domain/src/main/generated/writely/tables/AutoModifyMessage.java delete mode 100644 domain/src/main/generated/writely/tables/ChatMessage.java delete mode 100644 domain/src/main/generated/writely/tables/FeedbackMessage.java delete mode 100644 domain/src/main/generated/writely/tables/PgpArmorHeaders.java delete mode 100644 domain/src/main/generated/writely/tables/UserModifyMessage.java delete mode 100644 domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java delete mode 100644 domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java delete mode 100644 domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java delete mode 100644 domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java delete mode 100644 domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java delete mode 100644 domain/src/main/generated/writely/tables/records/ChatMessageRecord.java delete mode 100644 domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java delete mode 100644 domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java delete mode 100644 domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java rename domain/src/main/generated/{writely => writeon}/DefaultCatalog.java (98%) rename domain/src/main/generated/{writely => writeon}/Keys.java (61%) rename domain/src/main/generated/{writely => writeon}/Public.java (53%) create mode 100644 domain/src/main/generated/writeon/Tables.java rename domain/src/main/generated/{writely => writeon}/tables/Assistant.java (93%) rename domain/src/main/generated/{writely => writeon}/tables/AssistantEvaluation.java (98%) create mode 100644 domain/src/main/generated/writeon/tables/AssistantMessage.java rename domain/src/main/generated/{writely => writeon}/tables/LoginAttempt.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/Member.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/MemberPassword.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/Product.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductCharacter.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductCustomField.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductIdeanote.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductMemo.java (94%) rename domain/src/main/generated/{writely => writeon}/tables/ProductPlot.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductSynopsis.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/ProductWorldview.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/Terms.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/TermsAgreement.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/Assistant.java (87%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/AssistantEvaluation.java (99%) rename domain/src/main/generated/{writely/tables/pojos/ChatMessage.java => writeon/tables/pojos/AssistantMessage.java} (69%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/LoginAttempt.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/Member.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/MemberPassword.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/Product.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductCharacter.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductCustomField.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductIdeanote.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductMemo.java (92%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductPlot.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductSynopsis.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/ProductWorldview.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/Terms.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/pojos/TermsAgreement.java (99%) rename domain/src/main/generated/{writely => writeon}/tables/records/AssistantEvaluationRecord.java (96%) create mode 100644 domain/src/main/generated/writeon/tables/records/AssistantMessageRecord.java rename domain/src/main/generated/{writely => writeon}/tables/records/AssistantRecord.java (85%) rename domain/src/main/generated/{writely => writeon}/tables/records/LoginAttemptRecord.java (96%) rename domain/src/main/generated/{writely => writeon}/tables/records/MemberPasswordRecord.java (96%) rename domain/src/main/generated/{writely => writeon}/tables/records/MemberRecord.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductCharacterRecord.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductCustomFieldRecord.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductIdeanoteRecord.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductMemoRecord.java (85%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductPlotRecord.java (96%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductRecord.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductSynopsisRecord.java (97%) rename domain/src/main/generated/{writely => writeon}/tables/records/ProductWorldviewRecord.java (98%) rename domain/src/main/generated/{writely => writeon}/tables/records/TermsAgreementRecord.java (96%) rename domain/src/main/generated/{writely => writeon}/tables/records/TermsRecord.java (97%) rename domain/src/main/java/writeon/domain/assistant/{usermodify/UserModifyMessage.java => AssistantMessage.java} (74%) create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java delete mode 100644 domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 2d3f7e7..da3355d 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,19 +1,40 @@ package writeon.api.assistant.controller; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.util.List; +import java.util.UUID; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.*; +import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.request.AssistantCompletedRequest; +import writeon.api.assistant.request.AssistantEvaluationRequest; +import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; -import writeon.api.assistant.service.*; - -import java.util.UUID; +import writeon.api.assistant.service.AssistantEvaluationService; +import writeon.api.assistant.service.AssistantService; +import writeon.api.assistant.service.AutoModifyService; +import writeon.api.assistant.service.ChatService; +import writeon.api.assistant.service.FeedbackService; +import writeon.api.assistant.service.UserModifyService; @RestController @RequiredArgsConstructor @@ -99,6 +120,12 @@ public SseEmitter streamUserModify(@RequestParam UUID assistantId) { return emitter; } + @Operation(summary = "어시스턴트 사용 내역 조회") + @GetMapping("/histories") + public List getHistories(@RequestParam UUID productId) { + return assistantService.getHistories(productId); + } + @Operation(summary = "AI 어시 기능 완료 처리") @PutMapping("/{assistantId}/completed") public void completed(@PathVariable UUID assistantId, @RequestBody AssistantCompletedRequest request) { diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java new file mode 100644 index 0000000..dd0b915 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -0,0 +1,53 @@ +package writeon.api.assistant.repository; + +import org.jooq.DSLContext; +import org.jooq.Record; +import org.jooq.Result; +import org.springframework.stereotype.Repository; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantRecord; + +import static writeon.tables.Assistant.ASSISTANT; +import static writeon.tables.AssistantMessage.ASSISTANT_MESSAGE; + +@Repository +@RequiredArgsConstructor +public class AssistantDao { + + private final DSLContext dsl; + + public List selectHistories(UUID productId) { + Map> groupedResults = dsl + .select(ASSISTANT.asterisk(), ASSISTANT_MESSAGE.asterisk()) + .from(ASSISTANT) + .join(ASSISTANT_MESSAGE) + .on(ASSISTANT.ID.eq(ASSISTANT_MESSAGE.ASSISTANT_ID)) + .where(ASSISTANT.PRODUCT_ID.eq(productId)) + .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) + .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) + .orderBy(ASSISTANT.CREATED_AT.desc()) + .fetchGroups(ASSISTANT.ID); + + return groupedResults.values().stream() + .map(records -> { + AssistantRecord assistant = records.getFirst().into(AssistantRecord.class); + List messages = records.stream() + .map(record -> { + AssistantMessageRecord message = record.into(AssistantMessageRecord.class); + return new AssistantHistoryResponse.MessageHistory(message.getRole(), message.getContent()); + }) + .toList(); + return new AssistantHistoryResponse(assistant, messages); + }) + .toList(); + } +} diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java new file mode 100644 index 0000000..625865f --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -0,0 +1,39 @@ +package writeon.api.assistant.response; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import writeon.tables.records.AssistantRecord; + +@Getter +public class AssistantHistoryResponse { + + private final UUID id; + private final String type; + private final List messages; + private final LocalDateTime createdAt; + + public AssistantHistoryResponse(AssistantRecord assistant, List messages) { + this.id = assistant.getId(); + this.type = assistant.getType(); + this.messages = messages; + this.createdAt = assistant.getCreatedAt(); + } + + @Getter + public static class MessageHistory { + + @Schema(title = "메세지 송신 역할") + private final String role; + @Schema(title = "사용자가 선택한 구간 / Assistant 답변") + private final String content; + + public MessageHistory(String role, String content) { + this.role = role; + this.content = content; + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java index 1b0bd39..22fa216 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantResponse.java @@ -1,20 +1,19 @@ package writeon.api.assistant.response; +import java.util.UUID; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; -import java.util.UUID; - @Getter public class AssistantResponse { - @Schema(title = "어시스턴트 ID") - private final UUID assistantId; + private final UUID id; @Schema(title = "답변 내용") private final String answer; - public AssistantResponse(UUID assistantId, String answer) { - this.assistantId = assistantId; + public AssistantResponse(UUID id, String answer) { + this.id = id; this.answer = answer; } } diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 60fefd9..ff9ae2b 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -1,24 +1,36 @@ package writeon.api.assistant.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.repository.AssistantDao; import writeon.api.assistant.request.AssistantCompletedRequest; +import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.MemberUtil; +import writeon.api.product.service.ProductQueryService; import writeon.domain.assistant.Assistant; import writeon.domain.assistant.AssistantJpaRepository; +import writeon.domain.assistant.AssistantMessage; +import writeon.domain.assistant.AssistantMessageJpaRepository; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; - -import java.util.UUID; +import writeon.domain.assistant.enums.MessageSenderRole; @Service @RequiredArgsConstructor public class AssistantService { private final AssistantJpaRepository assistantRepository; + private final AssistantMessageJpaRepository assistantMessageRepository; + private final AssistantDao assistantDao; + + private final ProductQueryService productQueryService; @Transactional public UUID create(UUID productId, AssistantType type) { @@ -26,6 +38,11 @@ public UUID create(UUID productId, AssistantType type) { return assistantRepository.save(assistant).getId(); } + @Transactional + public UUID createMessage(AssistantMessage message) { + return assistantMessageRepository.save(message).getId(); + } + @Transactional public void completed(UUID assistantId, AssistantCompletedRequest request) { Assistant assistant = getById(assistantId); @@ -54,6 +71,26 @@ public Assistant getById(UUID assistantId, UUID memberId) { .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); } + @Transactional(readOnly = true) + public List getHistories(UUID productId) { + productQueryService.verifyExist(productId); + + return assistantDao.selectHistories(productId); + } + + @Transactional(readOnly = true) + public AssistantMessage getMessage(UUID assistantId, MessageSenderRole role) { + return assistantMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, role) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } + + @Transactional(readOnly = true) + public void verifyAnswered(UUID assistantId) { + if (assistantMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } + @Transactional(readOnly = true) public void verifyExist(UUID assistantId) { if (!assistantRepository.existsByIdAndCreatedBy(assistantId, MemberUtil.getMemberId())) { diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index 76504a9..5a0688a 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -1,9 +1,13 @@ package writeon.api.assistant.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.io.IOException; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -14,23 +18,18 @@ import writeon.assistantapiclient.request.AutoModifyRequest; import writeon.assistantapiclient.request.UserSetting; import writeon.domain.assistant.Assistant; -import writeon.domain.assistant.automodify.AutoModifyMessage; -import writeon.domain.assistant.automodify.AutoModifyMessageJpaRepository; +import writeon.domain.assistant.AssistantMessage; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; -import java.io.IOException; -import java.util.UUID; - @Service @RequiredArgsConstructor public class AutoModifyService { private final long TIMEOUT = 180_000L; - private final AutoModifyMessageJpaRepository autoModifyMessageRepository; private final AssistantApiClient assistantApiClient; private final AssistantService assistantService; private final ProductQueryService productQueryService; @@ -40,14 +39,14 @@ public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest req productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); - AutoModifyMessage memberMessage = AutoModifyMessage.builder() + + AssistantMessage memberMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.MEMBER) .content(request.getContent()) .createdBy(MemberUtil.getMemberId()) .build(); - - autoModifyMessageRepository.save(memberMessage); + assistantService.createMessage(memberMessage); return new MessageCreateResponse(assistantId); } @@ -55,14 +54,14 @@ public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest req public SseEmitter streamAutoModify(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); - verifyAnswered(assistantId); + assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AutoModifyMessage message = getMemberMessage(assistantId); + AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); AutoModifyRequest request = new AutoModifyRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent() + assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent() ); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -85,13 +84,14 @@ public SseEmitter streamAutoModify(UUID assistantId) { throw exception; }, () -> { - AutoModifyMessage assistantMessage = AutoModifyMessage.builder() + String answer = responseBuilder.toString().replace("[DONE]", "").trim(); + AssistantMessage assistantMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.ASSISTANT) - .content(responseBuilder.toString()) - .createdBy(message.getCreatedBy()) + .content(answer) + .createdBy(assistant.getCreatedBy()) .build(); - autoModifyMessageRepository.save(assistantMessage); + assistantService.createMessage(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); @@ -100,15 +100,4 @@ public SseEmitter streamAutoModify(UUID assistantId) { return emitter; } - - private AutoModifyMessage getMemberMessage(UUID assistantId) { - return autoModifyMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } - - private void verifyAnswered(UUID assistantId) { - if (autoModifyMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { - throw new BaseException(AssistantException.ALREADY_ANSWERED); - } - } } diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index 11852bd..c9362c4 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -1,9 +1,13 @@ package writeon.api.assistant.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.io.IOException; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantChatMessageRequest; import writeon.api.assistant.request.AssistantResearchRequest; import writeon.api.assistant.response.AssistantResponse; @@ -17,23 +21,18 @@ import writeon.assistantapiclient.request.ResearchRequest; import writeon.assistantapiclient.request.UserSetting; import writeon.domain.assistant.Assistant; -import writeon.domain.assistant.chat.ChatMessage; -import writeon.domain.assistant.chat.ChatMessageJpaRepository; +import writeon.domain.assistant.AssistantMessage; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; -import java.io.IOException; -import java.util.UUID; - @Service @RequiredArgsConstructor public class ChatService { private final long TIMEOUT = 180_000L; - private final ChatMessageJpaRepository chatMessageRepository; private final AssistantApiClient assistantApiClient; private final AssistantService assistantService; private final ProductQueryService productQueryService; @@ -43,14 +42,14 @@ public MessageCreateResponse createMessage(AssistantChatMessageRequest request) productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); - ChatMessage memberMessage = ChatMessage.builder() + AssistantMessage memberMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.MEMBER) .content(request.getContent()) .prompt(request.getPrompt()) .createdBy(MemberUtil.getMemberId()) .build(); - chatMessageRepository.save(memberMessage); + assistantService.createMessage(memberMessage); return new MessageCreateResponse(assistantId); } @@ -58,14 +57,14 @@ public MessageCreateResponse createMessage(AssistantChatMessageRequest request) public SseEmitter streamChat(UUID assistantId, String sessionId) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); - verifyAnswered(assistantId); + assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - ChatMessage message = getMemberMessage(assistantId); + AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); ChatRequest request = new ChatRequest( - userSetting, message.getContent(), message.getPrompt(), sessionId + userSetting, memberMessage.getContent(), memberMessage.getPrompt(), sessionId ); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -86,13 +85,14 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { - ChatMessage assistantMessage = ChatMessage.builder() + String answer = responseBuilder.toString().replace("[DONE]", "").trim(); + AssistantMessage assistantMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.ASSISTANT) - .content(responseBuilder.toString()) - .createdBy(message.getCreatedBy()) + .content(answer) + .createdBy(memberMessage.getCreatedBy()) .build(); - chatMessageRepository.save(assistantMessage); + assistantService.createMessage(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); @@ -108,9 +108,15 @@ public AssistantResponse research(AssistantResearchRequest request) { // assistant 및 message 생성 UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); - ChatMessage memberMessage = - new ChatMessage(assistantId, MessageSenderRole.MEMBER, request.getContent(), request.getPrompt(), MemberUtil.getMemberId()); - chatMessageRepository.save(memberMessage); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .prompt(request.getPrompt()) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); ResearchRequest researchRequest = new ResearchRequest(userSetting, request.getContent(), request.getPrompt(), request.getSessionId()); @@ -119,21 +125,14 @@ public AssistantResponse research(AssistantResearchRequest request) { String answer = assistantApiClient.research(researchRequest).block(); // assistant 응답 저장 - ChatMessage assistantMessage = - new ChatMessage(assistantId, MessageSenderRole.ASSISTANT, answer, null, MemberUtil.getMemberId()); - chatMessageRepository.save(assistantMessage); + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); return new AssistantResponse(assistantId, answer); } - - private ChatMessage getMemberMessage(UUID assistantId) { - return chatMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } - - private void verifyAnswered(UUID assistantId) { - if (chatMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { - throw new BaseException(AssistantException.ALREADY_ANSWERED); - } - } } diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index f0244d6..49dd79b 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -1,9 +1,13 @@ package writeon.api.assistant.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.io.IOException; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantFeedbackMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -14,15 +18,11 @@ import writeon.assistantapiclient.request.FeedbackRequest; import writeon.assistantapiclient.request.UserSetting; import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantMessage; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.assistant.feedback.FeedbackMessage; -import writeon.domain.assistant.feedback.FeedbackMessageJpaRepository; - -import java.io.IOException; -import java.util.UUID; @Service @RequiredArgsConstructor @@ -30,7 +30,6 @@ public class FeedbackService { private final long TIMEOUT = 180_000L; - private final FeedbackMessageJpaRepository feedbackMessageRepository; private final AssistantApiClient assistantApiClient; private final AssistantService assistantService; private final ProductQueryService productQueryService; @@ -40,14 +39,14 @@ public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest reque productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); - FeedbackMessage memberMessage = FeedbackMessage.builder() + + AssistantMessage memberMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.MEMBER) .content(request.getContent()) .createdBy(MemberUtil.getMemberId()) .build(); - - feedbackMessageRepository.save(memberMessage); + assistantService.createMessage(memberMessage); return new MessageCreateResponse(assistantId); } @@ -55,14 +54,14 @@ public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest reque public SseEmitter streamFeedback(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); - verifyAnswered(assistantId); + assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - FeedbackMessage message = getMemberMessage(assistantId); + AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); FeedbackRequest request = new FeedbackRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent() + assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent() ); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -85,14 +84,14 @@ public SseEmitter streamFeedback(UUID assistantId) { throw exception; }, () -> { - FeedbackMessage assistantMessage = FeedbackMessage.builder() + String answer = responseBuilder.toString().replace("[DONE]", "").trim(); + AssistantMessage assistantMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.ASSISTANT) - .content(responseBuilder.toString()) - .createdBy(message.getCreatedBy()) + .content(answer) + .createdBy(memberMessage.getCreatedBy()) .build(); - - feedbackMessageRepository.save(assistantMessage); + assistantService.createMessage(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); @@ -101,15 +100,4 @@ public SseEmitter streamFeedback(UUID assistantId) { return emitter; } - - private FeedbackMessage getMemberMessage(UUID assistantId) { - return feedbackMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } - - private void verifyAnswered(UUID assistantId) { - if (feedbackMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { - throw new BaseException(AssistantException.ALREADY_ANSWERED); - } - } } diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index faf9435..1f94069 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -1,9 +1,13 @@ package writeon.api.assistant.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.io.IOException; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantUserModifyMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -14,15 +18,11 @@ import writeon.assistantapiclient.request.UserModifyRequest; import writeon.assistantapiclient.request.UserSetting; import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantMessage; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantStatus; import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.assistant.usermodify.UserModifyMessage; -import writeon.domain.assistant.usermodify.UserModifyMessageJpaRepository; - -import java.io.IOException; -import java.util.UUID; @Service @RequiredArgsConstructor @@ -30,7 +30,6 @@ public class UserModifyService { private final long TIMEOUT = 180_000L; - private final UserModifyMessageJpaRepository userModifyMessageRepository; private final AssistantApiClient assistantApiClient; private final AssistantService assistantService; private final ProductQueryService productQueryService; @@ -40,15 +39,15 @@ public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest req productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); - UserModifyMessage memberMessage = UserModifyMessage.builder() + + AssistantMessage memberMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.MEMBER) .content(request.getContent()) .prompt(request.getPrompt()) .createdBy(MemberUtil.getMemberId()) .build(); - - userModifyMessageRepository.save(memberMessage); + assistantService.createMessage(memberMessage); return new MessageCreateResponse(assistantId); } @@ -56,14 +55,14 @@ public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest req public SseEmitter streamUserModify(UUID assistantId) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); - verifyAnswered(assistantId); + assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - UserModifyMessage message = getMemberMessage(assistantId); + AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); UserModifyRequest request = new UserModifyRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, message.getContent(), message.getPrompt() + assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent(), memberMessage.getPrompt() ); SseEmitter emitter = new SseEmitter(TIMEOUT); @@ -86,14 +85,14 @@ public SseEmitter streamUserModify(UUID assistantId) { throw exception; }, () -> { - UserModifyMessage assistantMessage = UserModifyMessage.builder() + String answer = responseBuilder.toString().replace("[DONE]", "").trim(); + AssistantMessage assistantMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.ASSISTANT) - .content(responseBuilder.toString()) - .createdBy(message.getCreatedBy()) + .content(answer) + .createdBy(memberMessage.getCreatedBy()) .build(); - - userModifyMessageRepository.save(assistantMessage); + assistantService.createMessage(assistantMessage); assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); emitter.complete(); @@ -102,15 +101,4 @@ public SseEmitter streamUserModify(UUID assistantId) { return emitter; } - - private UserModifyMessage getMemberMessage(UUID assistantId) { - return userModifyMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.MEMBER) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } - - private void verifyAnswered(UUID assistantId) { - if (userModifyMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { - throw new BaseException(AssistantException.ALREADY_ANSWERED); - } - } } diff --git a/api/src/main/java/writeon/api/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java index 8dadeef..c1ef6fd 100644 --- a/api/src/main/java/writeon/api/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -1,15 +1,16 @@ package writeon.api.product.repository; -import writeon.api.common.util.MemberUtil; -import writeon.api.product.response.ProductResponse; -import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; import java.util.List; -import static writely.tables.Product.PRODUCT; -import static writely.tables.ProductSynopsis.PRODUCT_SYNOPSIS; +import lombok.RequiredArgsConstructor; +import writeon.api.common.util.MemberUtil; +import writeon.api.product.response.ProductResponse; + +import static writeon.tables.Product.PRODUCT; +import static writeon.tables.ProductSynopsis.PRODUCT_SYNOPSIS; @Repository diff --git a/api/src/main/java/writeon/api/product/response/ProductResponse.java b/api/src/main/java/writeon/api/product/response/ProductResponse.java index d943f14..1391831 100644 --- a/api/src/main/java/writeon/api/product/response/ProductResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductResponse.java @@ -1,12 +1,12 @@ package writeon.api.product.response; +import java.time.LocalDateTime; +import java.util.UUID; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; -import writely.tables.records.ProductRecord; - -import java.time.LocalDateTime; -import java.util.UUID; +import writeon.tables.records.ProductRecord; @Getter @Setter diff --git a/api/src/main/java/writeon/api/terms/repository/TermsDao.java b/api/src/main/java/writeon/api/terms/repository/TermsDao.java index 2a8ea0f..faf0a56 100644 --- a/api/src/main/java/writeon/api/terms/repository/TermsDao.java +++ b/api/src/main/java/writeon/api/terms/repository/TermsDao.java @@ -1,16 +1,17 @@ package writeon.api.terms.repository; -import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; -import writely.tables.records.TermsRecord; -import writeon.domain.terms.enums.TermsCode; import java.util.List; import java.util.Optional; +import lombok.RequiredArgsConstructor; +import writeon.domain.terms.enums.TermsCode; +import writeon.tables.records.TermsRecord; + import static org.jooq.impl.DSL.count; -import static writely.tables.Terms.TERMS; +import static writeon.tables.Terms.TERMS; @Repository @RequiredArgsConstructor diff --git a/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java b/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java index 2182394..44d6c1f 100644 --- a/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java +++ b/api/src/main/java/writeon/api/terms/response/TermsDetailResponse.java @@ -1,13 +1,13 @@ package writeon.api.terms.response; +import java.time.LocalDateTime; +import java.util.UUID; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; -import writely.tables.records.TermsRecord; import writeon.domain.terms.enums.TermsCode; - -import java.time.LocalDateTime; -import java.util.UUID; +import writeon.tables.records.TermsRecord; @Getter @Setter diff --git a/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java b/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java index 7b5d5e8..da20429 100644 --- a/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java +++ b/api/src/main/java/writeon/api/terms/response/TermsSummaryResponse.java @@ -1,12 +1,12 @@ package writeon.api.terms.response; +import java.util.UUID; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; -import writely.tables.records.TermsRecord; import writeon.domain.terms.enums.TermsCode; - -import java.util.UUID; +import writeon.tables.records.TermsRecord; @Getter @Setter diff --git a/api/src/main/java/writeon/api/terms/service/TermsQueryService.java b/api/src/main/java/writeon/api/terms/service/TermsQueryService.java index 0e48ddf..53abc92 100644 --- a/api/src/main/java/writeon/api/terms/service/TermsQueryService.java +++ b/api/src/main/java/writeon/api/terms/service/TermsQueryService.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import writely.tables.records.TermsRecord; +import writeon.tables.records.TermsRecord; import writeon.api.common.exception.BaseException; import writeon.api.terms.repository.TermsDao; import writeon.api.terms.response.TermsDetailResponse; diff --git a/domain/build.gradle b/domain/build.gradle index 3bd739d..42f8b3f 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -48,9 +48,9 @@ jooq { logging = org.jooq.meta.jaxb.Logging.DEBUG jdbc { driver = 'org.postgresql.Driver' - url = 'jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service' + url = 'jdbc:postgresql://localhost:5432/service' user = 'postgres' - password = 'Writely0101%' + password = '1234' } generator { name = 'org.jooq.codegen.DefaultGenerator' @@ -65,7 +65,7 @@ jooq { fluentSetters = true } target { - packageName = 'writely' + packageName = 'writeon' directory = 'src/main/generated' } strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy' diff --git a/domain/src/main/generated/writely/Routines.java b/domain/src/main/generated/writely/Routines.java deleted file mode 100644 index b647465..0000000 --- a/domain/src/main/generated/writely/Routines.java +++ /dev/null @@ -1,1704 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely; - - -import java.util.UUID; - -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; - -import writely.routines.Armor1; -import writely.routines.Armor2; -import writely.routines.Crypt; -import writely.routines.Dearmor; -import writely.routines.Decrypt; -import writely.routines.DecryptIv; -import writely.routines.Digest1; -import writely.routines.Digest2; -import writely.routines.Encrypt; -import writely.routines.EncryptIv; -import writely.routines.GenRandomBytes; -import writely.routines.GenRandomUuid; -import writely.routines.GenSalt1; -import writely.routines.GenSalt2; -import writely.routines.Hmac1; -import writely.routines.Hmac2; -import writely.routines.PgpKeyId; -import writely.routines.PgpPubDecrypt1; -import writely.routines.PgpPubDecrypt2; -import writely.routines.PgpPubDecrypt3; -import writely.routines.PgpPubDecryptBytea1; -import writely.routines.PgpPubDecryptBytea2; -import writely.routines.PgpPubDecryptBytea3; -import writely.routines.PgpPubEncrypt1; -import writely.routines.PgpPubEncrypt2; -import writely.routines.PgpPubEncryptBytea1; -import writely.routines.PgpPubEncryptBytea2; -import writely.routines.PgpSymDecrypt1; -import writely.routines.PgpSymDecrypt2; -import writely.routines.PgpSymDecryptBytea1; -import writely.routines.PgpSymDecryptBytea2; -import writely.routines.PgpSymEncrypt1; -import writely.routines.PgpSymEncrypt2; -import writely.routines.PgpSymEncryptBytea1; -import writely.routines.PgpSymEncryptBytea2; -import writely.tables.PgpArmorHeaders; -import writely.tables.records.PgpArmorHeadersRecord; - - -/** - * Convenience access to all stored procedures and functions in public. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Routines { - - /** - * Call public.armor - */ - public static String armor1( - Configuration configuration - , byte[] __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor1( - byte[] __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor1( - Field __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.armor - */ - public static String armor2( - Configuration configuration - , byte[] __1 - , String[] __2 - , String[] __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor2( - byte[] __1 - , String[] __2 - , String[] __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor2( - Field __1 - , Field __2 - , Field __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.crypt - */ - public static String crypt( - Configuration configuration - , String __1 - , String __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.crypt as a field. - */ - public static Field crypt( - String __1 - , String __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.crypt as a field. - */ - public static Field crypt( - Field __1 - , Field __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.dearmor - */ - public static byte[] dearmor( - Configuration configuration - , String __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.dearmor as a field. - */ - public static Field dearmor( - String __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.dearmor as a field. - */ - public static Field dearmor( - Field __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.decrypt - */ - public static byte[] decrypt( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.decrypt as a field. - */ - public static Field decrypt( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.decrypt as a field. - */ - public static Field decrypt( - Field __1 - , Field __2 - , Field __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.decrypt_iv - */ - public static byte[] decryptIv( - Configuration configuration - , byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.decrypt_iv as a field. - */ - public static Field decryptIv( - byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.decrypt_iv as a field. - */ - public static Field decryptIv( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.digest - */ - public static byte[] digest1( - Configuration configuration - , String __1 - , String __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest1( - String __1 - , String __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest1( - Field __1 - , Field __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.digest - */ - public static byte[] digest2( - Configuration configuration - , byte[] __1 - , String __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest2( - byte[] __1 - , String __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest2( - Field __1 - , Field __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.encrypt - */ - public static byte[] encrypt( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.encrypt as a field. - */ - public static Field encrypt( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.encrypt as a field. - */ - public static Field encrypt( - Field __1 - , Field __2 - , Field __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.encrypt_iv - */ - public static byte[] encryptIv( - Configuration configuration - , byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.encrypt_iv as a field. - */ - public static Field encryptIv( - byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.encrypt_iv as a field. - */ - public static Field encryptIv( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.gen_random_bytes - */ - public static byte[] genRandomBytes( - Configuration configuration - , Integer __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_random_bytes as a field. - */ - public static Field genRandomBytes( - Integer __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.gen_random_bytes as a field. - */ - public static Field genRandomBytes( - Field __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.gen_random_uuid - */ - public static UUID genRandomUuid( - Configuration configuration - ) { - GenRandomUuid f = new GenRandomUuid(); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_random_uuid as a field. - */ - public static Field genRandomUuid() { - GenRandomUuid f = new GenRandomUuid(); - - return f.asField(); - } - - /** - * Call public.gen_salt - */ - public static String genSalt1( - Configuration configuration - , String __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt1( - String __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt1( - Field __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.gen_salt - */ - public static String genSalt2( - Configuration configuration - , String __1 - , Integer __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt2( - String __1 - , Integer __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt2( - Field __1 - , Field __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.hmac - */ - public static byte[] hmac1( - Configuration configuration - , String __1 - , String __2 - , String __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac1( - String __1 - , String __2 - , String __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac1( - Field __1 - , Field __2 - , Field __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.hmac - */ - public static byte[] hmac2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac2( - Field __1 - , Field __2 - , Field __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_key_id - */ - public static String pgpKeyId( - Configuration configuration - , byte[] __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_key_id as a field. - */ - public static Field pgpKeyId( - byte[] __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.pgp_key_id as a field. - */ - public static Field pgpKeyId( - Field __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt1( - byte[] __1 - , byte[] __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt1( - Field __1 - , Field __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt3( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt3( - byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt3( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea1( - byte[] __1 - , byte[] __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea1( - Field __1 - , Field __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea3( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea3( - byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea3( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt - */ - public static byte[] pgpPubEncrypt1( - Configuration configuration - , String __1 - , byte[] __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt1( - String __1 - , byte[] __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt1( - Field __1 - , Field __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt - */ - public static byte[] pgpPubEncrypt2( - Configuration configuration - , String __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt2( - String __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt_bytea - */ - public static byte[] pgpPubEncryptBytea1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea1( - byte[] __1 - , byte[] __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea1( - Field __1 - , Field __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt_bytea - */ - public static byte[] pgpPubEncryptBytea2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt - */ - public static String pgpSymDecrypt1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt1( - byte[] __1 - , String __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt1( - Field __1 - , Field __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt - */ - public static String pgpSymDecrypt2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt_bytea - */ - public static byte[] pgpSymDecryptBytea1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea1( - byte[] __1 - , String __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea1( - Field __1 - , Field __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt_bytea - */ - public static byte[] pgpSymDecryptBytea2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt - */ - public static byte[] pgpSymEncrypt1( - Configuration configuration - , String __1 - , String __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt1( - String __1 - , String __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt1( - Field __1 - , Field __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt - */ - public static byte[] pgpSymEncrypt2( - Configuration configuration - , String __1 - , String __2 - , String __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt2( - String __1 - , String __2 - , String __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt_bytea - */ - public static byte[] pgpSymEncryptBytea1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea1( - byte[] __1 - , String __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea1( - Field __1 - , Field __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt_bytea - */ - public static byte[] pgpSymEncryptBytea2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_armor_headers. - */ - public static Result pgpArmorHeaders( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders pgpArmorHeaders( - String __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders pgpArmorHeaders( - Field __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } -} diff --git a/domain/src/main/generated/writely/Tables.java b/domain/src/main/generated/writely/Tables.java deleted file mode 100644 index fddf66f..0000000 --- a/domain/src/main/generated/writely/Tables.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely; - - -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; - -import writely.tables.Assistant; -import writely.tables.AssistantEvaluation; -import writely.tables.AutoModifyMessage; -import writely.tables.ChatMessage; -import writely.tables.FeedbackMessage; -import writely.tables.LoginAttempt; -import writely.tables.Member; -import writely.tables.MemberPassword; -import writely.tables.PgpArmorHeaders; -import writely.tables.Product; -import writely.tables.ProductCharacter; -import writely.tables.ProductCustomField; -import writely.tables.ProductIdeanote; -import writely.tables.ProductMemo; -import writely.tables.ProductPlot; -import writely.tables.ProductSynopsis; -import writely.tables.ProductWorldview; -import writely.tables.Terms; -import writely.tables.TermsAgreement; -import writely.tables.UserModifyMessage; -import writely.tables.records.PgpArmorHeadersRecord; - - -/** - * Convenience access to all tables in public. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Tables { - - /** - * 어시스턴트 - */ - public static final Assistant ASSISTANT = Assistant.ASSISTANT; - - /** - * 어시스턴트 평가 - */ - public static final AssistantEvaluation ASSISTANT_EVALUATION = AssistantEvaluation.ASSISTANT_EVALUATION; - - /** - * 자동 수정 메세지 - */ - public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; - - /** - * The table public.chat_message. - */ - public static final ChatMessage CHAT_MESSAGE = ChatMessage.CHAT_MESSAGE; - - /** - * 피드백 메세지 - */ - public static final FeedbackMessage FEEDBACK_MESSAGE = FeedbackMessage.FEEDBACK_MESSAGE; - - /** - * 로그인_시도 - */ - public static final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; - - /** - * 회원 - */ - public static final Member MEMBER = Member.MEMBER; - - /** - * 회원_비밀번호 - */ - public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; - - /** - * The table public.pgp_armor_headers. - */ - public static final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; - - /** - * Call public.pgp_armor_headers. - */ - public static Result PGP_ARMOR_HEADERS( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - String __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - Field __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * 작품 - */ - public static final Product PRODUCT = Product.PRODUCT; - - /** - * 작품 등장인물 - */ - public static final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; - - /** - * The table public.product_custom_field. - */ - public static final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; - - /** - * 작품 아이디어 노트 - */ - public static final ProductIdeanote PRODUCT_IDEANOTE = ProductIdeanote.PRODUCT_IDEANOTE; - - /** - * 작품 메모 - */ - public static final ProductMemo PRODUCT_MEMO = ProductMemo.PRODUCT_MEMO; - - /** - * 작품 줄거리 - */ - public static final ProductPlot PRODUCT_PLOT = ProductPlot.PRODUCT_PLOT; - - /** - * 작품 시놉시스 - */ - public static final ProductSynopsis PRODUCT_SYNOPSIS = ProductSynopsis.PRODUCT_SYNOPSIS; - - /** - * 작품 세계관 - */ - public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; - - /** - * 약관 - */ - public static final Terms TERMS = Terms.TERMS; - - /** - * 약관_동의 - */ - public static final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; - - /** - * The table public.user_modify_message. - */ - public static final UserModifyMessage USER_MODIFY_MESSAGE = UserModifyMessage.USER_MODIFY_MESSAGE; -} diff --git a/domain/src/main/generated/writely/routines/Armor1.java b/domain/src/main/generated/writely/routines/Armor1.java deleted file mode 100644 index c835b2a..0000000 --- a/domain/src/main/generated/writely/routines/Armor1.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Armor1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.armor.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.armor._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public Armor1() { - super("armor", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Armor1 set__1(Field field) { - setField(_1, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Armor2.java b/domain/src/main/generated/writely/routines/Armor2.java deleted file mode 100644 index 0e648b9..0000000 --- a/domain/src/main/generated/writely/routines/Armor2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Armor2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.armor.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.armor._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.armor._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB.array(), false, true); - - /** - * The parameter public.armor._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB.array(), false, true); - - /** - * Create a new routine call instance - */ - public Armor2() { - super("armor", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Armor2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Armor2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String[] value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Armor2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Crypt.java b/domain/src/main/generated/writely/routines/Crypt.java deleted file mode 100644 index 18d21d7..0000000 --- a/domain/src/main/generated/writely/routines/Crypt.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Crypt extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.crypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.crypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.crypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Crypt() { - super("crypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Crypt set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Crypt set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Dearmor.java b/domain/src/main/generated/writely/routines/Dearmor.java deleted file mode 100644 index 3f82bc9..0000000 --- a/domain/src/main/generated/writely/routines/Dearmor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Dearmor extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.dearmor.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.dearmor._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Dearmor() { - super("dearmor", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Dearmor set__1(Field field) { - setField(_1, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Decrypt.java b/domain/src/main/generated/writely/routines/Decrypt.java deleted file mode 100644 index 6ff1e17..0000000 --- a/domain/src/main/generated/writely/routines/Decrypt.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Decrypt extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.decrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Decrypt() { - super("decrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Decrypt set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Decrypt set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Decrypt set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/DecryptIv.java b/domain/src/main/generated/writely/routines/DecryptIv.java deleted file mode 100644 index c0e6e96..0000000 --- a/domain/src/main/generated/writely/routines/DecryptIv.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class DecryptIv extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.decrypt_iv.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.decrypt_iv._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.decrypt_iv._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.decrypt_iv._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); - - /** - * The parameter public.decrypt_iv._4. - */ - public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public DecryptIv() { - super("decrypt_iv", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - addInParameter(_4); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public DecryptIv set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public DecryptIv set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(byte[] value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public DecryptIv set__3(Field field) { - setField(_3, field); - return this; - } - - /** - * Set the _4 parameter IN value to the routine - */ - public void set__4(String value) { - setValue(_4, value); - } - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public DecryptIv set__4(Field field) { - setField(_4, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Digest1.java b/domain/src/main/generated/writely/routines/Digest1.java deleted file mode 100644 index 1863aca..0000000 --- a/domain/src/main/generated/writely/routines/Digest1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Digest1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.digest.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.digest._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.digest._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Digest1() { - super("digest", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Digest1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Digest1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Digest2.java b/domain/src/main/generated/writely/routines/Digest2.java deleted file mode 100644 index bcd7e6c..0000000 --- a/domain/src/main/generated/writely/routines/Digest2.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Digest2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.digest.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.digest._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.digest._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Digest2() { - super("digest", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Digest2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Digest2 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Encrypt.java b/domain/src/main/generated/writely/routines/Encrypt.java deleted file mode 100644 index ffbb445..0000000 --- a/domain/src/main/generated/writely/routines/Encrypt.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Encrypt extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.encrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.encrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.encrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.encrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Encrypt() { - super("encrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Encrypt set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Encrypt set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Encrypt set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/EncryptIv.java b/domain/src/main/generated/writely/routines/EncryptIv.java deleted file mode 100644 index 64b06cc..0000000 --- a/domain/src/main/generated/writely/routines/EncryptIv.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class EncryptIv extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.encrypt_iv.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.encrypt_iv._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.encrypt_iv._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.encrypt_iv._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); - - /** - * The parameter public.encrypt_iv._4. - */ - public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public EncryptIv() { - super("encrypt_iv", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - addInParameter(_4); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public EncryptIv set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public EncryptIv set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(byte[] value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public EncryptIv set__3(Field field) { - setField(_3, field); - return this; - } - - /** - * Set the _4 parameter IN value to the routine - */ - public void set__4(String value) { - setValue(_4, value); - } - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public EncryptIv set__4(Field field) { - setField(_4, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/GenRandomBytes.java b/domain/src/main/generated/writely/routines/GenRandomBytes.java deleted file mode 100644 index 2219479..0000000 --- a/domain/src/main/generated/writely/routines/GenRandomBytes.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class GenRandomBytes extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.gen_random_bytes.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.gen_random_bytes._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.INTEGER, false, true); - - /** - * Create a new routine call instance - */ - public GenRandomBytes() { - super("gen_random_bytes", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(Integer value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public GenRandomBytes set__1(Field field) { - setField(_1, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/GenRandomUuid.java b/domain/src/main/generated/writely/routines/GenRandomUuid.java deleted file mode 100644 index 0553fb1..0000000 --- a/domain/src/main/generated/writely/routines/GenRandomUuid.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import java.util.UUID; - -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class GenRandomUuid extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.gen_random_uuid.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.UUID, false, false); - - /** - * Create a new routine call instance - */ - public GenRandomUuid() { - super("gen_random_uuid", Public.PUBLIC, SQLDataType.UUID); - - setReturnParameter(RETURN_VALUE); - } -} diff --git a/domain/src/main/generated/writely/routines/GenSalt1.java b/domain/src/main/generated/writely/routines/GenSalt1.java deleted file mode 100644 index b6b325f..0000000 --- a/domain/src/main/generated/writely/routines/GenSalt1.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class GenSalt1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.gen_salt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.gen_salt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public GenSalt1() { - super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public GenSalt1 set__1(Field field) { - setField(_1, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/GenSalt2.java b/domain/src/main/generated/writely/routines/GenSalt2.java deleted file mode 100644 index 603c9d6..0000000 --- a/domain/src/main/generated/writely/routines/GenSalt2.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class GenSalt2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.gen_salt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.gen_salt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.gen_salt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.INTEGER, false, true); - - /** - * Create a new routine call instance - */ - public GenSalt2() { - super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public GenSalt2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(Integer value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public GenSalt2 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Hmac1.java b/domain/src/main/generated/writely/routines/Hmac1.java deleted file mode 100644 index b3082a2..0000000 --- a/domain/src/main/generated/writely/routines/Hmac1.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Hmac1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.hmac.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.hmac._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.hmac._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * The parameter public.hmac._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Hmac1() { - super("hmac", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac1 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac1 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/Hmac2.java b/domain/src/main/generated/writely/routines/Hmac2.java deleted file mode 100644 index 21e1a1d..0000000 --- a/domain/src/main/generated/writely/routines/Hmac2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Hmac2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.hmac.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.hmac._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.hmac._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.hmac._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public Hmac2() { - super("hmac", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public Hmac2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpKeyId.java b/domain/src/main/generated/writely/routines/PgpKeyId.java deleted file mode 100644 index 3e9fac6..0000000 --- a/domain/src/main/generated/writely/routines/PgpKeyId.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpKeyId extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_key_id.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_key_id._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpKeyId() { - super("pgp_key_id", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpKeyId set__1(Field field) { - setField(_1, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecrypt1.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt1.java deleted file mode 100644 index c1b67f2..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecrypt1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecrypt1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecrypt1() { - super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecrypt2.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt2.java deleted file mode 100644 index 477b5e1..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecrypt2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecrypt2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecrypt2() { - super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecrypt3.java b/domain/src/main/generated/writely/routines/PgpPubDecrypt3.java deleted file mode 100644 index 523f1f2..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecrypt3.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecrypt3 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt._4. - */ - public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecrypt3() { - super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - addInParameter(_4); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt3 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt3 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt3 set__3(Field field) { - setField(_3, field); - return this; - } - - /** - * Set the _4 parameter IN value to the routine - */ - public void set__4(String value) { - setValue(_4, value); - } - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecrypt3 set__4(Field field) { - setField(_4, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java deleted file mode 100644 index 05f3e53..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecryptBytea1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecryptBytea1() { - super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java deleted file mode 100644 index 43eeeb2..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecryptBytea2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecryptBytea2() { - super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java b/domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java deleted file mode 100644 index 02c24ff..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubDecryptBytea3.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubDecryptBytea3 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_pub_decrypt_bytea._4. - */ - public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubDecryptBytea3() { - super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - addInParameter(_4); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea3 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea3 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea3 set__3(Field field) { - setField(_3, field); - return this; - } - - /** - * Set the _4 parameter IN value to the routine - */ - public void set__4(String value) { - setValue(_4, value); - } - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubDecryptBytea3 set__4(Field field) { - setField(_4, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubEncrypt1.java b/domain/src/main/generated/writely/routines/PgpPubEncrypt1.java deleted file mode 100644 index 4ea7505..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubEncrypt1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubEncrypt1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_encrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_encrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubEncrypt1() { - super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncrypt1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncrypt1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubEncrypt2.java b/domain/src/main/generated/writely/routines/PgpPubEncrypt2.java deleted file mode 100644 index 4dfa568..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubEncrypt2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubEncrypt2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_encrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_encrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubEncrypt2() { - super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncrypt2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncrypt2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncrypt2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java b/domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java deleted file mode 100644 index df86a32..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubEncryptBytea1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubEncryptBytea1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_encrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubEncryptBytea1() { - super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncryptBytea1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncryptBytea1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java b/domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java deleted file mode 100644 index 717acd3..0000000 --- a/domain/src/main/generated/writely/routines/PgpPubEncryptBytea2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpPubEncryptBytea2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_pub_encrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_pub_encrypt_bytea._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpPubEncryptBytea2() { - super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncryptBytea2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(byte[] value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncryptBytea2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpPubEncryptBytea2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymDecrypt1.java b/domain/src/main/generated/writely/routines/PgpSymDecrypt1.java deleted file mode 100644 index 080e3e1..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymDecrypt1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymDecrypt1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_sym_decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymDecrypt1() { - super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecrypt1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecrypt1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymDecrypt2.java b/domain/src/main/generated/writely/routines/PgpSymDecrypt2.java deleted file mode 100644 index 57346f8..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymDecrypt2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymDecrypt2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_decrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); - - /** - * The parameter public.pgp_sym_decrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymDecrypt2() { - super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecrypt2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecrypt2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecrypt2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java b/domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java deleted file mode 100644 index 71f60b5..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymDecryptBytea1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymDecryptBytea1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_decrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymDecryptBytea1() { - super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecryptBytea1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecryptBytea1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java b/domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java deleted file mode 100644 index 4463c50..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymDecryptBytea2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymDecryptBytea2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_decrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_decrypt_bytea._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymDecryptBytea2() { - super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecryptBytea2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecryptBytea2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymDecryptBytea2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymEncrypt1.java b/domain/src/main/generated/writely/routines/PgpSymEncrypt1.java deleted file mode 100644 index b0080eb..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymEncrypt1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymEncrypt1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_encrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_encrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymEncrypt1() { - super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncrypt1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncrypt1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymEncrypt2.java b/domain/src/main/generated/writely/routines/PgpSymEncrypt2.java deleted file mode 100644 index 7f08ec5..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymEncrypt2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymEncrypt2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_encrypt.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_encrypt._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymEncrypt2() { - super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(String value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncrypt2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncrypt2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncrypt2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java b/domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java deleted file mode 100644 index e6b0469..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymEncryptBytea1.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymEncryptBytea1 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_encrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymEncryptBytea1() { - super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncryptBytea1 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncryptBytea1 set__2(Field field) { - setField(_2, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java b/domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java deleted file mode 100644 index 0070cc0..0000000 --- a/domain/src/main/generated/writely/routines/PgpSymEncryptBytea2.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.routines; - - -import org.jooq.Field; -import org.jooq.Parameter; -import org.jooq.impl.AbstractRoutine; -import org.jooq.impl.Internal; -import org.jooq.impl.SQLDataType; - -import writely.Public; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpSymEncryptBytea2 extends AbstractRoutine { - - private static final long serialVersionUID = 1L; - - /** - * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. - */ - public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); - - /** - * The parameter public.pgp_sym_encrypt_bytea._1. - */ - public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt_bytea._2. - */ - public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); - - /** - * The parameter public.pgp_sym_encrypt_bytea._3. - */ - public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); - - /** - * Create a new routine call instance - */ - public PgpSymEncryptBytea2() { - super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); - - setReturnParameter(RETURN_VALUE); - addInParameter(_1); - addInParameter(_2); - addInParameter(_3); - setOverloaded(true); - } - - /** - * Set the _1 parameter IN value to the routine - */ - public void set__1(byte[] value) { - setValue(_1, value); - } - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncryptBytea2 set__1(Field field) { - setField(_1, field); - return this; - } - - /** - * Set the _2 parameter IN value to the routine - */ - public void set__2(String value) { - setValue(_2, value); - } - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncryptBytea2 set__2(Field field) { - setField(_2, field); - return this; - } - - /** - * Set the _3 parameter IN value to the routine - */ - public void set__3(String value) { - setValue(_3, value); - } - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - public PgpSymEncryptBytea2 set__3(Field field) { - setField(_3, field); - return this; - } -} diff --git a/domain/src/main/generated/writely/tables/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/AutoModifyMessage.java deleted file mode 100644 index 85dad76..0000000 --- a/domain/src/main/generated/writely/tables/AutoModifyMessage.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.AutoModifyMessageRecord; - - -/** - * 자동 수정 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class AutoModifyMessage extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.auto_modify_message - */ - public static final AutoModifyMessage AUTO_MODIFY_MESSAGE = new AutoModifyMessage(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return AutoModifyMessageRecord.class; - } - - /** - * The column public.auto_modify_message.id. 자동 수정 메세지 ID - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "자동 수정 메세지 ID"); - - /** - * The column public.auto_modify_message.product_id. 작품 ID - */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); - - /** - * The column public.auto_modify_message.assistant_id. 어시스턴트 ID - */ - public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); - - /** - * The column public.auto_modify_message.role. 메세지 송신자 - */ - public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); - - /** - * The column public.auto_modify_message.content. 내용 - */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); - - /** - * The column public.auto_modify_message.created_at. 생성일시 - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); - - /** - * The column public.auto_modify_message.created_by. 생성자 ID - */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); - - /** - * The column public.auto_modify_message.updated_at. 수정일시 - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); - - /** - * The column public.auto_modify_message.updated_by. 수정자 ID - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); - - private AutoModifyMessage(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private AutoModifyMessage(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("자동 수정 메세지"), TableOptions.table(), where); - } - - /** - * Create an aliased public.auto_modify_message table reference - */ - public AutoModifyMessage(String alias) { - this(DSL.name(alias), AUTO_MODIFY_MESSAGE); - } - - /** - * Create an aliased public.auto_modify_message table reference - */ - public AutoModifyMessage(Name alias) { - this(alias, AUTO_MODIFY_MESSAGE); - } - - /** - * Create a public.auto_modify_message table reference - */ - public AutoModifyMessage() { - this(DSL.name("auto_modify_message"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.AUTO_MODIFY_MESSAGE_PK; - } - - @Override - public AutoModifyMessage as(String alias) { - return new AutoModifyMessage(DSL.name(alias), this); - } - - @Override - public AutoModifyMessage as(Name alias) { - return new AutoModifyMessage(alias, this); - } - - @Override - public AutoModifyMessage as(Table alias) { - return new AutoModifyMessage(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public AutoModifyMessage rename(String name) { - return new AutoModifyMessage(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public AutoModifyMessage rename(Name name) { - return new AutoModifyMessage(name, null); - } - - /** - * Rename this table - */ - @Override - public AutoModifyMessage rename(Table name) { - return new AutoModifyMessage(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage where(Condition condition) { - return new AutoModifyMessage(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public AutoModifyMessage where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public AutoModifyMessage where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public AutoModifyMessage where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public AutoModifyMessage where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public AutoModifyMessage whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/domain/src/main/generated/writely/tables/ChatMessage.java b/domain/src/main/generated/writely/tables/ChatMessage.java deleted file mode 100644 index 7dffc0e..0000000 --- a/domain/src/main/generated/writely/tables/ChatMessage.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.ChatMessageRecord; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ChatMessage extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.chat_message - */ - public static final ChatMessage CHAT_MESSAGE = new ChatMessage(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return ChatMessageRecord.class; - } - - /** - * The column public.chat_message.id. - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); - - /** - * The column public.chat_message.assistant_id. - */ - public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); - - /** - * The column public.chat_message.role. - */ - public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, ""); - - /** - * The column public.chat_message.content. - */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column public.chat_message.prompt. - */ - public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, ""); - - /** - * The column public.chat_message.created_at. - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); - - /** - * The column public.chat_message.created_by. - */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, ""); - - /** - * The column public.chat_message.updated_at. - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); - - /** - * The column public.chat_message.updated_by. - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); - - private ChatMessage(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private ChatMessage(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); - } - - /** - * Create an aliased public.chat_message table reference - */ - public ChatMessage(String alias) { - this(DSL.name(alias), CHAT_MESSAGE); - } - - /** - * Create an aliased public.chat_message table reference - */ - public ChatMessage(Name alias) { - this(alias, CHAT_MESSAGE); - } - - /** - * Create a public.chat_message table reference - */ - public ChatMessage() { - this(DSL.name("chat_message"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.CHAT_MESSAGE_PK; - } - - @Override - public ChatMessage as(String alias) { - return new ChatMessage(DSL.name(alias), this); - } - - @Override - public ChatMessage as(Name alias) { - return new ChatMessage(alias, this); - } - - @Override - public ChatMessage as(Table alias) { - return new ChatMessage(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public ChatMessage rename(String name) { - return new ChatMessage(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public ChatMessage rename(Name name) { - return new ChatMessage(name, null); - } - - /** - * Rename this table - */ - @Override - public ChatMessage rename(Table name) { - return new ChatMessage(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage where(Condition condition) { - return new ChatMessage(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ChatMessage where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ChatMessage where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ChatMessage where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public ChatMessage where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public ChatMessage whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/domain/src/main/generated/writely/tables/FeedbackMessage.java b/domain/src/main/generated/writely/tables/FeedbackMessage.java deleted file mode 100644 index 9d7ce3a..0000000 --- a/domain/src/main/generated/writely/tables/FeedbackMessage.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.FeedbackMessageRecord; - - -/** - * 피드백 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class FeedbackMessage extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.feedback_message - */ - public static final FeedbackMessage FEEDBACK_MESSAGE = new FeedbackMessage(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return FeedbackMessageRecord.class; - } - - /** - * The column public.feedback_message.id. 피드백 메세지 ID - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "피드백 메세지 ID"); - - /** - * The column public.feedback_message.product_id. 작품 ID - */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); - - /** - * The column public.feedback_message.assistant_id. 어시스턴트 ID - */ - public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, "어시스턴트 ID"); - - /** - * The column public.feedback_message.role. 메세지 송신자 - */ - public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, "메세지 송신자"); - - /** - * The column public.feedback_message.content. 내용 - */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, "내용"); - - /** - * The column public.feedback_message.created_at. 생성일시 - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "생성일시"); - - /** - * The column public.feedback_message.created_by. 생성자 ID - */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); - - /** - * The column public.feedback_message.updated_at. 수정일시 - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); - - /** - * The column public.feedback_message.updated_by. 수정자 ID - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); - - private FeedbackMessage(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private FeedbackMessage(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("피드백 메세지"), TableOptions.table(), where); - } - - /** - * Create an aliased public.feedback_message table reference - */ - public FeedbackMessage(String alias) { - this(DSL.name(alias), FEEDBACK_MESSAGE); - } - - /** - * Create an aliased public.feedback_message table reference - */ - public FeedbackMessage(Name alias) { - this(alias, FEEDBACK_MESSAGE); - } - - /** - * Create a public.feedback_message table reference - */ - public FeedbackMessage() { - this(DSL.name("feedback_message"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.FEEDBACK_MESSAGE_PK; - } - - @Override - public FeedbackMessage as(String alias) { - return new FeedbackMessage(DSL.name(alias), this); - } - - @Override - public FeedbackMessage as(Name alias) { - return new FeedbackMessage(alias, this); - } - - @Override - public FeedbackMessage as(Table alias) { - return new FeedbackMessage(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public FeedbackMessage rename(String name) { - return new FeedbackMessage(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public FeedbackMessage rename(Name name) { - return new FeedbackMessage(name, null); - } - - /** - * Rename this table - */ - @Override - public FeedbackMessage rename(Table name) { - return new FeedbackMessage(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage where(Condition condition) { - return new FeedbackMessage(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public FeedbackMessage where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public FeedbackMessage where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public FeedbackMessage where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public FeedbackMessage where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public FeedbackMessage whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/domain/src/main/generated/writely/tables/PgpArmorHeaders.java b/domain/src/main/generated/writely/tables/PgpArmorHeaders.java deleted file mode 100644 index f23ab08..0000000 --- a/domain/src/main/generated/writely/tables/PgpArmorHeaders.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.Schema; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Public; -import writely.tables.records.PgpArmorHeadersRecord; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeaders extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.pgp_armor_headers - */ - public static final PgpArmorHeaders PGP_ARMOR_HEADERS = new PgpArmorHeaders(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return PgpArmorHeadersRecord.class; - } - - /** - * The column public.pgp_armor_headers.key. - */ - public final TableField KEY = createField(DSL.name("key"), SQLDataType.CLOB, this, ""); - - /** - * The column public.pgp_armor_headers.value. - */ - public final TableField VALUE = createField(DSL.name("value"), SQLDataType.CLOB, this, ""); - - private PgpArmorHeaders(Name alias, Table aliased) { - this(alias, aliased, new Field[] { - DSL.val(null, SQLDataType.CLOB) - }); - } - - private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters) { - this(alias, aliased, parameters, null); - } - - private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.function(), where); - } - - /** - * Create an aliased public.pgp_armor_headers table reference - */ - public PgpArmorHeaders(String alias) { - this(DSL.name(alias), PGP_ARMOR_HEADERS); - } - - /** - * Create an aliased public.pgp_armor_headers table reference - */ - public PgpArmorHeaders(Name alias) { - this(alias, PGP_ARMOR_HEADERS); - } - - /** - * Create a public.pgp_armor_headers table reference - */ - public PgpArmorHeaders() { - this(DSL.name("pgp_armor_headers"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public PgpArmorHeaders as(String alias) { - return new PgpArmorHeaders(DSL.name(alias), this, parameters); - } - - @Override - public PgpArmorHeaders as(Name alias) { - return new PgpArmorHeaders(alias, this, parameters); - } - - @Override - public PgpArmorHeaders as(Table alias) { - return new PgpArmorHeaders(alias.getQualifiedName(), this, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(String name) { - return new PgpArmorHeaders(DSL.name(name), null, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(Name name) { - return new PgpArmorHeaders(name, null, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(Table name) { - return new PgpArmorHeaders(name.getQualifiedName(), null, parameters); - } - - /** - * Call this table-valued function - */ - public PgpArmorHeaders call( - String __1 - ) { - PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { - DSL.val(__1, SQLDataType.CLOB) - }); - - return aliased() ? result.as(getUnqualifiedName()) : result; - } - - /** - * Call this table-valued function - */ - public PgpArmorHeaders call( - Field __1 - ) { - PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { - __1 - }); - - return aliased() ? result.as(getUnqualifiedName()) : result; - } -} diff --git a/domain/src/main/generated/writely/tables/UserModifyMessage.java b/domain/src/main/generated/writely/tables/UserModifyMessage.java deleted file mode 100644 index f6a9933..0000000 --- a/domain/src/main/generated/writely/tables/UserModifyMessage.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables; - - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.UUID; - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.PlainSQL; -import org.jooq.QueryPart; -import org.jooq.SQL; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.Stringly; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.UniqueKey; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writely.Keys; -import writely.Public; -import writely.tables.records.UserModifyMessageRecord; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class UserModifyMessage extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.user_modify_message - */ - public static final UserModifyMessage USER_MODIFY_MESSAGE = new UserModifyMessage(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return UserModifyMessageRecord.class; - } - - /** - * The column public.user_modify_message.id. - */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); - - /** - * The column public.user_modify_message.assistant_id. - */ - public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); - - /** - * The column public.user_modify_message.role. - */ - public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, ""); - - /** - * The column public.user_modify_message.content. - */ - public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, ""); - - /** - * The column public.user_modify_message.prompt. - */ - public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, ""); - - /** - * The column public.user_modify_message.created_at. - */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); - - /** - * The column public.user_modify_message.created_by. - */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, ""); - - /** - * The column public.user_modify_message.updated_at. - */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); - - /** - * The column public.user_modify_message.updated_by. - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); - - private UserModifyMessage(Name alias, Table aliased) { - this(alias, aliased, (Field[]) null, null); - } - - private UserModifyMessage(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); - } - - /** - * Create an aliased public.user_modify_message table reference - */ - public UserModifyMessage(String alias) { - this(DSL.name(alias), USER_MODIFY_MESSAGE); - } - - /** - * Create an aliased public.user_modify_message table reference - */ - public UserModifyMessage(Name alias) { - this(alias, USER_MODIFY_MESSAGE); - } - - /** - * Create a public.user_modify_message table reference - */ - public UserModifyMessage() { - this(DSL.name("user_modify_message"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public UniqueKey getPrimaryKey() { - return Keys.USER_MODIFY_MESSAGE_PK; - } - - @Override - public UserModifyMessage as(String alias) { - return new UserModifyMessage(DSL.name(alias), this); - } - - @Override - public UserModifyMessage as(Name alias) { - return new UserModifyMessage(alias, this); - } - - @Override - public UserModifyMessage as(Table alias) { - return new UserModifyMessage(alias.getQualifiedName(), this); - } - - /** - * Rename this table - */ - @Override - public UserModifyMessage rename(String name) { - return new UserModifyMessage(DSL.name(name), null); - } - - /** - * Rename this table - */ - @Override - public UserModifyMessage rename(Name name) { - return new UserModifyMessage(name, null); - } - - /** - * Rename this table - */ - @Override - public UserModifyMessage rename(Table name) { - return new UserModifyMessage(name.getQualifiedName(), null); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage where(Condition condition) { - return new UserModifyMessage(getQualifiedName(), aliased() ? this : null, null, condition); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage where(Collection conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage where(Condition... conditions) { - return where(DSL.and(conditions)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage where(Field condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public UserModifyMessage where(SQL condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public UserModifyMessage where(@Stringly.SQL String condition) { - return where(DSL.condition(condition)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public UserModifyMessage where(@Stringly.SQL String condition, Object... binds) { - return where(DSL.condition(condition, binds)); - } - - /** - * Create an inline derived table from this table - */ - @Override - @PlainSQL - public UserModifyMessage where(@Stringly.SQL String condition, QueryPart... parts) { - return where(DSL.condition(condition, parts)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage whereExists(Select select) { - return where(DSL.exists(select)); - } - - /** - * Create an inline derived table from this table - */ - @Override - public UserModifyMessage whereNotExists(Select select) { - return where(DSL.notExists(select)); - } -} diff --git a/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java deleted file mode 100644 index 3c57f22..0000000 --- a/domain/src/main/generated/writely/tables/pojos/AutoModifyMessage.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.pojos; - - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - - -/** - * 자동 수정 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class AutoModifyMessage implements Serializable { - - private static final long serialVersionUID = 1L; - - private final UUID id; - private final UUID productId; - private final UUID assistantId; - private final String role; - private final String content; - private final LocalDateTime createdAt; - private final UUID createdBy; - private final LocalDateTime updatedAt; - private final UUID updatedBy; - - public AutoModifyMessage(AutoModifyMessage value) { - this.id = value.id; - this.productId = value.productId; - this.assistantId = value.assistantId; - this.role = value.role; - this.content = value.content; - this.createdAt = value.createdAt; - this.createdBy = value.createdBy; - this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; - } - - public AutoModifyMessage( - UUID id, - UUID productId, - UUID assistantId, - String role, - String content, - LocalDateTime createdAt, - UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy - ) { - this.id = id; - this.productId = productId; - this.assistantId = assistantId; - this.role = role; - this.content = content; - this.createdAt = createdAt; - this.createdBy = createdBy; - this.updatedAt = updatedAt; - this.updatedBy = updatedBy; - } - - /** - * Getter for public.auto_modify_message.id. 자동 수정 메세지 ID - */ - public UUID getId() { - return this.id; - } - - /** - * Getter for public.auto_modify_message.product_id. 작품 ID - */ - public UUID getProductId() { - return this.productId; - } - - /** - * Getter for public.auto_modify_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return this.assistantId; - } - - /** - * Getter for public.auto_modify_message.role. 메세지 송신자 - */ - public String getRole() { - return this.role; - } - - /** - * Getter for public.auto_modify_message.content. 내용 - */ - public String getContent() { - return this.content; - } - - /** - * Getter for public.auto_modify_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return this.createdAt; - } - - /** - * Getter for public.auto_modify_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return this.createdBy; - } - - /** - * Getter for public.auto_modify_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Getter for public.auto_modify_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final AutoModifyMessage other = (AutoModifyMessage) obj; - if (this.id == null) { - if (other.id != null) - return false; - } - else if (!this.id.equals(other.id)) - return false; - if (this.productId == null) { - if (other.productId != null) - return false; - } - else if (!this.productId.equals(other.productId)) - return false; - if (this.assistantId == null) { - if (other.assistantId != null) - return false; - } - else if (!this.assistantId.equals(other.assistantId)) - return false; - if (this.role == null) { - if (other.role != null) - return false; - } - else if (!this.role.equals(other.role)) - return false; - if (this.content == null) { - if (other.content != null) - return false; - } - else if (!this.content.equals(other.content)) - return false; - if (this.createdAt == null) { - if (other.createdAt != null) - return false; - } - else if (!this.createdAt.equals(other.createdAt)) - return false; - if (this.createdBy == null) { - if (other.createdBy != null) - return false; - } - else if (!this.createdBy.equals(other.createdBy)) - return false; - if (this.updatedAt == null) { - if (other.updatedAt != null) - return false; - } - else if (!this.updatedAt.equals(other.updatedAt)) - return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); - result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); - result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); - result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); - result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); - result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); - result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AutoModifyMessage ("); - - sb.append(id); - sb.append(", ").append(productId); - sb.append(", ").append(assistantId); - sb.append(", ").append(role); - sb.append(", ").append(content); - sb.append(", ").append(createdAt); - sb.append(", ").append(createdBy); - sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java b/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java deleted file mode 100644 index 619bbef..0000000 --- a/domain/src/main/generated/writely/tables/pojos/FeedbackMessage.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.pojos; - - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - - -/** - * 피드백 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class FeedbackMessage implements Serializable { - - private static final long serialVersionUID = 1L; - - private final UUID id; - private final UUID productId; - private final UUID assistantId; - private final String role; - private final String content; - private final LocalDateTime createdAt; - private final UUID createdBy; - private final LocalDateTime updatedAt; - private final UUID updatedBy; - - public FeedbackMessage(FeedbackMessage value) { - this.id = value.id; - this.productId = value.productId; - this.assistantId = value.assistantId; - this.role = value.role; - this.content = value.content; - this.createdAt = value.createdAt; - this.createdBy = value.createdBy; - this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; - } - - public FeedbackMessage( - UUID id, - UUID productId, - UUID assistantId, - String role, - String content, - LocalDateTime createdAt, - UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy - ) { - this.id = id; - this.productId = productId; - this.assistantId = assistantId; - this.role = role; - this.content = content; - this.createdAt = createdAt; - this.createdBy = createdBy; - this.updatedAt = updatedAt; - this.updatedBy = updatedBy; - } - - /** - * Getter for public.feedback_message.id. 피드백 메세지 ID - */ - public UUID getId() { - return this.id; - } - - /** - * Getter for public.feedback_message.product_id. 작품 ID - */ - public UUID getProductId() { - return this.productId; - } - - /** - * Getter for public.feedback_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return this.assistantId; - } - - /** - * Getter for public.feedback_message.role. 메세지 송신자 - */ - public String getRole() { - return this.role; - } - - /** - * Getter for public.feedback_message.content. 내용 - */ - public String getContent() { - return this.content; - } - - /** - * Getter for public.feedback_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return this.createdAt; - } - - /** - * Getter for public.feedback_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return this.createdBy; - } - - /** - * Getter for public.feedback_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Getter for public.feedback_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final FeedbackMessage other = (FeedbackMessage) obj; - if (this.id == null) { - if (other.id != null) - return false; - } - else if (!this.id.equals(other.id)) - return false; - if (this.productId == null) { - if (other.productId != null) - return false; - } - else if (!this.productId.equals(other.productId)) - return false; - if (this.assistantId == null) { - if (other.assistantId != null) - return false; - } - else if (!this.assistantId.equals(other.assistantId)) - return false; - if (this.role == null) { - if (other.role != null) - return false; - } - else if (!this.role.equals(other.role)) - return false; - if (this.content == null) { - if (other.content != null) - return false; - } - else if (!this.content.equals(other.content)) - return false; - if (this.createdAt == null) { - if (other.createdAt != null) - return false; - } - else if (!this.createdAt.equals(other.createdAt)) - return false; - if (this.createdBy == null) { - if (other.createdBy != null) - return false; - } - else if (!this.createdBy.equals(other.createdBy)) - return false; - if (this.updatedAt == null) { - if (other.updatedAt != null) - return false; - } - else if (!this.updatedAt.equals(other.updatedAt)) - return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); - result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); - result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); - result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); - result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); - result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); - result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("FeedbackMessage ("); - - sb.append(id); - sb.append(", ").append(productId); - sb.append(", ").append(assistantId); - sb.append(", ").append(role); - sb.append(", ").append(content); - sb.append(", ").append(createdAt); - sb.append(", ").append(createdBy); - sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java b/domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java deleted file mode 100644 index f38b12e..0000000 --- a/domain/src/main/generated/writely/tables/pojos/PgpArmorHeaders.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.pojos; - - -import java.io.Serializable; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeaders implements Serializable { - - private static final long serialVersionUID = 1L; - - private final String key; - private final String value; - - public PgpArmorHeaders(PgpArmorHeaders value) { - this.key = value.key; - this.value = value.value; - } - - public PgpArmorHeaders( - String key, - String value - ) { - this.key = key; - this.value = value; - } - - /** - * Getter for public.pgp_armor_headers.key. - */ - public String getKey() { - return this.key; - } - - /** - * Getter for public.pgp_armor_headers.value. - */ - public String getValue() { - return this.value; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final PgpArmorHeaders other = (PgpArmorHeaders) obj; - if (this.key == null) { - if (other.key != null) - return false; - } - else if (!this.key.equals(other.key)) - return false; - if (this.value == null) { - if (other.value != null) - return false; - } - else if (!this.value.equals(other.value)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); - result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("PgpArmorHeaders ("); - - sb.append(key); - sb.append(", ").append(value); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java b/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java deleted file mode 100644 index 6549290..0000000 --- a/domain/src/main/generated/writely/tables/pojos/UserModifyMessage.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.pojos; - - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class UserModifyMessage implements Serializable { - - private static final long serialVersionUID = 1L; - - private final UUID id; - private final UUID assistantId; - private final String role; - private final String content; - private final String prompt; - private final LocalDateTime createdAt; - private final UUID createdBy; - private final LocalDateTime updatedAt; - private final UUID updatedBy; - - public UserModifyMessage(UserModifyMessage value) { - this.id = value.id; - this.assistantId = value.assistantId; - this.role = value.role; - this.content = value.content; - this.prompt = value.prompt; - this.createdAt = value.createdAt; - this.createdBy = value.createdBy; - this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; - } - - public UserModifyMessage( - UUID id, - UUID assistantId, - String role, - String content, - String prompt, - LocalDateTime createdAt, - UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy - ) { - this.id = id; - this.assistantId = assistantId; - this.role = role; - this.content = content; - this.prompt = prompt; - this.createdAt = createdAt; - this.createdBy = createdBy; - this.updatedAt = updatedAt; - this.updatedBy = updatedBy; - } - - /** - * Getter for public.user_modify_message.id. - */ - public UUID getId() { - return this.id; - } - - /** - * Getter for public.user_modify_message.assistant_id. - */ - public UUID getAssistantId() { - return this.assistantId; - } - - /** - * Getter for public.user_modify_message.role. - */ - public String getRole() { - return this.role; - } - - /** - * Getter for public.user_modify_message.content. - */ - public String getContent() { - return this.content; - } - - /** - * Getter for public.user_modify_message.prompt. - */ - public String getPrompt() { - return this.prompt; - } - - /** - * Getter for public.user_modify_message.created_at. - */ - public LocalDateTime getCreatedAt() { - return this.createdAt; - } - - /** - * Getter for public.user_modify_message.created_by. - */ - public UUID getCreatedBy() { - return this.createdBy; - } - - /** - * Getter for public.user_modify_message.updated_at. - */ - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Getter for public.user_modify_message.updated_by. - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final UserModifyMessage other = (UserModifyMessage) obj; - if (this.id == null) { - if (other.id != null) - return false; - } - else if (!this.id.equals(other.id)) - return false; - if (this.assistantId == null) { - if (other.assistantId != null) - return false; - } - else if (!this.assistantId.equals(other.assistantId)) - return false; - if (this.role == null) { - if (other.role != null) - return false; - } - else if (!this.role.equals(other.role)) - return false; - if (this.content == null) { - if (other.content != null) - return false; - } - else if (!this.content.equals(other.content)) - return false; - if (this.prompt == null) { - if (other.prompt != null) - return false; - } - else if (!this.prompt.equals(other.prompt)) - return false; - if (this.createdAt == null) { - if (other.createdAt != null) - return false; - } - else if (!this.createdAt.equals(other.createdAt)) - return false; - if (this.createdBy == null) { - if (other.createdBy != null) - return false; - } - else if (!this.createdBy.equals(other.createdBy)) - return false; - if (this.updatedAt == null) { - if (other.updatedAt != null) - return false; - } - else if (!this.updatedAt.equals(other.updatedAt)) - return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); - result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); - result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); - result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); - result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); - result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); - result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); - result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("UserModifyMessage ("); - - sb.append(id); - sb.append(", ").append(assistantId); - sb.append(", ").append(role); - sb.append(", ").append(content); - sb.append(", ").append(prompt); - sb.append(", ").append(createdAt); - sb.append(", ").append(createdBy); - sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java deleted file mode 100644 index 5365967..0000000 --- a/domain/src/main/generated/writely/tables/records/AutoModifyMessageRecord.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; - -import writely.tables.AutoModifyMessage; - - -/** - * 자동 수정 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class AutoModifyMessageRecord extends UpdatableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.auto_modify_message.id. 자동 수정 메세지 ID - */ - public AutoModifyMessageRecord setId(UUID value) { - set(0, value); - return this; - } - - /** - * Getter for public.auto_modify_message.id. 자동 수정 메세지 ID - */ - public UUID getId() { - return (UUID) get(0); - } - - /** - * Setter for public.auto_modify_message.product_id. 작품 ID - */ - public AutoModifyMessageRecord setProductId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.auto_modify_message.product_id. 작품 ID - */ - public UUID getProductId() { - return (UUID) get(1); - } - - /** - * Setter for public.auto_modify_message.assistant_id. 어시스턴트 ID - */ - public AutoModifyMessageRecord setAssistantId(UUID value) { - set(2, value); - return this; - } - - /** - * Getter for public.auto_modify_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return (UUID) get(2); - } - - /** - * Setter for public.auto_modify_message.role. 메세지 송신자 - */ - public AutoModifyMessageRecord setRole(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.auto_modify_message.role. 메세지 송신자 - */ - public String getRole() { - return (String) get(3); - } - - /** - * Setter for public.auto_modify_message.content. 내용 - */ - public AutoModifyMessageRecord setContent(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.auto_modify_message.content. 내용 - */ - public String getContent() { - return (String) get(4); - } - - /** - * Setter for public.auto_modify_message.created_at. 생성일시 - */ - public AutoModifyMessageRecord setCreatedAt(LocalDateTime value) { - set(5, value); - return this; - } - - /** - * Getter for public.auto_modify_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); - } - - /** - * Setter for public.auto_modify_message.created_by. 생성자 ID - */ - public AutoModifyMessageRecord setCreatedBy(UUID value) { - set(6, value); - return this; - } - - /** - * Getter for public.auto_modify_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return (UUID) get(6); - } - - /** - * Setter for public.auto_modify_message.updated_at. 수정일시 - */ - public AutoModifyMessageRecord setUpdatedAt(LocalDateTime value) { - set(7, value); - return this; - } - - /** - * Getter for public.auto_modify_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); - } - - /** - * Setter for public.auto_modify_message.updated_by. 수정자 ID - */ - public AutoModifyMessageRecord setUpdatedBy(UUID value) { - set(8, value); - return this; - } - - /** - * Getter for public.auto_modify_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return (UUID) get(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached AutoModifyMessageRecord - */ - public AutoModifyMessageRecord() { - super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); - } - - /** - * Create a detached, initialised AutoModifyMessageRecord - */ - public AutoModifyMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { - super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); - - setId(id); - setProductId(productId); - setAssistantId(assistantId); - setRole(role); - setContent(content); - setCreatedAt(createdAt); - setCreatedBy(createdBy); - setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised AutoModifyMessageRecord - */ - public AutoModifyMessageRecord(writely.tables.pojos.AutoModifyMessage value) { - super(AutoModifyMessage.AUTO_MODIFY_MESSAGE); - - if (value != null) { - setId(value.getId()); - setProductId(value.getProductId()); - setAssistantId(value.getAssistantId()); - setRole(value.getRole()); - setContent(value.getContent()); - setCreatedAt(value.getCreatedAt()); - setCreatedBy(value.getCreatedBy()); - setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java b/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java deleted file mode 100644 index 0964d13..0000000 --- a/domain/src/main/generated/writely/tables/records/ChatMessageRecord.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; - -import writely.tables.ChatMessage; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ChatMessageRecord extends UpdatableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.chat_message.id. - */ - public ChatMessageRecord setId(UUID value) { - set(0, value); - return this; - } - - /** - * Getter for public.chat_message.id. - */ - public UUID getId() { - return (UUID) get(0); - } - - /** - * Setter for public.chat_message.assistant_id. - */ - public ChatMessageRecord setAssistantId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.chat_message.assistant_id. - */ - public UUID getAssistantId() { - return (UUID) get(1); - } - - /** - * Setter for public.chat_message.role. - */ - public ChatMessageRecord setRole(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.chat_message.role. - */ - public String getRole() { - return (String) get(2); - } - - /** - * Setter for public.chat_message.content. - */ - public ChatMessageRecord setContent(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.chat_message.content. - */ - public String getContent() { - return (String) get(3); - } - - /** - * Setter for public.chat_message.prompt. - */ - public ChatMessageRecord setPrompt(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.chat_message.prompt. - */ - public String getPrompt() { - return (String) get(4); - } - - /** - * Setter for public.chat_message.created_at. - */ - public ChatMessageRecord setCreatedAt(LocalDateTime value) { - set(5, value); - return this; - } - - /** - * Getter for public.chat_message.created_at. - */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); - } - - /** - * Setter for public.chat_message.created_by. - */ - public ChatMessageRecord setCreatedBy(UUID value) { - set(6, value); - return this; - } - - /** - * Getter for public.chat_message.created_by. - */ - public UUID getCreatedBy() { - return (UUID) get(6); - } - - /** - * Setter for public.chat_message.updated_at. - */ - public ChatMessageRecord setUpdatedAt(LocalDateTime value) { - set(7, value); - return this; - } - - /** - * Getter for public.chat_message.updated_at. - */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); - } - - /** - * Setter for public.chat_message.updated_by. - */ - public ChatMessageRecord setUpdatedBy(UUID value) { - set(8, value); - return this; - } - - /** - * Getter for public.chat_message.updated_by. - */ - public UUID getUpdatedBy() { - return (UUID) get(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached ChatMessageRecord - */ - public ChatMessageRecord() { - super(ChatMessage.CHAT_MESSAGE); - } - - /** - * Create a detached, initialised ChatMessageRecord - */ - public ChatMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { - super(ChatMessage.CHAT_MESSAGE); - - setId(id); - setAssistantId(assistantId); - setRole(role); - setContent(content); - setPrompt(prompt); - setCreatedAt(createdAt); - setCreatedBy(createdBy); - setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised ChatMessageRecord - */ - public ChatMessageRecord(writely.tables.pojos.ChatMessage value) { - super(ChatMessage.CHAT_MESSAGE); - - if (value != null) { - setId(value.getId()); - setAssistantId(value.getAssistantId()); - setRole(value.getRole()); - setContent(value.getContent()); - setPrompt(value.getPrompt()); - setCreatedAt(value.getCreatedAt()); - setCreatedBy(value.getCreatedBy()); - setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java b/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java deleted file mode 100644 index 20592d1..0000000 --- a/domain/src/main/generated/writely/tables/records/FeedbackMessageRecord.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; - -import writely.tables.FeedbackMessage; - - -/** - * 피드백 메세지 - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class FeedbackMessageRecord extends UpdatableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.feedback_message.id. 피드백 메세지 ID - */ - public FeedbackMessageRecord setId(UUID value) { - set(0, value); - return this; - } - - /** - * Getter for public.feedback_message.id. 피드백 메세지 ID - */ - public UUID getId() { - return (UUID) get(0); - } - - /** - * Setter for public.feedback_message.product_id. 작품 ID - */ - public FeedbackMessageRecord setProductId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.feedback_message.product_id. 작품 ID - */ - public UUID getProductId() { - return (UUID) get(1); - } - - /** - * Setter for public.feedback_message.assistant_id. 어시스턴트 ID - */ - public FeedbackMessageRecord setAssistantId(UUID value) { - set(2, value); - return this; - } - - /** - * Getter for public.feedback_message.assistant_id. 어시스턴트 ID - */ - public UUID getAssistantId() { - return (UUID) get(2); - } - - /** - * Setter for public.feedback_message.role. 메세지 송신자 - */ - public FeedbackMessageRecord setRole(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.feedback_message.role. 메세지 송신자 - */ - public String getRole() { - return (String) get(3); - } - - /** - * Setter for public.feedback_message.content. 내용 - */ - public FeedbackMessageRecord setContent(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.feedback_message.content. 내용 - */ - public String getContent() { - return (String) get(4); - } - - /** - * Setter for public.feedback_message.created_at. 생성일시 - */ - public FeedbackMessageRecord setCreatedAt(LocalDateTime value) { - set(5, value); - return this; - } - - /** - * Getter for public.feedback_message.created_at. 생성일시 - */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); - } - - /** - * Setter for public.feedback_message.created_by. 생성자 ID - */ - public FeedbackMessageRecord setCreatedBy(UUID value) { - set(6, value); - return this; - } - - /** - * Getter for public.feedback_message.created_by. 생성자 ID - */ - public UUID getCreatedBy() { - return (UUID) get(6); - } - - /** - * Setter for public.feedback_message.updated_at. 수정일시 - */ - public FeedbackMessageRecord setUpdatedAt(LocalDateTime value) { - set(7, value); - return this; - } - - /** - * Getter for public.feedback_message.updated_at. 수정일시 - */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); - } - - /** - * Setter for public.feedback_message.updated_by. 수정자 ID - */ - public FeedbackMessageRecord setUpdatedBy(UUID value) { - set(8, value); - return this; - } - - /** - * Getter for public.feedback_message.updated_by. 수정자 ID - */ - public UUID getUpdatedBy() { - return (UUID) get(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached FeedbackMessageRecord - */ - public FeedbackMessageRecord() { - super(FeedbackMessage.FEEDBACK_MESSAGE); - } - - /** - * Create a detached, initialised FeedbackMessageRecord - */ - public FeedbackMessageRecord(UUID id, UUID productId, UUID assistantId, String role, String content, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { - super(FeedbackMessage.FEEDBACK_MESSAGE); - - setId(id); - setProductId(productId); - setAssistantId(assistantId); - setRole(role); - setContent(content); - setCreatedAt(createdAt); - setCreatedBy(createdBy); - setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised FeedbackMessageRecord - */ - public FeedbackMessageRecord(writely.tables.pojos.FeedbackMessage value) { - super(FeedbackMessage.FEEDBACK_MESSAGE); - - if (value != null) { - setId(value.getId()); - setProductId(value.getProductId()); - setAssistantId(value.getAssistantId()); - setRole(value.getRole()); - setContent(value.getContent()); - setCreatedAt(value.getCreatedAt()); - setCreatedBy(value.getCreatedBy()); - setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java b/domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java deleted file mode 100644 index 6a75a21..0000000 --- a/domain/src/main/generated/writely/tables/records/PgpArmorHeadersRecord.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import org.jooq.impl.TableRecordImpl; - -import writely.tables.PgpArmorHeaders; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeadersRecord extends TableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.pgp_armor_headers.key. - */ - public PgpArmorHeadersRecord setKey(String value) { - set(0, value); - return this; - } - - /** - * Getter for public.pgp_armor_headers.key. - */ - public String getKey() { - return (String) get(0); - } - - /** - * Setter for public.pgp_armor_headers.value. - */ - public PgpArmorHeadersRecord setValue(String value) { - set(1, value); - return this; - } - - /** - * Getter for public.pgp_armor_headers.value. - */ - public String getValue() { - return (String) get(1); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord() { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - } - - /** - * Create a detached, initialised PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord(String key, String value) { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - - setKey(key); - setValue(value); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord(writely.tables.pojos.PgpArmorHeaders value) { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - - if (value != null) { - setKey(value.getKey()); - setValue(value.getValue()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java b/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java deleted file mode 100644 index f3de132..0000000 --- a/domain/src/main/generated/writely/tables/records/UserModifyMessageRecord.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writely.tables.records; - - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; - -import writely.tables.UserModifyMessage; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class UserModifyMessageRecord extends UpdatableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.user_modify_message.id. - */ - public UserModifyMessageRecord setId(UUID value) { - set(0, value); - return this; - } - - /** - * Getter for public.user_modify_message.id. - */ - public UUID getId() { - return (UUID) get(0); - } - - /** - * Setter for public.user_modify_message.assistant_id. - */ - public UserModifyMessageRecord setAssistantId(UUID value) { - set(1, value); - return this; - } - - /** - * Getter for public.user_modify_message.assistant_id. - */ - public UUID getAssistantId() { - return (UUID) get(1); - } - - /** - * Setter for public.user_modify_message.role. - */ - public UserModifyMessageRecord setRole(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.user_modify_message.role. - */ - public String getRole() { - return (String) get(2); - } - - /** - * Setter for public.user_modify_message.content. - */ - public UserModifyMessageRecord setContent(String value) { - set(3, value); - return this; - } - - /** - * Getter for public.user_modify_message.content. - */ - public String getContent() { - return (String) get(3); - } - - /** - * Setter for public.user_modify_message.prompt. - */ - public UserModifyMessageRecord setPrompt(String value) { - set(4, value); - return this; - } - - /** - * Getter for public.user_modify_message.prompt. - */ - public String getPrompt() { - return (String) get(4); - } - - /** - * Setter for public.user_modify_message.created_at. - */ - public UserModifyMessageRecord setCreatedAt(LocalDateTime value) { - set(5, value); - return this; - } - - /** - * Getter for public.user_modify_message.created_at. - */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(5); - } - - /** - * Setter for public.user_modify_message.created_by. - */ - public UserModifyMessageRecord setCreatedBy(UUID value) { - set(6, value); - return this; - } - - /** - * Getter for public.user_modify_message.created_by. - */ - public UUID getCreatedBy() { - return (UUID) get(6); - } - - /** - * Setter for public.user_modify_message.updated_at. - */ - public UserModifyMessageRecord setUpdatedAt(LocalDateTime value) { - set(7, value); - return this; - } - - /** - * Getter for public.user_modify_message.updated_at. - */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(7); - } - - /** - * Setter for public.user_modify_message.updated_by. - */ - public UserModifyMessageRecord setUpdatedBy(UUID value) { - set(8, value); - return this; - } - - /** - * Getter for public.user_modify_message.updated_by. - */ - public UUID getUpdatedBy() { - return (UUID) get(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached UserModifyMessageRecord - */ - public UserModifyMessageRecord() { - super(UserModifyMessage.USER_MODIFY_MESSAGE); - } - - /** - * Create a detached, initialised UserModifyMessageRecord - */ - public UserModifyMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { - super(UserModifyMessage.USER_MODIFY_MESSAGE); - - setId(id); - setAssistantId(assistantId); - setRole(role); - setContent(content); - setPrompt(prompt); - setCreatedAt(createdAt); - setCreatedBy(createdBy); - setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised UserModifyMessageRecord - */ - public UserModifyMessageRecord(writely.tables.pojos.UserModifyMessage value) { - super(UserModifyMessage.USER_MODIFY_MESSAGE); - - if (value != null) { - setId(value.getId()); - setAssistantId(value.getAssistantId()); - setRole(value.getRole()); - setContent(value.getContent()); - setPrompt(value.getPrompt()); - setCreatedAt(value.getCreatedAt()); - setCreatedBy(value.getCreatedBy()); - setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writely/DefaultCatalog.java b/domain/src/main/generated/writeon/DefaultCatalog.java similarity index 98% rename from domain/src/main/generated/writely/DefaultCatalog.java rename to domain/src/main/generated/writeon/DefaultCatalog.java index a453609..1ce0d58 100644 --- a/domain/src/main/generated/writely/DefaultCatalog.java +++ b/domain/src/main/generated/writeon/DefaultCatalog.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely; +package writeon; import java.util.Arrays; diff --git a/domain/src/main/generated/writely/Keys.java b/domain/src/main/generated/writeon/Keys.java similarity index 61% rename from domain/src/main/generated/writely/Keys.java rename to domain/src/main/generated/writeon/Keys.java index e971ef4..4795d29 100644 --- a/domain/src/main/generated/writely/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely; +package writeon; import org.jooq.TableField; @@ -9,44 +9,38 @@ import org.jooq.impl.DSL; import org.jooq.impl.Internal; -import writely.tables.Assistant; -import writely.tables.AssistantEvaluation; -import writely.tables.AutoModifyMessage; -import writely.tables.ChatMessage; -import writely.tables.FeedbackMessage; -import writely.tables.LoginAttempt; -import writely.tables.Member; -import writely.tables.MemberPassword; -import writely.tables.Product; -import writely.tables.ProductCharacter; -import writely.tables.ProductCustomField; -import writely.tables.ProductIdeanote; -import writely.tables.ProductMemo; -import writely.tables.ProductPlot; -import writely.tables.ProductSynopsis; -import writely.tables.ProductWorldview; -import writely.tables.Terms; -import writely.tables.TermsAgreement; -import writely.tables.UserModifyMessage; -import writely.tables.records.AssistantEvaluationRecord; -import writely.tables.records.AssistantRecord; -import writely.tables.records.AutoModifyMessageRecord; -import writely.tables.records.ChatMessageRecord; -import writely.tables.records.FeedbackMessageRecord; -import writely.tables.records.LoginAttemptRecord; -import writely.tables.records.MemberPasswordRecord; -import writely.tables.records.MemberRecord; -import writely.tables.records.ProductCharacterRecord; -import writely.tables.records.ProductCustomFieldRecord; -import writely.tables.records.ProductIdeanoteRecord; -import writely.tables.records.ProductMemoRecord; -import writely.tables.records.ProductPlotRecord; -import writely.tables.records.ProductRecord; -import writely.tables.records.ProductSynopsisRecord; -import writely.tables.records.ProductWorldviewRecord; -import writely.tables.records.TermsAgreementRecord; -import writely.tables.records.TermsRecord; -import writely.tables.records.UserModifyMessageRecord; +import writeon.tables.Assistant; +import writeon.tables.AssistantEvaluation; +import writeon.tables.AssistantMessage; +import writeon.tables.LoginAttempt; +import writeon.tables.Member; +import writeon.tables.MemberPassword; +import writeon.tables.Product; +import writeon.tables.ProductCharacter; +import writeon.tables.ProductCustomField; +import writeon.tables.ProductIdeanote; +import writeon.tables.ProductMemo; +import writeon.tables.ProductPlot; +import writeon.tables.ProductSynopsis; +import writeon.tables.ProductWorldview; +import writeon.tables.Terms; +import writeon.tables.TermsAgreement; +import writeon.tables.records.AssistantEvaluationRecord; +import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantRecord; +import writeon.tables.records.LoginAttemptRecord; +import writeon.tables.records.MemberPasswordRecord; +import writeon.tables.records.MemberRecord; +import writeon.tables.records.ProductCharacterRecord; +import writeon.tables.records.ProductCustomFieldRecord; +import writeon.tables.records.ProductIdeanoteRecord; +import writeon.tables.records.ProductMemoRecord; +import writeon.tables.records.ProductPlotRecord; +import writeon.tables.records.ProductRecord; +import writeon.tables.records.ProductSynopsisRecord; +import writeon.tables.records.ProductWorldviewRecord; +import writeon.tables.records.TermsAgreementRecord; +import writeon.tables.records.TermsRecord; /** @@ -62,9 +56,7 @@ public class Keys { public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); - public static final UniqueKey AUTO_MODIFY_MESSAGE_PK = Internal.createUniqueKey(AutoModifyMessage.AUTO_MODIFY_MESSAGE, DSL.name("auto_modify_message_pk"), new TableField[] { AutoModifyMessage.AUTO_MODIFY_MESSAGE.ID }, true); - public static final UniqueKey CHAT_MESSAGE_PK = Internal.createUniqueKey(ChatMessage.CHAT_MESSAGE, DSL.name("chat_message_pk"), new TableField[] { ChatMessage.CHAT_MESSAGE.ID }, true); - public static final UniqueKey FEEDBACK_MESSAGE_PK = Internal.createUniqueKey(FeedbackMessage.FEEDBACK_MESSAGE, DSL.name("feedback_message_pk"), new TableField[] { FeedbackMessage.FEEDBACK_MESSAGE.ID }, true); + public static final UniqueKey ASSISTANT_MESSAGE_PK = Internal.createUniqueKey(AssistantMessage.ASSISTANT_MESSAGE, DSL.name("assistant_message_pk"), new TableField[] { AssistantMessage.ASSISTANT_MESSAGE.ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); @@ -80,5 +72,4 @@ public class Keys { public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); public static final UniqueKey TERMS_AGREEMENT_PK = Internal.createUniqueKey(TermsAgreement.TERMS_AGREEMENT, DSL.name("terms_agreement_pk"), new TableField[] { TermsAgreement.TERMS_AGREEMENT.TERMS_CD, TermsAgreement.TERMS_AGREEMENT.MEMBER_ID }, true); - public static final UniqueKey USER_MODIFY_MESSAGE_PK = Internal.createUniqueKey(UserModifyMessage.USER_MODIFY_MESSAGE, DSL.name("user_modify_message_pk"), new TableField[] { UserModifyMessage.USER_MODIFY_MESSAGE.ID }, true); } diff --git a/domain/src/main/generated/writely/Public.java b/domain/src/main/generated/writeon/Public.java similarity index 53% rename from domain/src/main/generated/writely/Public.java rename to domain/src/main/generated/writeon/Public.java index 9569f3b..066129e 100644 --- a/domain/src/main/generated/writely/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -1,40 +1,32 @@ /* * This file is generated by jOOQ. */ -package writely; +package writeon; import java.util.Arrays; import java.util.List; import org.jooq.Catalog; -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; import org.jooq.Table; import org.jooq.impl.SchemaImpl; -import writely.tables.Assistant; -import writely.tables.AssistantEvaluation; -import writely.tables.AutoModifyMessage; -import writely.tables.ChatMessage; -import writely.tables.FeedbackMessage; -import writely.tables.LoginAttempt; -import writely.tables.Member; -import writely.tables.MemberPassword; -import writely.tables.PgpArmorHeaders; -import writely.tables.Product; -import writely.tables.ProductCharacter; -import writely.tables.ProductCustomField; -import writely.tables.ProductIdeanote; -import writely.tables.ProductMemo; -import writely.tables.ProductPlot; -import writely.tables.ProductSynopsis; -import writely.tables.ProductWorldview; -import writely.tables.Terms; -import writely.tables.TermsAgreement; -import writely.tables.UserModifyMessage; -import writely.tables.records.PgpArmorHeadersRecord; +import writeon.tables.Assistant; +import writeon.tables.AssistantEvaluation; +import writeon.tables.AssistantMessage; +import writeon.tables.LoginAttempt; +import writeon.tables.Member; +import writeon.tables.MemberPassword; +import writeon.tables.Product; +import writeon.tables.ProductCharacter; +import writeon.tables.ProductCustomField; +import writeon.tables.ProductIdeanote; +import writeon.tables.ProductMemo; +import writeon.tables.ProductPlot; +import writeon.tables.ProductSynopsis; +import writeon.tables.ProductWorldview; +import writeon.tables.Terms; +import writeon.tables.TermsAgreement; /** @@ -61,19 +53,9 @@ public class Public extends SchemaImpl { public final AssistantEvaluation ASSISTANT_EVALUATION = AssistantEvaluation.ASSISTANT_EVALUATION; /** - * 자동 수정 메세지 + * The table public.assistant_message. */ - public final AutoModifyMessage AUTO_MODIFY_MESSAGE = AutoModifyMessage.AUTO_MODIFY_MESSAGE; - - /** - * The table public.chat_message. - */ - public final ChatMessage CHAT_MESSAGE = ChatMessage.CHAT_MESSAGE; - - /** - * 피드백 메세지 - */ - public final FeedbackMessage FEEDBACK_MESSAGE = FeedbackMessage.FEEDBACK_MESSAGE; + public final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; /** * 로그인_시도 @@ -90,45 +72,6 @@ public class Public extends SchemaImpl { */ public final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; - /** - * The table public.pgp_armor_headers. - */ - public final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; - - /** - * Call public.pgp_armor_headers. - */ - public static Result PGP_ARMOR_HEADERS( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - String __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - Field __1 - ) { - return writely.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - /** * 작품 */ @@ -179,11 +122,6 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; - /** - * The table public.user_modify_message. - */ - public final UserModifyMessage USER_MODIFY_MESSAGE = UserModifyMessage.USER_MODIFY_MESSAGE; - /** * No further instances allowed */ @@ -202,13 +140,10 @@ public final List> getTables() { return Arrays.asList( Assistant.ASSISTANT, AssistantEvaluation.ASSISTANT_EVALUATION, - AutoModifyMessage.AUTO_MODIFY_MESSAGE, - ChatMessage.CHAT_MESSAGE, - FeedbackMessage.FEEDBACK_MESSAGE, + AssistantMessage.ASSISTANT_MESSAGE, LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, - PgpArmorHeaders.PGP_ARMOR_HEADERS, Product.PRODUCT, ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, @@ -218,8 +153,7 @@ public final List> getTables() { ProductSynopsis.PRODUCT_SYNOPSIS, ProductWorldview.PRODUCT_WORLDVIEW, Terms.TERMS, - TermsAgreement.TERMS_AGREEMENT, - UserModifyMessage.USER_MODIFY_MESSAGE + TermsAgreement.TERMS_AGREEMENT ); } } diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java new file mode 100644 index 0000000..f2bf187 --- /dev/null +++ b/domain/src/main/generated/writeon/Tables.java @@ -0,0 +1,110 @@ +/* + * This file is generated by jOOQ. + */ +package writeon; + + +import writeon.tables.Assistant; +import writeon.tables.AssistantEvaluation; +import writeon.tables.AssistantMessage; +import writeon.tables.LoginAttempt; +import writeon.tables.Member; +import writeon.tables.MemberPassword; +import writeon.tables.Product; +import writeon.tables.ProductCharacter; +import writeon.tables.ProductCustomField; +import writeon.tables.ProductIdeanote; +import writeon.tables.ProductMemo; +import writeon.tables.ProductPlot; +import writeon.tables.ProductSynopsis; +import writeon.tables.ProductWorldview; +import writeon.tables.Terms; +import writeon.tables.TermsAgreement; + + +/** + * Convenience access to all tables in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Tables { + + /** + * 어시스턴트 + */ + public static final Assistant ASSISTANT = Assistant.ASSISTANT; + + /** + * 어시스턴트 평가 + */ + public static final AssistantEvaluation ASSISTANT_EVALUATION = AssistantEvaluation.ASSISTANT_EVALUATION; + + /** + * The table public.assistant_message. + */ + public static final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; + + /** + * 로그인_시도 + */ + public static final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; + + /** + * 회원 + */ + public static final Member MEMBER = Member.MEMBER; + + /** + * 회원_비밀번호 + */ + public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + + /** + * 작품 + */ + public static final Product PRODUCT = Product.PRODUCT; + + /** + * 작품 등장인물 + */ + public static final ProductCharacter PRODUCT_CHARACTER = ProductCharacter.PRODUCT_CHARACTER; + + /** + * The table public.product_custom_field. + */ + public static final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; + + /** + * 작품 아이디어 노트 + */ + public static final ProductIdeanote PRODUCT_IDEANOTE = ProductIdeanote.PRODUCT_IDEANOTE; + + /** + * 작품 메모 + */ + public static final ProductMemo PRODUCT_MEMO = ProductMemo.PRODUCT_MEMO; + + /** + * 작품 줄거리 + */ + public static final ProductPlot PRODUCT_PLOT = ProductPlot.PRODUCT_PLOT; + + /** + * 작품 시놉시스 + */ + public static final ProductSynopsis PRODUCT_SYNOPSIS = ProductSynopsis.PRODUCT_SYNOPSIS; + + /** + * 작품 세계관 + */ + public static final ProductWorldview PRODUCT_WORLDVIEW = ProductWorldview.PRODUCT_WORLDVIEW; + + /** + * 약관 + */ + public static final Terms TERMS = Terms.TERMS; + + /** + * 약관_동의 + */ + public static final TermsAgreement TERMS_AGREEMENT = TermsAgreement.TERMS_AGREEMENT; +} diff --git a/domain/src/main/generated/writely/tables/Assistant.java b/domain/src/main/generated/writeon/tables/Assistant.java similarity index 93% rename from domain/src/main/generated/writely/tables/Assistant.java rename to domain/src/main/generated/writeon/tables/Assistant.java index 02a2c44..dc993d0 100644 --- a/domain/src/main/generated/writely/tables/Assistant.java +++ b/domain/src/main/generated/writeon/tables/Assistant.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.AssistantRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.AssistantRecord; /** @@ -77,20 +77,15 @@ public Class getRecordType() { public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); /** - * The column public.assistant.created_by. 수정자 ID + * The column public.assistant.created_by. 생성자 ID */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); /** * The column public.assistant.updated_at. */ public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); - /** - * The column public.assistant.updated_by. - */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); - private Assistant(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } diff --git a/domain/src/main/generated/writely/tables/AssistantEvaluation.java b/domain/src/main/generated/writeon/tables/AssistantEvaluation.java similarity index 98% rename from domain/src/main/generated/writely/tables/AssistantEvaluation.java rename to domain/src/main/generated/writeon/tables/AssistantEvaluation.java index 8cf083e..d304498 100644 --- a/domain/src/main/generated/writely/tables/AssistantEvaluation.java +++ b/domain/src/main/generated/writeon/tables/AssistantEvaluation.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.AssistantEvaluationRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.AssistantEvaluationRecord; /** diff --git a/domain/src/main/generated/writeon/tables/AssistantMessage.java b/domain/src/main/generated/writeon/tables/AssistantMessage.java new file mode 100644 index 0000000..c0c75f2 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/AssistantMessage.java @@ -0,0 +1,250 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.AssistantMessageRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.assistant_message + */ + public static final AssistantMessage ASSISTANT_MESSAGE = new AssistantMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AssistantMessageRecord.class; + } + + /** + * The column public.assistant_message.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); + + /** + * The column public.assistant_message.assistant_id. + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.assistant_message.role. + */ + public final TableField ROLE = createField(DSL.name("role"), SQLDataType.VARCHAR(10).nullable(false), this, ""); + + /** + * The column public.assistant_message.content. + */ + public final TableField CONTENT = createField(DSL.name("content"), SQLDataType.CLOB, this, ""); + + /** + * The column public.assistant_message.prompt. + */ + public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB, this, ""); + + /** + * The column public.assistant_message.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + /** + * The column public.assistant_message.created_by. + */ + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, ""); + + private AssistantMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private AssistantMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.assistant_message table reference + */ + public AssistantMessage(String alias) { + this(DSL.name(alias), ASSISTANT_MESSAGE); + } + + /** + * Create an aliased public.assistant_message table reference + */ + public AssistantMessage(Name alias) { + this(alias, ASSISTANT_MESSAGE); + } + + /** + * Create a public.assistant_message table reference + */ + public AssistantMessage() { + this(DSL.name("assistant_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.ASSISTANT_MESSAGE_PK; + } + + @Override + public AssistantMessage as(String alias) { + return new AssistantMessage(DSL.name(alias), this); + } + + @Override + public AssistantMessage as(Name alias) { + return new AssistantMessage(alias, this); + } + + @Override + public AssistantMessage as(Table alias) { + return new AssistantMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public AssistantMessage rename(String name) { + return new AssistantMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public AssistantMessage rename(Name name) { + return new AssistantMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public AssistantMessage rename(Table name) { + return new AssistantMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage where(Condition condition) { + return new AssistantMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writely/tables/LoginAttempt.java b/domain/src/main/generated/writeon/tables/LoginAttempt.java similarity index 98% rename from domain/src/main/generated/writely/tables/LoginAttempt.java rename to domain/src/main/generated/writeon/tables/LoginAttempt.java index fd53486..97af241 100644 --- a/domain/src/main/generated/writely/tables/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/LoginAttempt.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.OffsetDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.LoginAttemptRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.LoginAttemptRecord; /** diff --git a/domain/src/main/generated/writely/tables/Member.java b/domain/src/main/generated/writeon/tables/Member.java similarity index 97% rename from domain/src/main/generated/writely/tables/Member.java rename to domain/src/main/generated/writeon/tables/Member.java index 2498a14..c4672fc 100644 --- a/domain/src/main/generated/writely/tables/Member.java +++ b/domain/src/main/generated/writeon/tables/Member.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.OffsetDateTime; @@ -27,9 +27,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.MemberRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.MemberRecord; /** @@ -66,7 +66,7 @@ public Class getRecordType() { /** * The column public.member.nickname. 회원 닉네임 */ - public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 닉네임"); + public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(20).nullable(false), this, "회원 닉네임"); /** * The column public.member.profile_image. 회원 프로필 이미지 경로 diff --git a/domain/src/main/generated/writely/tables/MemberPassword.java b/domain/src/main/generated/writeon/tables/MemberPassword.java similarity index 98% rename from domain/src/main/generated/writely/tables/MemberPassword.java rename to domain/src/main/generated/writeon/tables/MemberPassword.java index 2e71966..61f2d8f 100644 --- a/domain/src/main/generated/writely/tables/MemberPassword.java +++ b/domain/src/main/generated/writeon/tables/MemberPassword.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.OffsetDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.MemberPasswordRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.MemberPasswordRecord; /** diff --git a/domain/src/main/generated/writely/tables/Product.java b/domain/src/main/generated/writeon/tables/Product.java similarity index 98% rename from domain/src/main/generated/writely/tables/Product.java rename to domain/src/main/generated/writeon/tables/Product.java index 9ddb9cb..36cf3a7 100644 --- a/domain/src/main/generated/writely/tables/Product.java +++ b/domain/src/main/generated/writeon/tables/Product.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductCharacter.java b/domain/src/main/generated/writeon/tables/ProductCharacter.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductCharacter.java rename to domain/src/main/generated/writeon/tables/ProductCharacter.java index a0078a8..73601a2 100644 --- a/domain/src/main/generated/writely/tables/ProductCharacter.java +++ b/domain/src/main/generated/writeon/tables/ProductCharacter.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductCharacterRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductCharacterRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductCustomField.java b/domain/src/main/generated/writeon/tables/ProductCustomField.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductCustomField.java rename to domain/src/main/generated/writeon/tables/ProductCustomField.java index 83e586f..5d7af12 100644 --- a/domain/src/main/generated/writely/tables/ProductCustomField.java +++ b/domain/src/main/generated/writeon/tables/ProductCustomField.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductCustomFieldRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductCustomFieldRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductIdeanote.java b/domain/src/main/generated/writeon/tables/ProductIdeanote.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductIdeanote.java rename to domain/src/main/generated/writeon/tables/ProductIdeanote.java index 45643fc..2354d2e 100644 --- a/domain/src/main/generated/writely/tables/ProductIdeanote.java +++ b/domain/src/main/generated/writeon/tables/ProductIdeanote.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductIdeanoteRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductIdeanoteRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductMemo.java b/domain/src/main/generated/writeon/tables/ProductMemo.java similarity index 94% rename from domain/src/main/generated/writely/tables/ProductMemo.java rename to domain/src/main/generated/writeon/tables/ProductMemo.java index bf4ca39..ae2a5e9 100644 --- a/domain/src/main/generated/writely/tables/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/ProductMemo.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductMemoRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductMemoRecord; /** @@ -61,6 +61,11 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + /** + * The column public.product_memo.title. 제목 + */ + public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(100), this, "제목"); + /** * The column public.product_memo.content. 내용 */ @@ -82,9 +87,9 @@ public Class getRecordType() { public final TableField END_INDEX = createField(DSL.name("end_index"), SQLDataType.INTEGER.nullable(false), this, ""); /** - * The column public.product_memo.is_completed. 완료여부 + * The column public.product_memo.is_completed. 완료 여부 */ - public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false), this, "완료여부"); + public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "완료 여부"); /** * The column public.product_memo.created_at. 생성일시 diff --git a/domain/src/main/generated/writely/tables/ProductPlot.java b/domain/src/main/generated/writeon/tables/ProductPlot.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductPlot.java rename to domain/src/main/generated/writeon/tables/ProductPlot.java index 7cbba29..ea11741 100644 --- a/domain/src/main/generated/writely/tables/ProductPlot.java +++ b/domain/src/main/generated/writeon/tables/ProductPlot.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductPlotRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductPlotRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductSynopsis.java b/domain/src/main/generated/writeon/tables/ProductSynopsis.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductSynopsis.java rename to domain/src/main/generated/writeon/tables/ProductSynopsis.java index 93195de..a198e4d 100644 --- a/domain/src/main/generated/writely/tables/ProductSynopsis.java +++ b/domain/src/main/generated/writeon/tables/ProductSynopsis.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductSynopsisRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductSynopsisRecord; /** diff --git a/domain/src/main/generated/writely/tables/ProductWorldview.java b/domain/src/main/generated/writeon/tables/ProductWorldview.java similarity index 98% rename from domain/src/main/generated/writely/tables/ProductWorldview.java rename to domain/src/main/generated/writeon/tables/ProductWorldview.java index 17f2729..ca7e2d7 100644 --- a/domain/src/main/generated/writely/tables/ProductWorldview.java +++ b/domain/src/main/generated/writeon/tables/ProductWorldview.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.LocalDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.ProductWorldviewRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductWorldviewRecord; /** diff --git a/domain/src/main/generated/writely/tables/Terms.java b/domain/src/main/generated/writeon/tables/Terms.java similarity index 98% rename from domain/src/main/generated/writely/tables/Terms.java rename to domain/src/main/generated/writeon/tables/Terms.java index 275051e..3e581e9 100644 --- a/domain/src/main/generated/writely/tables/Terms.java +++ b/domain/src/main/generated/writeon/tables/Terms.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.OffsetDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.TermsRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.TermsRecord; /** diff --git a/domain/src/main/generated/writely/tables/TermsAgreement.java b/domain/src/main/generated/writeon/tables/TermsAgreement.java similarity index 98% rename from domain/src/main/generated/writely/tables/TermsAgreement.java rename to domain/src/main/generated/writeon/tables/TermsAgreement.java index de3907f..dcf87be 100644 --- a/domain/src/main/generated/writely/tables/TermsAgreement.java +++ b/domain/src/main/generated/writeon/tables/TermsAgreement.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables; +package writeon.tables; import java.time.OffsetDateTime; @@ -25,9 +25,9 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writely.Keys; -import writely.Public; -import writely.tables.records.TermsAgreementRecord; +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.TermsAgreementRecord; /** diff --git a/domain/src/main/generated/writely/tables/pojos/Assistant.java b/domain/src/main/generated/writeon/tables/pojos/Assistant.java similarity index 87% rename from domain/src/main/generated/writely/tables/pojos/Assistant.java rename to domain/src/main/generated/writeon/tables/pojos/Assistant.java index 0c46fb4..8abcfd4 100644 --- a/domain/src/main/generated/writely/tables/pojos/Assistant.java +++ b/domain/src/main/generated/writeon/tables/pojos/Assistant.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; @@ -24,7 +24,6 @@ public class Assistant implements Serializable { private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; - private final UUID updatedBy; public Assistant(Assistant value) { this.id = value.id; @@ -34,7 +33,6 @@ public Assistant(Assistant value) { this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; } public Assistant( @@ -44,8 +42,7 @@ public Assistant( String status, LocalDateTime createdAt, UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy + LocalDateTime updatedAt ) { this.id = id; this.productId = productId; @@ -54,7 +51,6 @@ public Assistant( this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; - this.updatedBy = updatedBy; } /** @@ -93,7 +89,7 @@ public LocalDateTime getCreatedAt() { } /** - * Getter for public.assistant.created_by. 수정자 ID + * Getter for public.assistant.created_by. 생성자 ID */ public UUID getCreatedBy() { return this.createdBy; @@ -106,13 +102,6 @@ public LocalDateTime getUpdatedAt() { return this.updatedAt; } - /** - * Getter for public.assistant.updated_by. - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - @Override public boolean equals(Object obj) { if (this == obj) @@ -164,12 +153,6 @@ else if (!this.createdBy.equals(other.createdBy)) } else if (!this.updatedAt.equals(other.updatedAt)) return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; return true; } @@ -184,7 +167,6 @@ public int hashCode() { result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); return result; } @@ -199,7 +181,6 @@ public String toString() { sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); sb.append(")"); return sb.toString(); diff --git a/domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java b/domain/src/main/generated/writeon/tables/pojos/AssistantEvaluation.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java rename to domain/src/main/generated/writeon/tables/pojos/AssistantEvaluation.java index 4f04f5c..2644fc1 100644 --- a/domain/src/main/generated/writely/tables/pojos/AssistantEvaluation.java +++ b/domain/src/main/generated/writeon/tables/pojos/AssistantEvaluation.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ChatMessage.java b/domain/src/main/generated/writeon/tables/pojos/AssistantMessage.java similarity index 69% rename from domain/src/main/generated/writely/tables/pojos/ChatMessage.java rename to domain/src/main/generated/writeon/tables/pojos/AssistantMessage.java index 02d65bf..346b4af 100644 --- a/domain/src/main/generated/writely/tables/pojos/ChatMessage.java +++ b/domain/src/main/generated/writeon/tables/pojos/AssistantMessage.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; @@ -13,7 +13,7 @@ * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class ChatMessage implements Serializable { +public class AssistantMessage implements Serializable { private static final long serialVersionUID = 1L; @@ -24,10 +24,8 @@ public class ChatMessage implements Serializable { private final String prompt; private final LocalDateTime createdAt; private final UUID createdBy; - private final LocalDateTime updatedAt; - private final UUID updatedBy; - public ChatMessage(ChatMessage value) { + public AssistantMessage(AssistantMessage value) { this.id = value.id; this.assistantId = value.assistantId; this.role = value.role; @@ -35,20 +33,16 @@ public ChatMessage(ChatMessage value) { this.prompt = value.prompt; this.createdAt = value.createdAt; this.createdBy = value.createdBy; - this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; } - public ChatMessage( + public AssistantMessage( UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, - UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy + UUID createdBy ) { this.id = id; this.assistantId = assistantId; @@ -57,73 +51,57 @@ public ChatMessage( this.prompt = prompt; this.createdAt = createdAt; this.createdBy = createdBy; - this.updatedAt = updatedAt; - this.updatedBy = updatedBy; } /** - * Getter for public.chat_message.id. + * Getter for public.assistant_message.id. */ public UUID getId() { return this.id; } /** - * Getter for public.chat_message.assistant_id. + * Getter for public.assistant_message.assistant_id. */ public UUID getAssistantId() { return this.assistantId; } /** - * Getter for public.chat_message.role. + * Getter for public.assistant_message.role. */ public String getRole() { return this.role; } /** - * Getter for public.chat_message.content. + * Getter for public.assistant_message.content. */ public String getContent() { return this.content; } /** - * Getter for public.chat_message.prompt. + * Getter for public.assistant_message.prompt. */ public String getPrompt() { return this.prompt; } /** - * Getter for public.chat_message.created_at. + * Getter for public.assistant_message.created_at. */ public LocalDateTime getCreatedAt() { return this.createdAt; } /** - * Getter for public.chat_message.created_by. + * Getter for public.assistant_message.created_by. */ public UUID getCreatedBy() { return this.createdBy; } - /** - * Getter for public.chat_message.updated_at. - */ - public LocalDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Getter for public.chat_message.updated_by. - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - @Override public boolean equals(Object obj) { if (this == obj) @@ -132,7 +110,7 @@ public boolean equals(Object obj) { return false; if (getClass() != obj.getClass()) return false; - final ChatMessage other = (ChatMessage) obj; + final AssistantMessage other = (AssistantMessage) obj; if (this.id == null) { if (other.id != null) return false; @@ -175,18 +153,6 @@ else if (!this.createdAt.equals(other.createdAt)) } else if (!this.createdBy.equals(other.createdBy)) return false; - if (this.updatedAt == null) { - if (other.updatedAt != null) - return false; - } - else if (!this.updatedAt.equals(other.updatedAt)) - return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; return true; } @@ -201,14 +167,12 @@ public int hashCode() { result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); - result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); return result; } @Override public String toString() { - StringBuilder sb = new StringBuilder("ChatMessage ("); + StringBuilder sb = new StringBuilder("AssistantMessage ("); sb.append(id); sb.append(", ").append(assistantId); @@ -217,8 +181,6 @@ public String toString() { sb.append(", ").append(prompt); sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); - sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); sb.append(")"); return sb.toString(); diff --git a/domain/src/main/generated/writely/tables/pojos/LoginAttempt.java b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/LoginAttempt.java rename to domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java index 3c8f5a6..27048bb 100644 --- a/domain/src/main/generated/writely/tables/pojos/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/Member.java b/domain/src/main/generated/writeon/tables/pojos/Member.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/Member.java rename to domain/src/main/generated/writeon/tables/pojos/Member.java index ce5492c..e7dcd41 100644 --- a/domain/src/main/generated/writely/tables/pojos/Member.java +++ b/domain/src/main/generated/writeon/tables/pojos/Member.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/MemberPassword.java b/domain/src/main/generated/writeon/tables/pojos/MemberPassword.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/MemberPassword.java rename to domain/src/main/generated/writeon/tables/pojos/MemberPassword.java index 200356c..ebd2bb9 100644 --- a/domain/src/main/generated/writely/tables/pojos/MemberPassword.java +++ b/domain/src/main/generated/writeon/tables/pojos/MemberPassword.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/Product.java b/domain/src/main/generated/writeon/tables/pojos/Product.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/Product.java rename to domain/src/main/generated/writeon/tables/pojos/Product.java index a3c9520..cd2f210 100644 --- a/domain/src/main/generated/writely/tables/pojos/Product.java +++ b/domain/src/main/generated/writeon/tables/pojos/Product.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductCharacter.java b/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductCharacter.java rename to domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java index dca8979..dcab8cf 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductCharacter.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductCustomField.java b/domain/src/main/generated/writeon/tables/pojos/ProductCustomField.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductCustomField.java rename to domain/src/main/generated/writeon/tables/pojos/ProductCustomField.java index 0ca8e72..237bdb4 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductCustomField.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductCustomField.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductIdeanote.java b/domain/src/main/generated/writeon/tables/pojos/ProductIdeanote.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductIdeanote.java rename to domain/src/main/generated/writeon/tables/pojos/ProductIdeanote.java index 063eaa1..4b608f8 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductIdeanote.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductIdeanote.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductMemo.java b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java similarity index 92% rename from domain/src/main/generated/writely/tables/pojos/ProductMemo.java rename to domain/src/main/generated/writeon/tables/pojos/ProductMemo.java index 3926b78..dad311b 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; @@ -19,6 +19,7 @@ public class ProductMemo implements Serializable { private final UUID id; private final UUID productId; + private final String title; private final String content; private final String selectedText; private final Integer startIndex; @@ -32,6 +33,7 @@ public class ProductMemo implements Serializable { public ProductMemo(ProductMemo value) { this.id = value.id; this.productId = value.productId; + this.title = value.title; this.content = value.content; this.selectedText = value.selectedText; this.startIndex = value.startIndex; @@ -46,6 +48,7 @@ public ProductMemo(ProductMemo value) { public ProductMemo( UUID id, UUID productId, + String title, String content, String selectedText, Integer startIndex, @@ -58,6 +61,7 @@ public ProductMemo( ) { this.id = id; this.productId = productId; + this.title = title; this.content = content; this.selectedText = selectedText; this.startIndex = startIndex; @@ -83,6 +87,13 @@ public UUID getProductId() { return this.productId; } + /** + * Getter for public.product_memo.title. 제목 + */ + public String getTitle() { + return this.title; + } + /** * Getter for public.product_memo.content. 내용 */ @@ -112,7 +123,7 @@ public Integer getEndIndex() { } /** - * Getter for public.product_memo.is_completed. 완료여부 + * Getter for public.product_memo.is_completed. 완료 여부 */ public Boolean getIsCompleted() { return this.isCompleted; @@ -167,6 +178,12 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; + if (this.title == null) { + if (other.title != null) + return false; + } + else if (!this.title.equals(other.title)) + return false; if (this.content == null) { if (other.content != null) return false; @@ -230,6 +247,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.selectedText == null) ? 0 : this.selectedText.hashCode()); result = prime * result + ((this.startIndex == null) ? 0 : this.startIndex.hashCode()); @@ -248,6 +266,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); + sb.append(", ").append(title); sb.append(", ").append(content); sb.append(", ").append(selectedText); sb.append(", ").append(startIndex); diff --git a/domain/src/main/generated/writely/tables/pojos/ProductPlot.java b/domain/src/main/generated/writeon/tables/pojos/ProductPlot.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductPlot.java rename to domain/src/main/generated/writeon/tables/pojos/ProductPlot.java index 7955e8c..ae6c36b 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductPlot.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductPlot.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductSynopsis.java b/domain/src/main/generated/writeon/tables/pojos/ProductSynopsis.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductSynopsis.java rename to domain/src/main/generated/writeon/tables/pojos/ProductSynopsis.java index 2d6e5b8..3e3d726 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductSynopsis.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductSynopsis.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/ProductWorldview.java b/domain/src/main/generated/writeon/tables/pojos/ProductWorldview.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/ProductWorldview.java rename to domain/src/main/generated/writeon/tables/pojos/ProductWorldview.java index bd07800..669f547 100644 --- a/domain/src/main/generated/writely/tables/pojos/ProductWorldview.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductWorldview.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/Terms.java b/domain/src/main/generated/writeon/tables/pojos/Terms.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/Terms.java rename to domain/src/main/generated/writeon/tables/pojos/Terms.java index 8eb84e8..d36e39f 100644 --- a/domain/src/main/generated/writely/tables/pojos/Terms.java +++ b/domain/src/main/generated/writeon/tables/pojos/Terms.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/pojos/TermsAgreement.java b/domain/src/main/generated/writeon/tables/pojos/TermsAgreement.java similarity index 99% rename from domain/src/main/generated/writely/tables/pojos/TermsAgreement.java rename to domain/src/main/generated/writeon/tables/pojos/TermsAgreement.java index 7ce3dab..0ccf7bf 100644 --- a/domain/src/main/generated/writely/tables/pojos/TermsAgreement.java +++ b/domain/src/main/generated/writeon/tables/pojos/TermsAgreement.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.pojos; +package writeon.tables.pojos; import java.io.Serializable; diff --git a/domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantEvaluationRecord.java similarity index 96% rename from domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java rename to domain/src/main/generated/writeon/tables/records/AssistantEvaluationRecord.java index a16bf14..9a60893 100644 --- a/domain/src/main/generated/writely/tables/records/AssistantEvaluationRecord.java +++ b/domain/src/main/generated/writeon/tables/records/AssistantEvaluationRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.AssistantEvaluation; +import writeon.tables.AssistantEvaluation; /** @@ -135,7 +135,7 @@ public AssistantEvaluationRecord(UUID assistantId, Boolean isGood, String feedba /** * Create a detached, initialised AssistantEvaluationRecord */ - public AssistantEvaluationRecord(writely.tables.pojos.AssistantEvaluation value) { + public AssistantEvaluationRecord(writeon.tables.pojos.AssistantEvaluation value) { super(AssistantEvaluation.ASSISTANT_EVALUATION); if (value != null) { diff --git a/domain/src/main/generated/writeon/tables/records/AssistantMessageRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantMessageRecord.java new file mode 100644 index 0000000..0e18c23 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/AssistantMessageRecord.java @@ -0,0 +1,182 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writeon.tables.AssistantMessage; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.assistant_message.id. + */ + public AssistantMessageRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.assistant_message.id. + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.assistant_message.assistant_id. + */ + public AssistantMessageRecord setAssistantId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.assistant_message.assistant_id. + */ + public UUID getAssistantId() { + return (UUID) get(1); + } + + /** + * Setter for public.assistant_message.role. + */ + public AssistantMessageRecord setRole(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.assistant_message.role. + */ + public String getRole() { + return (String) get(2); + } + + /** + * Setter for public.assistant_message.content. + */ + public AssistantMessageRecord setContent(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.assistant_message.content. + */ + public String getContent() { + return (String) get(3); + } + + /** + * Setter for public.assistant_message.prompt. + */ + public AssistantMessageRecord setPrompt(String value) { + set(4, value); + return this; + } + + /** + * Getter for public.assistant_message.prompt. + */ + public String getPrompt() { + return (String) get(4); + } + + /** + * Setter for public.assistant_message.created_at. + */ + public AssistantMessageRecord setCreatedAt(LocalDateTime value) { + set(5, value); + return this; + } + + /** + * Getter for public.assistant_message.created_at. + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(5); + } + + /** + * Setter for public.assistant_message.created_by. + */ + public AssistantMessageRecord setCreatedBy(UUID value) { + set(6, value); + return this; + } + + /** + * Getter for public.assistant_message.created_by. + */ + public UUID getCreatedBy() { + return (UUID) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AssistantMessageRecord + */ + public AssistantMessageRecord() { + super(AssistantMessage.ASSISTANT_MESSAGE); + } + + /** + * Create a detached, initialised AssistantMessageRecord + */ + public AssistantMessageRecord(UUID id, UUID assistantId, String role, String content, String prompt, LocalDateTime createdAt, UUID createdBy) { + super(AssistantMessage.ASSISTANT_MESSAGE); + + setId(id); + setAssistantId(assistantId); + setRole(role); + setContent(content); + setPrompt(prompt); + setCreatedAt(createdAt); + setCreatedBy(createdBy); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised AssistantMessageRecord + */ + public AssistantMessageRecord(writeon.tables.pojos.AssistantMessage value) { + super(AssistantMessage.ASSISTANT_MESSAGE); + + if (value != null) { + setId(value.getId()); + setAssistantId(value.getAssistantId()); + setRole(value.getRole()); + setContent(value.getContent()); + setPrompt(value.getPrompt()); + setCreatedAt(value.getCreatedAt()); + setCreatedBy(value.getCreatedBy()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/generated/writely/tables/records/AssistantRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java similarity index 85% rename from domain/src/main/generated/writely/tables/records/AssistantRecord.java rename to domain/src/main/generated/writeon/tables/records/AssistantRecord.java index 8f20853..fbf8a2e 100644 --- a/domain/src/main/generated/writely/tables/records/AssistantRecord.java +++ b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.Assistant; +import writeon.tables.Assistant; /** @@ -97,7 +97,7 @@ public LocalDateTime getCreatedAt() { } /** - * Setter for public.assistant.created_by. 수정자 ID + * Setter for public.assistant.created_by. 생성자 ID */ public AssistantRecord setCreatedBy(UUID value) { set(5, value); @@ -105,7 +105,7 @@ public AssistantRecord setCreatedBy(UUID value) { } /** - * Getter for public.assistant.created_by. 수정자 ID + * Getter for public.assistant.created_by. 생성자 ID */ public UUID getCreatedBy() { return (UUID) get(5); @@ -126,21 +126,6 @@ public LocalDateTime getUpdatedAt() { return (LocalDateTime) get(6); } - /** - * Setter for public.assistant.updated_by. - */ - public AssistantRecord setUpdatedBy(UUID value) { - set(7, value); - return this; - } - - /** - * Getter for public.assistant.updated_by. - */ - public UUID getUpdatedBy() { - return (UUID) get(7); - } - // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -164,7 +149,7 @@ public AssistantRecord() { /** * Create a detached, initialised AssistantRecord */ - public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt) { super(Assistant.ASSISTANT); setId(id); @@ -174,14 +159,13 @@ public AssistantRecord(UUID id, UUID productId, String type, String status, Loca setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); resetChangedOnNotNull(); } /** * Create a detached, initialised AssistantRecord */ - public AssistantRecord(writely.tables.pojos.Assistant value) { + public AssistantRecord(writeon.tables.pojos.Assistant value) { super(Assistant.ASSISTANT); if (value != null) { @@ -192,7 +176,6 @@ public AssistantRecord(writely.tables.pojos.Assistant value) { setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); resetChangedOnNotNull(); } } diff --git a/domain/src/main/generated/writely/tables/records/LoginAttemptRecord.java b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java similarity index 96% rename from domain/src/main/generated/writely/tables/records/LoginAttemptRecord.java rename to domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java index 0f53a5a..d24cca5 100644 --- a/domain/src/main/generated/writely/tables/records/LoginAttemptRecord.java +++ b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.OffsetDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.LoginAttempt; +import writeon.tables.LoginAttempt; /** @@ -133,7 +133,7 @@ public LoginAttemptRecord(UUID id, String email, String result, OffsetDateTime c /** * Create a detached, initialised LoginAttemptRecord */ - public LoginAttemptRecord(writely.tables.pojos.LoginAttempt value) { + public LoginAttemptRecord(writeon.tables.pojos.LoginAttempt value) { super(LoginAttempt.LOGIN_ATTEMPT); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/MemberPasswordRecord.java b/domain/src/main/generated/writeon/tables/records/MemberPasswordRecord.java similarity index 96% rename from domain/src/main/generated/writely/tables/records/MemberPasswordRecord.java rename to domain/src/main/generated/writeon/tables/records/MemberPasswordRecord.java index c325674..ded569c 100644 --- a/domain/src/main/generated/writely/tables/records/MemberPasswordRecord.java +++ b/domain/src/main/generated/writeon/tables/records/MemberPasswordRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.OffsetDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.MemberPassword; +import writeon.tables.MemberPassword; /** @@ -117,7 +117,7 @@ public MemberPasswordRecord(UUID memberId, String password, OffsetDateTime creat /** * Create a detached, initialised MemberPasswordRecord */ - public MemberPasswordRecord(writely.tables.pojos.MemberPassword value) { + public MemberPasswordRecord(writeon.tables.pojos.MemberPassword value) { super(MemberPassword.MEMBER_PASSWORD); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/MemberRecord.java b/domain/src/main/generated/writeon/tables/records/MemberRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/MemberRecord.java rename to domain/src/main/generated/writeon/tables/records/MemberRecord.java index b5ee6c2..88d74ab 100644 --- a/domain/src/main/generated/writely/tables/records/MemberRecord.java +++ b/domain/src/main/generated/writeon/tables/records/MemberRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.OffsetDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.Member; +import writeon.tables.Member; /** @@ -149,7 +149,7 @@ public MemberRecord(UUID id, String email, String nickname, String profileImage, /** * Create a detached, initialised MemberRecord */ - public MemberRecord(writely.tables.pojos.Member value) { + public MemberRecord(writeon.tables.pojos.Member value) { super(Member.MEMBER); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductCharacterRecord.java b/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java similarity index 98% rename from domain/src/main/generated/writely/tables/records/ProductCharacterRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java index ec36318..26ded55 100644 --- a/domain/src/main/generated/writely/tables/records/ProductCharacterRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductCharacter; +import writeon.tables.ProductCharacter; /** @@ -293,7 +293,7 @@ public ProductCharacterRecord(UUID id, UUID productId, String intro, String name /** * Create a detached, initialised ProductCharacterRecord */ - public ProductCharacterRecord(writely.tables.pojos.ProductCharacter value) { + public ProductCharacterRecord(writeon.tables.pojos.ProductCharacter value) { super(ProductCharacter.PRODUCT_CHARACTER); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java b/domain/src/main/generated/writeon/tables/records/ProductCustomFieldRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductCustomFieldRecord.java index f8a07ad..c8910e5 100644 --- a/domain/src/main/generated/writely/tables/records/ProductCustomFieldRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductCustomFieldRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductCustomField; +import writeon.tables.ProductCustomField; /** @@ -229,7 +229,7 @@ public ProductCustomFieldRecord(UUID id, UUID productId, UUID sectionId, String /** * Create a detached, initialised ProductCustomFieldRecord */ - public ProductCustomFieldRecord(writely.tables.pojos.ProductCustomField value) { + public ProductCustomFieldRecord(writeon.tables.pojos.ProductCustomField value) { super(ProductCustomField.PRODUCT_CUSTOM_FIELD); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java b/domain/src/main/generated/writeon/tables/records/ProductIdeanoteRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductIdeanoteRecord.java index 0891a2c..03b5299 100644 --- a/domain/src/main/generated/writely/tables/records/ProductIdeanoteRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductIdeanoteRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductIdeanote; +import writeon.tables.ProductIdeanote; /** @@ -165,7 +165,7 @@ public ProductIdeanoteRecord(UUID id, String title, String content, LocalDateTim /** * Create a detached, initialised ProductIdeanoteRecord */ - public ProductIdeanoteRecord(writely.tables.pojos.ProductIdeanote value) { + public ProductIdeanoteRecord(writeon.tables.pojos.ProductIdeanote value) { super(ProductIdeanote.PRODUCT_IDEANOTE); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductMemoRecord.java b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java similarity index 85% rename from domain/src/main/generated/writely/tables/records/ProductMemoRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java index 51fdf91..1dd6acf 100644 --- a/domain/src/main/generated/writely/tables/records/ProductMemoRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductMemo; +import writeon.tables.ProductMemo; /** @@ -51,11 +51,26 @@ public UUID getProductId() { return (UUID) get(1); } + /** + * Setter for public.product_memo.title. 제목 + */ + public ProductMemoRecord setTitle(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_memo.title. 제목 + */ + public String getTitle() { + return (String) get(2); + } + /** * Setter for public.product_memo.content. 내용 */ public ProductMemoRecord setContent(String value) { - set(2, value); + set(3, value); return this; } @@ -63,14 +78,14 @@ public ProductMemoRecord setContent(String value) { * Getter for public.product_memo.content. 내용 */ public String getContent() { - return (String) get(2); + return (String) get(3); } /** * Setter for public.product_memo.selected_text. */ public ProductMemoRecord setSelectedText(String value) { - set(3, value); + set(4, value); return this; } @@ -78,14 +93,14 @@ public ProductMemoRecord setSelectedText(String value) { * Getter for public.product_memo.selected_text. */ public String getSelectedText() { - return (String) get(3); + return (String) get(4); } /** * Setter for public.product_memo.start_index. */ public ProductMemoRecord setStartIndex(Integer value) { - set(4, value); + set(5, value); return this; } @@ -93,14 +108,14 @@ public ProductMemoRecord setStartIndex(Integer value) { * Getter for public.product_memo.start_index. */ public Integer getStartIndex() { - return (Integer) get(4); + return (Integer) get(5); } /** * Setter for public.product_memo.end_index. */ public ProductMemoRecord setEndIndex(Integer value) { - set(5, value); + set(6, value); return this; } @@ -108,29 +123,29 @@ public ProductMemoRecord setEndIndex(Integer value) { * Getter for public.product_memo.end_index. */ public Integer getEndIndex() { - return (Integer) get(5); + return (Integer) get(6); } /** - * Setter for public.product_memo.is_completed. 완료여부 + * Setter for public.product_memo.is_completed. 완료 여부 */ public ProductMemoRecord setIsCompleted(Boolean value) { - set(6, value); + set(7, value); return this; } /** - * Getter for public.product_memo.is_completed. 완료여부 + * Getter for public.product_memo.is_completed. 완료 여부 */ public Boolean getIsCompleted() { - return (Boolean) get(6); + return (Boolean) get(7); } /** * Setter for public.product_memo.created_at. 생성일시 */ public ProductMemoRecord setCreatedAt(LocalDateTime value) { - set(7, value); + set(8, value); return this; } @@ -138,14 +153,14 @@ public ProductMemoRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_memo.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(7); + return (LocalDateTime) get(8); } /** * Setter for public.product_memo.created_by. 생성자 ID */ public ProductMemoRecord setCreatedBy(UUID value) { - set(8, value); + set(9, value); return this; } @@ -153,14 +168,14 @@ public ProductMemoRecord setCreatedBy(UUID value) { * Getter for public.product_memo.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(8); + return (UUID) get(9); } /** * Setter for public.product_memo.updated_at. 수정일시 */ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { - set(9, value); + set(10, value); return this; } @@ -168,14 +183,14 @@ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_memo.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(9); + return (LocalDateTime) get(10); } /** * Setter for public.product_memo.updated_by. 수정일시 */ public ProductMemoRecord setUpdatedBy(UUID value) { - set(10, value); + set(11, value); return this; } @@ -183,7 +198,7 @@ public ProductMemoRecord setUpdatedBy(UUID value) { * Getter for public.product_memo.updated_by. 수정일시 */ public UUID getUpdatedBy() { - return (UUID) get(10); + return (UUID) get(11); } // ------------------------------------------------------------------------- @@ -209,11 +224,12 @@ public ProductMemoRecord() { /** * Create a detached, initialised ProductMemoRecord */ - public ProductMemoRecord(UUID id, UUID productId, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductMemoRecord(UUID id, UUID productId, String title, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductMemo.PRODUCT_MEMO); setId(id); setProductId(productId); + setTitle(title); setContent(content); setSelectedText(selectedText); setStartIndex(startIndex); @@ -229,12 +245,13 @@ public ProductMemoRecord(UUID id, UUID productId, String content, String selecte /** * Create a detached, initialised ProductMemoRecord */ - public ProductMemoRecord(writely.tables.pojos.ProductMemo value) { + public ProductMemoRecord(writeon.tables.pojos.ProductMemo value) { super(ProductMemo.PRODUCT_MEMO); if (value != null) { setId(value.getId()); setProductId(value.getProductId()); + setTitle(value.getTitle()); setContent(value.getContent()); setSelectedText(value.getSelectedText()); setStartIndex(value.getStartIndex()); diff --git a/domain/src/main/generated/writely/tables/records/ProductPlotRecord.java b/domain/src/main/generated/writeon/tables/records/ProductPlotRecord.java similarity index 96% rename from domain/src/main/generated/writely/tables/records/ProductPlotRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductPlotRecord.java index 409f785..3aa11af 100644 --- a/domain/src/main/generated/writely/tables/records/ProductPlotRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductPlotRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductPlot; +import writeon.tables.ProductPlot; /** @@ -149,7 +149,7 @@ public ProductPlotRecord(UUID id, String content, LocalDateTime createdAt, UUID /** * Create a detached, initialised ProductPlotRecord */ - public ProductPlotRecord(writely.tables.pojos.ProductPlot value) { + public ProductPlotRecord(writeon.tables.pojos.ProductPlot value) { super(ProductPlot.PRODUCT_PLOT); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductRecord.java b/domain/src/main/generated/writeon/tables/records/ProductRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/ProductRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductRecord.java index f24f81c..04c789d 100644 --- a/domain/src/main/generated/writely/tables/records/ProductRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.Product; +import writeon.tables.Product; /** @@ -165,7 +165,7 @@ public ProductRecord(UUID id, String title, String content, LocalDateTime create /** * Create a detached, initialised ProductRecord */ - public ProductRecord(writely.tables.pojos.Product value) { + public ProductRecord(writeon.tables.pojos.Product value) { super(Product.PRODUCT); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductSynopsisRecord.java b/domain/src/main/generated/writeon/tables/records/ProductSynopsisRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/ProductSynopsisRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductSynopsisRecord.java index 4cbf74a..1ecebbc 100644 --- a/domain/src/main/generated/writely/tables/records/ProductSynopsisRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductSynopsisRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductSynopsis; +import writeon.tables.ProductSynopsis; /** @@ -213,7 +213,7 @@ public ProductSynopsisRecord(UUID id, String genre, String length, String purpos /** * Create a detached, initialised ProductSynopsisRecord */ - public ProductSynopsisRecord(writely.tables.pojos.ProductSynopsis value) { + public ProductSynopsisRecord(writeon.tables.pojos.ProductSynopsis value) { super(ProductSynopsis.PRODUCT_SYNOPSIS); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/ProductWorldviewRecord.java b/domain/src/main/generated/writeon/tables/records/ProductWorldviewRecord.java similarity index 98% rename from domain/src/main/generated/writely/tables/records/ProductWorldviewRecord.java rename to domain/src/main/generated/writeon/tables/records/ProductWorldviewRecord.java index 8209fa3..e2164d0 100644 --- a/domain/src/main/generated/writely/tables/records/ProductWorldviewRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductWorldviewRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.ProductWorldview; +import writeon.tables.ProductWorldview; /** @@ -341,7 +341,7 @@ public ProductWorldviewRecord(UUID id, String geography, String history, String /** * Create a detached, initialised ProductWorldviewRecord */ - public ProductWorldviewRecord(writely.tables.pojos.ProductWorldview value) { + public ProductWorldviewRecord(writeon.tables.pojos.ProductWorldview value) { super(ProductWorldview.PRODUCT_WORLDVIEW); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/TermsAgreementRecord.java b/domain/src/main/generated/writeon/tables/records/TermsAgreementRecord.java similarity index 96% rename from domain/src/main/generated/writely/tables/records/TermsAgreementRecord.java rename to domain/src/main/generated/writeon/tables/records/TermsAgreementRecord.java index 0694e17..3bd4bfd 100644 --- a/domain/src/main/generated/writely/tables/records/TermsAgreementRecord.java +++ b/domain/src/main/generated/writeon/tables/records/TermsAgreementRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.OffsetDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record2; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.TermsAgreement; +import writeon.tables.TermsAgreement; /** @@ -117,7 +117,7 @@ public TermsAgreementRecord(String termsCd, UUID memberId, OffsetDateTime create /** * Create a detached, initialised TermsAgreementRecord */ - public TermsAgreementRecord(writely.tables.pojos.TermsAgreement value) { + public TermsAgreementRecord(writeon.tables.pojos.TermsAgreement value) { super(TermsAgreement.TERMS_AGREEMENT); if (value != null) { diff --git a/domain/src/main/generated/writely/tables/records/TermsRecord.java b/domain/src/main/generated/writeon/tables/records/TermsRecord.java similarity index 97% rename from domain/src/main/generated/writely/tables/records/TermsRecord.java rename to domain/src/main/generated/writeon/tables/records/TermsRecord.java index 4f49302..d4bfb27 100644 --- a/domain/src/main/generated/writely/tables/records/TermsRecord.java +++ b/domain/src/main/generated/writeon/tables/records/TermsRecord.java @@ -1,7 +1,7 @@ /* * This file is generated by jOOQ. */ -package writely.tables.records; +package writeon.tables.records; import java.time.OffsetDateTime; @@ -10,7 +10,7 @@ import org.jooq.Record1; import org.jooq.impl.UpdatableRecordImpl; -import writely.tables.Terms; +import writeon.tables.Terms; /** @@ -181,7 +181,7 @@ public TermsRecord(UUID id, String cd, Integer version, String title, String con /** * Create a detached, initialised TermsRecord */ - public TermsRecord(writely.tables.pojos.Terms value) { + public TermsRecord(writeon.tables.pojos.Terms value) { super(Terms.TERMS); if (value != null) { diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java similarity index 74% rename from domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java rename to domain/src/main/java/writeon/domain/assistant/AssistantMessage.java index b2e1461..4f8c39e 100644 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java @@ -1,20 +1,23 @@ -package writeon.domain.assistant.usermodify; +package writeon.domain.assistant; -import jakarta.persistence.*; +import java.time.LocalDateTime; +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import writeon.domain.assistant.MessageContent; import writeon.domain.assistant.enums.MessageSenderRole; -import java.time.LocalDateTime; -import java.util.UUID; - @Getter @Entity @NoArgsConstructor -@Table(name = "user_modify_message") -public class UserModifyMessage { +@Table(name = "assistant_message") +public class AssistantMessage { @Id @Column(updatable = false, nullable = false) @@ -36,7 +39,7 @@ public class UserModifyMessage { private UUID createdBy; @Builder - public UserModifyMessage(UUID assistantId, MessageSenderRole role, String content, String prompt, UUID createdBy) { + public AssistantMessage(UUID assistantId, MessageSenderRole role, String content, String prompt, UUID createdBy) { this.assistantId = assistantId; this.messageContent = new MessageContent(role, content); this.prompt = prompt; diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java new file mode 100644 index 0000000..0b4e7cb --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java @@ -0,0 +1,15 @@ +package writeon.domain.assistant; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; +import java.util.UUID; + +import writeon.domain.assistant.enums.MessageSenderRole; + +public interface AssistantMessageJpaRepository extends JpaRepository { + + boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); + + Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); +} diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java deleted file mode 100644 index 8dbb3c0..0000000 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessage.java +++ /dev/null @@ -1,49 +0,0 @@ -package writeon.domain.assistant.automodify; - -import jakarta.persistence.*; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.assistant.MessageContent; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.time.LocalDateTime; -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor -@Table(name = "auto_modify_message") -public class AutoModifyMessage { - - @Id - @Column(updatable = false, nullable = false) - private final UUID id = UUID.randomUUID(); - - @Column(name = "assistant_id", nullable = false) - private UUID assistantId; - - @Embedded - private MessageContent messageContent; - - @Column(name = "created_at", updatable = false, nullable = false) - private final LocalDateTime createdAt = LocalDateTime.now(); - - @Column(name = "created_by", updatable = false, nullable = false) - private UUID createdBy; - - @Builder - public AutoModifyMessage(UUID assistantId, MessageSenderRole role, String content, UUID createdBy) { - this.assistantId = assistantId; - this.messageContent = new MessageContent(role, content); - this.createdBy = createdBy; - } - - public MessageSenderRole getRole() { - return messageContent.getRole(); - } - - public String getContent() { - return messageContent.getContent(); - } -} diff --git a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java deleted file mode 100644 index 79c8265..0000000 --- a/domain/src/main/java/writeon/domain/assistant/automodify/AutoModifyMessageJpaRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package writeon.domain.assistant.automodify; - -import org.springframework.data.jpa.repository.JpaRepository; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.util.Optional; -import java.util.UUID; - -public interface AutoModifyMessageJpaRepository extends JpaRepository { - - boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); - - Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); -} diff --git a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java deleted file mode 100644 index 7e83800..0000000 --- a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessage.java +++ /dev/null @@ -1,53 +0,0 @@ -package writeon.domain.assistant.chat; - -import jakarta.persistence.*; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.assistant.MessageContent; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.time.LocalDateTime; -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor -@Table(name = "chat_message") -public class ChatMessage { - - @Id - @Column(updatable = false, nullable = false) - private final UUID id = UUID.randomUUID(); - - @Column(name = "assistant_id", nullable = false) - private UUID assistantId; - - @Embedded - private MessageContent messageContent; - - @Column(name = "prompt", nullable = false) - private String prompt; - - @Column(name = "created_at", updatable = false, nullable = false) - private final LocalDateTime createdAt = LocalDateTime.now(); - - @Column(name = "created_by", updatable = false, nullable = false) - private UUID createdBy; - - @Builder - public ChatMessage(UUID assistantId, MessageSenderRole role, String content, String prompt, UUID createdBy) { - this.assistantId = assistantId; - this.messageContent = new MessageContent(role, content); - this.prompt = prompt; - this.createdBy = createdBy; - } - - public MessageSenderRole getRole() { - return messageContent.getRole(); - } - - public String getContent() { - return messageContent.getContent(); - } -} diff --git a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java deleted file mode 100644 index 48f2b44..0000000 --- a/domain/src/main/java/writeon/domain/assistant/chat/ChatMessageJpaRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package writeon.domain.assistant.chat; - -import org.springframework.data.jpa.repository.JpaRepository; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.util.Optional; -import java.util.UUID; - -public interface ChatMessageJpaRepository extends JpaRepository { - - boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); - - Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); -} diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java deleted file mode 100644 index 0ee3b7c..0000000 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessage.java +++ /dev/null @@ -1,49 +0,0 @@ -package writeon.domain.assistant.feedback; - -import jakarta.persistence.*; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.assistant.MessageContent; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.time.LocalDateTime; -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor -@Table(name = "feedback_message") -public class FeedbackMessage { - - @Id - @Column(updatable = false, nullable = false) - private final UUID id = UUID.randomUUID(); - - @Column(name = "assistant_id", nullable = false) - private UUID assistantId; - - @Embedded - private MessageContent messageContent; - - @Column(name = "created_at", updatable = false, nullable = false) - private final LocalDateTime createdAt = LocalDateTime.now(); - - @Column(name = "created_by", updatable = false, nullable = false) - private UUID createdBy; - - @Builder - public FeedbackMessage(UUID assistantId, MessageSenderRole role, String content, UUID createdBy) { - this.assistantId = assistantId; - this.messageContent = new MessageContent(role, content); - this.createdBy = createdBy; - } - - public MessageSenderRole getRole() { - return messageContent.getRole(); - } - - public String getContent() { - return messageContent.getContent(); - } -} diff --git a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java deleted file mode 100644 index 27663d1..0000000 --- a/domain/src/main/java/writeon/domain/assistant/feedback/FeedbackMessageJpaRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package writeon.domain.assistant.feedback; - -import org.springframework.data.jpa.repository.JpaRepository; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.util.Optional; -import java.util.UUID; - -public interface FeedbackMessageJpaRepository extends JpaRepository { - - boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); - - Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); -} diff --git a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java deleted file mode 100644 index 44c23d4..0000000 --- a/domain/src/main/java/writeon/domain/assistant/usermodify/UserModifyMessageJpaRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package writeon.domain.assistant.usermodify; - -import org.springframework.data.jpa.repository.JpaRepository; -import writeon.domain.assistant.enums.MessageSenderRole; - -import java.util.Optional; -import java.util.UUID; - -public interface UserModifyMessageJpaRepository extends JpaRepository { - - boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); - - Optional findByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); -} diff --git a/domain/src/main/java/writeon/domain/terms/Terms.java b/domain/src/main/java/writeon/domain/terms/Terms.java index 9380d7b..af9d461 100644 --- a/domain/src/main/java/writeon/domain/terms/Terms.java +++ b/domain/src/main/java/writeon/domain/terms/Terms.java @@ -1,14 +1,18 @@ package writeon.domain.terms; -import jakarta.persistence.*; +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import writely.tables.records.TermsRecord; import writeon.domain.common.BaseTimeEntity; import writeon.domain.terms.enums.TermsCode; - -import java.util.UUID; +import writeon.tables.records.TermsRecord; @Getter @Setter diff --git a/sql/init.sql b/sql/init.sql index 5ab42cf..0bd5a6f 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -382,33 +382,10 @@ comment on column assistant_evaluation.created_by is '생성자 ID'; alter table assistant_evaluation owner to postgres; -create table auto_modify_message +create table assistant_message ( id uuid default gen_random_uuid() not null - constraint auto_modify_message_pk - primary key, - assistant_id uuid not null, - role varchar(10) not null, - content text not null, - created_at timestamp not null, - created_by uuid not null -); - -comment on table auto_modify_message is '자동 수정 메세지'; -comment on column auto_modify_message.id is '자동 수정 메세지 ID'; -comment on column auto_modify_message.assistant_id is '어시스턴트 ID'; -comment on column auto_modify_message.role is '메세지 송신자'; -comment on column auto_modify_message.content is '내용'; -comment on column auto_modify_message.created_at is '생성일시'; -comment on column auto_modify_message.created_by is '생성자 ID'; - -alter table auto_modify_message - owner to postgres; - -create table chat_message -( - id uuid default gen_random_uuid() not null - constraint chat_message_pk + constraint assistant_message_pk primary key, assistant_id uuid not null, role varchar(10) not null, @@ -418,45 +395,5 @@ create table chat_message created_by uuid not null ); -alter table chat_message - owner to postgres; - -create table feedback_message -( - id uuid default gen_random_uuid() not null - constraint feedback_message_pk - primary key, - assistant_id uuid not null, - role varchar(10) not null, - content text not null, - created_at timestamp not null, - created_by uuid not null -); - -comment on table feedback_message is '피드백 메세지'; -comment on column feedback_message.id is '피드백 메세지 ID'; -comment on column feedback_message.assistant_id is '어시스턴트 ID'; -comment on column feedback_message.role is '메세지 송신자'; -comment on column feedback_message.content is '내용'; -comment on column feedback_message.created_at is '생성일시'; -comment on column feedback_message.created_by is '생성자 ID'; - -alter table feedback_message - owner to postgres; - -create table user_modify_message -( - id uuid default gen_random_uuid() not null - constraint user_modify_message_pk - primary key, - assistant_id uuid not null, - role varchar(10) not null, - content text not null, - prompt text, - created_at timestamp not null, - created_by uuid not null -); - -alter table user_modify_message +alter table assistant_message owner to postgres; - From e31ac1c445aec8b28d1b4661e7d389df7e4fd4f3 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 31 Mar 2025 20:42:28 +0900 Subject: [PATCH 060/107] =?UTF-8?q?fix:=20RefreshToken=EC=9D=84=20?= =?UTF-8?q?=EC=BF=A0=ED=82=A4=EB=A1=9C=20=EC=84=A4=EC=A0=95=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/auth/controller/AuthController.java | 53 ++++++++++++++----- .../api/auth/helper/AuthCookieHelper.java | 37 +++++++++++++ .../writeon/api/auth/helper/JwtHelper.java | 2 + .../api/auth/request/ReissueRequest.java | 14 ----- .../api/auth/response/AuthTokenResponse.java | 21 -------- .../auth/response/TokenReissueResponse.java | 16 ++++++ .../api/auth/service/AuthCommandService.java | 31 ++++++----- .../writeon/domain/auth/dto/AuthTokenDto.java | 13 +++++ 8 files changed, 124 insertions(+), 63 deletions(-) create mode 100644 api/src/main/java/writeon/api/auth/helper/AuthCookieHelper.java delete mode 100644 api/src/main/java/writeon/api/auth/request/ReissueRequest.java delete mode 100644 api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java create mode 100644 api/src/main/java/writeon/api/auth/response/TokenReissueResponse.java create mode 100644 domain/src/main/java/writeon/domain/auth/dto/AuthTokenDto.java diff --git a/api/src/main/java/writeon/api/auth/controller/AuthController.java b/api/src/main/java/writeon/api/auth/controller/AuthController.java index d4b9a90..4452498 100644 --- a/api/src/main/java/writeon/api/auth/controller/AuthController.java +++ b/api/src/main/java/writeon/api/auth/controller/AuthController.java @@ -1,17 +1,21 @@ package writeon.api.auth.controller; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import writeon.api.auth.helper.AuthCookieHelper; import writeon.api.auth.request.*; -import writeon.api.auth.response.AuthTokenResponse; import writeon.api.auth.response.CheckEmailResponse; +import writeon.api.auth.response.TokenReissueResponse; import writeon.api.auth.service.AuthCommandService; import writeon.api.auth.service.AuthQueryService; -import writeon.domain.common.MemberSession; +import writeon.api.common.response.BaseResponse; +import writeon.api.common.util.LogUtil; +import writeon.domain.auth.dto.AuthTokenDto; @RestController @RequiredArgsConstructor @@ -20,26 +24,50 @@ public class AuthController { private final AuthQueryService authQueryService; private final AuthCommandService authCommandService; + private final AuthCookieHelper authCookieHelper; @Operation(summary = "토큰 재발급") @PostMapping("/token/reissue") - public AuthTokenResponse reissueToken(@Valid @RequestBody ReissueRequest request) { - - return authCommandService.reissueToken(request); + public ResponseEntity> reissueToken(@CookieValue(value = "refreshToken", defaultValue="") String tokenString) { + LogUtil.info("token" + tokenString); + AuthTokenDto tokens = authCommandService.reissueToken(tokenString); + TokenReissueResponse response = new TokenReissueResponse(tokens.getAccessToken()); + + String cookieString = authCookieHelper.createNewCookie(tokens.getRefreshToken()); + HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.SET_COOKIE, cookieString); + + return ResponseEntity.ok() + .headers(headers) + .body(BaseResponse.success(response)); } @Operation(summary = "로그인") @PostMapping("/login") - public AuthTokenResponse login(@Valid @RequestBody LoginRequest request) { + public ResponseEntity> login(@Valid @RequestBody LoginRequest request) { + AuthTokenDto tokens = authCommandService.login(request); + TokenReissueResponse response = new TokenReissueResponse(tokens.getAccessToken()); + + String cookieString = authCookieHelper.createNewCookie(tokens.getRefreshToken()); + HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.SET_COOKIE, cookieString); - return authCommandService.login(request); + return ResponseEntity.ok() + .headers(headers) + .body(BaseResponse.success(response)); } @Operation(summary = "로그아웃") @PostMapping("/logout") - public void logout(@Parameter(hidden = true) MemberSession memberSession) { + public ResponseEntity> logout() { + authCommandService.logout(); - authCommandService.logout(memberSession.getMemberId()); + HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.SET_COOKIE, authCookieHelper.createExpiredCookie()); + + return ResponseEntity.ok() + .headers(headers) + .body(null); } @Operation(summary = "회원가입") @@ -51,9 +79,9 @@ public void join(@Valid @RequestBody JoinRequest request) { @Operation(summary = "회원가입 완료") @PostMapping("/join/complete") - public AuthTokenResponse completeJoin(@Valid @RequestBody JoinCompletionRequest request) { + public void completeJoin(@Valid @RequestBody JoinCompletionRequest request) { - return authCommandService.completeJoin(request); + authCommandService.completeJoin(request); } @Operation(summary = "비밀번호 변경") @@ -83,4 +111,5 @@ public CheckEmailResponse checkNickname(@Valid CheckNicknameRequest request) { return authQueryService.checkNickname(request); } + } diff --git a/api/src/main/java/writeon/api/auth/helper/AuthCookieHelper.java b/api/src/main/java/writeon/api/auth/helper/AuthCookieHelper.java new file mode 100644 index 0000000..d423ba2 --- /dev/null +++ b/api/src/main/java/writeon/api/auth/helper/AuthCookieHelper.java @@ -0,0 +1,37 @@ +package writeon.api.auth.helper; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseCookie; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class AuthCookieHelper { + public final JwtHelper jwtHelper; + + @Value("${spring.profiles.active}") + private String profile; // todo: 프로필에 따른 쿠키 설정 분기, 운영기는 (secure: true && samesite: strict) + + public String createNewCookie(String refreshToken) { + return ResponseCookie + .from("refreshToken", refreshToken) + .httpOnly(true) + .path("/") + .maxAge(jwtHelper.getRefreshTokenExpirationPeriod()) + .sameSite("None") + .secure(true) + .build().toString(); + } + + public String createExpiredCookie() { + return ResponseCookie + .from("refreshToken", "") + .httpOnly(true) + .path("/") + .maxAge(0L) + .sameSite("None") + .secure(true) + .build().toString(); + } +} diff --git a/api/src/main/java/writeon/api/auth/helper/JwtHelper.java b/api/src/main/java/writeon/api/auth/helper/JwtHelper.java index f69657f..a8ed9b7 100644 --- a/api/src/main/java/writeon/api/auth/helper/JwtHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/JwtHelper.java @@ -5,6 +5,7 @@ import com.auth0.jwt.algorithms.Algorithm; import com.auth0.jwt.exceptions.JWTVerificationException; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -15,6 +16,7 @@ import java.time.Instant; @Component +@Getter public class JwtHelper { private final Algorithm algorithm; private final Long accessTokenExpirationPeriod; diff --git a/api/src/main/java/writeon/api/auth/request/ReissueRequest.java b/api/src/main/java/writeon/api/auth/request/ReissueRequest.java deleted file mode 100644 index 2a8ed03..0000000 --- a/api/src/main/java/writeon/api/auth/request/ReissueRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package writeon.api.auth.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class ReissueRequest { - @NotBlank - @Schema(title = "리프래시 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") - private String refreshToken; -} diff --git a/api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java b/api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java deleted file mode 100644 index 85447a1..0000000 --- a/api/src/main/java/writeon/api/auth/response/AuthTokenResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package writeon.api.auth.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; - - -@Getter -@Setter -public class AuthTokenResponse { - @Schema(title = "액세스 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") - private final String accessToken; - - @Schema(title = "리프레시 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") - private final String refreshToken; - - public AuthTokenResponse(String accessToken, String refreshToken) { - this.accessToken = accessToken; - this.refreshToken = refreshToken; - } -} diff --git a/api/src/main/java/writeon/api/auth/response/TokenReissueResponse.java b/api/src/main/java/writeon/api/auth/response/TokenReissueResponse.java new file mode 100644 index 0000000..c51137b --- /dev/null +++ b/api/src/main/java/writeon/api/auth/response/TokenReissueResponse.java @@ -0,0 +1,16 @@ +package writeon.api.auth.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + + +@Getter +@Setter +@RequiredArgsConstructor +public class TokenReissueResponse { + @Schema(title = "액세스 토큰", requiredMode = Schema.RequiredMode.REQUIRED, example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3Mzc4Nzc1MDUsImV4cCI6MTc0NTY1MzUwNSwibWVtYmVySWQiOiJlZGMxNDJmNi1hODI4LTQ4MTQtODllOC1jZGM2NmU2ZTExMzMifQ.dEr2bidlj9lPe3ozoHFDc8e9IPxKaDdGiFQOl0HgiUM") + private final String accessToken; + +} diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index ceeb28c..0d4408d 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -8,22 +8,21 @@ import org.springframework.stereotype.Service; import writeon.api.auth.helper.JwtHelper; import writeon.api.auth.helper.MailHelper; +import writeon.api.auth.helper.MemberHelper; import writeon.api.auth.request.*; -import writeon.api.auth.response.AuthTokenResponse; import writeon.api.auth.response.LoginFailResponse; -import writeon.api.common.enums.code.ResultCodeInfo; -import writeon.api.common.enums.exception.InternalServerException; import writeon.api.common.exception.BaseException; -import writeon.api.common.util.CryptoUtil; import writeon.api.terms.request.TermsAgreeRequest; import writeon.api.terms.service.TermsQueryService; import writeon.domain.auth.*; +import writeon.domain.auth.dto.AuthTokenDto; import writeon.domain.auth.enums.AuthException; import writeon.domain.auth.enums.LoginAttemptResultType; import writeon.domain.auth.repository.ChangePasswordTokenRedisRepository; import writeon.domain.auth.repository.JoinTokenRedisRepository; import writeon.domain.auth.repository.LoginAttemptJpaRepository; import writeon.domain.auth.repository.RefreshTokenRedisRepository; +import writeon.domain.common.MemberSession; import writeon.domain.member.Member; import writeon.domain.member.MemberPassword; import writeon.domain.member.repository.MemberJpaRepository; @@ -56,25 +55,25 @@ public class AuthCommandService { * 토큰 재발급 */ @Transactional - public AuthTokenResponse reissueToken(ReissueRequest request) { + public AuthTokenDto reissueToken(String tokenString) { // 리프래시 토큰이 비유효하면 - if (!jwtHelper.isTokenValid(request.getRefreshToken())) { + if (!jwtHelper.isTokenValid(tokenString)) { throw new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID); } // 레디스 검사 - RefreshToken oldRefreshToken = refreshTokenRedisRepository.findById(request.getRefreshToken()) + RefreshToken oldRefreshToken = refreshTokenRedisRepository.findById(tokenString) .orElseThrow(() -> new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID)); this.invalidateToken(oldRefreshToken); - JwtPayload payload = jwtHelper.getPayload(request.getRefreshToken()); + JwtPayload payload = jwtHelper.getPayload(tokenString); return generateAuthTokens(payload.getMemberId()); } /** * 로그인 */ - public AuthTokenResponse login(LoginRequest request) { + public AuthTokenDto login(LoginRequest request) { Member member = memberJpaRepository.findByEmail(request.getEmail()) .orElseThrow(() -> new BaseException(AuthException.LOGIN_FAILED)); MemberPassword memberPassword = memberPasswordJpaRepository.findById(member.getId()) @@ -120,8 +119,10 @@ public AuthTokenResponse login(LoginRequest request) { * 로그아웃 */ @Transactional - public void logout(UUID memberId) { - refreshTokenRedisRepository.findByMemberId(memberId) + public void logout() { + MemberSession memberSession = MemberHelper.getMemberSession(); + + refreshTokenRedisRepository.findByMemberId(memberSession.getMemberId()) .ifPresent(this::invalidateToken); } @@ -195,7 +196,7 @@ public void join(JoinRequest request) { * 회원가입 완료 */ @Transactional - public AuthTokenResponse completeJoin(JoinCompletionRequest request) { + public void completeJoin(JoinCompletionRequest request) { final String joinTokenString = request.getJoinToken(); // 토큰이 비유효한 경우 @@ -214,8 +215,6 @@ public AuthTokenResponse completeJoin(JoinCompletionRequest request) { // 토큰 무효화 this.invalidateToken(joinToken); - - return generateAuthTokens(joinToken.getMember().getId()); } /** @@ -284,7 +283,7 @@ public void completeChangePassword(ChangePasswordCompletionRequest request) { /** * 인증 토큰 발급 (액세스 + 리프래시) */ - private AuthTokenResponse generateAuthTokens(UUID memberId) { + private AuthTokenDto generateAuthTokens(UUID memberId) { JwtPayload jwtPayload = JwtPayload.builder() .memberId(memberId) .build(); @@ -292,7 +291,7 @@ private AuthTokenResponse generateAuthTokens(UUID memberId) { String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); refreshTokenRedisRepository.save(new RefreshToken(refreshToken, memberId));; - return new AuthTokenResponse(accessToken, refreshToken); + return new AuthTokenDto(accessToken, refreshToken); } /** diff --git a/domain/src/main/java/writeon/domain/auth/dto/AuthTokenDto.java b/domain/src/main/java/writeon/domain/auth/dto/AuthTokenDto.java new file mode 100644 index 0000000..2734bb6 --- /dev/null +++ b/domain/src/main/java/writeon/domain/auth/dto/AuthTokenDto.java @@ -0,0 +1,13 @@ +package writeon.domain.auth.dto; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@RequiredArgsConstructor +public class AuthTokenDto { + private final String accessToken; + private final String refreshToken; +} From b7815618965b440d3371fdb98b5c1f41402f7ddc Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 31 Mar 2025 20:55:57 +0900 Subject: [PATCH 061/107] =?UTF-8?q?fix:=20cors=20allowlist=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index cdfc193..0617ea9 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit cdfc19302bdbb7cab7cee8e23a5603e85912f97e +Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 From 5b3a4b481afaf7632e030e43af4957abcfd12b75 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 31 Mar 2025 21:12:01 +0900 Subject: [PATCH 062/107] =?UTF-8?q?fix:=20logout=20security=20config=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD=20(#61)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/main/java/writeon/api/common/config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/writeon/api/common/config/SecurityConfig.java b/api/src/main/java/writeon/api/common/config/SecurityConfig.java index b31a7a4..15736dc 100644 --- a/api/src/main/java/writeon/api/common/config/SecurityConfig.java +++ b/api/src/main/java/writeon/api/common/config/SecurityConfig.java @@ -43,8 +43,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .authorizeHttpRequests(auth -> auth .requestMatchers("/swagger-ui/**", "/doc/**", "/v3/api-docs/**").permitAll() .requestMatchers("/health-check/**").permitAll() - .requestMatchers("/auth/**").permitAll() .requestMatchers("/auth/logout").authenticated() + .requestMatchers("/auth/**").permitAll() .requestMatchers("/terms/**").permitAll() .requestMatchers(AntPathRequestMatcher.antMatcher("/assistant/**/stream")).permitAll() .anyRequest().authenticated() From 32b7106f4ea65a024d98726222e7ba6a5025d879 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Tue, 1 Apr 2025 20:54:10 +0900 Subject: [PATCH 063/107] =?UTF-8?q?fix:=20=ED=95=84=EC=88=98=20=EC=95=BD?= =?UTF-8?q?=EA=B4=80=20=EB=8F=99=EC=9D=98=20=EC=B6=94=EA=B0=80=20(#62)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/terms/controller/TermsController.java | 78 +- domain/src/main/generated/writeon/Public.java | 45 + .../src/main/generated/writeon/Routines.java | 1704 +++++++++++++++++ domain/src/main/generated/writeon/Tables.java | 45 + .../generated/writeon/routines/Armor1.java | 60 + .../generated/writeon/routines/Armor2.java | 104 + .../generated/writeon/routines/Crypt.java | 81 + .../generated/writeon/routines/Dearmor.java | 59 + .../generated/writeon/routines/Decrypt.java | 103 + .../generated/writeon/routines/DecryptIv.java | 125 ++ .../generated/writeon/routines/Digest1.java | 82 + .../generated/writeon/routines/Digest2.java | 82 + .../generated/writeon/routines/Encrypt.java | 103 + .../generated/writeon/routines/EncryptIv.java | 125 ++ .../writeon/routines/GenRandomBytes.java | 59 + .../writeon/routines/GenRandomUuid.java | 38 + .../generated/writeon/routines/GenSalt1.java | 60 + .../generated/writeon/routines/GenSalt2.java | 82 + .../generated/writeon/routines/Hmac1.java | 104 + .../generated/writeon/routines/Hmac2.java | 104 + .../generated/writeon/routines/PgpKeyId.java | 59 + .../writeon/routines/PgpPubDecrypt1.java | 82 + .../writeon/routines/PgpPubDecrypt2.java | 104 + .../writeon/routines/PgpPubDecrypt3.java | 126 ++ .../writeon/routines/PgpPubDecryptBytea1.java | 82 + .../writeon/routines/PgpPubDecryptBytea2.java | 104 + .../writeon/routines/PgpPubDecryptBytea3.java | 126 ++ .../writeon/routines/PgpPubEncrypt1.java | 82 + .../writeon/routines/PgpPubEncrypt2.java | 104 + .../writeon/routines/PgpPubEncryptBytea1.java | 82 + .../writeon/routines/PgpPubEncryptBytea2.java | 104 + .../writeon/routines/PgpSymDecrypt1.java | 82 + .../writeon/routines/PgpSymDecrypt2.java | 104 + .../writeon/routines/PgpSymDecryptBytea1.java | 82 + .../writeon/routines/PgpSymDecryptBytea2.java | 104 + .../writeon/routines/PgpSymEncrypt1.java | 82 + .../writeon/routines/PgpSymEncrypt2.java | 104 + .../writeon/routines/PgpSymEncryptBytea1.java | 82 + .../writeon/routines/PgpSymEncryptBytea2.java | 104 + .../generated/writeon/tables/Assistant.java | 9 +- .../writeon/tables/PgpArmorHeaders.java | 157 ++ .../writeon/tables/pojos/Assistant.java | 23 +- .../writeon/tables/pojos/PgpArmorHeaders.java | 91 + .../tables/records/AssistantRecord.java | 23 +- .../tables/records/PgpArmorHeadersRecord.java | 84 + .../writeon/domain/terms/enums/TermsCode.java | 3 +- 46 files changed, 5384 insertions(+), 48 deletions(-) create mode 100644 domain/src/main/generated/writeon/Routines.java create mode 100644 domain/src/main/generated/writeon/routines/Armor1.java create mode 100644 domain/src/main/generated/writeon/routines/Armor2.java create mode 100644 domain/src/main/generated/writeon/routines/Crypt.java create mode 100644 domain/src/main/generated/writeon/routines/Dearmor.java create mode 100644 domain/src/main/generated/writeon/routines/Decrypt.java create mode 100644 domain/src/main/generated/writeon/routines/DecryptIv.java create mode 100644 domain/src/main/generated/writeon/routines/Digest1.java create mode 100644 domain/src/main/generated/writeon/routines/Digest2.java create mode 100644 domain/src/main/generated/writeon/routines/Encrypt.java create mode 100644 domain/src/main/generated/writeon/routines/EncryptIv.java create mode 100644 domain/src/main/generated/writeon/routines/GenRandomBytes.java create mode 100644 domain/src/main/generated/writeon/routines/GenRandomUuid.java create mode 100644 domain/src/main/generated/writeon/routines/GenSalt1.java create mode 100644 domain/src/main/generated/writeon/routines/GenSalt2.java create mode 100644 domain/src/main/generated/writeon/routines/Hmac1.java create mode 100644 domain/src/main/generated/writeon/routines/Hmac2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpKeyId.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecrypt1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecrypt2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecrypt3.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecryptBytea1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecryptBytea2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubDecryptBytea3.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubEncrypt1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubEncrypt2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubEncryptBytea1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpPubEncryptBytea2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymDecrypt1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymDecrypt2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymDecryptBytea1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymDecryptBytea2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymEncrypt1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymEncrypt2.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymEncryptBytea1.java create mode 100644 domain/src/main/generated/writeon/routines/PgpSymEncryptBytea2.java create mode 100644 domain/src/main/generated/writeon/tables/PgpArmorHeaders.java create mode 100644 domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java create mode 100644 domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java diff --git a/api/src/main/java/writeon/api/terms/controller/TermsController.java b/api/src/main/java/writeon/api/terms/controller/TermsController.java index 1e31da0..25e905d 100644 --- a/api/src/main/java/writeon/api/terms/controller/TermsController.java +++ b/api/src/main/java/writeon/api/terms/controller/TermsController.java @@ -1,40 +1,38 @@ -package writeon.api.terms.controller; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import writeon.api.terms.response.TermsDetailResponse; -import writeon.api.terms.response.TermsSummaryResponse; -import writeon.api.terms.service.TermsQueryService; -import writeon.domain.terms.enums.TermsCode; - -import java.util.List; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/terms") -@Tag(name = "약관") -@Slf4j -public class TermsController { - private final TermsQueryService termsQueryService; - - @Operation(summary = "약관 상세 조회") - @GetMapping("/{termsCd}") - public TermsDetailResponse getTermsByTermsCd(@PathVariable TermsCode termsCd) { - - return termsQueryService.getTermsByTermsCd(termsCd); - } - - @Operation(summary = "약관 목록 조회") - @GetMapping("/") - public List getTermsList() { - - return termsQueryService.getAllTermsList(); - } - -} +//package writeon.api.terms.controller; +// +//import io.swagger.v3.oas.annotations.Operation; +//import io.swagger.v3.oas.annotations.tags.Tag; +//import lombok.RequiredArgsConstructor; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.PathVariable; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +//import writeon.api.terms.response.TermsDetailResponse; +//import writeon.api.terms.response.TermsSummaryResponse; +//import writeon.api.terms.service.TermsQueryService; +//import writeon.domain.terms.enums.TermsCode; +// +//import java.util.List; +// +//@RestController +//@RequiredArgsConstructor +//@RequestMapping("/terms") +//@Tag(name = "약관") +//public class TermsController { +// private final TermsQueryService termsQueryService; +// +// @Operation(summary = "약관 상세 조회") +// @GetMapping("/{termsCd}") +// public TermsDetailResponse getTermsByTermsCd(@PathVariable TermsCode termsCd) { +// +// return termsQueryService.getTermsByTermsCd(termsCd); +// } +// +// @Operation(summary = "약관 목록 조회") +// @GetMapping("/") +// public List getTermsList() { +// +// return termsQueryService.getAllTermsList(); +// } +// +//} diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index 066129e..3dc91c3 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -8,6 +8,9 @@ import java.util.List; import org.jooq.Catalog; +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; import org.jooq.Table; import org.jooq.impl.SchemaImpl; @@ -17,6 +20,7 @@ import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; +import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -27,6 +31,7 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; +import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -72,6 +77,45 @@ public class Public extends SchemaImpl { */ public final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + /** + * The table public.pgp_armor_headers. + */ + public final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + /** * 작품 */ @@ -144,6 +188,7 @@ public final List> getTables() { LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, + PgpArmorHeaders.PGP_ARMOR_HEADERS, Product.PRODUCT, ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, diff --git a/domain/src/main/generated/writeon/Routines.java b/domain/src/main/generated/writeon/Routines.java new file mode 100644 index 0000000..370498c --- /dev/null +++ b/domain/src/main/generated/writeon/Routines.java @@ -0,0 +1,1704 @@ +/* + * This file is generated by jOOQ. + */ +package writeon; + + +import java.util.UUID; + +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + +import writeon.routines.Armor1; +import writeon.routines.Armor2; +import writeon.routines.Crypt; +import writeon.routines.Dearmor; +import writeon.routines.Decrypt; +import writeon.routines.DecryptIv; +import writeon.routines.Digest1; +import writeon.routines.Digest2; +import writeon.routines.Encrypt; +import writeon.routines.EncryptIv; +import writeon.routines.GenRandomBytes; +import writeon.routines.GenRandomUuid; +import writeon.routines.GenSalt1; +import writeon.routines.GenSalt2; +import writeon.routines.Hmac1; +import writeon.routines.Hmac2; +import writeon.routines.PgpKeyId; +import writeon.routines.PgpPubDecrypt1; +import writeon.routines.PgpPubDecrypt2; +import writeon.routines.PgpPubDecrypt3; +import writeon.routines.PgpPubDecryptBytea1; +import writeon.routines.PgpPubDecryptBytea2; +import writeon.routines.PgpPubDecryptBytea3; +import writeon.routines.PgpPubEncrypt1; +import writeon.routines.PgpPubEncrypt2; +import writeon.routines.PgpPubEncryptBytea1; +import writeon.routines.PgpPubEncryptBytea2; +import writeon.routines.PgpSymDecrypt1; +import writeon.routines.PgpSymDecrypt2; +import writeon.routines.PgpSymDecryptBytea1; +import writeon.routines.PgpSymDecryptBytea2; +import writeon.routines.PgpSymEncrypt1; +import writeon.routines.PgpSymEncrypt2; +import writeon.routines.PgpSymEncryptBytea1; +import writeon.routines.PgpSymEncryptBytea2; +import writeon.tables.PgpArmorHeaders; +import writeon.tables.records.PgpArmorHeadersRecord; + + +/** + * Convenience access to all stored procedures and functions in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Routines { + + /** + * Call public.armor + */ + public static String armor1( + Configuration configuration + , byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + Field __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.armor + */ + public static String armor2( + Configuration configuration + , byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + Field __1 + , Field __2 + , Field __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.crypt + */ + public static String crypt( + Configuration configuration + , String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + Field __1 + , Field __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.dearmor + */ + public static byte[] dearmor( + Configuration configuration + , String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + Field __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.decrypt + */ + public static byte[] decrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.decrypt_iv + */ + public static byte[] decryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest1( + Configuration configuration + , String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + Field __1 + , Field __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest2( + Configuration configuration + , byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + Field __1 + , Field __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.encrypt + */ + public static byte[] encrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.encrypt_iv + */ + public static byte[] encryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.gen_random_bytes + */ + public static byte[] genRandomBytes( + Configuration configuration + , Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Field __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_random_uuid + */ + public static UUID genRandomUuid( + Configuration configuration + ) { + GenRandomUuid f = new GenRandomUuid(); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_uuid as a field. + */ + public static Field genRandomUuid() { + GenRandomUuid f = new GenRandomUuid(); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt1( + Configuration configuration + , String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + Field __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt2( + Configuration configuration + , String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + Field __1 + , Field __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac1( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_key_id + */ + public static String pgpKeyId( + Configuration configuration + , byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + Field __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + Field __1 + , Field __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt1( + Configuration configuration + , String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + Field __1 + , Field __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt2( + Configuration configuration + , String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + Field __1 + , Field __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt1( + Configuration configuration + , String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + Field __1 + , Field __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt2( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_armor_headers. + */ + public static Result pgpArmorHeaders( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } +} diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index f2bf187..8e5a794 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -4,12 +4,17 @@ package writeon; +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; +import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -20,6 +25,7 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; +import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -58,6 +64,45 @@ public class Tables { */ public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + /** + * The table public.pgp_armor_headers. + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + /** * 작품 */ diff --git a/domain/src/main/generated/writeon/routines/Armor1.java b/domain/src/main/generated/writeon/routines/Armor1.java new file mode 100644 index 0000000..af54806 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Armor1.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Armor1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.armor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.armor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public Armor1() { + super("armor", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor1 set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Armor2.java b/domain/src/main/generated/writeon/routines/Armor2.java new file mode 100644 index 0000000..fad96a5 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Armor2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Armor2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.armor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.armor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.armor._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB.array(), false, true); + + /** + * The parameter public.armor._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB.array(), false, true); + + /** + * Create a new routine call instance + */ + public Armor2() { + super("armor", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Armor2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Crypt.java b/domain/src/main/generated/writeon/routines/Crypt.java new file mode 100644 index 0000000..b14c383 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Crypt.java @@ -0,0 +1,81 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Crypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.crypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.crypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.crypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Crypt() { + super("crypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Crypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Crypt set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Dearmor.java b/domain/src/main/generated/writeon/routines/Dearmor.java new file mode 100644 index 0000000..bbda253 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Dearmor.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Dearmor extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.dearmor.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.dearmor._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Dearmor() { + super("dearmor", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Dearmor set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Decrypt.java b/domain/src/main/generated/writeon/routines/Decrypt.java new file mode 100644 index 0000000..7942c1f --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Decrypt.java @@ -0,0 +1,103 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Decrypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Decrypt() { + super("decrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Decrypt set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/DecryptIv.java b/domain/src/main/generated/writeon/routines/DecryptIv.java new file mode 100644 index 0000000..4f12930 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/DecryptIv.java @@ -0,0 +1,125 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class DecryptIv extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.decrypt_iv.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.decrypt_iv._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); + + /** + * The parameter public.decrypt_iv._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public DecryptIv() { + super("decrypt_iv", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(byte[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public DecryptIv set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Digest1.java b/domain/src/main/generated/writeon/routines/Digest1.java new file mode 100644 index 0000000..fce3a49 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Digest1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Digest1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.digest.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.digest._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.digest._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Digest1() { + super("digest", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Digest2.java b/domain/src/main/generated/writeon/routines/Digest2.java new file mode 100644 index 0000000..fdb0de4 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Digest2.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Digest2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.digest.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.digest._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.digest._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Digest2() { + super("digest", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Digest2 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Encrypt.java b/domain/src/main/generated/writeon/routines/Encrypt.java new file mode 100644 index 0000000..a395888 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Encrypt.java @@ -0,0 +1,103 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Encrypt extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Encrypt() { + super("encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Encrypt set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/EncryptIv.java b/domain/src/main/generated/writeon/routines/EncryptIv.java new file mode 100644 index 0000000..52cf33f --- /dev/null +++ b/domain/src/main/generated/writeon/routines/EncryptIv.java @@ -0,0 +1,125 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class EncryptIv extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.encrypt_iv.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.encrypt_iv._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.BLOB, false, true); + + /** + * The parameter public.encrypt_iv._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public EncryptIv() { + super("encrypt_iv", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(byte[] value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public EncryptIv set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/GenRandomBytes.java b/domain/src/main/generated/writeon/routines/GenRandomBytes.java new file mode 100644 index 0000000..db9124b --- /dev/null +++ b/domain/src/main/generated/writeon/routines/GenRandomBytes.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenRandomBytes extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_random_bytes.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.gen_random_bytes._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.INTEGER, false, true); + + /** + * Create a new routine call instance + */ + public GenRandomBytes() { + super("gen_random_bytes", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(Integer value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenRandomBytes set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/GenRandomUuid.java b/domain/src/main/generated/writeon/routines/GenRandomUuid.java new file mode 100644 index 0000000..a64820c --- /dev/null +++ b/domain/src/main/generated/writeon/routines/GenRandomUuid.java @@ -0,0 +1,38 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import java.util.UUID; + +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenRandomUuid extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_random_uuid.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.UUID, false, false); + + /** + * Create a new routine call instance + */ + public GenRandomUuid() { + super("gen_random_uuid", Public.PUBLIC, SQLDataType.UUID); + + setReturnParameter(RETURN_VALUE); + } +} diff --git a/domain/src/main/generated/writeon/routines/GenSalt1.java b/domain/src/main/generated/writeon/routines/GenSalt1.java new file mode 100644 index 0000000..e07dad7 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/GenSalt1.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenSalt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_salt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.gen_salt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public GenSalt1() { + super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt1 set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/GenSalt2.java b/domain/src/main/generated/writeon/routines/GenSalt2.java new file mode 100644 index 0000000..b550f32 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/GenSalt2.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class GenSalt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.gen_salt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.gen_salt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.gen_salt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.INTEGER, false, true); + + /** + * Create a new routine call instance + */ + public GenSalt2() { + super("gen_salt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(Integer value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public GenSalt2 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Hmac1.java b/domain/src/main/generated/writeon/routines/Hmac1.java new file mode 100644 index 0000000..cebb728 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Hmac1.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Hmac1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.hmac.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.hmac._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.hmac._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.hmac._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Hmac1() { + super("hmac", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac1 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/Hmac2.java b/domain/src/main/generated/writeon/routines/Hmac2.java new file mode 100644 index 0000000..843f386 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/Hmac2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Hmac2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.hmac.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.hmac._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.hmac._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.hmac._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public Hmac2() { + super("hmac", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public Hmac2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpKeyId.java b/domain/src/main/generated/writeon/routines/PgpKeyId.java new file mode 100644 index 0000000..d865377 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpKeyId.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpKeyId extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_key_id.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_key_id._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpKeyId() { + super("pgp_key_id", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpKeyId set__1(Field field) { + setField(_1, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecrypt1.java b/domain/src/main/generated/writeon/routines/PgpPubDecrypt1.java new file mode 100644 index 0000000..101b74d --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt1() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecrypt2.java b/domain/src/main/generated/writeon/routines/PgpPubDecrypt2.java new file mode 100644 index 0000000..239c899 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt2() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecrypt3.java b/domain/src/main/generated/writeon/routines/PgpPubDecrypt3.java new file mode 100644 index 0000000..ae09813 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecrypt3.java @@ -0,0 +1,126 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecrypt3 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecrypt3() { + super("pgp_pub_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecrypt3 set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea1.java b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea1.java new file mode 100644 index 0000000..3fe111b --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea1() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea2.java b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea2.java new file mode 100644 index 0000000..4a8e919 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea2() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea3.java b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea3.java new file mode 100644 index 0000000..671282d --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubDecryptBytea3.java @@ -0,0 +1,126 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubDecryptBytea3 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_decrypt_bytea._4. + */ + public static final Parameter _4 = Internal.createParameter("_4", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubDecryptBytea3() { + super("pgp_pub_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + addInParameter(_4); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__3(Field field) { + setField(_3, field); + return this; + } + + /** + * Set the _4 parameter IN value to the routine + */ + public void set__4(String value) { + setValue(_4, value); + } + + /** + * Set the _4 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubDecryptBytea3 set__4(Field field) { + setField(_4, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubEncrypt1.java b/domain/src/main/generated/writeon/routines/PgpPubEncrypt1.java new file mode 100644 index 0000000..102680d --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubEncrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncrypt1() { + super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubEncrypt2.java b/domain/src/main/generated/writeon/routines/PgpPubEncrypt2.java new file mode 100644 index 0000000..daf42ac --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubEncrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncrypt2() { + super("pgp_pub_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea1.java b/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea1.java new file mode 100644 index 0000000..41f9da9 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncryptBytea1() { + super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea2.java b/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea2.java new file mode 100644 index 0000000..4248f15 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpPubEncryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpPubEncryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_pub_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_pub_encrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpPubEncryptBytea2() { + super("pgp_pub_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(byte[] value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpPubEncryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymDecrypt1.java b/domain/src/main/generated/writeon/routines/PgpSymDecrypt1.java new file mode 100644 index 0000000..303ceae --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymDecrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecrypt1() { + super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymDecrypt2.java b/domain/src/main/generated/writeon/routines/PgpSymDecrypt2.java new file mode 100644 index 0000000..35b2633 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymDecrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecrypt2() { + super("pgp_sym_decrypt", Public.PUBLIC, SQLDataType.CLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea1.java b/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea1.java new file mode 100644 index 0000000..5febb59 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecryptBytea1() { + super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea2.java b/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea2.java new file mode 100644 index 0000000..a8da504 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymDecryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymDecryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_decrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_decrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymDecryptBytea2() { + super("pgp_sym_decrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymDecryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymEncrypt1.java b/domain/src/main/generated/writeon/routines/PgpSymEncrypt1.java new file mode 100644 index 0000000..53c6df5 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymEncrypt1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncrypt1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncrypt1() { + super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymEncrypt2.java b/domain/src/main/generated/writeon/routines/PgpSymEncrypt2.java new file mode 100644 index 0000000..883c799 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymEncrypt2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncrypt2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncrypt2() { + super("pgp_sym_encrypt", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(String value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncrypt2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea1.java b/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea1.java new file mode 100644 index 0000000..d885f0b --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea1.java @@ -0,0 +1,82 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncryptBytea1 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncryptBytea1() { + super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea1 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea1 set__2(Field field) { + setField(_2, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea2.java b/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea2.java new file mode 100644 index 0000000..5cdeca7 --- /dev/null +++ b/domain/src/main/generated/writeon/routines/PgpSymEncryptBytea2.java @@ -0,0 +1,104 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.routines; + + +import org.jooq.Field; +import org.jooq.Parameter; +import org.jooq.impl.AbstractRoutine; +import org.jooq.impl.Internal; +import org.jooq.impl.SQLDataType; + +import writeon.Public; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpSymEncryptBytea2 extends AbstractRoutine { + + private static final long serialVersionUID = 1L; + + /** + * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. + */ + public static final Parameter RETURN_VALUE = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false); + + /** + * The parameter public.pgp_sym_encrypt_bytea._1. + */ + public static final Parameter _1 = Internal.createParameter("_1", SQLDataType.BLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._2. + */ + public static final Parameter _2 = Internal.createParameter("_2", SQLDataType.CLOB, false, true); + + /** + * The parameter public.pgp_sym_encrypt_bytea._3. + */ + public static final Parameter _3 = Internal.createParameter("_3", SQLDataType.CLOB, false, true); + + /** + * Create a new routine call instance + */ + public PgpSymEncryptBytea2() { + super("pgp_sym_encrypt_bytea", Public.PUBLIC, SQLDataType.BLOB); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + addInParameter(_2); + addInParameter(_3); + setOverloaded(true); + } + + /** + * Set the _1 parameter IN value to the routine + */ + public void set__1(byte[] value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__1(Field field) { + setField(_1, field); + return this; + } + + /** + * Set the _2 parameter IN value to the routine + */ + public void set__2(String value) { + setValue(_2, value); + } + + /** + * Set the _2 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__2(Field field) { + setField(_2, field); + return this; + } + + /** + * Set the _3 parameter IN value to the routine + */ + public void set__3(String value) { + setValue(_3, value); + } + + /** + * Set the _3 parameter to the function to be used with a + * {@link org.jooq.Select} statement + */ + public PgpSymEncryptBytea2 set__3(Field field) { + setField(_3, field); + return this; + } +} diff --git a/domain/src/main/generated/writeon/tables/Assistant.java b/domain/src/main/generated/writeon/tables/Assistant.java index dc993d0..31f7fdd 100644 --- a/domain/src/main/generated/writeon/tables/Assistant.java +++ b/domain/src/main/generated/writeon/tables/Assistant.java @@ -77,15 +77,20 @@ public Class getRecordType() { public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); /** - * The column public.assistant.created_by. 생성자 ID + * The column public.assistant.created_by. 수정자 ID */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); /** * The column public.assistant.updated_at. */ public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + /** + * The column public.assistant.updated_by. + */ + public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); + private Assistant(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } diff --git a/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java new file mode 100644 index 0000000..d99e0bb --- /dev/null +++ b/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java @@ -0,0 +1,157 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Public; +import writeon.tables.records.PgpArmorHeadersRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.pgp_armor_headers + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = new PgpArmorHeaders(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return PgpArmorHeadersRecord.class; + } + + /** + * The column public.pgp_armor_headers.key. + */ + public final TableField KEY = createField(DSL.name("key"), SQLDataType.CLOB, this, ""); + + /** + * The column public.pgp_armor_headers.value. + */ + public final TableField VALUE = createField(DSL.name("value"), SQLDataType.CLOB, this, ""); + + private PgpArmorHeaders(Name alias, Table aliased) { + this(alias, aliased, new Field[] { + DSL.val(null, SQLDataType.CLOB) + }); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters) { + this(alias, aliased, parameters, null); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.function(), where); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(String alias) { + this(DSL.name(alias), PGP_ARMOR_HEADERS); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(Name alias) { + this(alias, PGP_ARMOR_HEADERS); + } + + /** + * Create a public.pgp_armor_headers table reference + */ + public PgpArmorHeaders() { + this(DSL.name("pgp_armor_headers"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public PgpArmorHeaders as(String alias) { + return new PgpArmorHeaders(DSL.name(alias), this, parameters); + } + + @Override + public PgpArmorHeaders as(Name alias) { + return new PgpArmorHeaders(alias, this, parameters); + } + + @Override + public PgpArmorHeaders as(Table alias) { + return new PgpArmorHeaders(alias.getQualifiedName(), this, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(String name) { + return new PgpArmorHeaders(DSL.name(name), null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Name name) { + return new PgpArmorHeaders(name, null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Table name) { + return new PgpArmorHeaders(name.getQualifiedName(), null, parameters); + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + String __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + DSL.val(__1, SQLDataType.CLOB) + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + Field __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + __1 + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } +} diff --git a/domain/src/main/generated/writeon/tables/pojos/Assistant.java b/domain/src/main/generated/writeon/tables/pojos/Assistant.java index 8abcfd4..3bab716 100644 --- a/domain/src/main/generated/writeon/tables/pojos/Assistant.java +++ b/domain/src/main/generated/writeon/tables/pojos/Assistant.java @@ -24,6 +24,7 @@ public class Assistant implements Serializable { private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; + private final UUID updatedBy; public Assistant(Assistant value) { this.id = value.id; @@ -33,6 +34,7 @@ public Assistant(Assistant value) { this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; + this.updatedBy = value.updatedBy; } public Assistant( @@ -42,7 +44,8 @@ public Assistant( String status, LocalDateTime createdAt, UUID createdBy, - LocalDateTime updatedAt + LocalDateTime updatedAt, + UUID updatedBy ) { this.id = id; this.productId = productId; @@ -51,6 +54,7 @@ public Assistant( this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; + this.updatedBy = updatedBy; } /** @@ -89,7 +93,7 @@ public LocalDateTime getCreatedAt() { } /** - * Getter for public.assistant.created_by. 생성자 ID + * Getter for public.assistant.created_by. 수정자 ID */ public UUID getCreatedBy() { return this.createdBy; @@ -102,6 +106,13 @@ public LocalDateTime getUpdatedAt() { return this.updatedAt; } + /** + * Getter for public.assistant.updated_by. + */ + public UUID getUpdatedBy() { + return this.updatedBy; + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -153,6 +164,12 @@ else if (!this.createdBy.equals(other.createdBy)) } else if (!this.updatedAt.equals(other.updatedAt)) return false; + if (this.updatedBy == null) { + if (other.updatedBy != null) + return false; + } + else if (!this.updatedBy.equals(other.updatedBy)) + return false; return true; } @@ -167,6 +184,7 @@ public int hashCode() { result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); + result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); return result; } @@ -181,6 +199,7 @@ public String toString() { sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); + sb.append(", ").append(updatedBy); sb.append(")"); return sb.toString(); diff --git a/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java new file mode 100644 index 0000000..feaccdf --- /dev/null +++ b/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java @@ -0,0 +1,91 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String key; + private final String value; + + public PgpArmorHeaders(PgpArmorHeaders value) { + this.key = value.key; + this.value = value.value; + } + + public PgpArmorHeaders( + String key, + String value + ) { + this.key = key; + this.value = value; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return this.key; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return this.value; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final PgpArmorHeaders other = (PgpArmorHeaders) obj; + if (this.key == null) { + if (other.key != null) + return false; + } + else if (!this.key.equals(other.key)) + return false; + if (this.value == null) { + if (other.value != null) + return false; + } + else if (!this.value.equals(other.value)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); + result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PgpArmorHeaders ("); + + sb.append(key); + sb.append(", ").append(value); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java index fbf8a2e..c9ce9be 100644 --- a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java +++ b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java @@ -97,7 +97,7 @@ public LocalDateTime getCreatedAt() { } /** - * Setter for public.assistant.created_by. 생성자 ID + * Setter for public.assistant.created_by. 수정자 ID */ public AssistantRecord setCreatedBy(UUID value) { set(5, value); @@ -105,7 +105,7 @@ public AssistantRecord setCreatedBy(UUID value) { } /** - * Getter for public.assistant.created_by. 생성자 ID + * Getter for public.assistant.created_by. 수정자 ID */ public UUID getCreatedBy() { return (UUID) get(5); @@ -126,6 +126,21 @@ public LocalDateTime getUpdatedAt() { return (LocalDateTime) get(6); } + /** + * Setter for public.assistant.updated_by. + */ + public AssistantRecord setUpdatedBy(UUID value) { + set(7, value); + return this; + } + + /** + * Getter for public.assistant.updated_by. + */ + public UUID getUpdatedBy() { + return (UUID) get(7); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -149,7 +164,7 @@ public AssistantRecord() { /** * Create a detached, initialised AssistantRecord */ - public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt) { + public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(Assistant.ASSISTANT); setId(id); @@ -159,6 +174,7 @@ public AssistantRecord(UUID id, UUID productId, String type, String status, Loca setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); + setUpdatedBy(updatedBy); resetChangedOnNotNull(); } @@ -176,6 +192,7 @@ public AssistantRecord(writeon.tables.pojos.Assistant value) { setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); + setUpdatedBy(value.getUpdatedBy()); resetChangedOnNotNull(); } } diff --git a/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java b/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java new file mode 100644 index 0000000..8e9c402 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java @@ -0,0 +1,84 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import org.jooq.impl.TableRecordImpl; + +import writeon.tables.PgpArmorHeaders; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeadersRecord extends TableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.pgp_armor_headers.key. + */ + public PgpArmorHeadersRecord setKey(String value) { + set(0, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return (String) get(0); + } + + /** + * Setter for public.pgp_armor_headers.value. + */ + public PgpArmorHeadersRecord setValue(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return (String) get(1); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord() { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(String key, String value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + setKey(key); + setValue(value); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(writeon.tables.pojos.PgpArmorHeaders value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + if (value != null) { + setKey(value.getKey()); + setValue(value.getValue()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java b/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java index c997e0b..464127e 100644 --- a/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java +++ b/domain/src/main/java/writeon/domain/terms/enums/TermsCode.java @@ -14,7 +14,8 @@ @Slf4j public enum TermsCode implements Codable { PRIVACY_POLICY("1001"), - MARKETING_AGREEMENT("1002"); + MARKETING_AGREEMENT("1002"), + TERMS_OF_USE("1003"); private final String code; From e219f54a467d0c9be5206c335a033e06d8e6dc1c Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 2 Apr 2025 00:53:09 +0900 Subject: [PATCH 064/107] feat: Add product favorite prompt APIs (#63) --- .../assistant/repository/AssistantDao.java | 49 ++-- .../response/AssistantHistoryResponse.java | 39 ++- .../product/controller/ProductController.java | 25 ++ .../ProductFavoritePromptCreateRequest.java | 13 + .../ProductFavoritePromptResponse.java | 22 ++ .../service/ProductCommandService.java | 15 ++ .../product/service/ProductQueryService.java | 15 +- domain/src/main/generated/writeon/Keys.java | 6 +- domain/src/main/generated/writeon/Public.java | 9 +- domain/src/main/generated/writeon/Tables.java | 8 +- .../writeon/tables/LoginAttempt.java | 27 +- .../main/generated/writeon/tables/Member.java | 2 +- .../writeon/tables/ProductFavoritePrompt.java | 237 ++++++++++++++++++ .../generated/writeon/tables/ProductMemo.java | 9 +- .../writeon/tables/pojos/LoginAttempt.java | 8 +- .../tables/pojos/ProductFavoritePrompt.java | 131 ++++++++++ .../writeon/tables/pojos/ProductMemo.java | 21 +- .../tables/records/LoginAttemptRecord.java | 28 +-- .../records/ProductFavoritePromptRecord.java | 131 ++++++++++ .../tables/records/ProductMemoRecord.java | 59 ++--- .../java/writeon/domain/product/Product.java | 3 + .../domain/product/ProductFavoritePrompt.java | 43 ++++ sql/init.sql | 13 + 23 files changed, 761 insertions(+), 152 deletions(-) create mode 100644 api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java create mode 100644 api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java create mode 100644 domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java create mode 100644 domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java create mode 100644 domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java create mode 100644 domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index dd0b915..14edc36 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -1,21 +1,20 @@ package writeon.api.assistant.repository; +import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.jooq.Record; import org.jooq.Result; import org.springframework.stereotype.Repository; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantRecord; import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.UUID; -import lombok.RequiredArgsConstructor; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.tables.records.AssistantMessageRecord; -import writeon.tables.records.AssistantRecord; - import static writeon.tables.Assistant.ASSISTANT; import static writeon.tables.AssistantMessage.ASSISTANT_MESSAGE; @@ -23,31 +22,27 @@ @RequiredArgsConstructor public class AssistantDao { - private final DSLContext dsl; + private final DSLContext dsl; - public List selectHistories(UUID productId) { - Map> groupedResults = dsl - .select(ASSISTANT.asterisk(), ASSISTANT_MESSAGE.asterisk()) - .from(ASSISTANT) - .join(ASSISTANT_MESSAGE) - .on(ASSISTANT.ID.eq(ASSISTANT_MESSAGE.ASSISTANT_ID)) - .where(ASSISTANT.PRODUCT_ID.eq(productId)) - .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) - .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) - .orderBy(ASSISTANT.CREATED_AT.desc()) - .fetchGroups(ASSISTANT.ID); + public List selectHistories(UUID productId) { + Map> groupedResults = dsl + .select(ASSISTANT.asterisk(), ASSISTANT_MESSAGE.asterisk()) + .from(ASSISTANT) + .join(ASSISTANT_MESSAGE) + .on(ASSISTANT.ID.eq(ASSISTANT_MESSAGE.ASSISTANT_ID)) + .where(ASSISTANT.PRODUCT_ID.eq(productId)) + .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) + .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) + .orderBy(ASSISTANT.CREATED_AT.desc()) + .fetchGroups(ASSISTANT.ID); return groupedResults.values().stream() .map(records -> { - AssistantRecord assistant = records.getFirst().into(AssistantRecord.class); - List messages = records.stream() - .map(record -> { - AssistantMessageRecord message = record.into(AssistantMessageRecord.class); - return new AssistantHistoryResponse.MessageHistory(message.getRole(), message.getContent()); - }) - .toList(); - return new AssistantHistoryResponse(assistant, messages); + AssistantRecord assistant = records.getFirst().into(AssistantRecord.class); + AssistantMessageRecord memberMessage = records.get(0).into(AssistantMessageRecord.class); + AssistantMessageRecord assistantMessage = records.get(1).into(AssistantMessageRecord.class); + return new AssistantHistoryResponse(assistant, memberMessage, assistantMessage); }) .toList(); - } + } } diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java index 625865f..ff209e7 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -1,38 +1,51 @@ package writeon.api.assistant.response; -import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; +import writeon.tables.records.AssistantMessageRecord; import writeon.tables.records.AssistantRecord; +import java.time.LocalDateTime; +import java.util.UUID; + @Getter public class AssistantHistoryResponse { private final UUID id; private final String type; - private final List messages; + private final MemberMessage memberMessage; + private final AssistantMessage assistantMessage; private final LocalDateTime createdAt; - public AssistantHistoryResponse(AssistantRecord assistant, List messages) { + public AssistantHistoryResponse(AssistantRecord assistant, AssistantMessageRecord memberMessage, AssistantMessageRecord assistantMessage) { this.id = assistant.getId(); this.type = assistant.getType(); - this.messages = messages; + this.memberMessage = new MemberMessage(memberMessage.getContent(), memberMessage.getPrompt()); + this.assistantMessage = new AssistantMessage(assistantMessage.getContent()); this.createdAt = assistant.getCreatedAt(); } @Getter - public static class MessageHistory { + public static class MemberMessage { + + @Schema(title = "사용자가 선택한 구간") + private final String content; + @Schema(title = "사용자가 입력한 프롬프트") + private final String prompt; + + public MemberMessage(String content, String prompt) { + this.content = content; + this.prompt = prompt; + } + } + + @Getter + public static class AssistantMessage { - @Schema(title = "메세지 송신 역할") - private final String role; - @Schema(title = "사용자가 선택한 구간 / Assistant 답변") + @Schema(title = "Assistant 답변") private final String content; - public MessageHistory(String role, String content) { - this.role = role; + public AssistantMessage(String content) { this.content = content; } } diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index cd514d4..0066a04 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -4,10 +4,13 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; + +import writeon.api.product.request.ProductFavoritePromptCreateRequest; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; import writeon.api.product.response.ProductDetailResponse; +import writeon.api.product.response.ProductFavoritePromptResponse; import writeon.api.product.response.ProductMemoResponse; import writeon.api.product.response.ProductResponse; import writeon.api.product.response.ProductTemplateResponse; @@ -40,6 +43,14 @@ public UUID modify( return productCommandService.save(productId, request); } + @Operation(summary = "프롬프트 즐겨찾기 설정") + @PostMapping("/{productId}/favorite-prompts") + public void createFavoritePrompt( + @PathVariable UUID productId, + @RequestBody ProductFavoritePromptCreateRequest request) { + productCommandService.createFavoritePrompt(productId, request); + } + @Operation(summary = "템플릿 저장") @PostMapping("/{productId}/templates") public void createTemplate( @@ -68,6 +79,12 @@ public ProductDetailResponse getDetail(@PathVariable UUID productId) { return productQueryService.getDetail(productId); } + @Operation(summary = "즐겨찾는 프롬프트 목록 조회") + @GetMapping("/{productId}/favorite-prompts") + public List getFavoritePrompts(@PathVariable UUID productId) { + return productQueryService.getFavoritePrompts(productId); + } + @Operation(summary = "템플릿 조회") @GetMapping("/{productId}/templates") public ProductTemplateResponse getTemplate(@PathVariable UUID productId) { @@ -96,4 +113,12 @@ public void deleteMemo( @PathVariable UUID memoId) { productCommandService.deleteMemo(productId, memoId); } + + @Operation(summary = "프롬프트 즐겨찾기 해제") + @DeleteMapping("/{productId}/favorite-prompts/{promptId}") + public void deleteFavoritePrompt( + @PathVariable UUID productId, + @PathVariable UUID promptId) { + productCommandService.deleteFavoritePrompt(productId, promptId); + } } diff --git a/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java b/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java new file mode 100644 index 0000000..ec804da --- /dev/null +++ b/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java @@ -0,0 +1,13 @@ +package writeon.api.product.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ProductFavoritePromptCreateRequest { + + @Schema(title = "프롬프트") + private String prompt; +} diff --git a/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java b/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java new file mode 100644 index 0000000..e76feff --- /dev/null +++ b/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java @@ -0,0 +1,22 @@ +package writeon.api.product.response; + +import java.time.LocalDateTime; +import java.util.UUID; + +import lombok.Getter; +import writeon.domain.product.ProductFavoritePrompt; +import writeon.domain.product.ProductMemo; + +@Getter +public class ProductFavoritePromptResponse { + + private final UUID id; + private final String prompt; + private final LocalDateTime createdAt; + + public ProductFavoritePromptResponse(ProductFavoritePrompt prompt) { + this.id = prompt.getId(); + this.prompt = prompt.getPrompt(); + this.createdAt = prompt.getCreatedAt(); + } +} diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index cb93481..8be149d 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -6,6 +6,7 @@ import writeon.api.assistant.service.DocumentUploadService; import writeon.api.common.exception.BaseException; import writeon.api.common.util.MemberUtil; +import writeon.api.product.request.ProductFavoritePromptCreateRequest; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; @@ -47,6 +48,13 @@ public void createMemo(UUID productId, ProductMemoSaveRequest request) { request.getSelectedText(), request.getStartIndex(), request.getEndIndex())); } + @Transactional + public void createFavoritePrompt(UUID productId, ProductFavoritePromptCreateRequest request) { + Product product = productQueryService.getById(productId); + + product.getFavoritePrompts().add(new ProductFavoritePrompt(product, request.getPrompt())); + } + @Transactional public void saveTemplate(UUID productId, ProductTemplateSaveRequest request) { Product product = productQueryService.getById(productId); @@ -91,6 +99,13 @@ public void deleteMemo(UUID productId, UUID memoId) { productMemoRepository.delete(memo); } + @Transactional + public void deleteFavoritePrompt(UUID productId, UUID promptId) { + Product product = productQueryService.getById(productId); + + product.getFavoritePrompts().removeIf(prompt -> prompt.getId().equals(promptId)); + } + private ProductMemo getMemoById(UUID memoId) { return productMemoRepository.findByIdAndCreatedBy(memoId, MemberUtil.getMemberId()) .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); diff --git a/api/src/main/java/writeon/api/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java index d45c71d..a8363ec 100644 --- a/api/src/main/java/writeon/api/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -7,10 +7,12 @@ import writeon.api.common.util.MemberUtil; import writeon.api.product.repository.ProductDao; import writeon.api.product.response.ProductDetailResponse; +import writeon.api.product.response.ProductFavoritePromptResponse; import writeon.api.product.response.ProductMemoResponse; import writeon.api.product.response.ProductResponse; import writeon.api.product.response.ProductTemplateResponse; import writeon.domain.product.Product; +import writeon.domain.product.ProductFavoritePrompt; import writeon.domain.product.ProductMemo; import writeon.domain.product.enums.ProductException; import writeon.domain.product.repository.ProductJpaRepository; @@ -40,6 +42,16 @@ public Product getById(UUID productId) { .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST)); } + public List getFavoritePrompts(UUID productId) { + Product product = getById(productId); + + return product.getFavoritePrompts() + .stream() + .sorted(Comparator.comparing(ProductFavoritePrompt::getCreatedAt).reversed()) + .map(ProductFavoritePromptResponse::new) + .toList(); + } + public ProductTemplateResponse getTemplate(UUID productId) { return new ProductTemplateResponse(getById(productId)); } @@ -47,7 +59,8 @@ public ProductTemplateResponse getTemplate(UUID productId) { public List getMemos(UUID productId) { Product product = getById(productId); - return product.getMemos().stream() + return product.getMemos() + .stream() .sorted(Comparator.comparing(ProductMemo::getUpdatedAt).reversed()) .map(ProductMemoResponse::new) .toList(); diff --git a/domain/src/main/generated/writeon/Keys.java b/domain/src/main/generated/writeon/Keys.java index 4795d29..fb12686 100644 --- a/domain/src/main/generated/writeon/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -12,12 +12,12 @@ import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; -import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; +import writeon.tables.ProductFavoritePrompt; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -28,11 +28,11 @@ import writeon.tables.records.AssistantEvaluationRecord; import writeon.tables.records.AssistantMessageRecord; import writeon.tables.records.AssistantRecord; -import writeon.tables.records.LoginAttemptRecord; import writeon.tables.records.MemberPasswordRecord; import writeon.tables.records.MemberRecord; import writeon.tables.records.ProductCharacterRecord; import writeon.tables.records.ProductCustomFieldRecord; +import writeon.tables.records.ProductFavoritePromptRecord; import writeon.tables.records.ProductIdeanoteRecord; import writeon.tables.records.ProductMemoRecord; import writeon.tables.records.ProductPlotRecord; @@ -57,7 +57,6 @@ public class Keys { public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey ASSISTANT_MESSAGE_PK = Internal.createUniqueKey(AssistantMessage.ASSISTANT_MESSAGE, DSL.name("assistant_message_pk"), new TableField[] { AssistantMessage.ASSISTANT_MESSAGE.ID }, true); - public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); public static final UniqueKey NICKNAME_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("nickname_uk"), new TableField[] { Member.MEMBER.NICKNAME }, true); @@ -65,6 +64,7 @@ public class Keys { public static final UniqueKey PRODUCT_PK = Internal.createUniqueKey(Product.PRODUCT, DSL.name("product_pk"), new TableField[] { Product.PRODUCT.ID }, true); public static final UniqueKey PRODUCT_CHARACTER_PK = Internal.createUniqueKey(ProductCharacter.PRODUCT_CHARACTER, DSL.name("product_character_pk"), new TableField[] { ProductCharacter.PRODUCT_CHARACTER.ID }, true); public static final UniqueKey PRODUCT_CUSTOM_FIELD_PK = Internal.createUniqueKey(ProductCustomField.PRODUCT_CUSTOM_FIELD, DSL.name("product_custom_field_pk"), new TableField[] { ProductCustomField.PRODUCT_CUSTOM_FIELD.ID }, true); + public static final UniqueKey PRODUCT_FAVORITE_PROMPT_PK = Internal.createUniqueKey(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT, DSL.name("product_favorite_prompt_pk"), new TableField[] { ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT.ID }, true); public static final UniqueKey PRODUCT_IDEANOTE_PK = Internal.createUniqueKey(ProductIdeanote.PRODUCT_IDEANOTE, DSL.name("product_ideanote_pk"), new TableField[] { ProductIdeanote.PRODUCT_IDEANOTE.ID }, true); public static final UniqueKey PRODUCT_MEMO_PK = Internal.createUniqueKey(ProductMemo.PRODUCT_MEMO, DSL.name("product_memo_pk"), new TableField[] { ProductMemo.PRODUCT_MEMO.ID }, true); public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index 3dc91c3..78680a2 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -24,6 +24,7 @@ import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; +import writeon.tables.ProductFavoritePrompt; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -63,7 +64,7 @@ public class Public extends SchemaImpl { public final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; /** - * 로그인_시도 + * The table public.login_attempt. */ public final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; @@ -131,6 +132,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; + /** + * The table public.product_favorite_prompt. + */ + public final ProductFavoritePrompt PRODUCT_FAVORITE_PROMPT = ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT; + /** * 작품 아이디어 노트 */ @@ -192,6 +198,7 @@ public final List> getTables() { Product.PRODUCT, ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, + ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT, ProductIdeanote.PRODUCT_IDEANOTE, ProductMemo.PRODUCT_MEMO, ProductPlot.PRODUCT_PLOT, diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index 8e5a794..c1f50c0 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -18,6 +18,7 @@ import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; +import writeon.tables.ProductFavoritePrompt; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -50,7 +51,7 @@ public class Tables { public static final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; /** - * 로그인_시도 + * The table public.login_attempt. */ public static final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; @@ -118,6 +119,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public static final ProductCustomField PRODUCT_CUSTOM_FIELD = ProductCustomField.PRODUCT_CUSTOM_FIELD; + /** + * The table public.product_favorite_prompt. + */ + public static final ProductFavoritePrompt PRODUCT_FAVORITE_PROMPT = ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT; + /** * 작품 아이디어 노트 */ diff --git a/domain/src/main/generated/writeon/tables/LoginAttempt.java b/domain/src/main/generated/writeon/tables/LoginAttempt.java index 97af241..4b852d0 100644 --- a/domain/src/main/generated/writeon/tables/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/LoginAttempt.java @@ -20,18 +20,16 @@ import org.jooq.Table; import org.jooq.TableField; import org.jooq.TableOptions; -import org.jooq.UniqueKey; import org.jooq.impl.DSL; import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writeon.Keys; import writeon.Public; import writeon.tables.records.LoginAttemptRecord; /** - * 로그인_시도 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class LoginAttempt extends TableImpl { @@ -52,36 +50,36 @@ public Class getRecordType() { } /** - * The column public.login_attempt.id. 로그인 시도 ID + * The column public.login_attempt.id. */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "로그인 시도 ID"); + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID, this, ""); /** - * The column public.login_attempt.email. 로그인 시도한 이메일 + * The column public.login_attempt.email. */ - public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255).nullable(false), this, "로그인 시도한 이메일"); + public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255), this, ""); /** - * The column public.login_attempt.result. 로그인 시도 후 결과 + * The column public.login_attempt.result. */ - public final TableField RESULT = createField(DSL.name("result"), SQLDataType.VARCHAR(10).nullable(false), this, "로그인 시도 후 결과"); + public final TableField RESULT = createField(DSL.name("result"), SQLDataType.VARCHAR(10), this, ""); /** * The column public.login_attempt.created_at. */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); /** * The column public.login_attempt.updated_at. */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); private LoginAttempt(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } private LoginAttempt(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("로그인_시도"), TableOptions.table(), where); + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); } /** @@ -110,11 +108,6 @@ public Schema getSchema() { return aliased() ? null : Public.PUBLIC; } - @Override - public UniqueKey getPrimaryKey() { - return Keys.LOGIN_ATTEMPT_PK; - } - @Override public LoginAttempt as(String alias) { return new LoginAttempt(DSL.name(alias), this); diff --git a/domain/src/main/generated/writeon/tables/Member.java b/domain/src/main/generated/writeon/tables/Member.java index c4672fc..0ccd62d 100644 --- a/domain/src/main/generated/writeon/tables/Member.java +++ b/domain/src/main/generated/writeon/tables/Member.java @@ -66,7 +66,7 @@ public Class getRecordType() { /** * The column public.member.nickname. 회원 닉네임 */ - public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(20).nullable(false), this, "회원 닉네임"); + public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 닉네임"); /** * The column public.member.profile_image. 회원 프로필 이미지 경로 diff --git a/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java new file mode 100644 index 0000000..79b87fb --- /dev/null +++ b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java @@ -0,0 +1,237 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.ProductFavoritePromptRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFavoritePrompt extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_favorite_prompt + */ + public static final ProductFavoritePrompt PRODUCT_FAVORITE_PROMPT = new ProductFavoritePrompt(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductFavoritePromptRecord.class; + } + + /** + * The column public.product_favorite_prompt.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, ""); + + /** + * The column public.product_favorite_prompt.product_id. + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.product_favorite_prompt.prompt. + */ + public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.product_favorite_prompt.created_at. + */ + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + + private ProductFavoritePrompt(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductFavoritePrompt(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_favorite_prompt table + * reference + */ + public ProductFavoritePrompt(String alias) { + this(DSL.name(alias), PRODUCT_FAVORITE_PROMPT); + } + + /** + * Create an aliased public.product_favorite_prompt table + * reference + */ + public ProductFavoritePrompt(Name alias) { + this(alias, PRODUCT_FAVORITE_PROMPT); + } + + /** + * Create a public.product_favorite_prompt table reference + */ + public ProductFavoritePrompt() { + this(DSL.name("product_favorite_prompt"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_FAVORITE_PROMPT_PK; + } + + @Override + public ProductFavoritePrompt as(String alias) { + return new ProductFavoritePrompt(DSL.name(alias), this); + } + + @Override + public ProductFavoritePrompt as(Name alias) { + return new ProductFavoritePrompt(alias, this); + } + + @Override + public ProductFavoritePrompt as(Table alias) { + return new ProductFavoritePrompt(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductFavoritePrompt rename(String name) { + return new ProductFavoritePrompt(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductFavoritePrompt rename(Name name) { + return new ProductFavoritePrompt(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductFavoritePrompt rename(Table name) { + return new ProductFavoritePrompt(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt where(Condition condition) { + return new ProductFavoritePrompt(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFavoritePrompt where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFavoritePrompt where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFavoritePrompt where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFavoritePrompt where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFavoritePrompt whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writeon/tables/ProductMemo.java b/domain/src/main/generated/writeon/tables/ProductMemo.java index ae2a5e9..81b2401 100644 --- a/domain/src/main/generated/writeon/tables/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/ProductMemo.java @@ -61,11 +61,6 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); - /** - * The column public.product_memo.title. 제목 - */ - public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(100), this, "제목"); - /** * The column public.product_memo.content. 내용 */ @@ -87,9 +82,9 @@ public Class getRecordType() { public final TableField END_INDEX = createField(DSL.name("end_index"), SQLDataType.INTEGER.nullable(false), this, ""); /** - * The column public.product_memo.is_completed. 완료 여부 + * The column public.product_memo.is_completed. 완료여부 */ - public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "완료 여부"); + public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false), this, "완료여부"); /** * The column public.product_memo.created_at. 생성일시 diff --git a/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java index 27048bb..d5135d1 100644 --- a/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java @@ -10,7 +10,7 @@ /** - * 로그인_시도 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class LoginAttempt implements Serializable { @@ -46,21 +46,21 @@ public LoginAttempt( } /** - * Getter for public.login_attempt.id. 로그인 시도 ID + * Getter for public.login_attempt.id. */ public UUID getId() { return this.id; } /** - * Getter for public.login_attempt.email. 로그인 시도한 이메일 + * Getter for public.login_attempt.email. */ public String getEmail() { return this.email; } /** - * Getter for public.login_attempt.result. 로그인 시도 후 결과 + * Getter for public.login_attempt.result. */ public String getResult() { return this.result; diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java b/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java new file mode 100644 index 0000000..982068b --- /dev/null +++ b/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.pojos; + + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFavoritePrompt implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID id; + private final UUID productId; + private final String prompt; + private final LocalDateTime createdAt; + + public ProductFavoritePrompt(ProductFavoritePrompt value) { + this.id = value.id; + this.productId = value.productId; + this.prompt = value.prompt; + this.createdAt = value.createdAt; + } + + public ProductFavoritePrompt( + UUID id, + UUID productId, + String prompt, + LocalDateTime createdAt + ) { + this.id = id; + this.productId = productId; + this.prompt = prompt; + this.createdAt = createdAt; + } + + /** + * Getter for public.product_favorite_prompt.id. + */ + public UUID getId() { + return this.id; + } + + /** + * Getter for public.product_favorite_prompt.product_id. + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.product_favorite_prompt.prompt. + */ + public String getPrompt() { + return this.prompt; + } + + /** + * Getter for public.product_favorite_prompt.created_at. + */ + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductFavoritePrompt other = (ProductFavoritePrompt) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.prompt == null) { + if (other.prompt != null) + return false; + } + else if (!this.prompt.equals(other.prompt)) + return false; + if (this.createdAt == null) { + if (other.createdAt != null) + return false; + } + else if (!this.createdAt.equals(other.createdAt)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); + result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductFavoritePrompt ("); + + sb.append(id); + sb.append(", ").append(productId); + sb.append(", ").append(prompt); + sb.append(", ").append(createdAt); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java index dad311b..dbafd9b 100644 --- a/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java @@ -19,7 +19,6 @@ public class ProductMemo implements Serializable { private final UUID id; private final UUID productId; - private final String title; private final String content; private final String selectedText; private final Integer startIndex; @@ -33,7 +32,6 @@ public class ProductMemo implements Serializable { public ProductMemo(ProductMemo value) { this.id = value.id; this.productId = value.productId; - this.title = value.title; this.content = value.content; this.selectedText = value.selectedText; this.startIndex = value.startIndex; @@ -48,7 +46,6 @@ public ProductMemo(ProductMemo value) { public ProductMemo( UUID id, UUID productId, - String title, String content, String selectedText, Integer startIndex, @@ -61,7 +58,6 @@ public ProductMemo( ) { this.id = id; this.productId = productId; - this.title = title; this.content = content; this.selectedText = selectedText; this.startIndex = startIndex; @@ -87,13 +83,6 @@ public UUID getProductId() { return this.productId; } - /** - * Getter for public.product_memo.title. 제목 - */ - public String getTitle() { - return this.title; - } - /** * Getter for public.product_memo.content. 내용 */ @@ -123,7 +112,7 @@ public Integer getEndIndex() { } /** - * Getter for public.product_memo.is_completed. 완료 여부 + * Getter for public.product_memo.is_completed. 완료여부 */ public Boolean getIsCompleted() { return this.isCompleted; @@ -178,12 +167,6 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; - if (this.title == null) { - if (other.title != null) - return false; - } - else if (!this.title.equals(other.title)) - return false; if (this.content == null) { if (other.content != null) return false; @@ -247,7 +230,6 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); - result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.selectedText == null) ? 0 : this.selectedText.hashCode()); result = prime * result + ((this.startIndex == null) ? 0 : this.startIndex.hashCode()); @@ -266,7 +248,6 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); - sb.append(", ").append(title); sb.append(", ").append(content); sb.append(", ").append(selectedText); sb.append(", ").append(startIndex); diff --git a/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java index d24cca5..a6247d0 100644 --- a/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java +++ b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java @@ -7,22 +7,21 @@ import java.time.OffsetDateTime; import java.util.UUID; -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; +import org.jooq.impl.TableRecordImpl; import writeon.tables.LoginAttempt; /** - * 로그인_시도 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class LoginAttemptRecord extends UpdatableRecordImpl { +public class LoginAttemptRecord extends TableRecordImpl { private static final long serialVersionUID = 1L; /** - * Setter for public.login_attempt.id. 로그인 시도 ID + * Setter for public.login_attempt.id. */ public LoginAttemptRecord setId(UUID value) { set(0, value); @@ -30,14 +29,14 @@ public LoginAttemptRecord setId(UUID value) { } /** - * Getter for public.login_attempt.id. 로그인 시도 ID + * Getter for public.login_attempt.id. */ public UUID getId() { return (UUID) get(0); } /** - * Setter for public.login_attempt.email. 로그인 시도한 이메일 + * Setter for public.login_attempt.email. */ public LoginAttemptRecord setEmail(String value) { set(1, value); @@ -45,14 +44,14 @@ public LoginAttemptRecord setEmail(String value) { } /** - * Getter for public.login_attempt.email. 로그인 시도한 이메일 + * Getter for public.login_attempt.email. */ public String getEmail() { return (String) get(1); } /** - * Setter for public.login_attempt.result. 로그인 시도 후 결과 + * Setter for public.login_attempt.result. */ public LoginAttemptRecord setResult(String value) { set(2, value); @@ -60,7 +59,7 @@ public LoginAttemptRecord setResult(String value) { } /** - * Getter for public.login_attempt.result. 로그인 시도 후 결과 + * Getter for public.login_attempt.result. */ public String getResult() { return (String) get(2); @@ -96,15 +95,6 @@ public OffsetDateTime getUpdatedAt() { return (OffsetDateTime) get(4); } - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); - } - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- diff --git a/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java b/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java new file mode 100644 index 0000000..a74d488 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java @@ -0,0 +1,131 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import java.time.LocalDateTime; +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writeon.tables.ProductFavoritePrompt; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFavoritePromptRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_favorite_prompt.id. + */ + public ProductFavoritePromptRecord setId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_favorite_prompt.id. + */ + public UUID getId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_favorite_prompt.product_id. + */ + public ProductFavoritePromptRecord setProductId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_favorite_prompt.product_id. + */ + public UUID getProductId() { + return (UUID) get(1); + } + + /** + * Setter for public.product_favorite_prompt.prompt. + */ + public ProductFavoritePromptRecord setPrompt(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_favorite_prompt.prompt. + */ + public String getPrompt() { + return (String) get(2); + } + + /** + * Setter for public.product_favorite_prompt.created_at. + */ + public ProductFavoritePromptRecord setCreatedAt(LocalDateTime value) { + set(3, value); + return this; + } + + /** + * Getter for public.product_favorite_prompt.created_at. + */ + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductFavoritePromptRecord + */ + public ProductFavoritePromptRecord() { + super(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT); + } + + /** + * Create a detached, initialised ProductFavoritePromptRecord + */ + public ProductFavoritePromptRecord(UUID id, UUID productId, String prompt, LocalDateTime createdAt) { + super(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT); + + setId(id); + setProductId(productId); + setPrompt(prompt); + setCreatedAt(createdAt); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductFavoritePromptRecord + */ + public ProductFavoritePromptRecord(writeon.tables.pojos.ProductFavoritePrompt value) { + super(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT); + + if (value != null) { + setId(value.getId()); + setProductId(value.getProductId()); + setPrompt(value.getPrompt()); + setCreatedAt(value.getCreatedAt()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java index 1dd6acf..f997720 100644 --- a/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java @@ -51,26 +51,11 @@ public UUID getProductId() { return (UUID) get(1); } - /** - * Setter for public.product_memo.title. 제목 - */ - public ProductMemoRecord setTitle(String value) { - set(2, value); - return this; - } - - /** - * Getter for public.product_memo.title. 제목 - */ - public String getTitle() { - return (String) get(2); - } - /** * Setter for public.product_memo.content. 내용 */ public ProductMemoRecord setContent(String value) { - set(3, value); + set(2, value); return this; } @@ -78,14 +63,14 @@ public ProductMemoRecord setContent(String value) { * Getter for public.product_memo.content. 내용 */ public String getContent() { - return (String) get(3); + return (String) get(2); } /** * Setter for public.product_memo.selected_text. */ public ProductMemoRecord setSelectedText(String value) { - set(4, value); + set(3, value); return this; } @@ -93,14 +78,14 @@ public ProductMemoRecord setSelectedText(String value) { * Getter for public.product_memo.selected_text. */ public String getSelectedText() { - return (String) get(4); + return (String) get(3); } /** * Setter for public.product_memo.start_index. */ public ProductMemoRecord setStartIndex(Integer value) { - set(5, value); + set(4, value); return this; } @@ -108,14 +93,14 @@ public ProductMemoRecord setStartIndex(Integer value) { * Getter for public.product_memo.start_index. */ public Integer getStartIndex() { - return (Integer) get(5); + return (Integer) get(4); } /** * Setter for public.product_memo.end_index. */ public ProductMemoRecord setEndIndex(Integer value) { - set(6, value); + set(5, value); return this; } @@ -123,29 +108,29 @@ public ProductMemoRecord setEndIndex(Integer value) { * Getter for public.product_memo.end_index. */ public Integer getEndIndex() { - return (Integer) get(6); + return (Integer) get(5); } /** - * Setter for public.product_memo.is_completed. 완료 여부 + * Setter for public.product_memo.is_completed. 완료여부 */ public ProductMemoRecord setIsCompleted(Boolean value) { - set(7, value); + set(6, value); return this; } /** - * Getter for public.product_memo.is_completed. 완료 여부 + * Getter for public.product_memo.is_completed. 완료여부 */ public Boolean getIsCompleted() { - return (Boolean) get(7); + return (Boolean) get(6); } /** * Setter for public.product_memo.created_at. 생성일시 */ public ProductMemoRecord setCreatedAt(LocalDateTime value) { - set(8, value); + set(7, value); return this; } @@ -153,14 +138,14 @@ public ProductMemoRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_memo.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(8); + return (LocalDateTime) get(7); } /** * Setter for public.product_memo.created_by. 생성자 ID */ public ProductMemoRecord setCreatedBy(UUID value) { - set(9, value); + set(8, value); return this; } @@ -168,14 +153,14 @@ public ProductMemoRecord setCreatedBy(UUID value) { * Getter for public.product_memo.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(9); + return (UUID) get(8); } /** * Setter for public.product_memo.updated_at. 수정일시 */ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { - set(10, value); + set(9, value); return this; } @@ -183,14 +168,14 @@ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_memo.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(10); + return (LocalDateTime) get(9); } /** * Setter for public.product_memo.updated_by. 수정일시 */ public ProductMemoRecord setUpdatedBy(UUID value) { - set(11, value); + set(10, value); return this; } @@ -198,7 +183,7 @@ public ProductMemoRecord setUpdatedBy(UUID value) { * Getter for public.product_memo.updated_by. 수정일시 */ public UUID getUpdatedBy() { - return (UUID) get(11); + return (UUID) get(10); } // ------------------------------------------------------------------------- @@ -224,12 +209,11 @@ public ProductMemoRecord() { /** * Create a detached, initialised ProductMemoRecord */ - public ProductMemoRecord(UUID id, UUID productId, String title, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductMemoRecord(UUID id, UUID productId, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductMemo.PRODUCT_MEMO); setId(id); setProductId(productId); - setTitle(title); setContent(content); setSelectedText(selectedText); setStartIndex(startIndex); @@ -251,7 +235,6 @@ public ProductMemoRecord(writeon.tables.pojos.ProductMemo value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); - setTitle(value.getTitle()); setContent(value.getContent()); setSelectedText(value.getSelectedText()); setStartIndex(value.getStartIndex()); diff --git a/domain/src/main/java/writeon/domain/product/Product.java b/domain/src/main/java/writeon/domain/product/Product.java index 7360a87..0de8527 100644 --- a/domain/src/main/java/writeon/domain/product/Product.java +++ b/domain/src/main/java/writeon/domain/product/Product.java @@ -53,6 +53,9 @@ public class Product extends BaseAuditTimeEntity { @JoinColumn(name = "id") private ProductWorldview worldview; + @OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) + private List favoritePrompts = new ArrayList<>(); + public void update(String title, String content) { this.title = title; this.content = content; diff --git a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java new file mode 100644 index 0000000..9226c5d --- /dev/null +++ b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java @@ -0,0 +1,43 @@ +package writeon.domain.product; + +import java.time.LocalDateTime; +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import writeon.domain.common.BaseAuditTimeEntity; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_favorite_prompt") +public class ProductFavoritePrompt { + + @Id + @Column(updatable = false, nullable = false) + private UUID id = UUID.randomUUID(); + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "product_id", nullable = false) + private Product product; + + @Column(name = "prompt", nullable = false) + private String prompt; + + @Column(name = "created_at", updatable = false, nullable = false) + protected final LocalDateTime createdAt = LocalDateTime.now(); + + public ProductFavoritePrompt(Product product, String prompt) { + this.product = product; + this.prompt = prompt; + } +} diff --git a/sql/init.sql b/sql/init.sql index 0bd5a6f..914afe1 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -337,6 +337,19 @@ comment on column product_worldview.updated_by is '수정자 ID'; alter table product_worldview owner to postgres; +create table product_favorite_prompt +( + id uuid default gen_random_uuid() not null + constraint product_favorite_prompt_pk + primary key, + product_id uuid not null, + prompt text not null, + created_at timestamp not null +); + +alter table product_favorite_prompt + owner to postgres; + create table assistant ( id uuid not null From 95000ebdb5f9e18412bf9394066516eed4cd0c09 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 2 Apr 2025 15:48:26 +0900 Subject: [PATCH 065/107] feat: Add pagination to get product histories API (#64) --- .../controller/AssistantController.java | 293 +-- .../assistant/repository/AssistantDao.java | 103 +- .../request/AssistantCompletedRequest.java | 13 - ...est.java => AssistantEvaluateRequest.java} | 40 +- .../request/AssistantHistoryListRequest.java | 14 + .../response/AssistantHistoryResponse.java | 106 +- .../service/AssistantEvaluationService.java | 97 +- .../assistant/service/AssistantService.java | 214 ++- .../api/common/request/OffsetRequest.java | 16 + .../api/common/response/OffsetResponse.java | 25 + domain/src/main/generated/writeon/Keys.java | 6 +- domain/src/main/generated/writeon/Public.java | 49 +- .../src/main/generated/writeon/Routines.java | 1704 ----------------- domain/src/main/generated/writeon/Tables.java | 49 +- .../generated/writeon/tables/Assistant.java | 41 +- .../writeon/tables/LoginAttempt.java | 27 +- .../main/generated/writeon/tables/Member.java | 2 +- .../writeon/tables/PgpArmorHeaders.java | 157 -- .../generated/writeon/tables/ProductMemo.java | 9 +- .../writeon/tables/pojos/Assistant.java | 52 +- .../writeon/tables/pojos/LoginAttempt.java | 8 +- .../writeon/tables/pojos/PgpArmorHeaders.java | 91 - .../writeon/tables/pojos/ProductMemo.java | 21 +- .../tables/records/AssistantRecord.java | 74 +- .../tables/records/LoginAttemptRecord.java | 28 +- .../tables/records/PgpArmorHeadersRecord.java | 84 - .../tables/records/ProductMemoRecord.java | 59 +- .../writeon/domain/assistant/Assistant.java | 105 +- .../assistant/enums/AssistantException.java | 48 +- 29 files changed, 768 insertions(+), 2767 deletions(-) delete mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java rename api/src/main/java/writeon/api/assistant/request/{AssistantEvaluationRequest.java => AssistantEvaluateRequest.java} (76%) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java create mode 100644 api/src/main/java/writeon/api/common/request/OffsetRequest.java create mode 100644 api/src/main/java/writeon/api/common/response/OffsetResponse.java delete mode 100644 domain/src/main/generated/writeon/Routines.java delete mode 100644 domain/src/main/generated/writeon/tables/PgpArmorHeaders.java delete mode 100644 domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java delete mode 100644 domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index da3355d..2a5b0e7 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,141 +1,152 @@ -package writeon.api.assistant.controller; - -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.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.util.List; -import java.util.UUID; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpServletResponse; -import lombok.RequiredArgsConstructor; -import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; -import writeon.api.assistant.request.AssistantChatMessageRequest; -import writeon.api.assistant.request.AssistantCompletedRequest; -import writeon.api.assistant.request.AssistantEvaluationRequest; -import writeon.api.assistant.request.AssistantFeedbackMessageRequest; -import writeon.api.assistant.request.AssistantResearchRequest; -import writeon.api.assistant.request.AssistantUserModifyMessageRequest; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.api.assistant.response.AssistantResponse; -import writeon.api.assistant.response.MessageCreateResponse; -import writeon.api.assistant.service.AssistantEvaluationService; -import writeon.api.assistant.service.AssistantService; -import writeon.api.assistant.service.AutoModifyService; -import writeon.api.assistant.service.ChatService; -import writeon.api.assistant.service.FeedbackService; -import writeon.api.assistant.service.UserModifyService; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/assistant") -@Tag(name = "AI 어시스턴트") -public class AssistantController { - - private final AssistantService assistantService; - private final AssistantEvaluationService assistantEvaluationService; - private final AutoModifyService autoModifyService; - private final ChatService chatService; - private final FeedbackService feedbackService; - private final UserModifyService userModifyService; - - @Operation(summary = "자동 수정 메세지 저장") - @PostMapping("/auto-modify/messages") - public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { - return autoModifyService.createMessage(request); - } - - @Operation(summary = "자유 대화 메세지 저장") - @PostMapping("/chat/messages") - public MessageCreateResponse createChatMessage(@RequestBody AssistantChatMessageRequest request) { - return chatService.createMessage(request); - } - - @Operation(summary = "평가") - @PostMapping("/evaluations") - public void evaluate(@RequestBody AssistantEvaluationRequest request) { - assistantEvaluationService.evaluate(request); - } - - @Operation(summary = "구간 피드백 메세지 저장") - @PostMapping("/feedback/messages") - public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { - return feedbackService.createMessage(request); - } - - @Operation(summary = "수동 수정 메세지 저장") - @PostMapping("/user-modify/messages") - public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { - return userModifyService.createMessage(request); - } - - @Operation(summary = "자유 대화 - 웹 검색 모드") - @PostMapping("/chat/research") - public AssistantResponse research(@RequestBody AssistantResearchRequest request) { - return chatService.research(request); - } - - @Operation(summary = "자동 수정 스트리밍") - @GetMapping("/auto-modify/stream") - public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { - SseEmitter emitter = autoModifyService.streamAutoModify(assistantId); - setResponseHeaderForSSE(); - return emitter; - } - - @Operation(summary = "자유 대화 스트리밍") - @GetMapping("/chat/stream") - public SseEmitter streamChat( - @RequestParam UUID assistantId, - @RequestParam String sessionId - ) { - SseEmitter emitter = chatService.streamChat(assistantId, sessionId); - setResponseHeaderForSSE(); - return emitter; - } - - @Operation(summary = "구간 피드백 스트리밍") - @GetMapping("/feedback/stream") - public SseEmitter streamFeedback(@RequestParam UUID assistantId) { - SseEmitter emitter = feedbackService.streamFeedback(assistantId); - setResponseHeaderForSSE(); - return emitter; - } - - @Operation(summary = "수동 수정 스트리밍") - @GetMapping("/user-modify/stream") - public SseEmitter streamUserModify(@RequestParam UUID assistantId) { - SseEmitter emitter = userModifyService.streamUserModify(assistantId); - setResponseHeaderForSSE(); - return emitter; - } - - @Operation(summary = "어시스턴트 사용 내역 조회") - @GetMapping("/histories") - public List getHistories(@RequestParam UUID productId) { - return assistantService.getHistories(productId); - } - - @Operation(summary = "AI 어시 기능 완료 처리") - @PutMapping("/{assistantId}/completed") - public void completed(@PathVariable UUID assistantId, @RequestBody AssistantCompletedRequest request) { - assistantService.completed(assistantId, request); - } - - private void setResponseHeaderForSSE() { - HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); - if (response != null) { - response.setContentType("text/event-stream; charset=UTF-8"); - } - } -} +package writeon.api.assistant.controller; + +import org.springdoc.core.annotations.ParameterObject; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.util.UUID; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.request.AssistantEvaluateRequest; +import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.api.assistant.response.AssistantResponse; +import writeon.api.assistant.response.MessageCreateResponse; +import writeon.api.assistant.service.AssistantEvaluationService; +import writeon.api.assistant.service.AssistantService; +import writeon.api.assistant.service.AutoModifyService; +import writeon.api.assistant.service.ChatService; +import writeon.api.assistant.service.FeedbackService; +import writeon.api.assistant.service.UserModifyService; +import writeon.api.common.request.OffsetRequest; +import writeon.api.common.response.OffsetResponse; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/assistant") +@Tag(name = "AI 어시스턴트") +public class AssistantController { + + private final AssistantService assistantService; + private final AssistantEvaluationService assistantEvaluationService; + private final AutoModifyService autoModifyService; + private final ChatService chatService; + private final FeedbackService feedbackService; + private final UserModifyService userModifyService; + + @Operation(summary = "어시스턴트 답변 적용") + @PostMapping("/{assistantId}/apply") + public void apply(@PathVariable UUID assistantId) { + assistantService.apply(assistantId); + } + + @Operation(summary = "자동 수정 메세지 저장") + @PostMapping("/auto-modify/messages") + public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { + return autoModifyService.createMessage(request); + } + + @Operation(summary = "자유 대화 메세지 저장") + @PostMapping("/chat/messages") + public MessageCreateResponse createChatMessage(@RequestBody AssistantChatMessageRequest request) { + return chatService.createMessage(request); + } + + @Operation(summary = "어시스턴트 답변 평가") + @PostMapping("/{assistantId}/evaluate") + public void evaluate( + @PathVariable UUID assistantId, + @RequestBody AssistantEvaluateRequest request) { + assistantEvaluationService.evaluate(assistantId, request); + } + + @Operation(summary = "구간 피드백 메세지 저장") + @PostMapping("/feedback/messages") + public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { + return feedbackService.createMessage(request); + } + + @Operation(summary = "수동 수정 메세지 저장") + @PostMapping("/user-modify/messages") + public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { + return userModifyService.createMessage(request); + } + + @Operation(summary = "자유 대화 - 웹 검색 모드") + @PostMapping("/chat/research") + public AssistantResponse research(@RequestBody AssistantResearchRequest request) { + return chatService.research(request); + } + + @Operation(summary = "자동 수정 스트리밍") + @GetMapping("/auto-modify/stream") + public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { + SseEmitter emitter = autoModifyService.streamAutoModify(assistantId); + setResponseHeaderForSSE(); + return emitter; + } + + @Operation(summary = "자유 대화 스트리밍") + @GetMapping("/chat/stream") + public SseEmitter streamChat( + @RequestParam UUID assistantId, + @RequestParam String sessionId + ) { + SseEmitter emitter = chatService.streamChat(assistantId, sessionId); + setResponseHeaderForSSE(); + return emitter; + } + + @Operation(summary = "구간 피드백 스트리밍") + @GetMapping("/feedback/stream") + public SseEmitter streamFeedback(@RequestParam UUID assistantId) { + SseEmitter emitter = feedbackService.streamFeedback(assistantId); + setResponseHeaderForSSE(); + return emitter; + } + + @Operation(summary = "수동 수정 스트리밍") + @GetMapping("/user-modify/stream") + public SseEmitter streamUserModify(@RequestParam UUID assistantId) { + SseEmitter emitter = userModifyService.streamUserModify(assistantId); + setResponseHeaderForSSE(); + return emitter; + } + + @Operation(summary = "어시스턴트 사용 내역 조회") + @GetMapping("/histories") + public OffsetResponse getHistories( + @RequestParam UUID productId, + @ParameterObject OffsetRequest request) { + return assistantService.getHistories(productId, request.getPage(), request.getSize()); + } + + @Operation(summary = "어시스턴트 기능 완료 처리") + @PutMapping("/{assistantId}/completed") + public void completed(@PathVariable UUID assistantId) { + assistantService.completed(assistantId); + } + + private void setResponseHeaderForSSE() { + HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse(); + if (response != null) { + response.setContentType("text/event-stream; charset=UTF-8"); + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index 14edc36..9cd16be 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -1,48 +1,55 @@ -package writeon.api.assistant.repository; - -import lombok.RequiredArgsConstructor; -import org.jooq.DSLContext; -import org.jooq.Record; -import org.jooq.Result; -import org.springframework.stereotype.Repository; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.tables.records.AssistantMessageRecord; -import writeon.tables.records.AssistantRecord; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static writeon.tables.Assistant.ASSISTANT; -import static writeon.tables.AssistantMessage.ASSISTANT_MESSAGE; - -@Repository -@RequiredArgsConstructor -public class AssistantDao { - - private final DSLContext dsl; - - public List selectHistories(UUID productId) { - Map> groupedResults = dsl - .select(ASSISTANT.asterisk(), ASSISTANT_MESSAGE.asterisk()) - .from(ASSISTANT) - .join(ASSISTANT_MESSAGE) - .on(ASSISTANT.ID.eq(ASSISTANT_MESSAGE.ASSISTANT_ID)) - .where(ASSISTANT.PRODUCT_ID.eq(productId)) - .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) - .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) - .orderBy(ASSISTANT.CREATED_AT.desc()) - .fetchGroups(ASSISTANT.ID); - - return groupedResults.values().stream() - .map(records -> { - AssistantRecord assistant = records.getFirst().into(AssistantRecord.class); - AssistantMessageRecord memberMessage = records.get(0).into(AssistantMessageRecord.class); - AssistantMessageRecord assistantMessage = records.get(1).into(AssistantMessageRecord.class); - return new AssistantHistoryResponse(assistant, memberMessage, assistantMessage); - }) - .toList(); - } -} +package writeon.api.assistant.repository; + +import org.jooq.DSLContext; +import org.springframework.stereotype.Repository; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.tables.AssistantMessage; + +import static writeon.Tables.ASSISTANT; +import static writeon.Tables.ASSISTANT_MESSAGE; + +@Repository +@RequiredArgsConstructor +public class AssistantDao { + + private final DSLContext dsl; + + public List selectHistories(UUID productId, int page, int size) { + AssistantMessage memberMessage = ASSISTANT_MESSAGE.as("member_message"); + AssistantMessage assistantMessage = ASSISTANT_MESSAGE.as("assistant_message"); + + return dsl.select(ASSISTANT.ID, ASSISTANT.TYPE, ASSISTANT.IS_APPLIED, ASSISTANT.CREATED_AT, + memberMessage.CONTENT, memberMessage.PROMPT, assistantMessage.CONTENT) + .from(ASSISTANT) + .join(memberMessage) + .on(ASSISTANT.ID.eq(memberMessage.ASSISTANT_ID) + .and(memberMessage.ROLE.eq(MessageSenderRole.MEMBER.getCode()))) + .join(assistantMessage) + .on(ASSISTANT.ID.eq(assistantMessage.ASSISTANT_ID) + .and(assistantMessage.ROLE.eq(MessageSenderRole.ASSISTANT.getCode()))) + .where(ASSISTANT.PRODUCT_ID.eq(productId)) + .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) + .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) + .orderBy(ASSISTANT.CREATED_AT.desc()) + .offset((long) (page - 1) * size) + .limit(size) + .fetchInto(AssistantHistoryResponse.class); + } + + public Long countHistories(UUID productId) { + return dsl.selectCount() + .from(ASSISTANT) + .where(ASSISTANT.PRODUCT_ID.eq(productId)) + .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) + .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) + .fetchOneInto(Long.class); + } +} diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java deleted file mode 100644 index 4744762..0000000 --- a/api/src/main/java/writeon/api/assistant/request/AssistantCompletedRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package writeon.api.assistant.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class AssistantCompletedRequest { - - @Schema(title = "응답 반영 여부") - private Boolean isReflected; -} diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantEvaluateRequest.java similarity index 76% rename from api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantEvaluateRequest.java index 87b60f0..696fccc 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantEvaluationRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantEvaluateRequest.java @@ -1,22 +1,18 @@ -package writeon.api.assistant.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; -import writeon.domain.assistant.enums.FeedbackType; - -import java.util.UUID; - -@Getter -@Setter -public class AssistantEvaluationRequest { - - @Schema(title = "어시스턴트 ID") - private UUID assistantId; - @Schema(title = "만족 여부") - private Boolean isGood; - @Schema(title = "피드백 타입", nullable = true) - private FeedbackType feedbackType; - @Schema(title = "피드백", nullable = true) - private String feedback; -} +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import writeon.domain.assistant.enums.FeedbackType; + +@Getter +@Setter +public class AssistantEvaluateRequest { + + @Schema(title = "만족 여부") + private Boolean isGood; + @Schema(title = "피드백 타입", nullable = true) + private FeedbackType feedbackType; + @Schema(title = "피드백", nullable = true) + private String feedback; +} diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java new file mode 100644 index 0000000..a1eb2bb --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java @@ -0,0 +1,14 @@ +package writeon.api.assistant.request; + +import java.time.LocalDateTime; + +import lombok.Getter; +import lombok.Setter; +import writeon.api.common.request.OffsetRequest; + +@Getter +@Setter +public class AssistantHistoryListRequest extends OffsetRequest { + + private LocalDateTime createdAt; +} diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java index ff209e7..4eb4aea 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -1,52 +1,54 @@ -package writeon.api.assistant.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import writeon.tables.records.AssistantMessageRecord; -import writeon.tables.records.AssistantRecord; - -import java.time.LocalDateTime; -import java.util.UUID; - -@Getter -public class AssistantHistoryResponse { - - private final UUID id; - private final String type; - private final MemberMessage memberMessage; - private final AssistantMessage assistantMessage; - private final LocalDateTime createdAt; - - public AssistantHistoryResponse(AssistantRecord assistant, AssistantMessageRecord memberMessage, AssistantMessageRecord assistantMessage) { - this.id = assistant.getId(); - this.type = assistant.getType(); - this.memberMessage = new MemberMessage(memberMessage.getContent(), memberMessage.getPrompt()); - this.assistantMessage = new AssistantMessage(assistantMessage.getContent()); - this.createdAt = assistant.getCreatedAt(); - } - - @Getter - public static class MemberMessage { - - @Schema(title = "사용자가 선택한 구간") - private final String content; - @Schema(title = "사용자가 입력한 프롬프트") - private final String prompt; - - public MemberMessage(String content, String prompt) { - this.content = content; - this.prompt = prompt; - } - } - - @Getter - public static class AssistantMessage { - - @Schema(title = "Assistant 답변") - private final String content; - - public AssistantMessage(String content) { - this.content = content; - } - } -} +package writeon.api.assistant.response; + +import java.time.LocalDateTime; +import java.util.UUID; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +@Getter +public class AssistantHistoryResponse { + + private final UUID id; + private final String type; + private final MemberMessage memberMessage; + private final AssistantMessage assistantMessage; + private final LocalDateTime createdAt; + + public AssistantHistoryResponse(UUID id, String type, Boolean isApplied, LocalDateTime createdAt, + String memberMessageContent, String memberMessagePrompt, String assistantMessageContent) { + this.id = id; + this.type = type; + this.memberMessage = new MemberMessage(memberMessageContent, memberMessagePrompt); + this.assistantMessage = new AssistantMessage(assistantMessageContent, isApplied); + this.createdAt = createdAt; + } + + @Getter + public static class MemberMessage { + + @Schema(title = "사용자가 선택한 구간") + private final String content; + @Schema(title = "사용자가 입력한 프롬프트") + private final String prompt; + + public MemberMessage(String content, String prompt) { + this.content = content; + this.prompt = prompt; + } + } + + @Getter + public static class AssistantMessage { + + @Schema(title = "Assistant 답변") + private final String content; + @Schema(title = "답변 적용 여부") + private final Boolean isApplied; + + public AssistantMessage(String content, Boolean isApplied) { + this.content = content; + this.isApplied = isApplied; + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java index c620201..9d46744 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java @@ -1,48 +1,49 @@ -package writeon.api.assistant.service; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import writeon.api.assistant.request.AssistantEvaluationRequest; -import writeon.api.common.exception.BaseException; -import writeon.domain.assistant.AssistantEvaluation; -import writeon.domain.assistant.AssistantEvaluationJpaRepository; -import writeon.domain.assistant.enums.AssistantException; -import writeon.domain.assistant.enums.FeedbackType; - -import java.util.UUID; - -@Service -@RequiredArgsConstructor -public class AssistantEvaluationService { - - private final AssistantEvaluationJpaRepository assistantEvaluationRepository; - private final AssistantService assistantService; - - @Transactional - public void evaluate(AssistantEvaluationRequest request) { - assistantService.verifyExist(request.getAssistantId()); - verifyEvaluated(request.getAssistantId()); - - String feedback = null; - - if (!request.getIsGood()) { - feedback = request.getFeedbackType() == FeedbackType.ETC - ? request.getFeedback() : request.getFeedbackType().getCode(); - } - - AssistantEvaluation assistantEvaluation = AssistantEvaluation.builder() - .assistantId(request.getAssistantId()) - .isGood(request.getIsGood()) - .feedback(feedback) - .build(); - - assistantEvaluationRepository.save(assistantEvaluation); - } - - private void verifyEvaluated(UUID assistantId) { - if (assistantEvaluationRepository.existsById(assistantId)) { - throw new BaseException(AssistantException.ALREADY_EVALUATED); - } - } -} +package writeon.api.assistant.service; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.UUID; + +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.request.AssistantEvaluateRequest; +import writeon.api.common.exception.BaseException; +import writeon.domain.assistant.AssistantEvaluation; +import writeon.domain.assistant.AssistantEvaluationJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.FeedbackType; + +@Service +@RequiredArgsConstructor +public class AssistantEvaluationService { + + private final AssistantEvaluationJpaRepository assistantEvaluationRepository; + private final AssistantService assistantService; + + @Transactional + public void evaluate(UUID assistantId, AssistantEvaluateRequest request) { + assistantService.verifyExist(assistantId); + verifyEvaluated(assistantId); + + String feedback = null; + + if (!request.getIsGood()) { + feedback = request.getFeedbackType() == FeedbackType.ETC + ? request.getFeedback() : request.getFeedbackType().getCode(); + } + + AssistantEvaluation assistantEvaluation = AssistantEvaluation.builder() + .assistantId(assistantId) + .isGood(request.getIsGood()) + .feedback(feedback) + .build(); + + assistantEvaluationRepository.save(assistantEvaluation); + } + + private void verifyEvaluated(UUID assistantId) { + if (assistantEvaluationRepository.existsById(assistantId)) { + throw new BaseException(AssistantException.ALREADY_EVALUATED); + } + } +} diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index ff9ae2b..2117269 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -1,100 +1,114 @@ -package writeon.api.assistant.service; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; -import writeon.api.assistant.repository.AssistantDao; -import writeon.api.assistant.request.AssistantCompletedRequest; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.api.common.exception.BaseException; -import writeon.api.common.util.MemberUtil; -import writeon.api.product.service.ProductQueryService; -import writeon.domain.assistant.Assistant; -import writeon.domain.assistant.AssistantJpaRepository; -import writeon.domain.assistant.AssistantMessage; -import writeon.domain.assistant.AssistantMessageJpaRepository; -import writeon.domain.assistant.enums.AssistantException; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.domain.assistant.enums.AssistantType; -import writeon.domain.assistant.enums.MessageSenderRole; - -@Service -@RequiredArgsConstructor -public class AssistantService { - - private final AssistantJpaRepository assistantRepository; - private final AssistantMessageJpaRepository assistantMessageRepository; - private final AssistantDao assistantDao; - - private final ProductQueryService productQueryService; - - @Transactional - public UUID create(UUID productId, AssistantType type) { - Assistant assistant = new Assistant(productId, type, MemberUtil.getMemberId()); - return assistantRepository.save(assistant).getId(); - } - - @Transactional - public UUID createMessage(AssistantMessage message) { - return assistantMessageRepository.save(message).getId(); - } - - @Transactional - public void completed(UUID assistantId, AssistantCompletedRequest request) { - Assistant assistant = getById(assistantId); - - if (assistant.getStatus() != AssistantStatus.IN_PROGRESS) { - throw new BaseException(AssistantException.CANNOT_BE_COMPLETED); - } - - assistant.updateStatus(AssistantStatus.COMPLETED); - } - - @Transactional - public void modifyStatus(UUID assistantId, AssistantStatus status) { - assistantRepository.updateStatus(assistantId, status); - } - - @Transactional(readOnly = true) - public Assistant getById(UUID assistantId) { - return assistantRepository.findById(assistantId) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); - } - - @Transactional(readOnly = true) - public Assistant getById(UUID assistantId, UUID memberId) { - return assistantRepository.findByIdAndCreatedBy(assistantId, memberId) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); - } - - @Transactional(readOnly = true) - public List getHistories(UUID productId) { - productQueryService.verifyExist(productId); - - return assistantDao.selectHistories(productId); - } - - @Transactional(readOnly = true) - public AssistantMessage getMessage(UUID assistantId, MessageSenderRole role) { - return assistantMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, role) - .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); - } - - @Transactional(readOnly = true) - public void verifyAnswered(UUID assistantId) { - if (assistantMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { - throw new BaseException(AssistantException.ALREADY_ANSWERED); - } - } - - @Transactional(readOnly = true) - public void verifyExist(UUID assistantId) { - if (!assistantRepository.existsByIdAndCreatedBy(assistantId, MemberUtil.getMemberId())) { - throw new BaseException(AssistantException.NOT_EXIST); - } - } -} +package writeon.api.assistant.service; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.UUID; + +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.repository.AssistantDao; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.api.common.exception.BaseException; +import writeon.api.common.response.OffsetResponse; +import writeon.api.common.util.MemberUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantJpaRepository; +import writeon.domain.assistant.AssistantMessage; +import writeon.domain.assistant.AssistantMessageJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; + +@Service +@RequiredArgsConstructor +public class AssistantService { + + private final AssistantJpaRepository assistantRepository; + private final AssistantMessageJpaRepository assistantMessageRepository; + private final AssistantDao assistantDao; + + private final ProductQueryService productQueryService; + + @Transactional + public void apply(UUID assistantId) { + Assistant assistant = getById(assistantId, MemberUtil.getMemberId()); + if (assistant.getStatus() == AssistantStatus.DRAFT || assistant.getIsApplied()) { + throw new BaseException(AssistantException.CANNOT_BE_APPLIED); + } + + assistant.apply(); + } + + @Transactional + public UUID create(UUID productId, AssistantType type) { + Assistant assistant = new Assistant(productId, type, MemberUtil.getMemberId()); + return assistantRepository.save(assistant).getId(); + } + + @Transactional + public UUID createMessage(AssistantMessage message) { + return assistantMessageRepository.save(message).getId(); + } + + @Transactional + public void completed(UUID assistantId) { + Assistant assistant = getById(assistantId, MemberUtil.getMemberId()); + if (assistant.getStatus() != AssistantStatus.IN_PROGRESS) { + throw new BaseException(AssistantException.CANNOT_BE_COMPLETED); + } + + assistant.updateStatus(AssistantStatus.COMPLETED); + } + + @Transactional + public void modifyStatus(UUID assistantId, AssistantStatus status) { + assistantRepository.updateStatus(assistantId, status); + } + + @Transactional(readOnly = true) + public Assistant getById(UUID assistantId) { + return assistantRepository.findById(assistantId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); + } + + @Transactional(readOnly = true) + public Assistant getById(UUID assistantId, UUID memberId) { + return assistantRepository.findByIdAndCreatedBy(assistantId, memberId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST)); + } + + @Transactional(readOnly = true) + public OffsetResponse getHistories(UUID productId, int page, int size) { + productQueryService.verifyExist(productId); + + long count = assistantDao.countHistories(productId); + return OffsetResponse.of( + assistantDao.selectHistories(productId, page, size), + page, + size, + count + ); + } + + @Transactional(readOnly = true) + public AssistantMessage getMessage(UUID assistantId, MessageSenderRole role) { + return assistantMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, role) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + } + + @Transactional(readOnly = true) + public void verifyAnswered(UUID assistantId) { + if (assistantMessageRepository.existsByAssistantIdAndMessageContent_Role(assistantId, MessageSenderRole.ASSISTANT)) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + } + + @Transactional(readOnly = true) + public void verifyExist(UUID assistantId) { + if (!assistantRepository.existsByIdAndCreatedBy(assistantId, MemberUtil.getMemberId())) { + throw new BaseException(AssistantException.NOT_EXIST); + } + } +} diff --git a/api/src/main/java/writeon/api/common/request/OffsetRequest.java b/api/src/main/java/writeon/api/common/request/OffsetRequest.java new file mode 100644 index 0000000..4c7b679 --- /dev/null +++ b/api/src/main/java/writeon/api/common/request/OffsetRequest.java @@ -0,0 +1,16 @@ +package writeon.api.common.request; + +import jakarta.validation.constraints.Positive; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class OffsetRequest { + + @Positive(message = "페이지는 양수여야 합니다.") + private int page = 1; + + @Positive(message = "한 페이지에 조회 할 데이터 수는 양수여야 합니다.") + private int size = 10; +} diff --git a/api/src/main/java/writeon/api/common/response/OffsetResponse.java b/api/src/main/java/writeon/api/common/response/OffsetResponse.java new file mode 100644 index 0000000..ced947a --- /dev/null +++ b/api/src/main/java/writeon/api/common/response/OffsetResponse.java @@ -0,0 +1,25 @@ +package writeon.api.common.response; + +import java.util.List; + +import lombok.Getter; + +@Getter +public class OffsetResponse { + + private final List contents; + private final int page; + private final long totalPages; + private final long totalElements; + + private OffsetResponse(List contents, int page, int size, long totalElements) { + this.contents = contents; + this.page = page; + this.totalPages = (int) Math.ceil((double) totalElements / size); + this.totalElements = totalElements; + } + + public static OffsetResponse of(List contents, int page, int size, long totalElements) { + return new OffsetResponse<>(contents, page, size, totalElements); + } +} diff --git a/domain/src/main/generated/writeon/Keys.java b/domain/src/main/generated/writeon/Keys.java index fb12686..6816dbe 100644 --- a/domain/src/main/generated/writeon/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -9,9 +9,9 @@ import org.jooq.impl.DSL; import org.jooq.impl.Internal; -import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; +import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; import writeon.tables.Product; @@ -27,7 +27,7 @@ import writeon.tables.TermsAgreement; import writeon.tables.records.AssistantEvaluationRecord; import writeon.tables.records.AssistantMessageRecord; -import writeon.tables.records.AssistantRecord; +import writeon.tables.records.LoginAttemptRecord; import writeon.tables.records.MemberPasswordRecord; import writeon.tables.records.MemberRecord; import writeon.tables.records.ProductCharacterRecord; @@ -54,9 +54,9 @@ public class Keys { // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- - public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey ASSISTANT_MESSAGE_PK = Internal.createUniqueKey(AssistantMessage.ASSISTANT_MESSAGE, DSL.name("assistant_message_pk"), new TableField[] { AssistantMessage.ASSISTANT_MESSAGE.ID }, true); + public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); public static final UniqueKey NICKNAME_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("nickname_uk"), new TableField[] { Member.MEMBER.NICKNAME }, true); diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index 78680a2..9281812 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -8,9 +8,6 @@ import java.util.List; import org.jooq.Catalog; -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; import org.jooq.Table; import org.jooq.impl.SchemaImpl; @@ -20,7 +17,6 @@ import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; -import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -32,7 +28,6 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; -import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -49,7 +44,7 @@ public class Public extends SchemaImpl { public static final Public PUBLIC = new Public(); /** - * 어시스턴트 + * The table public.assistant. */ public final Assistant ASSISTANT = Assistant.ASSISTANT; @@ -64,7 +59,7 @@ public class Public extends SchemaImpl { public final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; /** - * The table public.login_attempt. + * 로그인_시도 */ public final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; @@ -78,45 +73,6 @@ public class Public extends SchemaImpl { */ public final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; - /** - * The table public.pgp_armor_headers. - */ - public final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; - - /** - * Call public.pgp_armor_headers. - */ - public static Result PGP_ARMOR_HEADERS( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - String __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - Field __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - /** * 작품 */ @@ -194,7 +150,6 @@ public final List> getTables() { LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, - PgpArmorHeaders.PGP_ARMOR_HEADERS, Product.PRODUCT, ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, diff --git a/domain/src/main/generated/writeon/Routines.java b/domain/src/main/generated/writeon/Routines.java deleted file mode 100644 index 370498c..0000000 --- a/domain/src/main/generated/writeon/Routines.java +++ /dev/null @@ -1,1704 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writeon; - - -import java.util.UUID; - -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; - -import writeon.routines.Armor1; -import writeon.routines.Armor2; -import writeon.routines.Crypt; -import writeon.routines.Dearmor; -import writeon.routines.Decrypt; -import writeon.routines.DecryptIv; -import writeon.routines.Digest1; -import writeon.routines.Digest2; -import writeon.routines.Encrypt; -import writeon.routines.EncryptIv; -import writeon.routines.GenRandomBytes; -import writeon.routines.GenRandomUuid; -import writeon.routines.GenSalt1; -import writeon.routines.GenSalt2; -import writeon.routines.Hmac1; -import writeon.routines.Hmac2; -import writeon.routines.PgpKeyId; -import writeon.routines.PgpPubDecrypt1; -import writeon.routines.PgpPubDecrypt2; -import writeon.routines.PgpPubDecrypt3; -import writeon.routines.PgpPubDecryptBytea1; -import writeon.routines.PgpPubDecryptBytea2; -import writeon.routines.PgpPubDecryptBytea3; -import writeon.routines.PgpPubEncrypt1; -import writeon.routines.PgpPubEncrypt2; -import writeon.routines.PgpPubEncryptBytea1; -import writeon.routines.PgpPubEncryptBytea2; -import writeon.routines.PgpSymDecrypt1; -import writeon.routines.PgpSymDecrypt2; -import writeon.routines.PgpSymDecryptBytea1; -import writeon.routines.PgpSymDecryptBytea2; -import writeon.routines.PgpSymEncrypt1; -import writeon.routines.PgpSymEncrypt2; -import writeon.routines.PgpSymEncryptBytea1; -import writeon.routines.PgpSymEncryptBytea2; -import writeon.tables.PgpArmorHeaders; -import writeon.tables.records.PgpArmorHeadersRecord; - - -/** - * Convenience access to all stored procedures and functions in public. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class Routines { - - /** - * Call public.armor - */ - public static String armor1( - Configuration configuration - , byte[] __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor1( - byte[] __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor1( - Field __1 - ) { - Armor1 f = new Armor1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.armor - */ - public static String armor2( - Configuration configuration - , byte[] __1 - , String[] __2 - , String[] __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor2( - byte[] __1 - , String[] __2 - , String[] __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.armor as a field. - */ - public static Field armor2( - Field __1 - , Field __2 - , Field __3 - ) { - Armor2 f = new Armor2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.crypt - */ - public static String crypt( - Configuration configuration - , String __1 - , String __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.crypt as a field. - */ - public static Field crypt( - String __1 - , String __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.crypt as a field. - */ - public static Field crypt( - Field __1 - , Field __2 - ) { - Crypt f = new Crypt(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.dearmor - */ - public static byte[] dearmor( - Configuration configuration - , String __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.dearmor as a field. - */ - public static Field dearmor( - String __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.dearmor as a field. - */ - public static Field dearmor( - Field __1 - ) { - Dearmor f = new Dearmor(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.decrypt - */ - public static byte[] decrypt( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.decrypt as a field. - */ - public static Field decrypt( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.decrypt as a field. - */ - public static Field decrypt( - Field __1 - , Field __2 - , Field __3 - ) { - Decrypt f = new Decrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.decrypt_iv - */ - public static byte[] decryptIv( - Configuration configuration - , byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.decrypt_iv as a field. - */ - public static Field decryptIv( - byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.decrypt_iv as a field. - */ - public static Field decryptIv( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - DecryptIv f = new DecryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.digest - */ - public static byte[] digest1( - Configuration configuration - , String __1 - , String __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest1( - String __1 - , String __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest1( - Field __1 - , Field __2 - ) { - Digest1 f = new Digest1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.digest - */ - public static byte[] digest2( - Configuration configuration - , byte[] __1 - , String __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest2( - byte[] __1 - , String __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.digest as a field. - */ - public static Field digest2( - Field __1 - , Field __2 - ) { - Digest2 f = new Digest2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.encrypt - */ - public static byte[] encrypt( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.encrypt as a field. - */ - public static Field encrypt( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.encrypt as a field. - */ - public static Field encrypt( - Field __1 - , Field __2 - , Field __3 - ) { - Encrypt f = new Encrypt(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.encrypt_iv - */ - public static byte[] encryptIv( - Configuration configuration - , byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.encrypt_iv as a field. - */ - public static Field encryptIv( - byte[] __1 - , byte[] __2 - , byte[] __3 - , String __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.encrypt_iv as a field. - */ - public static Field encryptIv( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - EncryptIv f = new EncryptIv(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.gen_random_bytes - */ - public static byte[] genRandomBytes( - Configuration configuration - , Integer __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_random_bytes as a field. - */ - public static Field genRandomBytes( - Integer __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.gen_random_bytes as a field. - */ - public static Field genRandomBytes( - Field __1 - ) { - GenRandomBytes f = new GenRandomBytes(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.gen_random_uuid - */ - public static UUID genRandomUuid( - Configuration configuration - ) { - GenRandomUuid f = new GenRandomUuid(); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_random_uuid as a field. - */ - public static Field genRandomUuid() { - GenRandomUuid f = new GenRandomUuid(); - - return f.asField(); - } - - /** - * Call public.gen_salt - */ - public static String genSalt1( - Configuration configuration - , String __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt1( - String __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt1( - Field __1 - ) { - GenSalt1 f = new GenSalt1(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.gen_salt - */ - public static String genSalt2( - Configuration configuration - , String __1 - , Integer __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt2( - String __1 - , Integer __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.gen_salt as a field. - */ - public static Field genSalt2( - Field __1 - , Field __2 - ) { - GenSalt2 f = new GenSalt2(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.hmac - */ - public static byte[] hmac1( - Configuration configuration - , String __1 - , String __2 - , String __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac1( - String __1 - , String __2 - , String __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac1( - Field __1 - , Field __2 - , Field __3 - ) { - Hmac1 f = new Hmac1(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.hmac - */ - public static byte[] hmac2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.hmac as a field. - */ - public static Field hmac2( - Field __1 - , Field __2 - , Field __3 - ) { - Hmac2 f = new Hmac2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_key_id - */ - public static String pgpKeyId( - Configuration configuration - , byte[] __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_key_id as a field. - */ - public static Field pgpKeyId( - byte[] __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Get public.pgp_key_id as a field. - */ - public static Field pgpKeyId( - Field __1 - ) { - PgpKeyId f = new PgpKeyId(); - f.set__1(__1); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt1( - byte[] __1 - , byte[] __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt1( - Field __1 - , Field __2 - ) { - PgpPubDecrypt1 f = new PgpPubDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubDecrypt2 f = new PgpPubDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt - */ - public static String pgpPubDecrypt3( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt3( - byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt as a field. - */ - public static Field pgpPubDecrypt3( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - PgpPubDecrypt3 f = new PgpPubDecrypt3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea1( - byte[] __1 - , byte[] __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea1( - Field __1 - , Field __2 - ) { - PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_decrypt_bytea - */ - public static byte[] pgpPubDecryptBytea3( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea3( - byte[] __1 - , byte[] __2 - , String __3 - , String __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Get public.pgp_pub_decrypt_bytea as a field. - */ - public static Field pgpPubDecryptBytea3( - Field __1 - , Field __2 - , Field __3 - , Field __4 - ) { - PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - f.set__4(__4); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt - */ - public static byte[] pgpPubEncrypt1( - Configuration configuration - , String __1 - , byte[] __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt1( - String __1 - , byte[] __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt1( - Field __1 - , Field __2 - ) { - PgpPubEncrypt1 f = new PgpPubEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt - */ - public static byte[] pgpPubEncrypt2( - Configuration configuration - , String __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt2( - String __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt as a field. - */ - public static Field pgpPubEncrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubEncrypt2 f = new PgpPubEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt_bytea - */ - public static byte[] pgpPubEncryptBytea1( - Configuration configuration - , byte[] __1 - , byte[] __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea1( - byte[] __1 - , byte[] __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea1( - Field __1 - , Field __2 - ) { - PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_pub_encrypt_bytea - */ - public static byte[] pgpPubEncryptBytea2( - Configuration configuration - , byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea2( - byte[] __1 - , byte[] __2 - , String __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_pub_encrypt_bytea as a field. - */ - public static Field pgpPubEncryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt - */ - public static String pgpSymDecrypt1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt1( - byte[] __1 - , String __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt1( - Field __1 - , Field __2 - ) { - PgpSymDecrypt1 f = new PgpSymDecrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt - */ - public static String pgpSymDecrypt2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt as a field. - */ - public static Field pgpSymDecrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymDecrypt2 f = new PgpSymDecrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt_bytea - */ - public static byte[] pgpSymDecryptBytea1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea1( - byte[] __1 - , String __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea1( - Field __1 - , Field __2 - ) { - PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_decrypt_bytea - */ - public static byte[] pgpSymDecryptBytea2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_decrypt_bytea as a field. - */ - public static Field pgpSymDecryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt - */ - public static byte[] pgpSymEncrypt1( - Configuration configuration - , String __1 - , String __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt1( - String __1 - , String __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt1( - Field __1 - , Field __2 - ) { - PgpSymEncrypt1 f = new PgpSymEncrypt1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt - */ - public static byte[] pgpSymEncrypt2( - Configuration configuration - , String __1 - , String __2 - , String __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt2( - String __1 - , String __2 - , String __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt as a field. - */ - public static Field pgpSymEncrypt2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymEncrypt2 f = new PgpSymEncrypt2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt_bytea - */ - public static byte[] pgpSymEncryptBytea1( - Configuration configuration - , byte[] __1 - , String __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea1( - byte[] __1 - , String __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea1( - Field __1 - , Field __2 - ) { - PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); - f.set__1(__1); - f.set__2(__2); - - return f.asField(); - } - - /** - * Call public.pgp_sym_encrypt_bytea - */ - public static byte[] pgpSymEncryptBytea2( - Configuration configuration - , byte[] __1 - , String __2 - , String __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - f.execute(configuration); - return f.getReturnValue(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea2( - byte[] __1 - , String __2 - , String __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Get public.pgp_sym_encrypt_bytea as a field. - */ - public static Field pgpSymEncryptBytea2( - Field __1 - , Field __2 - , Field __3 - ) { - PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); - f.set__1(__1); - f.set__2(__2); - f.set__3(__3); - - return f.asField(); - } - - /** - * Call public.pgp_armor_headers. - */ - public static Result pgpArmorHeaders( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders pgpArmorHeaders( - String __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders pgpArmorHeaders( - Field __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } -} diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index c1f50c0..72e5f64 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -4,17 +4,12 @@ package writeon; -import org.jooq.Configuration; -import org.jooq.Field; -import org.jooq.Result; - import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; -import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -26,7 +21,6 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; -import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -36,7 +30,7 @@ public class Tables { /** - * 어시스턴트 + * The table public.assistant. */ public static final Assistant ASSISTANT = Assistant.ASSISTANT; @@ -51,7 +45,7 @@ public class Tables { public static final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; /** - * The table public.login_attempt. + * 로그인_시도 */ public static final LoginAttempt LOGIN_ATTEMPT = LoginAttempt.LOGIN_ATTEMPT; @@ -65,45 +59,6 @@ public class Tables { */ public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; - /** - * The table public.pgp_armor_headers. - */ - public static final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; - - /** - * Call public.pgp_armor_headers. - */ - public static Result PGP_ARMOR_HEADERS( - Configuration configuration - , String __1 - ) { - return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - )).fetch(); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - String __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - - /** - * Get public.pgp_armor_headers as a table. - */ - public static PgpArmorHeaders PGP_ARMOR_HEADERS( - Field __1 - ) { - return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( - __1 - ); - } - /** * 작품 */ diff --git a/domain/src/main/generated/writeon/tables/Assistant.java b/domain/src/main/generated/writeon/tables/Assistant.java index 31f7fdd..3630175 100644 --- a/domain/src/main/generated/writeon/tables/Assistant.java +++ b/domain/src/main/generated/writeon/tables/Assistant.java @@ -20,18 +20,16 @@ import org.jooq.Table; import org.jooq.TableField; import org.jooq.TableOptions; -import org.jooq.UniqueKey; import org.jooq.impl.DSL; import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; -import writeon.Keys; import writeon.Public; import writeon.tables.records.AssistantRecord; /** - * 어시스턴트 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Assistant extends TableImpl { @@ -54,49 +52,49 @@ public Class getRecordType() { /** * The column public.assistant.id. */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, ""); + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID, this, ""); /** - * The column public.assistant.product_id. 작품 ID + * The column public.assistant.product_id. */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID, this, ""); /** - * The column public.assistant.type. 기능 종류 + * The column public.assistant.type. */ - public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR(20).nullable(false), this, "기능 종류"); + public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR(20), this, ""); /** - * The column public.assistant.status. 진행 상태 + * The column public.assistant.status. */ - public final TableField STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(20).nullable(false), this, "진행 상태"); + public final TableField STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(20), this, ""); /** - * The column public.assistant.created_at. 수정일시 + * The column public.assistant.is_applied. */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); + public final TableField IS_APPLIED = createField(DSL.name("is_applied"), SQLDataType.BOOLEAN, this, ""); /** - * The column public.assistant.created_by. 수정자 ID + * The column public.assistant.created_at. */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6), this, ""); /** - * The column public.assistant.updated_at. + * The column public.assistant.created_by. */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID, this, ""); /** - * The column public.assistant.updated_by. + * The column public.assistant.updated_at. */ - public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, ""); + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6), this, ""); private Assistant(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } private Assistant(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment("어시스턴트"), TableOptions.table(), where); + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); } /** @@ -125,11 +123,6 @@ public Schema getSchema() { return aliased() ? null : Public.PUBLIC; } - @Override - public UniqueKey getPrimaryKey() { - return Keys.ASSISTANT_PK; - } - @Override public Assistant as(String alias) { return new Assistant(DSL.name(alias), this); diff --git a/domain/src/main/generated/writeon/tables/LoginAttempt.java b/domain/src/main/generated/writeon/tables/LoginAttempt.java index 4b852d0..97af241 100644 --- a/domain/src/main/generated/writeon/tables/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/LoginAttempt.java @@ -20,16 +20,18 @@ import org.jooq.Table; import org.jooq.TableField; import org.jooq.TableOptions; +import org.jooq.UniqueKey; import org.jooq.impl.DSL; import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; +import writeon.Keys; import writeon.Public; import writeon.tables.records.LoginAttemptRecord; /** - * This class is generated by jOOQ. + * 로그인_시도 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class LoginAttempt extends TableImpl { @@ -50,36 +52,36 @@ public Class getRecordType() { } /** - * The column public.login_attempt.id. + * The column public.login_attempt.id. 로그인 시도 ID */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID, this, ""); + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "로그인 시도 ID"); /** - * The column public.login_attempt.email. + * The column public.login_attempt.email. 로그인 시도한 이메일 */ - public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255), this, ""); + public final TableField EMAIL = createField(DSL.name("email"), SQLDataType.VARCHAR(255).nullable(false), this, "로그인 시도한 이메일"); /** - * The column public.login_attempt.result. + * The column public.login_attempt.result. 로그인 시도 후 결과 */ - public final TableField RESULT = createField(DSL.name("result"), SQLDataType.VARCHAR(10), this, ""); + public final TableField RESULT = createField(DSL.name("result"), SQLDataType.VARCHAR(10).nullable(false), this, "로그인 시도 후 결과"); /** * The column public.login_attempt.created_at. */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); /** * The column public.login_attempt.updated_at. */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, ""); private LoginAttempt(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } private LoginAttempt(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + super(alias, null, aliased, parameters, DSL.comment("로그인_시도"), TableOptions.table(), where); } /** @@ -108,6 +110,11 @@ public Schema getSchema() { return aliased() ? null : Public.PUBLIC; } + @Override + public UniqueKey getPrimaryKey() { + return Keys.LOGIN_ATTEMPT_PK; + } + @Override public LoginAttempt as(String alias) { return new LoginAttempt(DSL.name(alias), this); diff --git a/domain/src/main/generated/writeon/tables/Member.java b/domain/src/main/generated/writeon/tables/Member.java index 0ccd62d..c4672fc 100644 --- a/domain/src/main/generated/writeon/tables/Member.java +++ b/domain/src/main/generated/writeon/tables/Member.java @@ -66,7 +66,7 @@ public Class getRecordType() { /** * The column public.member.nickname. 회원 닉네임 */ - public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(10).nullable(false), this, "회원 닉네임"); + public final TableField NICKNAME = createField(DSL.name("nickname"), SQLDataType.VARCHAR(20).nullable(false), this, "회원 닉네임"); /** * The column public.member.profile_image. 회원 프로필 이미지 경로 diff --git a/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java deleted file mode 100644 index d99e0bb..0000000 --- a/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writeon.tables; - - -import org.jooq.Condition; -import org.jooq.Field; -import org.jooq.Name; -import org.jooq.Schema; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.TableOptions; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -import writeon.Public; -import writeon.tables.records.PgpArmorHeadersRecord; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeaders extends TableImpl { - - private static final long serialVersionUID = 1L; - - /** - * The reference instance of public.pgp_armor_headers - */ - public static final PgpArmorHeaders PGP_ARMOR_HEADERS = new PgpArmorHeaders(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return PgpArmorHeadersRecord.class; - } - - /** - * The column public.pgp_armor_headers.key. - */ - public final TableField KEY = createField(DSL.name("key"), SQLDataType.CLOB, this, ""); - - /** - * The column public.pgp_armor_headers.value. - */ - public final TableField VALUE = createField(DSL.name("value"), SQLDataType.CLOB, this, ""); - - private PgpArmorHeaders(Name alias, Table aliased) { - this(alias, aliased, new Field[] { - DSL.val(null, SQLDataType.CLOB) - }); - } - - private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters) { - this(alias, aliased, parameters, null); - } - - private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.function(), where); - } - - /** - * Create an aliased public.pgp_armor_headers table reference - */ - public PgpArmorHeaders(String alias) { - this(DSL.name(alias), PGP_ARMOR_HEADERS); - } - - /** - * Create an aliased public.pgp_armor_headers table reference - */ - public PgpArmorHeaders(Name alias) { - this(alias, PGP_ARMOR_HEADERS); - } - - /** - * Create a public.pgp_armor_headers table reference - */ - public PgpArmorHeaders() { - this(DSL.name("pgp_armor_headers"), null); - } - - @Override - public Schema getSchema() { - return aliased() ? null : Public.PUBLIC; - } - - @Override - public PgpArmorHeaders as(String alias) { - return new PgpArmorHeaders(DSL.name(alias), this, parameters); - } - - @Override - public PgpArmorHeaders as(Name alias) { - return new PgpArmorHeaders(alias, this, parameters); - } - - @Override - public PgpArmorHeaders as(Table alias) { - return new PgpArmorHeaders(alias.getQualifiedName(), this, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(String name) { - return new PgpArmorHeaders(DSL.name(name), null, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(Name name) { - return new PgpArmorHeaders(name, null, parameters); - } - - /** - * Rename this table - */ - @Override - public PgpArmorHeaders rename(Table name) { - return new PgpArmorHeaders(name.getQualifiedName(), null, parameters); - } - - /** - * Call this table-valued function - */ - public PgpArmorHeaders call( - String __1 - ) { - PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { - DSL.val(__1, SQLDataType.CLOB) - }); - - return aliased() ? result.as(getUnqualifiedName()) : result; - } - - /** - * Call this table-valued function - */ - public PgpArmorHeaders call( - Field __1 - ) { - PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { - __1 - }); - - return aliased() ? result.as(getUnqualifiedName()) : result; - } -} diff --git a/domain/src/main/generated/writeon/tables/ProductMemo.java b/domain/src/main/generated/writeon/tables/ProductMemo.java index 81b2401..ae2a5e9 100644 --- a/domain/src/main/generated/writeon/tables/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/ProductMemo.java @@ -61,6 +61,11 @@ public Class getRecordType() { */ public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); + /** + * The column public.product_memo.title. 제목 + */ + public final TableField TITLE = createField(DSL.name("title"), SQLDataType.VARCHAR(100), this, "제목"); + /** * The column public.product_memo.content. 내용 */ @@ -82,9 +87,9 @@ public Class getRecordType() { public final TableField END_INDEX = createField(DSL.name("end_index"), SQLDataType.INTEGER.nullable(false), this, ""); /** - * The column public.product_memo.is_completed. 완료여부 + * The column public.product_memo.is_completed. 완료 여부 */ - public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false), this, "완료여부"); + public final TableField IS_COMPLETED = createField(DSL.name("is_completed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "완료 여부"); /** * The column public.product_memo.created_at. 생성일시 diff --git a/domain/src/main/generated/writeon/tables/pojos/Assistant.java b/domain/src/main/generated/writeon/tables/pojos/Assistant.java index 3bab716..2b9f85e 100644 --- a/domain/src/main/generated/writeon/tables/pojos/Assistant.java +++ b/domain/src/main/generated/writeon/tables/pojos/Assistant.java @@ -10,7 +10,7 @@ /** - * 어시스턴트 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Assistant implements Serializable { @@ -21,20 +21,20 @@ public class Assistant implements Serializable { private final UUID productId; private final String type; private final String status; + private final Boolean isApplied; private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; - private final UUID updatedBy; public Assistant(Assistant value) { this.id = value.id; this.productId = value.productId; this.type = value.type; this.status = value.status; + this.isApplied = value.isApplied; this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; - this.updatedBy = value.updatedBy; } public Assistant( @@ -42,19 +42,19 @@ public Assistant( UUID productId, String type, String status, + Boolean isApplied, LocalDateTime createdAt, UUID createdBy, - LocalDateTime updatedAt, - UUID updatedBy + LocalDateTime updatedAt ) { this.id = id; this.productId = productId; this.type = type; this.status = status; + this.isApplied = isApplied; this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; - this.updatedBy = updatedBy; } /** @@ -65,35 +65,42 @@ public UUID getId() { } /** - * Getter for public.assistant.product_id. 작품 ID + * Getter for public.assistant.product_id. */ public UUID getProductId() { return this.productId; } /** - * Getter for public.assistant.type. 기능 종류 + * Getter for public.assistant.type. */ public String getType() { return this.type; } /** - * Getter for public.assistant.status. 진행 상태 + * Getter for public.assistant.status. */ public String getStatus() { return this.status; } /** - * Getter for public.assistant.created_at. 수정일시 + * Getter for public.assistant.is_applied. + */ + public Boolean getIsApplied() { + return this.isApplied; + } + + /** + * Getter for public.assistant.created_at. */ public LocalDateTime getCreatedAt() { return this.createdAt; } /** - * Getter for public.assistant.created_by. 수정자 ID + * Getter for public.assistant.created_by. */ public UUID getCreatedBy() { return this.createdBy; @@ -106,13 +113,6 @@ public LocalDateTime getUpdatedAt() { return this.updatedAt; } - /** - * Getter for public.assistant.updated_by. - */ - public UUID getUpdatedBy() { - return this.updatedBy; - } - @Override public boolean equals(Object obj) { if (this == obj) @@ -146,6 +146,12 @@ else if (!this.type.equals(other.type)) } else if (!this.status.equals(other.status)) return false; + if (this.isApplied == null) { + if (other.isApplied != null) + return false; + } + else if (!this.isApplied.equals(other.isApplied)) + return false; if (this.createdAt == null) { if (other.createdAt != null) return false; @@ -164,12 +170,6 @@ else if (!this.createdBy.equals(other.createdBy)) } else if (!this.updatedAt.equals(other.updatedAt)) return false; - if (this.updatedBy == null) { - if (other.updatedBy != null) - return false; - } - else if (!this.updatedBy.equals(other.updatedBy)) - return false; return true; } @@ -181,10 +181,10 @@ public int hashCode() { result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); result = prime * result + ((this.type == null) ? 0 : this.type.hashCode()); result = prime * result + ((this.status == null) ? 0 : this.status.hashCode()); + result = prime * result + ((this.isApplied == null) ? 0 : this.isApplied.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); - result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); return result; } @@ -196,10 +196,10 @@ public String toString() { sb.append(", ").append(productId); sb.append(", ").append(type); sb.append(", ").append(status); + sb.append(", ").append(isApplied); sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); - sb.append(", ").append(updatedBy); sb.append(")"); return sb.toString(); diff --git a/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java index d5135d1..27048bb 100644 --- a/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java +++ b/domain/src/main/generated/writeon/tables/pojos/LoginAttempt.java @@ -10,7 +10,7 @@ /** - * This class is generated by jOOQ. + * 로그인_시도 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class LoginAttempt implements Serializable { @@ -46,21 +46,21 @@ public LoginAttempt( } /** - * Getter for public.login_attempt.id. + * Getter for public.login_attempt.id. 로그인 시도 ID */ public UUID getId() { return this.id; } /** - * Getter for public.login_attempt.email. + * Getter for public.login_attempt.email. 로그인 시도한 이메일 */ public String getEmail() { return this.email; } /** - * Getter for public.login_attempt.result. + * Getter for public.login_attempt.result. 로그인 시도 후 결과 */ public String getResult() { return this.result; diff --git a/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java deleted file mode 100644 index feaccdf..0000000 --- a/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writeon.tables.pojos; - - -import java.io.Serializable; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeaders implements Serializable { - - private static final long serialVersionUID = 1L; - - private final String key; - private final String value; - - public PgpArmorHeaders(PgpArmorHeaders value) { - this.key = value.key; - this.value = value.value; - } - - public PgpArmorHeaders( - String key, - String value - ) { - this.key = key; - this.value = value; - } - - /** - * Getter for public.pgp_armor_headers.key. - */ - public String getKey() { - return this.key; - } - - /** - * Getter for public.pgp_armor_headers.value. - */ - public String getValue() { - return this.value; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final PgpArmorHeaders other = (PgpArmorHeaders) obj; - if (this.key == null) { - if (other.key != null) - return false; - } - else if (!this.key.equals(other.key)) - return false; - if (this.value == null) { - if (other.value != null) - return false; - } - else if (!this.value.equals(other.value)) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); - result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("PgpArmorHeaders ("); - - sb.append(key); - sb.append(", ").append(value); - - sb.append(")"); - return sb.toString(); - } -} diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java index dbafd9b..dad311b 100644 --- a/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductMemo.java @@ -19,6 +19,7 @@ public class ProductMemo implements Serializable { private final UUID id; private final UUID productId; + private final String title; private final String content; private final String selectedText; private final Integer startIndex; @@ -32,6 +33,7 @@ public class ProductMemo implements Serializable { public ProductMemo(ProductMemo value) { this.id = value.id; this.productId = value.productId; + this.title = value.title; this.content = value.content; this.selectedText = value.selectedText; this.startIndex = value.startIndex; @@ -46,6 +48,7 @@ public ProductMemo(ProductMemo value) { public ProductMemo( UUID id, UUID productId, + String title, String content, String selectedText, Integer startIndex, @@ -58,6 +61,7 @@ public ProductMemo( ) { this.id = id; this.productId = productId; + this.title = title; this.content = content; this.selectedText = selectedText; this.startIndex = startIndex; @@ -83,6 +87,13 @@ public UUID getProductId() { return this.productId; } + /** + * Getter for public.product_memo.title. 제목 + */ + public String getTitle() { + return this.title; + } + /** * Getter for public.product_memo.content. 내용 */ @@ -112,7 +123,7 @@ public Integer getEndIndex() { } /** - * Getter for public.product_memo.is_completed. 완료여부 + * Getter for public.product_memo.is_completed. 완료 여부 */ public Boolean getIsCompleted() { return this.isCompleted; @@ -167,6 +178,12 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; + if (this.title == null) { + if (other.title != null) + return false; + } + else if (!this.title.equals(other.title)) + return false; if (this.content == null) { if (other.content != null) return false; @@ -230,6 +247,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.title == null) ? 0 : this.title.hashCode()); result = prime * result + ((this.content == null) ? 0 : this.content.hashCode()); result = prime * result + ((this.selectedText == null) ? 0 : this.selectedText.hashCode()); result = prime * result + ((this.startIndex == null) ? 0 : this.startIndex.hashCode()); @@ -248,6 +266,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); + sb.append(", ").append(title); sb.append(", ").append(content); sb.append(", ").append(selectedText); sb.append(", ").append(startIndex); diff --git a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java index c9ce9be..4c716e8 100644 --- a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java +++ b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java @@ -7,17 +7,16 @@ import java.time.LocalDateTime; import java.util.UUID; -import org.jooq.Record1; -import org.jooq.impl.UpdatableRecordImpl; +import org.jooq.impl.TableRecordImpl; import writeon.tables.Assistant; /** - * 어시스턴트 + * This class is generated by jOOQ. */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class AssistantRecord extends UpdatableRecordImpl { +public class AssistantRecord extends TableRecordImpl { private static final long serialVersionUID = 1L; @@ -37,7 +36,7 @@ public UUID getId() { } /** - * Setter for public.assistant.product_id. 작품 ID + * Setter for public.assistant.product_id. */ public AssistantRecord setProductId(UUID value) { set(1, value); @@ -45,14 +44,14 @@ public AssistantRecord setProductId(UUID value) { } /** - * Getter for public.assistant.product_id. 작품 ID + * Getter for public.assistant.product_id. */ public UUID getProductId() { return (UUID) get(1); } /** - * Setter for public.assistant.type. 기능 종류 + * Setter for public.assistant.type. */ public AssistantRecord setType(String value) { set(2, value); @@ -60,14 +59,14 @@ public AssistantRecord setType(String value) { } /** - * Getter for public.assistant.type. 기능 종류 + * Getter for public.assistant.type. */ public String getType() { return (String) get(2); } /** - * Setter for public.assistant.status. 진행 상태 + * Setter for public.assistant.status. */ public AssistantRecord setStatus(String value) { set(3, value); @@ -75,79 +74,70 @@ public AssistantRecord setStatus(String value) { } /** - * Getter for public.assistant.status. 진행 상태 + * Getter for public.assistant.status. */ public String getStatus() { return (String) get(3); } /** - * Setter for public.assistant.created_at. 수정일시 + * Setter for public.assistant.is_applied. */ - public AssistantRecord setCreatedAt(LocalDateTime value) { + public AssistantRecord setIsApplied(Boolean value) { set(4, value); return this; } /** - * Getter for public.assistant.created_at. 수정일시 + * Getter for public.assistant.is_applied. */ - public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(4); + public Boolean getIsApplied() { + return (Boolean) get(4); } /** - * Setter for public.assistant.created_by. 수정자 ID + * Setter for public.assistant.created_at. */ - public AssistantRecord setCreatedBy(UUID value) { + public AssistantRecord setCreatedAt(LocalDateTime value) { set(5, value); return this; } /** - * Getter for public.assistant.created_by. 수정자 ID + * Getter for public.assistant.created_at. */ - public UUID getCreatedBy() { - return (UUID) get(5); + public LocalDateTime getCreatedAt() { + return (LocalDateTime) get(5); } /** - * Setter for public.assistant.updated_at. + * Setter for public.assistant.created_by. */ - public AssistantRecord setUpdatedAt(LocalDateTime value) { + public AssistantRecord setCreatedBy(UUID value) { set(6, value); return this; } /** - * Getter for public.assistant.updated_at. + * Getter for public.assistant.created_by. */ - public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(6); + public UUID getCreatedBy() { + return (UUID) get(6); } /** - * Setter for public.assistant.updated_by. + * Setter for public.assistant.updated_at. */ - public AssistantRecord setUpdatedBy(UUID value) { + public AssistantRecord setUpdatedAt(LocalDateTime value) { set(7, value); return this; } /** - * Getter for public.assistant.updated_by. + * Getter for public.assistant.updated_at. */ - public UUID getUpdatedBy() { - return (UUID) get(7); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - @Override - public Record1 key() { - return (Record1) super.key(); + public LocalDateTime getUpdatedAt() { + return (LocalDateTime) get(7); } // ------------------------------------------------------------------------- @@ -164,17 +154,17 @@ public AssistantRecord() { /** * Create a detached, initialised AssistantRecord */ - public AssistantRecord(UUID id, UUID productId, String type, String status, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public AssistantRecord(UUID id, UUID productId, String type, String status, Boolean isApplied, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt) { super(Assistant.ASSISTANT); setId(id); setProductId(productId); setType(type); setStatus(status); + setIsApplied(isApplied); setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); - setUpdatedBy(updatedBy); resetChangedOnNotNull(); } @@ -189,10 +179,10 @@ public AssistantRecord(writeon.tables.pojos.Assistant value) { setProductId(value.getProductId()); setType(value.getType()); setStatus(value.getStatus()); + setIsApplied(value.getIsApplied()); setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); - setUpdatedBy(value.getUpdatedBy()); resetChangedOnNotNull(); } } diff --git a/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java index a6247d0..d24cca5 100644 --- a/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java +++ b/domain/src/main/generated/writeon/tables/records/LoginAttemptRecord.java @@ -7,21 +7,22 @@ import java.time.OffsetDateTime; import java.util.UUID; -import org.jooq.impl.TableRecordImpl; +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; import writeon.tables.LoginAttempt; /** - * This class is generated by jOOQ. + * 로그인_시도 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class LoginAttemptRecord extends TableRecordImpl { +public class LoginAttemptRecord extends UpdatableRecordImpl { private static final long serialVersionUID = 1L; /** - * Setter for public.login_attempt.id. + * Setter for public.login_attempt.id. 로그인 시도 ID */ public LoginAttemptRecord setId(UUID value) { set(0, value); @@ -29,14 +30,14 @@ public LoginAttemptRecord setId(UUID value) { } /** - * Getter for public.login_attempt.id. + * Getter for public.login_attempt.id. 로그인 시도 ID */ public UUID getId() { return (UUID) get(0); } /** - * Setter for public.login_attempt.email. + * Setter for public.login_attempt.email. 로그인 시도한 이메일 */ public LoginAttemptRecord setEmail(String value) { set(1, value); @@ -44,14 +45,14 @@ public LoginAttemptRecord setEmail(String value) { } /** - * Getter for public.login_attempt.email. + * Getter for public.login_attempt.email. 로그인 시도한 이메일 */ public String getEmail() { return (String) get(1); } /** - * Setter for public.login_attempt.result. + * Setter for public.login_attempt.result. 로그인 시도 후 결과 */ public LoginAttemptRecord setResult(String value) { set(2, value); @@ -59,7 +60,7 @@ public LoginAttemptRecord setResult(String value) { } /** - * Getter for public.login_attempt.result. + * Getter for public.login_attempt.result. 로그인 시도 후 결과 */ public String getResult() { return (String) get(2); @@ -95,6 +96,15 @@ public OffsetDateTime getUpdatedAt() { return (OffsetDateTime) get(4); } + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- diff --git a/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java b/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java deleted file mode 100644 index 8e9c402..0000000 --- a/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package writeon.tables.records; - - -import org.jooq.impl.TableRecordImpl; - -import writeon.tables.PgpArmorHeaders; - - -/** - * This class is generated by jOOQ. - */ -@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class PgpArmorHeadersRecord extends TableRecordImpl { - - private static final long serialVersionUID = 1L; - - /** - * Setter for public.pgp_armor_headers.key. - */ - public PgpArmorHeadersRecord setKey(String value) { - set(0, value); - return this; - } - - /** - * Getter for public.pgp_armor_headers.key. - */ - public String getKey() { - return (String) get(0); - } - - /** - * Setter for public.pgp_armor_headers.value. - */ - public PgpArmorHeadersRecord setValue(String value) { - set(1, value); - return this; - } - - /** - * Getter for public.pgp_armor_headers.value. - */ - public String getValue() { - return (String) get(1); - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord() { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - } - - /** - * Create a detached, initialised PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord(String key, String value) { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - - setKey(key); - setValue(value); - resetChangedOnNotNull(); - } - - /** - * Create a detached, initialised PgpArmorHeadersRecord - */ - public PgpArmorHeadersRecord(writeon.tables.pojos.PgpArmorHeaders value) { - super(PgpArmorHeaders.PGP_ARMOR_HEADERS); - - if (value != null) { - setKey(value.getKey()); - setValue(value.getValue()); - resetChangedOnNotNull(); - } - } -} diff --git a/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java index f997720..1dd6acf 100644 --- a/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductMemoRecord.java @@ -51,11 +51,26 @@ public UUID getProductId() { return (UUID) get(1); } + /** + * Setter for public.product_memo.title. 제목 + */ + public ProductMemoRecord setTitle(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.product_memo.title. 제목 + */ + public String getTitle() { + return (String) get(2); + } + /** * Setter for public.product_memo.content. 내용 */ public ProductMemoRecord setContent(String value) { - set(2, value); + set(3, value); return this; } @@ -63,14 +78,14 @@ public ProductMemoRecord setContent(String value) { * Getter for public.product_memo.content. 내용 */ public String getContent() { - return (String) get(2); + return (String) get(3); } /** * Setter for public.product_memo.selected_text. */ public ProductMemoRecord setSelectedText(String value) { - set(3, value); + set(4, value); return this; } @@ -78,14 +93,14 @@ public ProductMemoRecord setSelectedText(String value) { * Getter for public.product_memo.selected_text. */ public String getSelectedText() { - return (String) get(3); + return (String) get(4); } /** * Setter for public.product_memo.start_index. */ public ProductMemoRecord setStartIndex(Integer value) { - set(4, value); + set(5, value); return this; } @@ -93,14 +108,14 @@ public ProductMemoRecord setStartIndex(Integer value) { * Getter for public.product_memo.start_index. */ public Integer getStartIndex() { - return (Integer) get(4); + return (Integer) get(5); } /** * Setter for public.product_memo.end_index. */ public ProductMemoRecord setEndIndex(Integer value) { - set(5, value); + set(6, value); return this; } @@ -108,29 +123,29 @@ public ProductMemoRecord setEndIndex(Integer value) { * Getter for public.product_memo.end_index. */ public Integer getEndIndex() { - return (Integer) get(5); + return (Integer) get(6); } /** - * Setter for public.product_memo.is_completed. 완료여부 + * Setter for public.product_memo.is_completed. 완료 여부 */ public ProductMemoRecord setIsCompleted(Boolean value) { - set(6, value); + set(7, value); return this; } /** - * Getter for public.product_memo.is_completed. 완료여부 + * Getter for public.product_memo.is_completed. 완료 여부 */ public Boolean getIsCompleted() { - return (Boolean) get(6); + return (Boolean) get(7); } /** * Setter for public.product_memo.created_at. 생성일시 */ public ProductMemoRecord setCreatedAt(LocalDateTime value) { - set(7, value); + set(8, value); return this; } @@ -138,14 +153,14 @@ public ProductMemoRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_memo.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(7); + return (LocalDateTime) get(8); } /** * Setter for public.product_memo.created_by. 생성자 ID */ public ProductMemoRecord setCreatedBy(UUID value) { - set(8, value); + set(9, value); return this; } @@ -153,14 +168,14 @@ public ProductMemoRecord setCreatedBy(UUID value) { * Getter for public.product_memo.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(8); + return (UUID) get(9); } /** * Setter for public.product_memo.updated_at. 수정일시 */ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { - set(9, value); + set(10, value); return this; } @@ -168,14 +183,14 @@ public ProductMemoRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_memo.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(9); + return (LocalDateTime) get(10); } /** * Setter for public.product_memo.updated_by. 수정일시 */ public ProductMemoRecord setUpdatedBy(UUID value) { - set(10, value); + set(11, value); return this; } @@ -183,7 +198,7 @@ public ProductMemoRecord setUpdatedBy(UUID value) { * Getter for public.product_memo.updated_by. 수정일시 */ public UUID getUpdatedBy() { - return (UUID) get(10); + return (UUID) get(11); } // ------------------------------------------------------------------------- @@ -209,11 +224,12 @@ public ProductMemoRecord() { /** * Create a detached, initialised ProductMemoRecord */ - public ProductMemoRecord(UUID id, UUID productId, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductMemoRecord(UUID id, UUID productId, String title, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { super(ProductMemo.PRODUCT_MEMO); setId(id); setProductId(productId); + setTitle(title); setContent(content); setSelectedText(selectedText); setStartIndex(startIndex); @@ -235,6 +251,7 @@ public ProductMemoRecord(writeon.tables.pojos.ProductMemo value) { if (value != null) { setId(value.getId()); setProductId(value.getProductId()); + setTitle(value.getTitle()); setContent(value.getContent()); setSelectedText(value.getSelectedText()); setStartIndex(value.getStartIndex()); diff --git a/domain/src/main/java/writeon/domain/assistant/Assistant.java b/domain/src/main/java/writeon/domain/assistant/Assistant.java index 49b4e23..3ee234a 100644 --- a/domain/src/main/java/writeon/domain/assistant/Assistant.java +++ b/domain/src/main/java/writeon/domain/assistant/Assistant.java @@ -1,47 +1,58 @@ -package writeon.domain.assistant; - -import jakarta.persistence.*; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.domain.assistant.enums.AssistantType; -import writeon.domain.common.BaseTimeEntity; - -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor -@Table(name = "assistant") -public class Assistant extends BaseTimeEntity { - - @Id - @Column(name = "id", updatable = false) - private final UUID id = UUID.randomUUID(); - - @Column(name = "product_id", updatable = false, nullable = false) - private UUID productId; - - @Convert(converter = AssistantType.TypeCodeConverter.class) - @Column(name = "type", nullable = false) - private AssistantType type; - - @Convert(converter = AssistantStatus.TypeCodeConverter.class) - @Column(name = "status", nullable = false) - private AssistantStatus status = AssistantStatus.DRAFT; - - @Column(name = "created_by", updatable = false, nullable = false) - private UUID createdBy; - - @Builder - public Assistant(UUID productId, AssistantType type, UUID createdBy) { - this.productId = productId; - this.type = type; - this.createdBy = createdBy; - } - - public void updateStatus(AssistantStatus status) { - this.status = status; - } -} +package writeon.domain.assistant; + +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.common.BaseTimeEntity; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "assistant") +public class Assistant extends BaseTimeEntity { + + @Id + @Column(name = "id", updatable = false) + private final UUID id = UUID.randomUUID(); + + @Column(name = "product_id", updatable = false, nullable = false) + private UUID productId; + + @Convert(converter = AssistantType.TypeCodeConverter.class) + @Column(name = "type", nullable = false) + private AssistantType type; + + @Convert(converter = AssistantStatus.TypeCodeConverter.class) + @Column(name = "status", nullable = false) + private AssistantStatus status = AssistantStatus.DRAFT; + + @Column(name = "is_applied", nullable = false) + private Boolean isApplied = Boolean.FALSE; + + @Column(name = "created_by", updatable = false, nullable = false) + private UUID createdBy; + + @Builder + public Assistant(UUID productId, AssistantType type, UUID createdBy) { + this.productId = productId; + this.type = type; + this.createdBy = createdBy; + } + + public void apply() { + this.isApplied = Boolean.TRUE; + } + + public void updateStatus(AssistantStatus status) { + this.status = status; + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java index 72d5db0..d43597d 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantException.java @@ -1,23 +1,25 @@ -package writeon.domain.assistant.enums; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import writeon.domain.common.enums.CodeInfo; - -@Getter -@RequiredArgsConstructor -public enum AssistantException implements CodeInfo { - - NOT_EXIST(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 Assistant입니다."), - NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-002", "존재하지 않는 메세지입니다."), - SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "SSE 데이터 전송 중 오류가 발생했습니다."), - ALREADY_ANSWERED(HttpStatus.BAD_REQUEST, "AI-004", "이미 응답된 메세지입니다."), - ALREADY_EVALUATED(HttpStatus.BAD_REQUEST, "AI-005", "이미 평가되었습니다."), - CANNOT_BE_COMPLETED(HttpStatus.BAD_REQUEST, "AI-006", "완료처리 할 수 없는 상태입니다."), - WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-007", "WebClient 요청 중 오류가 발생했습니다."); - - private final HttpStatus status; - private final String code; - private final String message; -} +package writeon.domain.assistant.enums; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import writeon.domain.common.enums.CodeInfo; + +@Getter +@RequiredArgsConstructor +public enum AssistantException implements CodeInfo { + + NOT_EXIST(HttpStatus.NOT_FOUND, "AI-001", "존재하지 않는 Assistant입니다."), + NOT_EXIST_MESSAGE(HttpStatus.NOT_FOUND, "AI-002", "존재하지 않는 메세지입니다."), + SSE_SEND_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-003", "SSE 데이터 전송 중 오류가 발생했습니다."), + ALREADY_ANSWERED(HttpStatus.BAD_REQUEST, "AI-004", "이미 응답된 메세지입니다."), + ALREADY_EVALUATED(HttpStatus.BAD_REQUEST, "AI-005", "이미 평가되었습니다."), + CANNOT_BE_COMPLETED(HttpStatus.BAD_REQUEST, "AI-006", "완료 처리할 수 없는 상태입니다."), + CANNOT_BE_APPLIED(HttpStatus.BAD_REQUEST, "AI-007", "적용 처리할 수 없는 상태입니다."), + WEBCLIENT_REQUEST_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "AI-008", "WebClient 요청 중 오류가 발생했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} From 59cbc569010d35f3db2f430dc33fbe6d1dee1842 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 2 Apr 2025 20:31:54 +0900 Subject: [PATCH 066/107] =?UTF-8?q?style:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EB=AC=B8=EA=B5=AC=20=EB=B3=80=EA=B2=BD=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/writeon/api/auth/helper/MailHelper.java | 4 ++-- .../main/resources/templates/mail/change-password.html | 6 +++--- api/src/main/resources/templates/mail/join.html | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/src/main/java/writeon/api/auth/helper/MailHelper.java b/api/src/main/java/writeon/api/auth/helper/MailHelper.java index 6db92d7..f0fc015 100644 --- a/api/src/main/java/writeon/api/auth/helper/MailHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/MailHelper.java @@ -36,8 +36,8 @@ public void send ( @Getter @RequiredArgsConstructor public enum MailType { - JOIN("[라이틀리] 계정을 인증해주세요!", "mail/join"), - CHANGE_PASSWORD("[라이틀리] 비밀번호 재설정 안내", "mail/change-password"); + JOIN("[라이트온] 계정을 인증해주세요!", "mail/join"), + CHANGE_PASSWORD("[라이트온] 비밀번호 재설정 안내", "mail/change-password"); private final String subject; private final String templatePath; diff --git a/api/src/main/resources/templates/mail/change-password.html b/api/src/main/resources/templates/mail/change-password.html index e4ec10e..db4a5df 100644 --- a/api/src/main/resources/templates/mail/change-password.html +++ b/api/src/main/resources/templates/mail/change-password.html @@ -10,7 +10,7 @@

비밀번호 재설정을 요청하셨나요? 아래 링크를 클릭하여 새 비밀번호를 설정해 주세요.
- 비밀번호 재설정하기 + 비밀번호 재설정하기

⚠️보안 주의사항 @@ -21,11 +21,11 @@

- 궁금한 점이 있다면 언제든지 writelyforwriters@gmail.com을 통해 문의해 주세요. + 궁금한 점이 있다면 언제든지 writeonforwriters@gmail.com을 통해 문의해 주세요.

감사합니다!
- 라이틀리 팀 드림 + 라이트온 팀 드림

diff --git a/api/src/main/resources/templates/mail/join.html b/api/src/main/resources/templates/mail/join.html index ec80797..f1a6f4b 100644 --- a/api/src/main/resources/templates/mail/join.html +++ b/api/src/main/resources/templates/mail/join.html @@ -7,24 +7,24 @@

안녕하세요, 님!
- 라이틀리에 가입해 주셔서 감사합니다. + 라이트온에 가입해 주셔서 감사합니다.

계정을 활성화하려면 아래 링크를 클릭하여 이메일 주소를 인증해 주세요.
- 이메일 인증하기 + 이메일 인증하기

위 버튼이 작동하지 않는다면 아래 링크를 복사하여 브라우저 주소창에 붙여넣어 주세요.
- https://writely-for-writers.co.kr/join/complete?joinToken= + https://writeon.ai.kr/join/complete?joinToken=

이메일 인증은 보안을 위해 필수 절차이며, 일정 시간 내에 완료되지 않으면 계정이 비활성화될 수 있습니다.
- 궁금한 점이 있다면 언제든지 writelyforwriters@gmail.com을 통해 문의해 주세요. + 궁금한 점이 있다면 언제든지 writeonforwriters@gmail.com을 통해 문의해 주세요.

감사합니다!
- 라이틀리 팀 드림 + 라이트온 팀 드림

From 70e6a034adb1e9f945a2b60fe8f89887a6fc6c10 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 5 Apr 2025 13:57:44 +0900 Subject: [PATCH 067/107] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=97=90=EB=9F=AC=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=EC=B2=98=EB=A6=AC=20(#66)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/auth/response/LoginFailResponse.java | 5 + .../api/auth/service/AuthCommandService.java | 27 +- .../api/common/exception/BaseException.java | 7 + .../handler/GlobalExceptionHandler.java | 51 +- .../api/common/response/BaseResponse.java | 8 + .../writeon/api/common/util/DateTimeUtil.java | 1 + domain/src/main/generated/writeon/Keys.java | 3 + domain/src/main/generated/writeon/Public.java | 47 +- .../src/main/generated/writeon/Routines.java | 1704 +++++++++++++++++ domain/src/main/generated/writeon/Tables.java | 47 +- .../generated/writeon/tables/Assistant.java | 39 +- .../writeon/tables/PgpArmorHeaders.java | 157 ++ .../writeon/tables/pojos/Assistant.java | 14 +- .../writeon/tables/pojos/PgpArmorHeaders.java | 91 + .../tables/records/AssistantRecord.java | 40 +- .../tables/records/PgpArmorHeadersRecord.java | 84 + .../domain/auth/enums/AuthException.java | 5 +- 17 files changed, 2260 insertions(+), 70 deletions(-) create mode 100644 domain/src/main/generated/writeon/Routines.java create mode 100644 domain/src/main/generated/writeon/tables/PgpArmorHeaders.java create mode 100644 domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java create mode 100644 domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java diff --git a/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java index a8c4e61..0fddfdb 100644 --- a/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java +++ b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java @@ -5,10 +5,15 @@ import lombok.Getter; import lombok.Setter; +import java.time.LocalDateTime; + @Getter @Setter @AllArgsConstructor public class LoginFailResponse { @Schema(title = "남은 로그인 시도 횟수", requiredMode = Schema.RequiredMode.REQUIRED, example = "4") private int remainingAttempts; + + @Schema(title = "로그인 가능 시각", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2025-04-05T14:41:10.626943") + private LocalDateTime availableLoginAt; } diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index 0d4408d..c314941 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -12,6 +12,7 @@ import writeon.api.auth.request.*; import writeon.api.auth.response.LoginFailResponse; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.DateTimeUtil; import writeon.api.terms.request.TermsAgreeRequest; import writeon.api.terms.service.TermsQueryService; import writeon.domain.auth.*; @@ -32,6 +33,7 @@ import writeon.domain.terms.repository.TermsAgreeJpaRepository; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.UUID; @@ -80,13 +82,19 @@ public AuthTokenDto login(LoginRequest request) { .orElseThrow(() -> new BaseException(AuthException.AUTH_FAILED_BY_UNKNOWN_ERROR)); List lastFiveAttempts = loginAttemptJpaRepository.findTop5ByEmailOrderByCreatedAtDesc(request.getEmail()); + LoginAttempt lastAttempt = lastFiveAttempts.getFirst(); // 로그인 시도가 블락 상태이고, 블락 시간으로부터 1시간이 지나지 않은 경우 if ( !lastFiveAttempts.isEmpty() - && lastFiveAttempts.getFirst().getResult() == LoginAttemptResultType.BLOCKED - && lastFiveAttempts.getFirst().getCreatedAt().isAfter(LocalDateTime.now().minusHours(1)) + && lastAttempt.getResult() == LoginAttemptResultType.BLOCKED + && lastAttempt.getCreatedAt().isAfter(LocalDateTime.now().minusHours(1)) ) { - throw new BaseException(AuthException.LOGIN_BLOCKED); + LocalDateTime loginAvailableAt = lastAttempt.getCreatedAt().plusHours(1); + throw new BaseException( + AuthException.LOGIN_BLOCKED, + new LoginFailResponse(0, loginAvailableAt), + String.format("로그인 5회 실패로 [%s]까지 접속이 제한됩니다.", loginAvailableAt.format(DateTimeFormatter.ofPattern(DateTimeUtil.DATETIME_HOUR_ONLY_KR_PATTERN))) + ); } LoginAttempt newLoginAttempt = new LoginAttempt(); @@ -107,7 +115,18 @@ public AuthTokenDto login(LoginRequest request) { : LoginAttemptResultType.FAILED ); loginAttemptJpaRepository.save(newLoginAttempt); - throw new BaseException(AuthException.LOGIN_FAILED, new LoginFailResponse(attemptsRemaining)); + if (attemptsRemaining == 0) { + LocalDateTime now = LocalDateTime.now(); + throw new BaseException( + AuthException.LOGIN_BLOCKED, + new LoginFailResponse(0, now), + String.format("로그인 5회 실패로 [%s]까지 접속이 제한됩니다.", now.format(DateTimeFormatter.ofPattern(DateTimeUtil.DATETIME_HOUR_ONLY_KR_PATTERN))) + ); + } else if (attemptsRemaining > 2) { + throw new BaseException(AuthException.LOGIN_FAILED, new LoginFailResponse(attemptsRemaining, null)); + } else { + throw new BaseException(AuthException.LOGIN_FAILED_WITH_WARNING, new LoginFailResponse(attemptsRemaining, null)); + } } newLoginAttempt.setResult(LoginAttemptResultType.SUCCEED); diff --git a/api/src/main/java/writeon/api/common/exception/BaseException.java b/api/src/main/java/writeon/api/common/exception/BaseException.java index d342082..909a28a 100644 --- a/api/src/main/java/writeon/api/common/exception/BaseException.java +++ b/api/src/main/java/writeon/api/common/exception/BaseException.java @@ -8,6 +8,7 @@ public class BaseException extends RuntimeException { private CodeInfo codeInfo; private Object extraParams; + private String customMessage; public BaseException() { } @@ -21,6 +22,12 @@ public BaseException(CodeInfo codeInfo, Object extraParams) { this.extraParams = extraParams; } + public BaseException(CodeInfo codeInfo, Object extraParams, String customMessage) { + this.codeInfo = codeInfo; + this.extraParams = extraParams; + this.customMessage = customMessage; + } + @Override public String toString() { return "BaseException [status=" + codeInfo.getStatus().value() + ", code=" + codeInfo.getCode() + ", message=" + codeInfo.getMessage() + "]"; diff --git a/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java b/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java index 1c3f8bc..2cb280c 100644 --- a/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java +++ b/api/src/main/java/writeon/api/common/exception/handler/GlobalExceptionHandler.java @@ -23,30 +23,33 @@ public ResponseEntity> handle(Exception e) { HttpStatus status = null; BaseResponse response = null; - if (e instanceof BaseException ex) { - status = ex.getCodeInfo().getStatus(); - response = BaseResponse.failure(ex.getCodeInfo(), ex.getExtraParams()); - } - else if (e instanceof MethodArgumentNotValidException ex) { - CodeInfo codeInfo = ResultCodeInfo.BAD_REQUEST; - - status = codeInfo.getStatus(); - response = BaseResponse.failure(codeInfo); - String responseMessage = codeInfo.getMessage() - + " " - + ex.getBindingResult() - .getFieldErrors() - .stream() - .map(error -> error.getField() + " 이(가)" + error.getDefaultMessage()) - .collect(Collectors.joining(" ")); - response.setMessage(responseMessage); - } - - if (status == null) { - status = ResultCodeInfo.FAILURE.getStatus(); - } - if (response == null) { - response = BaseResponse.failure(ResultCodeInfo.FAILURE); + switch (e) { + case BaseException ex -> { + status = ex.getCodeInfo().getStatus(); + response = BaseResponse.failure(ex.getCodeInfo(), ex.getExtraParams()); + if (ex.getCustomMessage() != null) { + response.setMessage(ex.getCustomMessage()); + } + } + + case MethodArgumentNotValidException ex -> { + CodeInfo codeInfo = ResultCodeInfo.BAD_REQUEST; + status = codeInfo.getStatus(); + response = BaseResponse.failure(codeInfo); + String responseMessage = codeInfo.getMessage() + + " " + + ex.getBindingResult() + .getFieldErrors() + .stream() + .map(error -> error.getField() + " 이(가)" + error.getDefaultMessage()) + .collect(Collectors.joining(" ")); + response.setMessage(responseMessage); + } + + default -> { + status = ResultCodeInfo.FAILURE.getStatus(); + response = BaseResponse.failure(ResultCodeInfo.FAILURE); + } } return new ResponseEntity<>(response, status); diff --git a/api/src/main/java/writeon/api/common/response/BaseResponse.java b/api/src/main/java/writeon/api/common/response/BaseResponse.java index ffb54cf..86439f7 100644 --- a/api/src/main/java/writeon/api/common/response/BaseResponse.java +++ b/api/src/main/java/writeon/api/common/response/BaseResponse.java @@ -55,4 +55,12 @@ public static BaseResponse failure(CodeInfo codeInfo, T extraParams) { return res; } + public static BaseResponse failure(CodeInfo codeInfo, T extraParams, String customMessage) { + BaseResponse res = new BaseResponse<>(); + res.code = codeInfo.getCode(); + res.message = customMessage; + res.result = extraParams; + return res; + } + } \ No newline at end of file diff --git a/api/src/main/java/writeon/api/common/util/DateTimeUtil.java b/api/src/main/java/writeon/api/common/util/DateTimeUtil.java index a582dfe..a413f93 100644 --- a/api/src/main/java/writeon/api/common/util/DateTimeUtil.java +++ b/api/src/main/java/writeon/api/common/util/DateTimeUtil.java @@ -20,6 +20,7 @@ public class DateTimeUtil { public final String DATE_DOT_PATTERN = "yyyy.MM.dd"; public final String DATETIME_DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss"; + public final String DATETIME_HOUR_ONLY_KR_PATTERN = "yyyy년 MM월 dd일 HH시"; public final TimeZone KOREA_TIME_ZONE = TimeZone.getTimeZone(ZoneId.of("Asia/Seoul")); diff --git a/domain/src/main/generated/writeon/Keys.java b/domain/src/main/generated/writeon/Keys.java index 6816dbe..379529d 100644 --- a/domain/src/main/generated/writeon/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -9,6 +9,7 @@ import org.jooq.impl.DSL; import org.jooq.impl.Internal; +import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; import writeon.tables.LoginAttempt; @@ -27,6 +28,7 @@ import writeon.tables.TermsAgreement; import writeon.tables.records.AssistantEvaluationRecord; import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantRecord; import writeon.tables.records.LoginAttemptRecord; import writeon.tables.records.MemberPasswordRecord; import writeon.tables.records.MemberRecord; @@ -54,6 +56,7 @@ public class Keys { // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- + public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey ASSISTANT_MESSAGE_PK = Internal.createUniqueKey(AssistantMessage.ASSISTANT_MESSAGE, DSL.name("assistant_message_pk"), new TableField[] { AssistantMessage.ASSISTANT_MESSAGE.ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index 9281812..2d1e534 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -8,6 +8,9 @@ import java.util.List; import org.jooq.Catalog; +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; import org.jooq.Table; import org.jooq.impl.SchemaImpl; @@ -17,6 +20,7 @@ import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; +import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -28,6 +32,7 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; +import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -44,7 +49,7 @@ public class Public extends SchemaImpl { public static final Public PUBLIC = new Public(); /** - * The table public.assistant. + * 어시스턴트 */ public final Assistant ASSISTANT = Assistant.ASSISTANT; @@ -73,6 +78,45 @@ public class Public extends SchemaImpl { */ public final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + /** + * The table public.pgp_armor_headers. + */ + public final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + /** * 작품 */ @@ -150,6 +194,7 @@ public final List> getTables() { LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, + PgpArmorHeaders.PGP_ARMOR_HEADERS, Product.PRODUCT, ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, diff --git a/domain/src/main/generated/writeon/Routines.java b/domain/src/main/generated/writeon/Routines.java new file mode 100644 index 0000000..370498c --- /dev/null +++ b/domain/src/main/generated/writeon/Routines.java @@ -0,0 +1,1704 @@ +/* + * This file is generated by jOOQ. + */ +package writeon; + + +import java.util.UUID; + +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + +import writeon.routines.Armor1; +import writeon.routines.Armor2; +import writeon.routines.Crypt; +import writeon.routines.Dearmor; +import writeon.routines.Decrypt; +import writeon.routines.DecryptIv; +import writeon.routines.Digest1; +import writeon.routines.Digest2; +import writeon.routines.Encrypt; +import writeon.routines.EncryptIv; +import writeon.routines.GenRandomBytes; +import writeon.routines.GenRandomUuid; +import writeon.routines.GenSalt1; +import writeon.routines.GenSalt2; +import writeon.routines.Hmac1; +import writeon.routines.Hmac2; +import writeon.routines.PgpKeyId; +import writeon.routines.PgpPubDecrypt1; +import writeon.routines.PgpPubDecrypt2; +import writeon.routines.PgpPubDecrypt3; +import writeon.routines.PgpPubDecryptBytea1; +import writeon.routines.PgpPubDecryptBytea2; +import writeon.routines.PgpPubDecryptBytea3; +import writeon.routines.PgpPubEncrypt1; +import writeon.routines.PgpPubEncrypt2; +import writeon.routines.PgpPubEncryptBytea1; +import writeon.routines.PgpPubEncryptBytea2; +import writeon.routines.PgpSymDecrypt1; +import writeon.routines.PgpSymDecrypt2; +import writeon.routines.PgpSymDecryptBytea1; +import writeon.routines.PgpSymDecryptBytea2; +import writeon.routines.PgpSymEncrypt1; +import writeon.routines.PgpSymEncrypt2; +import writeon.routines.PgpSymEncryptBytea1; +import writeon.routines.PgpSymEncryptBytea2; +import writeon.tables.PgpArmorHeaders; +import writeon.tables.records.PgpArmorHeadersRecord; + + +/** + * Convenience access to all stored procedures and functions in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Routines { + + /** + * Call public.armor + */ + public static String armor1( + Configuration configuration + , byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + byte[] __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor1( + Field __1 + ) { + Armor1 f = new Armor1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.armor + */ + public static String armor2( + Configuration configuration + , byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + byte[] __1 + , String[] __2 + , String[] __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.armor as a field. + */ + public static Field armor2( + Field __1 + , Field __2 + , Field __3 + ) { + Armor2 f = new Armor2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.crypt + */ + public static String crypt( + Configuration configuration + , String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + String __1 + , String __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.crypt as a field. + */ + public static Field crypt( + Field __1 + , Field __2 + ) { + Crypt f = new Crypt(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.dearmor + */ + public static byte[] dearmor( + Configuration configuration + , String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + String __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.dearmor as a field. + */ + public static Field dearmor( + Field __1 + ) { + Dearmor f = new Dearmor(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.decrypt + */ + public static byte[] decrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.decrypt as a field. + */ + public static Field decrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Decrypt f = new Decrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.decrypt_iv + */ + public static byte[] decryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.decrypt_iv as a field. + */ + public static Field decryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + DecryptIv f = new DecryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest1( + Configuration configuration + , String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + String __1 + , String __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest1( + Field __1 + , Field __2 + ) { + Digest1 f = new Digest1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.digest + */ + public static byte[] digest2( + Configuration configuration + , byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + byte[] __1 + , String __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.digest as a field. + */ + public static Field digest2( + Field __1 + , Field __2 + ) { + Digest2 f = new Digest2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.encrypt + */ + public static byte[] encrypt( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.encrypt as a field. + */ + public static Field encrypt( + Field __1 + , Field __2 + , Field __3 + ) { + Encrypt f = new Encrypt(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.encrypt_iv + */ + public static byte[] encryptIv( + Configuration configuration + , byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + byte[] __1 + , byte[] __2 + , byte[] __3 + , String __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.encrypt_iv as a field. + */ + public static Field encryptIv( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + EncryptIv f = new EncryptIv(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.gen_random_bytes + */ + public static byte[] genRandomBytes( + Configuration configuration + , Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Integer __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_random_bytes as a field. + */ + public static Field genRandomBytes( + Field __1 + ) { + GenRandomBytes f = new GenRandomBytes(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_random_uuid + */ + public static UUID genRandomUuid( + Configuration configuration + ) { + GenRandomUuid f = new GenRandomUuid(); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_random_uuid as a field. + */ + public static Field genRandomUuid() { + GenRandomUuid f = new GenRandomUuid(); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt1( + Configuration configuration + , String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + String __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt1( + Field __1 + ) { + GenSalt1 f = new GenSalt1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.gen_salt + */ + public static String genSalt2( + Configuration configuration + , String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + String __1 + , Integer __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.gen_salt as a field. + */ + public static Field genSalt2( + Field __1 + , Field __2 + ) { + GenSalt2 f = new GenSalt2(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac1( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + String __1 + , String __2 + , String __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac1( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac1 f = new Hmac1(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.hmac + */ + public static byte[] hmac2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.hmac as a field. + */ + public static Field hmac2( + Field __1 + , Field __2 + , Field __3 + ) { + Hmac2 f = new Hmac2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_key_id + */ + public static String pgpKeyId( + Configuration configuration + , byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + byte[] __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get public.pgp_key_id as a field. + */ + public static Field pgpKeyId( + Field __1 + ) { + PgpKeyId f = new PgpKeyId(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt1( + Field __1 + , Field __2 + ) { + PgpPubDecrypt1 f = new PgpPubDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecrypt2 f = new PgpPubDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt + */ + public static String pgpPubDecrypt3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt as a field. + */ + public static Field pgpPubDecrypt3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecrypt3 f = new PgpPubDecrypt3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubDecryptBytea1 f = new PgpPubDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubDecryptBytea2 f = new PgpPubDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_decrypt_bytea + */ + public static byte[] pgpPubDecryptBytea3( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + byte[] __1 + , byte[] __2 + , String __3 + , String __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Get public.pgp_pub_decrypt_bytea as a field. + */ + public static Field pgpPubDecryptBytea3( + Field __1 + , Field __2 + , Field __3 + , Field __4 + ) { + PgpPubDecryptBytea3 f = new PgpPubDecryptBytea3(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + f.set__4(__4); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt1( + Configuration configuration + , String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + String __1 + , byte[] __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt1( + Field __1 + , Field __2 + ) { + PgpPubEncrypt1 f = new PgpPubEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt + */ + public static byte[] pgpPubEncrypt2( + Configuration configuration + , String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + String __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt as a field. + */ + public static Field pgpPubEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncrypt2 f = new PgpPubEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea1( + Configuration configuration + , byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + byte[] __1 + , byte[] __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpPubEncryptBytea1 f = new PgpPubEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_pub_encrypt_bytea + */ + public static byte[] pgpPubEncryptBytea2( + Configuration configuration + , byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + byte[] __1 + , byte[] __2 + , String __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_pub_encrypt_bytea as a field. + */ + public static Field pgpPubEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpPubEncryptBytea2 f = new PgpPubEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + byte[] __1 + , String __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt1( + Field __1 + , Field __2 + ) { + PgpSymDecrypt1 f = new PgpSymDecrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt + */ + public static String pgpSymDecrypt2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt as a field. + */ + public static Field pgpSymDecrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecrypt2 f = new PgpSymDecrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymDecryptBytea1 f = new PgpSymDecryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_decrypt_bytea + */ + public static byte[] pgpSymDecryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_decrypt_bytea as a field. + */ + public static Field pgpSymDecryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymDecryptBytea2 f = new PgpSymDecryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt1( + Configuration configuration + , String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + String __1 + , String __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt1( + Field __1 + , Field __2 + ) { + PgpSymEncrypt1 f = new PgpSymEncrypt1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt + */ + public static byte[] pgpSymEncrypt2( + Configuration configuration + , String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + String __1 + , String __2 + , String __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt as a field. + */ + public static Field pgpSymEncrypt2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncrypt2 f = new PgpSymEncrypt2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea1( + Configuration configuration + , byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + byte[] __1 + , String __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea1( + Field __1 + , Field __2 + ) { + PgpSymEncryptBytea1 f = new PgpSymEncryptBytea1(); + f.set__1(__1); + f.set__2(__2); + + return f.asField(); + } + + /** + * Call public.pgp_sym_encrypt_bytea + */ + public static byte[] pgpSymEncryptBytea2( + Configuration configuration + , byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + byte[] __1 + , String __2 + , String __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Get public.pgp_sym_encrypt_bytea as a field. + */ + public static Field pgpSymEncryptBytea2( + Field __1 + , Field __2 + , Field __3 + ) { + PgpSymEncryptBytea2 f = new PgpSymEncryptBytea2(); + f.set__1(__1); + f.set__2(__2); + f.set__3(__3); + + return f.asField(); + } + + /** + * Call public.pgp_armor_headers. + */ + public static Result pgpArmorHeaders( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders pgpArmorHeaders( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } +} diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index 72e5f64..dfa3211 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -4,12 +4,17 @@ package writeon; +import org.jooq.Configuration; +import org.jooq.Field; +import org.jooq.Result; + import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; +import writeon.tables.PgpArmorHeaders; import writeon.tables.Product; import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; @@ -21,6 +26,7 @@ import writeon.tables.ProductWorldview; import writeon.tables.Terms; import writeon.tables.TermsAgreement; +import writeon.tables.records.PgpArmorHeadersRecord; /** @@ -30,7 +36,7 @@ public class Tables { /** - * The table public.assistant. + * 어시스턴트 */ public static final Assistant ASSISTANT = Assistant.ASSISTANT; @@ -59,6 +65,45 @@ public class Tables { */ public static final MemberPassword MEMBER_PASSWORD = MemberPassword.MEMBER_PASSWORD; + /** + * The table public.pgp_armor_headers. + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = PgpArmorHeaders.PGP_ARMOR_HEADERS; + + /** + * Call public.pgp_armor_headers. + */ + public static Result PGP_ARMOR_HEADERS( + Configuration configuration + , String __1 + ) { + return configuration.dsl().selectFrom(writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + )).fetch(); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + String __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + + /** + * Get public.pgp_armor_headers as a table. + */ + public static PgpArmorHeaders PGP_ARMOR_HEADERS( + Field __1 + ) { + return writeon.tables.PgpArmorHeaders.PGP_ARMOR_HEADERS.call( + __1 + ); + } + /** * 작품 */ diff --git a/domain/src/main/generated/writeon/tables/Assistant.java b/domain/src/main/generated/writeon/tables/Assistant.java index 3630175..fd05d2f 100644 --- a/domain/src/main/generated/writeon/tables/Assistant.java +++ b/domain/src/main/generated/writeon/tables/Assistant.java @@ -20,16 +20,18 @@ import org.jooq.Table; import org.jooq.TableField; import org.jooq.TableOptions; +import org.jooq.UniqueKey; import org.jooq.impl.DSL; import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; +import writeon.Keys; import writeon.Public; import writeon.tables.records.AssistantRecord; /** - * This class is generated by jOOQ. + * 어시스턴트 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Assistant extends TableImpl { @@ -52,49 +54,49 @@ public Class getRecordType() { /** * The column public.assistant.id. */ - public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID, this, ""); + public final TableField ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, ""); /** - * The column public.assistant.product_id. + * The column public.assistant.product_id. 작품 ID */ - public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID, this, ""); + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, "작품 ID"); /** - * The column public.assistant.type. + * The column public.assistant.type. 기능 종류 */ - public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR(20), this, ""); + public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR(20).nullable(false), this, "기능 종류"); /** - * The column public.assistant.status. + * The column public.assistant.status. 진행 상태 */ - public final TableField STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(20), this, ""); + public final TableField STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(20).nullable(false), this, "진행 상태"); /** - * The column public.assistant.is_applied. + * The column public.assistant.is_applied. 진행 상태 */ - public final TableField IS_APPLIED = createField(DSL.name("is_applied"), SQLDataType.BOOLEAN, this, ""); + public final TableField IS_APPLIED = createField(DSL.name("is_applied"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "진행 상태"); /** - * The column public.assistant.created_at. + * The column public.assistant.created_at. 수정일시 */ - public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6), this, ""); + public final TableField CREATED_AT = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "수정일시"); /** - * The column public.assistant.created_by. + * The column public.assistant.created_by. 생성자 ID */ - public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID, this, ""); + public final TableField CREATED_BY = createField(DSL.name("created_by"), SQLDataType.UUID.nullable(false), this, "생성자 ID"); /** * The column public.assistant.updated_at. */ - public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6), this, ""); + public final TableField UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.LOCALDATETIME(6).nullable(false), this, ""); private Assistant(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } private Assistant(Name alias, Table aliased, Field[] parameters, Condition where) { - super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + super(alias, null, aliased, parameters, DSL.comment("어시스턴트"), TableOptions.table(), where); } /** @@ -123,6 +125,11 @@ public Schema getSchema() { return aliased() ? null : Public.PUBLIC; } + @Override + public UniqueKey getPrimaryKey() { + return Keys.ASSISTANT_PK; + } + @Override public Assistant as(String alias) { return new Assistant(DSL.name(alias), this); diff --git a/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java new file mode 100644 index 0000000..d99e0bb --- /dev/null +++ b/domain/src/main/generated/writeon/tables/PgpArmorHeaders.java @@ -0,0 +1,157 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Public; +import writeon.tables.records.PgpArmorHeadersRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.pgp_armor_headers + */ + public static final PgpArmorHeaders PGP_ARMOR_HEADERS = new PgpArmorHeaders(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return PgpArmorHeadersRecord.class; + } + + /** + * The column public.pgp_armor_headers.key. + */ + public final TableField KEY = createField(DSL.name("key"), SQLDataType.CLOB, this, ""); + + /** + * The column public.pgp_armor_headers.value. + */ + public final TableField VALUE = createField(DSL.name("value"), SQLDataType.CLOB, this, ""); + + private PgpArmorHeaders(Name alias, Table aliased) { + this(alias, aliased, new Field[] { + DSL.val(null, SQLDataType.CLOB) + }); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters) { + this(alias, aliased, parameters, null); + } + + private PgpArmorHeaders(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.function(), where); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(String alias) { + this(DSL.name(alias), PGP_ARMOR_HEADERS); + } + + /** + * Create an aliased public.pgp_armor_headers table reference + */ + public PgpArmorHeaders(Name alias) { + this(alias, PGP_ARMOR_HEADERS); + } + + /** + * Create a public.pgp_armor_headers table reference + */ + public PgpArmorHeaders() { + this(DSL.name("pgp_armor_headers"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public PgpArmorHeaders as(String alias) { + return new PgpArmorHeaders(DSL.name(alias), this, parameters); + } + + @Override + public PgpArmorHeaders as(Name alias) { + return new PgpArmorHeaders(alias, this, parameters); + } + + @Override + public PgpArmorHeaders as(Table alias) { + return new PgpArmorHeaders(alias.getQualifiedName(), this, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(String name) { + return new PgpArmorHeaders(DSL.name(name), null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Name name) { + return new PgpArmorHeaders(name, null, parameters); + } + + /** + * Rename this table + */ + @Override + public PgpArmorHeaders rename(Table name) { + return new PgpArmorHeaders(name.getQualifiedName(), null, parameters); + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + String __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + DSL.val(__1, SQLDataType.CLOB) + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } + + /** + * Call this table-valued function + */ + public PgpArmorHeaders call( + Field __1 + ) { + PgpArmorHeaders result = new PgpArmorHeaders(DSL.name("pgp_armor_headers"), null, new Field[] { + __1 + }); + + return aliased() ? result.as(getUnqualifiedName()) : result; + } +} diff --git a/domain/src/main/generated/writeon/tables/pojos/Assistant.java b/domain/src/main/generated/writeon/tables/pojos/Assistant.java index 2b9f85e..9f4955f 100644 --- a/domain/src/main/generated/writeon/tables/pojos/Assistant.java +++ b/domain/src/main/generated/writeon/tables/pojos/Assistant.java @@ -10,7 +10,7 @@ /** - * This class is generated by jOOQ. + * 어시스턴트 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) public class Assistant implements Serializable { @@ -65,42 +65,42 @@ public UUID getId() { } /** - * Getter for public.assistant.product_id. + * Getter for public.assistant.product_id. 작품 ID */ public UUID getProductId() { return this.productId; } /** - * Getter for public.assistant.type. + * Getter for public.assistant.type. 기능 종류 */ public String getType() { return this.type; } /** - * Getter for public.assistant.status. + * Getter for public.assistant.status. 진행 상태 */ public String getStatus() { return this.status; } /** - * Getter for public.assistant.is_applied. + * Getter for public.assistant.is_applied. 진행 상태 */ public Boolean getIsApplied() { return this.isApplied; } /** - * Getter for public.assistant.created_at. + * Getter for public.assistant.created_at. 수정일시 */ public LocalDateTime getCreatedAt() { return this.createdAt; } /** - * Getter for public.assistant.created_by. + * Getter for public.assistant.created_by. 생성자 ID */ public UUID getCreatedBy() { return this.createdBy; diff --git a/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java b/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java new file mode 100644 index 0000000..feaccdf --- /dev/null +++ b/domain/src/main/generated/writeon/tables/pojos/PgpArmorHeaders.java @@ -0,0 +1,91 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeaders implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String key; + private final String value; + + public PgpArmorHeaders(PgpArmorHeaders value) { + this.key = value.key; + this.value = value.value; + } + + public PgpArmorHeaders( + String key, + String value + ) { + this.key = key; + this.value = value; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return this.key; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return this.value; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final PgpArmorHeaders other = (PgpArmorHeaders) obj; + if (this.key == null) { + if (other.key != null) + return false; + } + else if (!this.key.equals(other.key)) + return false; + if (this.value == null) { + if (other.value != null) + return false; + } + else if (!this.value.equals(other.value)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); + result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PgpArmorHeaders ("); + + sb.append(key); + sb.append(", ").append(value); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java index 4c716e8..aeff5e7 100644 --- a/domain/src/main/generated/writeon/tables/records/AssistantRecord.java +++ b/domain/src/main/generated/writeon/tables/records/AssistantRecord.java @@ -7,16 +7,17 @@ import java.time.LocalDateTime; import java.util.UUID; -import org.jooq.impl.TableRecordImpl; +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; import writeon.tables.Assistant; /** - * This class is generated by jOOQ. + * 어시스턴트 */ @SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) -public class AssistantRecord extends TableRecordImpl { +public class AssistantRecord extends UpdatableRecordImpl { private static final long serialVersionUID = 1L; @@ -36,7 +37,7 @@ public UUID getId() { } /** - * Setter for public.assistant.product_id. + * Setter for public.assistant.product_id. 작품 ID */ public AssistantRecord setProductId(UUID value) { set(1, value); @@ -44,14 +45,14 @@ public AssistantRecord setProductId(UUID value) { } /** - * Getter for public.assistant.product_id. + * Getter for public.assistant.product_id. 작품 ID */ public UUID getProductId() { return (UUID) get(1); } /** - * Setter for public.assistant.type. + * Setter for public.assistant.type. 기능 종류 */ public AssistantRecord setType(String value) { set(2, value); @@ -59,14 +60,14 @@ public AssistantRecord setType(String value) { } /** - * Getter for public.assistant.type. + * Getter for public.assistant.type. 기능 종류 */ public String getType() { return (String) get(2); } /** - * Setter for public.assistant.status. + * Setter for public.assistant.status. 진행 상태 */ public AssistantRecord setStatus(String value) { set(3, value); @@ -74,14 +75,14 @@ public AssistantRecord setStatus(String value) { } /** - * Getter for public.assistant.status. + * Getter for public.assistant.status. 진행 상태 */ public String getStatus() { return (String) get(3); } /** - * Setter for public.assistant.is_applied. + * Setter for public.assistant.is_applied. 진행 상태 */ public AssistantRecord setIsApplied(Boolean value) { set(4, value); @@ -89,14 +90,14 @@ public AssistantRecord setIsApplied(Boolean value) { } /** - * Getter for public.assistant.is_applied. + * Getter for public.assistant.is_applied. 진행 상태 */ public Boolean getIsApplied() { return (Boolean) get(4); } /** - * Setter for public.assistant.created_at. + * Setter for public.assistant.created_at. 수정일시 */ public AssistantRecord setCreatedAt(LocalDateTime value) { set(5, value); @@ -104,14 +105,14 @@ public AssistantRecord setCreatedAt(LocalDateTime value) { } /** - * Getter for public.assistant.created_at. + * Getter for public.assistant.created_at. 수정일시 */ public LocalDateTime getCreatedAt() { return (LocalDateTime) get(5); } /** - * Setter for public.assistant.created_by. + * Setter for public.assistant.created_by. 생성자 ID */ public AssistantRecord setCreatedBy(UUID value) { set(6, value); @@ -119,7 +120,7 @@ public AssistantRecord setCreatedBy(UUID value) { } /** - * Getter for public.assistant.created_by. + * Getter for public.assistant.created_by. 생성자 ID */ public UUID getCreatedBy() { return (UUID) get(6); @@ -140,6 +141,15 @@ public LocalDateTime getUpdatedAt() { return (LocalDateTime) get(7); } + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- diff --git a/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java b/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java new file mode 100644 index 0000000..8e9c402 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/PgpArmorHeadersRecord.java @@ -0,0 +1,84 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import org.jooq.impl.TableRecordImpl; + +import writeon.tables.PgpArmorHeaders; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PgpArmorHeadersRecord extends TableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.pgp_armor_headers.key. + */ + public PgpArmorHeadersRecord setKey(String value) { + set(0, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.key. + */ + public String getKey() { + return (String) get(0); + } + + /** + * Setter for public.pgp_armor_headers.value. + */ + public PgpArmorHeadersRecord setValue(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.pgp_armor_headers.value. + */ + public String getValue() { + return (String) get(1); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord() { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(String key, String value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + setKey(key); + setValue(value); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised PgpArmorHeadersRecord + */ + public PgpArmorHeadersRecord(writeon.tables.pojos.PgpArmorHeaders value) { + super(PgpArmorHeaders.PGP_ARMOR_HEADERS); + + if (value != null) { + setKey(value.getKey()); + setValue(value.getValue()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java index 8ec56c1..00532f5 100644 --- a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java +++ b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java @@ -12,8 +12,9 @@ public enum AuthException implements CodeInfo { REFRESH_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-002", "리프레시 토큰이 유효하지 않습니다."), JOIN_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-101", "가입 토큰이 유효하지 않습니다."), JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), - LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "로그인에 실패하였습니다."), - LOGIN_BLOCKED(HttpStatus.UNAUTHORIZED, "AUTH-202", "로그인 실패 가능 횟수를 초과하였습니다."), + LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "이메일 또는 비밀번호가 잘못되었거나 존재하지 않습니다."), + LOGIN_FAILED_WITH_WARNING(HttpStatus.UNAUTHORIZED, "AUTH-202", "이메일 또는 비밀번호가 잘못되었거나 존재하지 않습니다. 5회 이상 실패하면 1시간 동안 로그인이 제한됩니다"), + LOGIN_BLOCKED(HttpStatus.UNAUTHORIZED, "AUTH-203", "로그인 실패 가능 횟수를 초과하였습니다."), MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), CHANGE_PASSWORD_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "AUTH-402", "가입되지 않은 이메일입니다."), From 82184ccd0c30cc615aaecb95305134689e04b5db Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 5 Apr 2025 19:05:12 +0900 Subject: [PATCH 068/107] =?UTF-8?q?fix:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=ED=83=80=EC=9E=84=EC=A1=B4=20=EC=84=A4=EC=A0=95=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index c3bccc8..ca8c584 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM openjdk:21-jdk-slim WORKDIR /writeon ENV TZ=Asiz/Seoul +RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime COPY api/build/libs/*.jar writeon.jar From 752be3a2e24f169a74fc470100cffeeba605e85c Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 5 Apr 2025 19:20:38 +0900 Subject: [PATCH 069/107] Fix/timezone (#68) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca8c584..bb42586 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM openjdk:21-jdk-slim WORKDIR /writeon -ENV TZ=Asiz/Seoul +ENV TZ=Asia/Seoul RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime COPY api/build/libs/*.jar writeon.jar From 733dba506e2c172503962d1e1003d41d3353c0f0 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 5 Apr 2025 19:28:20 +0900 Subject: [PATCH 070/107] =?UTF-8?q?style:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?5=ED=9A=8C=20=EA=B2=BD=EA=B3=A0=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95=20(#69)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/writeon/domain/auth/enums/AuthException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java index 00532f5..ea196f3 100644 --- a/domain/src/main/java/writeon/domain/auth/enums/AuthException.java +++ b/domain/src/main/java/writeon/domain/auth/enums/AuthException.java @@ -13,7 +13,7 @@ public enum AuthException implements CodeInfo { JOIN_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-101", "가입 토큰이 유효하지 않습니다."), JOIN_ALREADY_EXIST_MEMBER(HttpStatus.CONFLICT, "AUTH-102", "이미 있는 회원입니다."), LOGIN_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-201", "이메일 또는 비밀번호가 잘못되었거나 존재하지 않습니다."), - LOGIN_FAILED_WITH_WARNING(HttpStatus.UNAUTHORIZED, "AUTH-202", "이메일 또는 비밀번호가 잘못되었거나 존재하지 않습니다. 5회 이상 실패하면 1시간 동안 로그인이 제한됩니다"), + LOGIN_FAILED_WITH_WARNING(HttpStatus.UNAUTHORIZED, "AUTH-202", "5회 이상 실패하면 1시간 동안 로그인이 제한됩니다"), LOGIN_BLOCKED(HttpStatus.UNAUTHORIZED, "AUTH-203", "로그인 실패 가능 횟수를 초과하였습니다."), MAIL_SEND_FAILED(HttpStatus.UNAUTHORIZED, "AUTH-301", "이메일 발송에 실패했습니다."), CHANGE_PASSWORD_TOKEN_NOT_VALID(HttpStatus.UNAUTHORIZED, "AUTH-401", "비밀번호 변경 토큰이 유효하지 않습니다."), From 787917d94af816719e53233ca6c40ea2eb6e3e17 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 5 Apr 2025 19:41:13 +0900 Subject: [PATCH 071/107] =?UTF-8?q?refactor:=20availableLoginAt=20->=20log?= =?UTF-8?q?inAvailableAt=20=EC=9D=91=EB=8B=B5=20=EB=B3=80=EA=B2=BD=20(#70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/writeon/api/auth/response/LoginFailResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java index 0fddfdb..5be6422 100644 --- a/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java +++ b/api/src/main/java/writeon/api/auth/response/LoginFailResponse.java @@ -15,5 +15,5 @@ public class LoginFailResponse { private int remainingAttempts; @Schema(title = "로그인 가능 시각", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2025-04-05T14:41:10.626943") - private LocalDateTime availableLoginAt; + private LocalDateTime loginAvailableAt; } From 6d179291da3c68b8f90ba2faf2a517e506242f48 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:53:02 +0900 Subject: [PATCH 072/107] feat: add assistant planner generate API (#71) --- .../controller/AssistantController.java | 51 ++-- .../AssistantPlannerMessageRequest.java | 33 +++ .../api/assistant/service/PlannerService.java | 119 +++++++++ .../AssistantApiClient.java | 16 ++ .../request/PlannerGenerateRequest.java | 26 ++ domain/build.gradle | 4 +- domain/src/main/generated/writeon/Keys.java | 3 + domain/src/main/generated/writeon/Public.java | 7 + domain/src/main/generated/writeon/Tables.java | 6 + .../tables/AssistantPlannerMessage.java | 236 ++++++++++++++++++ .../tables/pojos/AssistantPlannerMessage.java | 130 ++++++++++ .../AssistantPlannerMessageRecord.java | 130 ++++++++++ .../domain/assistant/AssistantMessage.java | 14 +- .../assistant/AssistantPlannerMessage.java | 41 +++ .../AssistantPlannerMessageJpaRepository.java | 8 + .../domain/assistant/enums/AssistantType.java | 3 +- sql/init.sql | 15 +- 17 files changed, 802 insertions(+), 40 deletions(-) create mode 100644 api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java create mode 100644 api/src/main/java/writeon/api/assistant/service/PlannerService.java create mode 100644 assistant-api-client/src/main/java/writeon/assistantapiclient/request/PlannerGenerateRequest.java create mode 100644 domain/src/main/generated/writeon/tables/AssistantPlannerMessage.java create mode 100644 domain/src/main/generated/writeon/tables/pojos/AssistantPlannerMessage.java create mode 100644 domain/src/main/generated/writeon/tables/records/AssistantPlannerMessageRecord.java create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java create mode 100644 domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessageJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 2a5b0e7..3368334 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,42 +1,24 @@ package writeon.api.assistant.controller; -import org.springdoc.core.annotations.ParameterObject; -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.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.util.UUID; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; -import writeon.api.assistant.request.AssistantChatMessageRequest; -import writeon.api.assistant.request.AssistantEvaluateRequest; -import writeon.api.assistant.request.AssistantFeedbackMessageRequest; -import writeon.api.assistant.request.AssistantResearchRequest; -import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import org.springdoc.core.annotations.ParameterObject; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.*; import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; -import writeon.api.assistant.service.AssistantEvaluationService; -import writeon.api.assistant.service.AssistantService; -import writeon.api.assistant.service.AutoModifyService; -import writeon.api.assistant.service.ChatService; -import writeon.api.assistant.service.FeedbackService; -import writeon.api.assistant.service.UserModifyService; +import writeon.api.assistant.service.*; import writeon.api.common.request.OffsetRequest; import writeon.api.common.response.OffsetResponse; +import java.util.UUID; + @RestController @RequiredArgsConstructor @RequestMapping("/assistant") @@ -49,6 +31,7 @@ public class AssistantController { private final ChatService chatService; private final FeedbackService feedbackService; private final UserModifyService userModifyService; + private final PlannerService plannerService; @Operation(summary = "어시스턴트 답변 적용") @PostMapping("/{assistantId}/apply") @@ -82,6 +65,12 @@ public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbac return feedbackService.createMessage(request); } + @Operation(summary = "플래너 AI 완성 메세지 저장") + @PostMapping("/planner/messages") + public MessageCreateResponse createPlannerMessage(@RequestBody AssistantPlannerMessageRequest request) { + return plannerService.createMessage(request); + } + @Operation(summary = "수동 수정 메세지 저장") @PostMapping("/user-modify/messages") public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { @@ -121,6 +110,14 @@ public SseEmitter streamFeedback(@RequestParam UUID assistantId) { return emitter; } + @Operation(summary = "플래너 AI 완성 스트리밍") + @GetMapping("/planner/stream") + public SseEmitter streamPlanner(@RequestParam UUID assistantId) { + SseEmitter emitter = plannerService.streamPlanner(assistantId); + setResponseHeaderForSSE(); + return emitter; + } + @Operation(summary = "수동 수정 스트리밍") @GetMapping("/user-modify/stream") public SseEmitter streamUserModify(@RequestParam UUID assistantId) { diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java new file mode 100644 index 0000000..311da51 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java @@ -0,0 +1,33 @@ +package writeon.api.assistant.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +@Setter +public class AssistantPlannerMessageRequest { + + @Schema(title = "작품 ID") + private UUID productId; + @Schema(title = "장르") + private String genre; + @Schema(title = "로그라인") + private String logline; + @Schema( + title = "생성할 섹션", + description = """ + 생성 가능한 섹션: + - example: 예시문장 + - geography, history, politics, society, religion: 세계관(지리/역사/정치/사회/종교) + - economy, technology, lifestyle, language, culture: 세계관(경제/기술/생활/언어/문화) + - species, occupation, conflict, custom_field: 세계관(종족/직업/갈등/커스텀필드) + - introduction, development, crisis, conclusion: 줄거리(발단/전개/위기/결말) + """ + ) + private String section; + @Schema(title = "프롬프트") + private String prompt; +} diff --git a/api/src/main/java/writeon/api/assistant/service/PlannerService.java b/api/src/main/java/writeon/api/assistant/service/PlannerService.java new file mode 100644 index 0000000..7f3e106 --- /dev/null +++ b/api/src/main/java/writeon/api/assistant/service/PlannerService.java @@ -0,0 +1,119 @@ +package writeon.api.assistant.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.AssistantPlannerMessageRequest; +import writeon.api.assistant.response.MessageCreateResponse; +import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; +import writeon.api.common.util.MemberUtil; +import writeon.api.product.service.ProductQueryService; +import writeon.assistantapiclient.AssistantApiClient; +import writeon.assistantapiclient.request.PlannerGenerateRequest; +import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantMessage; +import writeon.domain.assistant.AssistantPlannerMessage; +import writeon.domain.assistant.AssistantPlannerMessageJpaRepository; +import writeon.domain.assistant.enums.AssistantException; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; + +import java.io.IOException; +import java.util.UUID; + +@Service +@RequiredArgsConstructor +public class PlannerService { + + private final long TIMEOUT = 180_000L; + + private final AssistantApiClient assistantApiClient; + private final AssistantService assistantService; + private final ProductQueryService productQueryService; + private final AssistantPlannerMessageJpaRepository assistantPlannerMessageRepository; + + @Transactional + public MessageCreateResponse createMessage(AssistantPlannerMessageRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.PLANNER); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .prompt(request.getPrompt()) + .role(MessageSenderRole.MEMBER) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + AssistantPlannerMessage plannerMessage = AssistantPlannerMessage.builder() + .assistantId(assistantId) + .genre(request.getGenre()) + .logline(request.getLogline()) + .section(request.getSection()) + .build(); + assistantPlannerMessageRepository.save(plannerMessage); + + return new MessageCreateResponse(assistantId); + } + + public SseEmitter streamPlanner(UUID assistantId) { + Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); + + if (assistant.getStatus() != AssistantStatus.DRAFT) { + throw new BaseException(AssistantException.ALREADY_ANSWERED); + } + productQueryService.verifyExist(assistant.getProductId()); + + AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + + AssistantPlannerMessage plannerMessage = assistantPlannerMessageRepository.findById(assistantId) + .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); + + PlannerGenerateRequest request = PlannerGenerateRequest.builder() + .tenantId(assistant.getProductId().toString()) + .genre(plannerMessage.getGenre()) + .logline(plannerMessage.getLogline()) + .section(plannerMessage.getSection()) + .prompt(memberMessage.getPrompt()) + .build(); + + SseEmitter emitter = new SseEmitter(TIMEOUT); + StringBuilder responseBuilder = new StringBuilder(); + + assistantApiClient.streamPlannerGenerate(request) + .subscribe( + data -> { + try { + emitter.send(SseEmitter.event().data(data)); + responseBuilder.append(data); + } catch (IOException e) { + emitter.completeWithError(new BaseException(AssistantException.SSE_SEND_ERROR)); + } + }, + error -> { + LogUtil.error(error); + BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); + emitter.completeWithError(exception); + throw exception; + }, + () -> { + String answer = responseBuilder.toString().replace("[DONE]", "").trim(); + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + emitter.complete(); + } + ); + + return emitter; + } +} diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 3387cd4..7711d3b 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -94,6 +94,22 @@ public Flux streamFeedback(FeedbackRequest request) { .bodyToFlux(String.class); } + public Flux streamPlannerGenerate(PlannerGenerateRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/planner/generate/stream") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToFlux(String.class); + } + public Flux streamUserModify(UserModifyRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/PlannerGenerateRequest.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/PlannerGenerateRequest.java new file mode 100644 index 0000000..3b354b8 --- /dev/null +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/PlannerGenerateRequest.java @@ -0,0 +1,26 @@ +package writeon.assistantapiclient.request; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Builder; +import lombok.Getter; + +@Getter +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class PlannerGenerateRequest { + + private final String tenantId; + private final String genre; + private final String logline; + private final String section; + private final String prompt; + + @Builder + public PlannerGenerateRequest(String tenantId, String genre, String logline, String section, String prompt) { + this.tenantId = tenantId; + this.genre = genre; + this.logline = logline; + this.section = section; + this.prompt = prompt; + } +} diff --git a/domain/build.gradle b/domain/build.gradle index 42f8b3f..88cb129 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -48,9 +48,9 @@ jooq { logging = org.jooq.meta.jaxb.Logging.DEBUG jdbc { driver = 'org.postgresql.Driver' - url = 'jdbc:postgresql://localhost:5432/service' + url = 'jdbc:postgresql://db-instance-postgres.cv2280c0874d.ap-northeast-2.rds.amazonaws.com:5432/service' user = 'postgres' - password = '1234' + password = 'Writely0101%' } generator { name = 'org.jooq.codegen.DefaultGenerator' diff --git a/domain/src/main/generated/writeon/Keys.java b/domain/src/main/generated/writeon/Keys.java index 379529d..d6dc0cc 100644 --- a/domain/src/main/generated/writeon/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -12,6 +12,7 @@ import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; +import writeon.tables.AssistantPlannerMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; @@ -28,6 +29,7 @@ import writeon.tables.TermsAgreement; import writeon.tables.records.AssistantEvaluationRecord; import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantPlannerMessageRecord; import writeon.tables.records.AssistantRecord; import writeon.tables.records.LoginAttemptRecord; import writeon.tables.records.MemberPasswordRecord; @@ -59,6 +61,7 @@ public class Keys { public static final UniqueKey ASSISTANT_PK = Internal.createUniqueKey(Assistant.ASSISTANT, DSL.name("assistant_pk"), new TableField[] { Assistant.ASSISTANT.ID }, true); public static final UniqueKey ASSISTANT_EVALUATION_PK = Internal.createUniqueKey(AssistantEvaluation.ASSISTANT_EVALUATION, DSL.name("assistant_evaluation_pk"), new TableField[] { AssistantEvaluation.ASSISTANT_EVALUATION.ASSISTANT_ID }, true); public static final UniqueKey ASSISTANT_MESSAGE_PK = Internal.createUniqueKey(AssistantMessage.ASSISTANT_MESSAGE, DSL.name("assistant_message_pk"), new TableField[] { AssistantMessage.ASSISTANT_MESSAGE.ID }, true); + public static final UniqueKey ASSISTANT_PLANNER_MESSAGE_PK = Internal.createUniqueKey(AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE, DSL.name("assistant_planner_message_pk"), new TableField[] { AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE.ASSISTANT_ID }, true); public static final UniqueKey LOGIN_ATTEMPT_PK = Internal.createUniqueKey(LoginAttempt.LOGIN_ATTEMPT, DSL.name("login_attempt_pk"), new TableField[] { LoginAttempt.LOGIN_ATTEMPT.ID }, true); public static final UniqueKey EMAIL_UK = Internal.createUniqueKey(Member.MEMBER, DSL.name("email_uk"), new TableField[] { Member.MEMBER.EMAIL }, true); public static final UniqueKey MEMBER_PK = Internal.createUniqueKey(Member.MEMBER, DSL.name("member_pk"), new TableField[] { Member.MEMBER.ID }, true); diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index 2d1e534..a13ef5d 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -17,6 +17,7 @@ import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; +import writeon.tables.AssistantPlannerMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; @@ -63,6 +64,11 @@ public class Public extends SchemaImpl { */ public final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; + /** + * The table public.assistant_planner_message. + */ + public final AssistantPlannerMessage ASSISTANT_PLANNER_MESSAGE = AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE; + /** * 로그인_시도 */ @@ -191,6 +197,7 @@ public final List> getTables() { Assistant.ASSISTANT, AssistantEvaluation.ASSISTANT_EVALUATION, AssistantMessage.ASSISTANT_MESSAGE, + AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE, LoginAttempt.LOGIN_ATTEMPT, Member.MEMBER, MemberPassword.MEMBER_PASSWORD, diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index dfa3211..919f941 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -11,6 +11,7 @@ import writeon.tables.Assistant; import writeon.tables.AssistantEvaluation; import writeon.tables.AssistantMessage; +import writeon.tables.AssistantPlannerMessage; import writeon.tables.LoginAttempt; import writeon.tables.Member; import writeon.tables.MemberPassword; @@ -50,6 +51,11 @@ public class Tables { */ public static final AssistantMessage ASSISTANT_MESSAGE = AssistantMessage.ASSISTANT_MESSAGE; + /** + * The table public.assistant_planner_message. + */ + public static final AssistantPlannerMessage ASSISTANT_PLANNER_MESSAGE = AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE; + /** * 로그인_시도 */ diff --git a/domain/src/main/generated/writeon/tables/AssistantPlannerMessage.java b/domain/src/main/generated/writeon/tables/AssistantPlannerMessage.java new file mode 100644 index 0000000..a4284df --- /dev/null +++ b/domain/src/main/generated/writeon/tables/AssistantPlannerMessage.java @@ -0,0 +1,236 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import java.util.Collection; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Keys; +import writeon.Public; +import writeon.tables.records.AssistantPlannerMessageRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantPlannerMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.assistant_planner_message + */ + public static final AssistantPlannerMessage ASSISTANT_PLANNER_MESSAGE = new AssistantPlannerMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AssistantPlannerMessageRecord.class; + } + + /** + * The column public.assistant_planner_message.assistant_id. + */ + public final TableField ASSISTANT_ID = createField(DSL.name("assistant_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.assistant_planner_message.genre. + */ + public final TableField GENRE = createField(DSL.name("genre"), SQLDataType.VARCHAR(30).nullable(false), this, ""); + + /** + * The column public.assistant_planner_message.logline. + */ + public final TableField LOGLINE = createField(DSL.name("logline"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.assistant_planner_message.section. + */ + public final TableField SECTION = createField(DSL.name("section"), SQLDataType.VARCHAR(30).nullable(false), this, ""); + + private AssistantPlannerMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private AssistantPlannerMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.assistant_planner_message table + * reference + */ + public AssistantPlannerMessage(String alias) { + this(DSL.name(alias), ASSISTANT_PLANNER_MESSAGE); + } + + /** + * Create an aliased public.assistant_planner_message table + * reference + */ + public AssistantPlannerMessage(Name alias) { + this(alias, ASSISTANT_PLANNER_MESSAGE); + } + + /** + * Create a public.assistant_planner_message table reference + */ + public AssistantPlannerMessage() { + this(DSL.name("assistant_planner_message"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.ASSISTANT_PLANNER_MESSAGE_PK; + } + + @Override + public AssistantPlannerMessage as(String alias) { + return new AssistantPlannerMessage(DSL.name(alias), this); + } + + @Override + public AssistantPlannerMessage as(Name alias) { + return new AssistantPlannerMessage(alias, this); + } + + @Override + public AssistantPlannerMessage as(Table alias) { + return new AssistantPlannerMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public AssistantPlannerMessage rename(String name) { + return new AssistantPlannerMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public AssistantPlannerMessage rename(Name name) { + return new AssistantPlannerMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public AssistantPlannerMessage rename(Table name) { + return new AssistantPlannerMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage where(Condition condition) { + return new AssistantPlannerMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantPlannerMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantPlannerMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantPlannerMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public AssistantPlannerMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public AssistantPlannerMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writeon/tables/pojos/AssistantPlannerMessage.java b/domain/src/main/generated/writeon/tables/pojos/AssistantPlannerMessage.java new file mode 100644 index 0000000..4f65f96 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/pojos/AssistantPlannerMessage.java @@ -0,0 +1,130 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.pojos; + + +import java.io.Serializable; +import java.util.UUID; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantPlannerMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID assistantId; + private final String genre; + private final String logline; + private final String section; + + public AssistantPlannerMessage(AssistantPlannerMessage value) { + this.assistantId = value.assistantId; + this.genre = value.genre; + this.logline = value.logline; + this.section = value.section; + } + + public AssistantPlannerMessage( + UUID assistantId, + String genre, + String logline, + String section + ) { + this.assistantId = assistantId; + this.genre = genre; + this.logline = logline; + this.section = section; + } + + /** + * Getter for public.assistant_planner_message.assistant_id. + */ + public UUID getAssistantId() { + return this.assistantId; + } + + /** + * Getter for public.assistant_planner_message.genre. + */ + public String getGenre() { + return this.genre; + } + + /** + * Getter for public.assistant_planner_message.logline. + */ + public String getLogline() { + return this.logline; + } + + /** + * Getter for public.assistant_planner_message.section. + */ + public String getSection() { + return this.section; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final AssistantPlannerMessage other = (AssistantPlannerMessage) obj; + if (this.assistantId == null) { + if (other.assistantId != null) + return false; + } + else if (!this.assistantId.equals(other.assistantId)) + return false; + if (this.genre == null) { + if (other.genre != null) + return false; + } + else if (!this.genre.equals(other.genre)) + return false; + if (this.logline == null) { + if (other.logline != null) + return false; + } + else if (!this.logline.equals(other.logline)) + return false; + if (this.section == null) { + if (other.section != null) + return false; + } + else if (!this.section.equals(other.section)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.assistantId == null) ? 0 : this.assistantId.hashCode()); + result = prime * result + ((this.genre == null) ? 0 : this.genre.hashCode()); + result = prime * result + ((this.logline == null) ? 0 : this.logline.hashCode()); + result = prime * result + ((this.section == null) ? 0 : this.section.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("AssistantPlannerMessage ("); + + sb.append(assistantId); + sb.append(", ").append(genre); + sb.append(", ").append(logline); + sb.append(", ").append(section); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writeon/tables/records/AssistantPlannerMessageRecord.java b/domain/src/main/generated/writeon/tables/records/AssistantPlannerMessageRecord.java new file mode 100644 index 0000000..399bd74 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/AssistantPlannerMessageRecord.java @@ -0,0 +1,130 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writeon.tables.AssistantPlannerMessage; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class AssistantPlannerMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.assistant_planner_message.assistant_id. + */ + public AssistantPlannerMessageRecord setAssistantId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.assistant_planner_message.assistant_id. + */ + public UUID getAssistantId() { + return (UUID) get(0); + } + + /** + * Setter for public.assistant_planner_message.genre. + */ + public AssistantPlannerMessageRecord setGenre(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.assistant_planner_message.genre. + */ + public String getGenre() { + return (String) get(1); + } + + /** + * Setter for public.assistant_planner_message.logline. + */ + public AssistantPlannerMessageRecord setLogline(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.assistant_planner_message.logline. + */ + public String getLogline() { + return (String) get(2); + } + + /** + * Setter for public.assistant_planner_message.section. + */ + public AssistantPlannerMessageRecord setSection(String value) { + set(3, value); + return this; + } + + /** + * Getter for public.assistant_planner_message.section. + */ + public String getSection() { + return (String) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AssistantPlannerMessageRecord + */ + public AssistantPlannerMessageRecord() { + super(AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE); + } + + /** + * Create a detached, initialised AssistantPlannerMessageRecord + */ + public AssistantPlannerMessageRecord(UUID assistantId, String genre, String logline, String section) { + super(AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE); + + setAssistantId(assistantId); + setGenre(genre); + setLogline(logline); + setSection(section); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised AssistantPlannerMessageRecord + */ + public AssistantPlannerMessageRecord(writeon.tables.pojos.AssistantPlannerMessage value) { + super(AssistantPlannerMessage.ASSISTANT_PLANNER_MESSAGE); + + if (value != null) { + setAssistantId(value.getAssistantId()); + setGenre(value.getGenre()); + setLogline(value.getLogline()); + setSection(value.getSection()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java index 4f8c39e..df46a26 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java @@ -1,18 +1,14 @@ package writeon.domain.assistant; -import java.time.LocalDateTime; -import java.util.UUID; - -import jakarta.persistence.Column; -import jakarta.persistence.Embedded; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.enums.MessageSenderRole; +import java.time.LocalDateTime; +import java.util.UUID; + @Getter @Entity @NoArgsConstructor @@ -35,7 +31,7 @@ public class AssistantMessage { @Column(name = "created_at", updatable = false, nullable = false) private final LocalDateTime createdAt = LocalDateTime.now(); - @Column(name = "created_by", updatable = false, nullable = false) + @Column(name = "created_by", updatable = false) private UUID createdBy; @Builder diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java new file mode 100644 index 0000000..a920d91 --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java @@ -0,0 +1,41 @@ +package writeon.domain.assistant; + +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +@Getter +@Entity +@NoArgsConstructor +@Table(name = "assistant_planner_message") +public class AssistantPlannerMessage { + + @Id + @Column(name = "assistant_id", updatable = false, nullable = false) + private UUID assistantId; + + @Column(name = "genre", nullable = false) + private String genre; + + @Column(name = "logline", nullable = false) + private String logline; + + @Column(name = "section", nullable = false) + private String section; + + @OneToOne(fetch = FetchType.LAZY) + @MapsId + @JoinColumn(name = "assistant_id") + private AssistantMessage assistantMessage; + + @Builder + public AssistantPlannerMessage(UUID assistantId, String genre, String logline, String section) { + this.assistantId = assistantId; + this.genre = genre; + this.logline = logline; + this.section = section; + } +} diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessageJpaRepository.java new file mode 100644 index 0000000..842192e --- /dev/null +++ b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessageJpaRepository.java @@ -0,0 +1,8 @@ +package writeon.domain.assistant; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.UUID; + +public interface AssistantPlannerMessageJpaRepository extends JpaRepository { +} diff --git a/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java index 8488fef..0c6f441 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/AssistantType.java @@ -13,7 +13,8 @@ public enum AssistantType implements Codable { AUTO_MODIFY("auto modify"), FEEDBACK("feedback"), CHAT("chat"), - USER_MODIFY("user modify"); + USER_MODIFY("user modify"), + PLANNER("planner"); private final String code; diff --git a/sql/init.sql b/sql/init.sql index 914afe1..f1b7ade 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -405,8 +405,21 @@ create table assistant_message content text, prompt text, created_at timestamp not null, - created_by uuid not null + created_by uuid ); alter table assistant_message owner to postgres; + +create table assistant_planner_message +( + assistant_id uuid not null + constraint assistant_planner_message_pk + primary key, + genre varchar(30) not null, + logline text not null, + section varchar(30) not null +); + +alter table assistant_planner_message + owner to postgres; \ No newline at end of file From ba35b020b9527f48fe8cb0f4e39257a2c772c3f2 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 7 Apr 2025 21:19:25 +0900 Subject: [PATCH 073/107] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=9D=B4=EB=A0=A5=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EB=95=8C=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#72)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/auth/service/AuthCommandService.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index c314941..eef0880 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -82,21 +82,21 @@ public AuthTokenDto login(LoginRequest request) { .orElseThrow(() -> new BaseException(AuthException.AUTH_FAILED_BY_UNKNOWN_ERROR)); List lastFiveAttempts = loginAttemptJpaRepository.findTop5ByEmailOrderByCreatedAtDesc(request.getEmail()); - LoginAttempt lastAttempt = lastFiveAttempts.getFirst(); - // 로그인 시도가 블락 상태이고, 블락 시간으로부터 1시간이 지나지 않은 경우 - if ( - !lastFiveAttempts.isEmpty() - && lastAttempt.getResult() == LoginAttemptResultType.BLOCKED - && lastAttempt.getCreatedAt().isAfter(LocalDateTime.now().minusHours(1)) - ) { - LocalDateTime loginAvailableAt = lastAttempt.getCreatedAt().plusHours(1); - throw new BaseException( - AuthException.LOGIN_BLOCKED, - new LoginFailResponse(0, loginAvailableAt), - String.format("로그인 5회 실패로 [%s]까지 접속이 제한됩니다.", loginAvailableAt.format(DateTimeFormatter.ofPattern(DateTimeUtil.DATETIME_HOUR_ONLY_KR_PATTERN))) - ); + if (!lastFiveAttempts.isEmpty()) { + LoginAttempt lastAttempt = lastFiveAttempts.getFirst(); + // 로그인 시도가 블락 상태이고, 블락 시간으로부터 1시간이 지나지 않은 경우 + if (lastAttempt.getResult() == LoginAttemptResultType.BLOCKED && lastAttempt.getCreatedAt().isAfter(LocalDateTime.now().minusHours(1)) + ) { + LocalDateTime loginAvailableAt = lastAttempt.getCreatedAt().plusHours(1); + throw new BaseException( + AuthException.LOGIN_BLOCKED, + new LoginFailResponse(0, loginAvailableAt), + String.format("로그인 5회 실패로 [%s]까지 접속이 제한됩니다.", loginAvailableAt.format(DateTimeFormatter.ofPattern(DateTimeUtil.DATETIME_HOUR_ONLY_KR_PATTERN))) + ); + } } + LoginAttempt newLoginAttempt = new LoginAttempt(); newLoginAttempt.setEmail(request.getEmail()); From 37f11a0783dbc3671e3952e4e8b8626c69b2e9bf Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 7 Apr 2025 22:19:22 +0900 Subject: [PATCH 074/107] refactor: change get assistant histories API to cursor pagination with UUIDv7 PK (#73) --- .../controller/AssistantController.java | 48 +++++++++++++------ .../assistant/repository/AssistantDao.java | 28 +++++++---- .../request/AssistantHistoryListRequest.java | 36 ++++++++------ .../assistant/service/AssistantService.java | 17 ++++--- .../api/common/request/OffsetRequest.java | 16 ------- .../api/common/response/CursorResponse.java | 21 ++++++++ .../api/common/response/OffsetResponse.java | 25 ---------- domain/build.gradle | 2 + .../writeon/domain/assistant/Assistant.java | 4 +- .../domain/assistant/AssistantMessage.java | 16 +++++-- .../java/writeon/domain/product/Product.java | 20 ++++++-- .../domain/product/ProductCharacter.java | 4 +- .../domain/product/ProductCustomField.java | 4 +- .../domain/product/ProductFavoritePrompt.java | 4 +- .../writeon/domain/product/ProductMemo.java | 8 ++-- .../writeon/domain/product/ProductPlot.java | 5 +- sql/init.sql | 19 ++++---- 17 files changed, 161 insertions(+), 116 deletions(-) delete mode 100644 api/src/main/java/writeon/api/common/request/OffsetRequest.java create mode 100644 api/src/main/java/writeon/api/common/response/CursorResponse.java delete mode 100644 api/src/main/java/writeon/api/common/response/OffsetResponse.java diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 3368334..579b999 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,23 +1,43 @@ package writeon.api.assistant.controller; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpServletResponse; -import lombok.RequiredArgsConstructor; import org.springdoc.core.annotations.ParameterObject; -import org.springframework.web.bind.annotation.*; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.*; + +import java.util.UUID; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.request.AssistantEvaluateRequest; +import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.request.AssistantHistoryListRequest; +import writeon.api.assistant.request.AssistantPlannerMessageRequest; +import writeon.api.assistant.request.AssistantResearchRequest; +import writeon.api.assistant.request.AssistantUserModifyMessageRequest; import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; -import writeon.api.assistant.service.*; -import writeon.api.common.request.OffsetRequest; -import writeon.api.common.response.OffsetResponse; - -import java.util.UUID; +import writeon.api.assistant.service.AssistantEvaluationService; +import writeon.api.assistant.service.AssistantService; +import writeon.api.assistant.service.AutoModifyService; +import writeon.api.assistant.service.ChatService; +import writeon.api.assistant.service.FeedbackService; +import writeon.api.assistant.service.PlannerService; +import writeon.api.assistant.service.UserModifyService; +import writeon.api.common.response.CursorResponse; @RestController @RequiredArgsConstructor @@ -128,10 +148,8 @@ public SseEmitter streamUserModify(@RequestParam UUID assistantId) { @Operation(summary = "어시스턴트 사용 내역 조회") @GetMapping("/histories") - public OffsetResponse getHistories( - @RequestParam UUID productId, - @ParameterObject OffsetRequest request) { - return assistantService.getHistories(productId, request.getPage(), request.getSize()); + public CursorResponse getHistories(@ParameterObject AssistantHistoryListRequest request) { + return assistantService.getHistories(request); } @Operation(summary = "어시스턴트 기능 완료 처리") diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index 9cd16be..b176610 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -1,9 +1,11 @@ package writeon.api.assistant.repository; +import org.jooq.Condition; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -22,12 +24,22 @@ public class AssistantDao { private final DSLContext dsl; - public List selectHistories(UUID productId, int page, int size) { + public List selectHistories(UUID productId, UUID assistantId, int size) { AssistantMessage memberMessage = ASSISTANT_MESSAGE.as("member_message"); AssistantMessage assistantMessage = ASSISTANT_MESSAGE.as("assistant_message"); - return dsl.select(ASSISTANT.ID, ASSISTANT.TYPE, ASSISTANT.IS_APPLIED, ASSISTANT.CREATED_AT, - memberMessage.CONTENT, memberMessage.PROMPT, assistantMessage.CONTENT) + List conditions = new ArrayList<>(List.of( + ASSISTANT.PRODUCT_ID.eq(productId), + ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode()), + ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now()) + )); + if (assistantId != null) { + conditions.add(ASSISTANT.ID.lt(assistantId)); + } + + return dsl + .select(ASSISTANT.ID, ASSISTANT.TYPE, ASSISTANT.IS_APPLIED, ASSISTANT.CREATED_AT, + memberMessage.CONTENT, memberMessage.PROMPT, assistantMessage.CONTENT) .from(ASSISTANT) .join(memberMessage) .on(ASSISTANT.ID.eq(memberMessage.ASSISTANT_ID) @@ -35,17 +47,15 @@ public List selectHistories(UUID productId, int page, .join(assistantMessage) .on(ASSISTANT.ID.eq(assistantMessage.ASSISTANT_ID) .and(assistantMessage.ROLE.eq(MessageSenderRole.ASSISTANT.getCode()))) - .where(ASSISTANT.PRODUCT_ID.eq(productId)) - .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) - .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) - .orderBy(ASSISTANT.CREATED_AT.desc()) - .offset((long) (page - 1) * size) + .where(conditions) + .orderBy(ASSISTANT.ID.desc()) .limit(size) .fetchInto(AssistantHistoryResponse.class); } public Long countHistories(UUID productId) { - return dsl.selectCount() + return dsl + .selectCount() .from(ASSISTANT) .where(ASSISTANT.PRODUCT_ID.eq(productId)) .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java index a1eb2bb..3ce0dd7 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantHistoryListRequest.java @@ -1,14 +1,22 @@ -package writeon.api.assistant.request; - -import java.time.LocalDateTime; - -import lombok.Getter; -import lombok.Setter; -import writeon.api.common.request.OffsetRequest; - -@Getter -@Setter -public class AssistantHistoryListRequest extends OffsetRequest { - - private LocalDateTime createdAt; -} +package writeon.api.assistant.request; + +import java.util.UUID; + +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.validation.constraints.Positive; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class AssistantHistoryListRequest { + + @Parameter(required = true) + private UUID productId; + + @Parameter(description = "cursor pagination 기준값") + private UUID assistantId; + + @Positive(message = "한 페이지에 조회 할 데이터 수는 양수여야 합니다.") + private int size = 10; +} diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 2117269..2f1f7b8 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -7,9 +7,10 @@ import lombok.RequiredArgsConstructor; import writeon.api.assistant.repository.AssistantDao; +import writeon.api.assistant.request.AssistantHistoryListRequest; import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.common.exception.BaseException; -import writeon.api.common.response.OffsetResponse; +import writeon.api.common.response.CursorResponse; import writeon.api.common.util.MemberUtil; import writeon.api.product.service.ProductQueryService; import writeon.domain.assistant.Assistant; @@ -80,14 +81,12 @@ public Assistant getById(UUID assistantId, UUID memberId) { } @Transactional(readOnly = true) - public OffsetResponse getHistories(UUID productId, int page, int size) { - productQueryService.verifyExist(productId); - - long count = assistantDao.countHistories(productId); - return OffsetResponse.of( - assistantDao.selectHistories(productId, page, size), - page, - size, + public CursorResponse getHistories(AssistantHistoryListRequest request) { + productQueryService.verifyExist(request.getProductId()); + + long count = assistantDao.countHistories(request.getProductId()); + return CursorResponse.of( + assistantDao.selectHistories(request.getProductId(), request.getAssistantId(), request.getSize()), count ); } diff --git a/api/src/main/java/writeon/api/common/request/OffsetRequest.java b/api/src/main/java/writeon/api/common/request/OffsetRequest.java deleted file mode 100644 index 4c7b679..0000000 --- a/api/src/main/java/writeon/api/common/request/OffsetRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package writeon.api.common.request; - -import jakarta.validation.constraints.Positive; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class OffsetRequest { - - @Positive(message = "페이지는 양수여야 합니다.") - private int page = 1; - - @Positive(message = "한 페이지에 조회 할 데이터 수는 양수여야 합니다.") - private int size = 10; -} diff --git a/api/src/main/java/writeon/api/common/response/CursorResponse.java b/api/src/main/java/writeon/api/common/response/CursorResponse.java new file mode 100644 index 0000000..0e9ef10 --- /dev/null +++ b/api/src/main/java/writeon/api/common/response/CursorResponse.java @@ -0,0 +1,21 @@ +package writeon.api.common.response; + +import java.util.List; + +import lombok.Getter; + +@Getter +public class CursorResponse { + + private final List contents; + private final long totalElements; + + private CursorResponse(List contents, long totalElements) { + this.contents = contents; + this.totalElements = totalElements; + } + + public static CursorResponse of(List contents, long totalElements) { + return new CursorResponse<>(contents, totalElements); + } +} diff --git a/api/src/main/java/writeon/api/common/response/OffsetResponse.java b/api/src/main/java/writeon/api/common/response/OffsetResponse.java deleted file mode 100644 index ced947a..0000000 --- a/api/src/main/java/writeon/api/common/response/OffsetResponse.java +++ /dev/null @@ -1,25 +0,0 @@ -package writeon.api.common.response; - -import java.util.List; - -import lombok.Getter; - -@Getter -public class OffsetResponse { - - private final List contents; - private final int page; - private final long totalPages; - private final long totalElements; - - private OffsetResponse(List contents, int page, int size, long totalElements) { - this.contents = contents; - this.page = page; - this.totalPages = (int) Math.ceil((double) totalElements / size); - this.totalElements = totalElements; - } - - public static OffsetResponse of(List contents, int page, int size, long totalElements) { - return new OffsetResponse<>(contents, page, size, totalElements); - } -} diff --git a/domain/build.gradle b/domain/build.gradle index 88cb129..eafac58 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -12,6 +12,8 @@ dependencies { /* jooq */ api 'org.springframework.boot:spring-boot-starter-jooq' jooqGenerator 'org.postgresql:postgresql' + + api 'com.fasterxml.uuid:java-uuid-generator:5.1.0' } bootJar { diff --git a/domain/src/main/java/writeon/domain/assistant/Assistant.java b/domain/src/main/java/writeon/domain/assistant/Assistant.java index 3ee234a..fc18783 100644 --- a/domain/src/main/java/writeon/domain/assistant/Assistant.java +++ b/domain/src/main/java/writeon/domain/assistant/Assistant.java @@ -1,5 +1,7 @@ package writeon.domain.assistant; +import com.fasterxml.uuid.Generators; + import java.util.UUID; import jakarta.persistence.Column; @@ -22,7 +24,7 @@ public class Assistant extends BaseTimeEntity { @Id @Column(name = "id", updatable = false) - private final UUID id = UUID.randomUUID(); + private final UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "product_id", updatable = false, nullable = false) private UUID productId; diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java index df46a26..dec3604 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantMessage.java @@ -1,14 +1,20 @@ package writeon.domain.assistant; -import jakarta.persistence.*; +import com.fasterxml.uuid.Generators; + +import java.time.LocalDateTime; +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import writeon.domain.assistant.enums.MessageSenderRole; -import java.time.LocalDateTime; -import java.util.UUID; - @Getter @Entity @NoArgsConstructor @@ -17,7 +23,7 @@ public class AssistantMessage { @Id @Column(updatable = false, nullable = false) - private final UUID id = UUID.randomUUID(); + private final UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "assistant_id", nullable = false) private UUID assistantId; diff --git a/domain/src/main/java/writeon/domain/product/Product.java b/domain/src/main/java/writeon/domain/product/Product.java index 0de8527..b54d49b 100644 --- a/domain/src/main/java/writeon/domain/product/Product.java +++ b/domain/src/main/java/writeon/domain/product/Product.java @@ -1,14 +1,24 @@ package writeon.domain.product; -import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.common.BaseAuditTimeEntity; +import com.fasterxml.uuid.Generators; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.common.BaseAuditTimeEntity; + @Getter @Entity @NoArgsConstructor @@ -17,7 +27,7 @@ public class Product extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "title") private String title; diff --git a/domain/src/main/java/writeon/domain/product/ProductCharacter.java b/domain/src/main/java/writeon/domain/product/ProductCharacter.java index a87b91f..35f3930 100644 --- a/domain/src/main/java/writeon/domain/product/ProductCharacter.java +++ b/domain/src/main/java/writeon/domain/product/ProductCharacter.java @@ -1,5 +1,7 @@ package writeon.domain.product; +import com.fasterxml.uuid.Generators; + import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; @@ -21,7 +23,7 @@ public class ProductCharacter extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "product_id", nullable = false) private UUID productId; diff --git a/domain/src/main/java/writeon/domain/product/ProductCustomField.java b/domain/src/main/java/writeon/domain/product/ProductCustomField.java index e3745c0..78c58e3 100644 --- a/domain/src/main/java/writeon/domain/product/ProductCustomField.java +++ b/domain/src/main/java/writeon/domain/product/ProductCustomField.java @@ -1,5 +1,7 @@ package writeon.domain.product; +import com.fasterxml.uuid.Generators; + import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; @@ -19,7 +21,7 @@ public class ProductCustomField extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "product_id", nullable = false) private UUID productId; diff --git a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java index 9226c5d..7fb45f0 100644 --- a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java +++ b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java @@ -1,5 +1,7 @@ package writeon.domain.product; +import com.fasterxml.uuid.Generators; + import java.time.LocalDateTime; import java.util.UUID; @@ -24,7 +26,7 @@ public class ProductFavoritePrompt { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private UUID id = Generators.timeBasedEpochGenerator().generate(); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "product_id", nullable = false) diff --git a/domain/src/main/java/writeon/domain/product/ProductMemo.java b/domain/src/main/java/writeon/domain/product/ProductMemo.java index 6713774..6802c3f 100644 --- a/domain/src/main/java/writeon/domain/product/ProductMemo.java +++ b/domain/src/main/java/writeon/domain/product/ProductMemo.java @@ -1,5 +1,9 @@ package writeon.domain.product; +import com.fasterxml.uuid.Generators; + +import java.util.UUID; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -9,8 +13,6 @@ import lombok.Setter; import writeon.domain.common.BaseAuditTimeEntity; -import java.util.UUID; - @Getter @Setter @Entity @@ -20,7 +22,7 @@ public class ProductMemo extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) - private UUID id = UUID.randomUUID(); + private UUID id = Generators.timeBasedEpochGenerator().generate(); @Column(name = "product_id", nullable = false) private UUID productId; diff --git a/domain/src/main/java/writeon/domain/product/ProductPlot.java b/domain/src/main/java/writeon/domain/product/ProductPlot.java index 6b87abf..8c15c82 100644 --- a/domain/src/main/java/writeon/domain/product/ProductPlot.java +++ b/domain/src/main/java/writeon/domain/product/ProductPlot.java @@ -1,5 +1,7 @@ package writeon.domain.product; +import java.util.UUID; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -10,8 +12,6 @@ import lombok.Setter; import writeon.domain.common.BaseAuditTimeEntity; -import java.util.UUID; - @Getter @Setter @Entity @@ -22,6 +22,7 @@ public class ProductPlot extends BaseAuditTimeEntity { @Id @Column(updatable = false, nullable = false) private UUID id; + @Column private String content; diff --git a/sql/init.sql b/sql/init.sql index f1b7ade..915a7f7 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -352,24 +352,25 @@ alter table product_favorite_prompt create table assistant ( - id uuid not null + id uuid not null constraint assistant_pk primary key, - product_id uuid not null, - type varchar(20) not null , - status varchar(20) not null , - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null + product_id uuid not null, + type varchar(20) not null, + status varchar(20) not null, + is_applied boolean default false not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null ); comment on table assistant is '어시스턴트'; comment on column assistant.product_id is '작품 ID'; comment on column assistant.type is '기능 종류'; comment on column assistant.status is '진행 상태'; -comment on column assistant.created_at is '생성일시'; -comment on column assistant.created_by is '생성자 ID'; +comment on column assistant.is_applied is '답변 적용 여부'; comment on column assistant.created_at is '수정일시'; +comment on column assistant.created_by is '생성자 ID'; alter table assistant owner to postgres; From c10005b55eb3fbe595615e0db896477428910ffe Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 9 Apr 2025 20:58:59 +0900 Subject: [PATCH 075/107] fix: send mail asynchronously (#74) --- .../writeon/api/auth/helper/MailHelper.java | 2 ++ .../api/common/config/AsyncConfig.java | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 api/src/main/java/writeon/api/common/config/AsyncConfig.java diff --git a/api/src/main/java/writeon/api/auth/helper/MailHelper.java b/api/src/main/java/writeon/api/auth/helper/MailHelper.java index f0fc015..bef6a90 100644 --- a/api/src/main/java/writeon/api/auth/helper/MailHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/MailHelper.java @@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.thymeleaf.context.Context; import org.thymeleaf.spring6.SpringTemplateEngine; @@ -18,6 +19,7 @@ public class MailHelper { private final JavaMailSender javaMailSender; private final SpringTemplateEngine templateEngine; + @Async("threadPoolExecutor") public void send ( MailType mailType, String mailTo, MailData data ) throws MessagingException { diff --git a/api/src/main/java/writeon/api/common/config/AsyncConfig.java b/api/src/main/java/writeon/api/common/config/AsyncConfig.java new file mode 100644 index 0000000..a5b335c --- /dev/null +++ b/api/src/main/java/writeon/api/common/config/AsyncConfig.java @@ -0,0 +1,25 @@ +package writeon.api.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.Executor; + +@Configuration +@EnableAsync +public class AsyncConfig { + + @Bean(name = "threadPoolExecutor") + public Executor threadPoolExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(4); + executor.setMaxPoolSize(8); + executor.setQueueCapacity(50); + executor.setThreadNamePrefix("executor-threadpool-"); + executor.initialize(); + return executor; + } + +} From 57d6c9d35d6246fe8405f164efb41cc83913bfa1 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 10 Apr 2025 01:24:09 +0900 Subject: [PATCH 076/107] fix: modify query condition for assistant histories (#75) --- .../assistant/repository/AssistantDao.java | 40 ++++++++++++------- .../response/AssistantHistoryResponse.java | 7 ++-- .../product/service/ProductQueryService.java | 8 ++-- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index b176610..fde3be1 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -1,20 +1,20 @@ package writeon.api.assistant.repository; +import lombok.RequiredArgsConstructor; import org.jooq.Condition; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.tables.AssistantMessage; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import lombok.RequiredArgsConstructor; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.tables.AssistantMessage; - import static writeon.Tables.ASSISTANT; import static writeon.Tables.ASSISTANT_MESSAGE; @@ -28,11 +28,7 @@ public List selectHistories(UUID productId, UUID assis AssistantMessage memberMessage = ASSISTANT_MESSAGE.as("member_message"); AssistantMessage assistantMessage = ASSISTANT_MESSAGE.as("assistant_message"); - List conditions = new ArrayList<>(List.of( - ASSISTANT.PRODUCT_ID.eq(productId), - ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode()), - ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now()) - )); + List conditions = getConditions(productId); if (assistantId != null) { conditions.add(ASSISTANT.ID.lt(assistantId)); } @@ -57,9 +53,25 @@ public Long countHistories(UUID productId) { return dsl .selectCount() .from(ASSISTANT) - .where(ASSISTANT.PRODUCT_ID.eq(productId)) - .and(ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode())) - .and(ASSISTANT.CREATED_AT.between(LocalDateTime.now().minusMonths(6), LocalDateTime.now())) + .where(getConditions(productId)) .fetchOneInto(Long.class); } + + private List getConditions(UUID productId) { + LocalDateTime now = LocalDateTime.now(); + + return new ArrayList<>(List.of( + ASSISTANT.PRODUCT_ID.eq(productId), + ASSISTANT.STATUS.ne(AssistantStatus.DRAFT.getCode()), + ASSISTANT.CREATED_AT.between(now.minusMonths(6), now), + ASSISTANT.TYPE.in( + List.of( + AssistantType.AUTO_MODIFY.getCode(), + AssistantType.USER_MODIFY.getCode(), + AssistantType.FEEDBACK.getCode(), + AssistantType.CHAT.getCode() + ) + ) + )); + } } diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java index 4eb4aea..4ea6a11 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -1,15 +1,16 @@ package writeon.api.assistant.response; -import java.time.LocalDateTime; -import java.util.UUID; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; +import java.time.LocalDateTime; +import java.util.UUID; + @Getter public class AssistantHistoryResponse { private final UUID id; + @Schema(title = "어시스턴트 타입", description = "auto modify, feedback, chat, user modify") private final String type; private final MemberMessage memberMessage; private final AssistantMessage assistantMessage; diff --git a/api/src/main/java/writeon/api/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java index a8363ec..188dbda 100644 --- a/api/src/main/java/writeon/api/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -4,13 +4,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.LogUtil; import writeon.api.common.util.MemberUtil; import writeon.api.product.repository.ProductDao; -import writeon.api.product.response.ProductDetailResponse; -import writeon.api.product.response.ProductFavoritePromptResponse; -import writeon.api.product.response.ProductMemoResponse; -import writeon.api.product.response.ProductResponse; -import writeon.api.product.response.ProductTemplateResponse; +import writeon.api.product.response.*; import writeon.domain.product.Product; import writeon.domain.product.ProductFavoritePrompt; import writeon.domain.product.ProductMemo; @@ -67,6 +64,7 @@ public List getMemos(UUID productId) { } public void verifyExist(UUID productId) { + LogUtil.info("MemberUtil.getMemberId(): " + MemberUtil.getMemberId()); if (!productRepository.existsByIdAndCreatedBy(productId, MemberUtil.getMemberId())) { throw new BaseException(ProductException.NOT_EXIST); } From d3d72a687689c3fe68b7b7d3d370aaf42a9531b7 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Fri, 11 Apr 2025 17:06:04 +0900 Subject: [PATCH 077/107] feat: add isFavoritedPrompt field to assistant histories response (#76) --- .../assistant/repository/AssistantDao.java | 8 ++--- .../response/AssistantHistoryResponse.java | 36 ++++++++++++------- .../assistant/service/AssistantService.java | 9 +++-- .../assistant/service/AutoModifyService.java | 15 ++++---- .../api/assistant/service/ChatService.java | 11 +++--- .../assistant/service/FeedbackService.java | 15 ++++---- .../api/assistant/service/PlannerService.java | 6 ++-- .../assistant/service/UserModifyService.java | 15 ++++---- .../product/controller/ProductController.java | 6 ++-- .../api/product/repository/ProductDao.java | 24 ++++++++++--- .../ProductFavoritePromptCreateRequest.java | 6 ++-- .../ProductFavoritePromptResponse.java | 18 +++++----- .../service/ProductCommandService.java | 30 ++++++++++++++-- .../product/service/ProductQueryService.java | 11 ++---- .../writeon/tables/ProductFavoritePrompt.java | 4 +-- .../tables/pojos/ProductFavoritePrompt.java | 24 ++++++------- .../records/ProductFavoritePromptRecord.java | 16 ++++----- .../AssistantMessageJpaRepository.java | 3 +- .../domain/product/ProductFavoritePrompt.java | 24 +++++-------- .../product/enums/ProductException.java | 5 ++- .../ProductFavoritePromptJpaRepository.java | 11 ++++++ sql/init.sql | 7 ++-- 22 files changed, 173 insertions(+), 131 deletions(-) create mode 100644 domain/src/main/java/writeon/domain/product/repository/ProductFavoritePromptJpaRepository.java diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index fde3be1..fe7b71e 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -15,8 +15,7 @@ import java.util.List; import java.util.UUID; -import static writeon.Tables.ASSISTANT; -import static writeon.Tables.ASSISTANT_MESSAGE; +import static writeon.Tables.*; @Repository @RequiredArgsConstructor @@ -34,12 +33,13 @@ public List selectHistories(UUID productId, UUID assis } return dsl - .select(ASSISTANT.ID, ASSISTANT.TYPE, ASSISTANT.IS_APPLIED, ASSISTANT.CREATED_AT, - memberMessage.CONTENT, memberMessage.PROMPT, assistantMessage.CONTENT) + .select(ASSISTANT, memberMessage, PRODUCT_FAVORITE_PROMPT.MESSAGE_ID.isNotNull(), assistantMessage) .from(ASSISTANT) .join(memberMessage) .on(ASSISTANT.ID.eq(memberMessage.ASSISTANT_ID) .and(memberMessage.ROLE.eq(MessageSenderRole.MEMBER.getCode()))) + .leftJoin(PRODUCT_FAVORITE_PROMPT) + .on(memberMessage.ID.eq(PRODUCT_FAVORITE_PROMPT.MESSAGE_ID)) .join(assistantMessage) .on(ASSISTANT.ID.eq(assistantMessage.ASSISTANT_ID) .and(assistantMessage.ROLE.eq(MessageSenderRole.ASSISTANT.getCode()))) diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java index 4ea6a11..4360eae 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -1,7 +1,10 @@ package writeon.api.assistant.response; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; +import writeon.tables.records.AssistantMessageRecord; +import writeon.tables.records.AssistantRecord; import java.time.LocalDateTime; import java.util.UUID; @@ -16,39 +19,48 @@ public class AssistantHistoryResponse { private final AssistantMessage assistantMessage; private final LocalDateTime createdAt; - public AssistantHistoryResponse(UUID id, String type, Boolean isApplied, LocalDateTime createdAt, - String memberMessageContent, String memberMessagePrompt, String assistantMessageContent) { - this.id = id; - this.type = type; - this.memberMessage = new MemberMessage(memberMessageContent, memberMessagePrompt); - this.assistantMessage = new AssistantMessage(assistantMessageContent, isApplied); - this.createdAt = createdAt; + public AssistantHistoryResponse(AssistantRecord assistant, AssistantMessageRecord memberMessage, Boolean isFavoritedPrompt, AssistantMessageRecord assistantMessage) { + this.id = assistant.getId(); + this.type = assistant.getType(); + this.memberMessage = new MemberMessage(memberMessage, isFavoritedPrompt); + this.assistantMessage = new AssistantMessage(assistantMessage, assistant.getIsApplied()); + this.createdAt = assistant.getCreatedAt(); } @Getter + @JsonInclude(JsonInclude.Include.NON_NULL) public static class MemberMessage { + @Schema(title = "메세지 ID") + private final UUID id; @Schema(title = "사용자가 선택한 구간") private final String content; @Schema(title = "사용자가 입력한 프롬프트") private final String prompt; + @Schema(title = "즐겨찾기 적용 여부") + private final Boolean isFavoritedPrompt; - public MemberMessage(String content, String prompt) { - this.content = content; - this.prompt = prompt; + public MemberMessage(AssistantMessageRecord message, Boolean isFavoritedPrompt) { + this.id = message.getId(); + this.content = message.getContent(); + this.prompt = message.getPrompt(); + this.isFavoritedPrompt = isFavoritedPrompt; } } @Getter public static class AssistantMessage { + @Schema(title = "메세지 ID") + private final UUID id; @Schema(title = "Assistant 답변") private final String content; @Schema(title = "답변 적용 여부") private final Boolean isApplied; - public AssistantMessage(String content, Boolean isApplied) { - this.content = content; + public AssistantMessage(AssistantMessageRecord message, Boolean isApplied) { + this.id = message.getId(); + this.content = message.getContent(); this.isApplied = isApplied; } } diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 2f1f7b8..6a7ef9f 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -1,11 +1,8 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.repository.AssistantDao; import writeon.api.assistant.request.AssistantHistoryListRequest; import writeon.api.assistant.response.AssistantHistoryResponse; @@ -22,6 +19,8 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; +import java.util.UUID; + @Service @RequiredArgsConstructor public class AssistantService { @@ -92,7 +91,7 @@ public CursorResponse getHistories(AssistantHistoryLis } @Transactional(readOnly = true) - public AssistantMessage getMessage(UUID assistantId, MessageSenderRole role) { + public AssistantMessage getMessageByAssistantId(UUID assistantId, MessageSenderRole role) { return assistantMessageRepository.findByAssistantIdAndMessageContent_Role(assistantId, role) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); } diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index 5a0688a..ae38eb3 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -1,13 +1,9 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.io.IOException; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -24,6 +20,9 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; +import java.io.IOException; +import java.util.UUID; + @Service @RequiredArgsConstructor public class AutoModifyService { @@ -57,7 +56,7 @@ public SseEmitter streamAutoModify(UUID assistantId) { assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); AutoModifyRequest request = new AutoModifyRequest( @@ -79,9 +78,7 @@ public SseEmitter streamAutoModify(UUID assistantId) { }, error -> { LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; + emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { String answer = responseBuilder.toString().replace("[DONE]", "").trim(); diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index c9362c4..d388fba 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -1,13 +1,9 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.io.IOException; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantChatMessageRequest; import writeon.api.assistant.request.AssistantResearchRequest; import writeon.api.assistant.response.AssistantResponse; @@ -27,6 +23,9 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; +import java.io.IOException; +import java.util.UUID; + @Service @RequiredArgsConstructor public class ChatService { @@ -60,7 +59,7 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); ChatRequest request = new ChatRequest( diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index 49dd79b..d08b3e5 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -1,13 +1,9 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.io.IOException; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantFeedbackMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -24,6 +20,9 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; +import java.io.IOException; +import java.util.UUID; + @Service @RequiredArgsConstructor public class FeedbackService { @@ -57,7 +56,7 @@ public SseEmitter streamFeedback(UUID assistantId) { assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); FeedbackRequest request = new FeedbackRequest( @@ -79,9 +78,7 @@ public SseEmitter streamFeedback(UUID assistantId) { }, error -> { LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; + emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { String answer = responseBuilder.toString().replace("[DONE]", "").trim(); diff --git a/api/src/main/java/writeon/api/assistant/service/PlannerService.java b/api/src/main/java/writeon/api/assistant/service/PlannerService.java index 7f3e106..f331ee3 100644 --- a/api/src/main/java/writeon/api/assistant/service/PlannerService.java +++ b/api/src/main/java/writeon/api/assistant/service/PlannerService.java @@ -68,7 +68,7 @@ public SseEmitter streamPlanner(UUID assistantId) { } productQueryService.verifyExist(assistant.getProductId()); - AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); AssistantPlannerMessage plannerMessage = assistantPlannerMessageRepository.findById(assistantId) .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); @@ -96,9 +96,7 @@ public SseEmitter streamPlanner(UUID assistantId) { }, error -> { LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; + emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { String answer = responseBuilder.toString().replace("[DONE]", "").trim(); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 1f94069..301a005 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -1,13 +1,9 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.io.IOException; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantUserModifyMessageRequest; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; @@ -24,6 +20,9 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; +import java.io.IOException; +import java.util.UUID; + @Service @RequiredArgsConstructor public class UserModifyService { @@ -58,7 +57,7 @@ public SseEmitter streamUserModify(UUID assistantId) { assistantService.verifyAnswered(assistantId); productQueryService.verifyExist(assistant.getProductId()); - AssistantMessage memberMessage = assistantService.getMessage(assistantId, MessageSenderRole.MEMBER); + AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); UserModifyRequest request = new UserModifyRequest( @@ -80,9 +79,7 @@ public SseEmitter streamUserModify(UUID assistantId) { }, error -> { LogUtil.error(error); - BaseException exception = new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR); - emitter.completeWithError(exception); - throw exception; + emitter.completeWithError(new BaseException(AssistantException.WEBCLIENT_REQUEST_ERROR)); }, () -> { String answer = responseBuilder.toString().replace("[DONE]", "").trim(); diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index 0066a04..43f2f7c 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -115,10 +115,10 @@ public void deleteMemo( } @Operation(summary = "프롬프트 즐겨찾기 해제") - @DeleteMapping("/{productId}/favorite-prompts/{promptId}") + @DeleteMapping("/{productId}/favorite-prompts") public void deleteFavoritePrompt( @PathVariable UUID productId, - @PathVariable UUID promptId) { - productCommandService.deleteFavoritePrompt(productId, promptId); + @RequestParam UUID messageId) { + productCommandService.deleteFavoritePrompt(productId, messageId); } } diff --git a/api/src/main/java/writeon/api/product/repository/ProductDao.java b/api/src/main/java/writeon/api/product/repository/ProductDao.java index c1ef6fd..bbbed68 100644 --- a/api/src/main/java/writeon/api/product/repository/ProductDao.java +++ b/api/src/main/java/writeon/api/product/repository/ProductDao.java @@ -1,16 +1,19 @@ package writeon.api.product.repository; +import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.springframework.stereotype.Repository; - -import java.util.List; - -import lombok.RequiredArgsConstructor; import writeon.api.common.util.MemberUtil; +import writeon.api.product.response.ProductFavoritePromptResponse; import writeon.api.product.response.ProductResponse; +import java.util.List; +import java.util.UUID; + +import static writeon.tables.AssistantMessage.ASSISTANT_MESSAGE; import static writeon.tables.Product.PRODUCT; import static writeon.tables.ProductSynopsis.PRODUCT_SYNOPSIS; +import static writeon.tables.ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT; @Repository @@ -29,4 +32,17 @@ public List select() { .orderBy(PRODUCT.UPDATED_AT.desc()) .fetchInto(ProductResponse.class); } + + public List selectFavoritePrompts(UUID productId) { + return dsl + .select(PRODUCT_FAVORITE_PROMPT.MESSAGE_ID, ASSISTANT_MESSAGE.PROMPT, PRODUCT_FAVORITE_PROMPT.CREATED_AT) + .from(PRODUCT) + .join(PRODUCT_FAVORITE_PROMPT) + .on(PRODUCT.ID.eq(PRODUCT_FAVORITE_PROMPT.PRODUCT_ID)) + .join(ASSISTANT_MESSAGE) + .on(PRODUCT_FAVORITE_PROMPT.MESSAGE_ID.eq(ASSISTANT_MESSAGE.ID)) + .where(PRODUCT.ID.eq(productId)) + .orderBy(PRODUCT_FAVORITE_PROMPT.CREATED_AT.desc()) + .fetchInto(ProductFavoritePromptResponse.class); + } } diff --git a/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java b/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java index ec804da..04d44ff 100644 --- a/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductFavoritePromptCreateRequest.java @@ -4,10 +4,12 @@ import lombok.Getter; import lombok.Setter; +import java.util.UUID; + @Getter @Setter public class ProductFavoritePromptCreateRequest { - @Schema(title = "프롬프트") - private String prompt; + @Schema(title = "어시스턴트 ID") + private UUID assistantId; } diff --git a/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java b/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java index e76feff..9f09934 100644 --- a/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductFavoritePromptResponse.java @@ -1,22 +1,22 @@ package writeon.api.product.response; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + import java.time.LocalDateTime; import java.util.UUID; -import lombok.Getter; -import writeon.domain.product.ProductFavoritePrompt; -import writeon.domain.product.ProductMemo; - @Getter public class ProductFavoritePromptResponse { - private final UUID id; + @Schema(title = "메세지 ID") + private final UUID messageId; private final String prompt; private final LocalDateTime createdAt; - public ProductFavoritePromptResponse(ProductFavoritePrompt prompt) { - this.id = prompt.getId(); - this.prompt = prompt.getPrompt(); - this.createdAt = prompt.getCreatedAt(); + public ProductFavoritePromptResponse(UUID messageId, String prompt, LocalDateTime createdAt) { + this.messageId = messageId; + this.prompt = prompt; + this.createdAt = createdAt; } } diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 8be149d..c6c2f36 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import writeon.api.assistant.service.AssistantService; import writeon.api.assistant.service.DocumentUploadService; import writeon.api.common.exception.BaseException; import writeon.api.common.util.MemberUtil; @@ -10,6 +11,10 @@ import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; +import writeon.domain.assistant.Assistant; +import writeon.domain.assistant.AssistantMessage; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; import writeon.domain.product.*; import writeon.domain.product.enums.ProductException; import writeon.domain.product.enums.ProductSectionType; @@ -32,7 +37,9 @@ public class ProductCommandService { private final ProductPlotJpaRepository productPlotRepository; private final ProductSynopsisJpaRepository productSynopsisRepository; private final ProductWorldviewJpaRepository productWorldviewRepository; + private final ProductFavoritePromptJpaRepository productFavoritePromptRepository; + private final AssistantService assistantService; private final DocumentUploadService documentUploadService; @Transactional @@ -51,8 +58,20 @@ public void createMemo(UUID productId, ProductMemoSaveRequest request) { @Transactional public void createFavoritePrompt(UUID productId, ProductFavoritePromptCreateRequest request) { Product product = productQueryService.getById(productId); + Assistant assistant = assistantService.getById(request.getAssistantId()); - product.getFavoritePrompts().add(new ProductFavoritePrompt(product, request.getPrompt())); + // 자유 대화 기능에서만 프롬프트 즐겨찾기 등록 가능 + if (!assistant.getType().equals(AssistantType.CHAT)) { + throw new BaseException(ProductException.INVALID_FAVORITE_PROMPT_TYPE); + } + AssistantMessage message = assistantService.getMessageByAssistantId(request.getAssistantId(), MessageSenderRole.MEMBER); + + // 이미 즐겨찾기 등록된 프롬프트인지 검증 + if (productFavoritePromptRepository.existsByProduct_IdAndMessageId(productId, message.getId())) { + throw new BaseException(ProductException.ALREADY_EXIST_FAVORITE_PROMPT); + } + + product.getFavoritePrompts().add(new ProductFavoritePrompt(product, message.getId())); } @Transactional @@ -100,10 +119,15 @@ public void deleteMemo(UUID productId, UUID memoId) { } @Transactional - public void deleteFavoritePrompt(UUID productId, UUID promptId) { + public void deleteFavoritePrompt(UUID productId, UUID messageId) { Product product = productQueryService.getById(productId); - product.getFavoritePrompts().removeIf(prompt -> prompt.getId().equals(promptId)); + ProductFavoritePrompt favoritePrompt = product.getFavoritePrompts().stream() + .filter(prompt -> prompt.getMessageId().equals(messageId)) + .findFirst() + .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_FAVORITE_PROMPT)); + + productFavoritePromptRepository.delete(favoritePrompt); } private ProductMemo getMemoById(UUID memoId) { diff --git a/api/src/main/java/writeon/api/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java index 188dbda..72dd4e7 100644 --- a/api/src/main/java/writeon/api/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -4,12 +4,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writeon.api.common.exception.BaseException; -import writeon.api.common.util.LogUtil; import writeon.api.common.util.MemberUtil; import writeon.api.product.repository.ProductDao; import writeon.api.product.response.*; import writeon.domain.product.Product; -import writeon.domain.product.ProductFavoritePrompt; import writeon.domain.product.ProductMemo; import writeon.domain.product.enums.ProductException; import writeon.domain.product.repository.ProductJpaRepository; @@ -40,13 +38,9 @@ public Product getById(UUID productId) { } public List getFavoritePrompts(UUID productId) { - Product product = getById(productId); + verifyExist(productId); - return product.getFavoritePrompts() - .stream() - .sorted(Comparator.comparing(ProductFavoritePrompt::getCreatedAt).reversed()) - .map(ProductFavoritePromptResponse::new) - .toList(); + return productDao.selectFavoritePrompts(productId); } public ProductTemplateResponse getTemplate(UUID productId) { @@ -64,7 +58,6 @@ public List getMemos(UUID productId) { } public void verifyExist(UUID productId) { - LogUtil.info("MemberUtil.getMemberId(): " + MemberUtil.getMemberId()); if (!productRepository.existsByIdAndCreatedBy(productId, MemberUtil.getMemberId())) { throw new BaseException(ProductException.NOT_EXIST); } diff --git a/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java index 79b87fb..0559ea7 100644 --- a/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java +++ b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java @@ -62,9 +62,9 @@ public Class getRecordType() { public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, ""); /** - * The column public.product_favorite_prompt.prompt. + * The column public.product_favorite_prompt.message_id. */ - public final TableField PROMPT = createField(DSL.name("prompt"), SQLDataType.CLOB.nullable(false), this, ""); + public final TableField MESSAGE_ID = createField(DSL.name("message_id"), SQLDataType.UUID.nullable(false), this, ""); /** * The column public.product_favorite_prompt.created_at. diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java b/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java index 982068b..f256c95 100644 --- a/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductFavoritePrompt.java @@ -19,25 +19,25 @@ public class ProductFavoritePrompt implements Serializable { private final UUID id; private final UUID productId; - private final String prompt; + private final UUID messageId; private final LocalDateTime createdAt; public ProductFavoritePrompt(ProductFavoritePrompt value) { this.id = value.id; this.productId = value.productId; - this.prompt = value.prompt; + this.messageId = value.messageId; this.createdAt = value.createdAt; } public ProductFavoritePrompt( UUID id, UUID productId, - String prompt, + UUID messageId, LocalDateTime createdAt ) { this.id = id; this.productId = productId; - this.prompt = prompt; + this.messageId = messageId; this.createdAt = createdAt; } @@ -56,10 +56,10 @@ public UUID getProductId() { } /** - * Getter for public.product_favorite_prompt.prompt. + * Getter for public.product_favorite_prompt.message_id. */ - public String getPrompt() { - return this.prompt; + public UUID getMessageId() { + return this.messageId; } /** @@ -90,11 +90,11 @@ else if (!this.id.equals(other.id)) } else if (!this.productId.equals(other.productId)) return false; - if (this.prompt == null) { - if (other.prompt != null) + if (this.messageId == null) { + if (other.messageId != null) return false; } - else if (!this.prompt.equals(other.prompt)) + else if (!this.messageId.equals(other.messageId)) return false; if (this.createdAt == null) { if (other.createdAt != null) @@ -111,7 +111,7 @@ public int hashCode() { int result = 1; result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); - result = prime * result + ((this.prompt == null) ? 0 : this.prompt.hashCode()); + result = prime * result + ((this.messageId == null) ? 0 : this.messageId.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); return result; } @@ -122,7 +122,7 @@ public String toString() { sb.append(id); sb.append(", ").append(productId); - sb.append(", ").append(prompt); + sb.append(", ").append(messageId); sb.append(", ").append(createdAt); sb.append(")"); diff --git a/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java b/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java index a74d488..17a6128 100644 --- a/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductFavoritePromptRecord.java @@ -52,18 +52,18 @@ public UUID getProductId() { } /** - * Setter for public.product_favorite_prompt.prompt. + * Setter for public.product_favorite_prompt.message_id. */ - public ProductFavoritePromptRecord setPrompt(String value) { + public ProductFavoritePromptRecord setMessageId(UUID value) { set(2, value); return this; } /** - * Getter for public.product_favorite_prompt.prompt. + * Getter for public.product_favorite_prompt.message_id. */ - public String getPrompt() { - return (String) get(2); + public UUID getMessageId() { + return (UUID) get(2); } /** @@ -104,12 +104,12 @@ public ProductFavoritePromptRecord() { /** * Create a detached, initialised ProductFavoritePromptRecord */ - public ProductFavoritePromptRecord(UUID id, UUID productId, String prompt, LocalDateTime createdAt) { + public ProductFavoritePromptRecord(UUID id, UUID productId, UUID messageId, LocalDateTime createdAt) { super(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT); setId(id); setProductId(productId); - setPrompt(prompt); + setMessageId(messageId); setCreatedAt(createdAt); resetChangedOnNotNull(); } @@ -123,7 +123,7 @@ public ProductFavoritePromptRecord(writeon.tables.pojos.ProductFavoritePrompt va if (value != null) { setId(value.getId()); setProductId(value.getProductId()); - setPrompt(value.getPrompt()); + setMessageId(value.getMessageId()); setCreatedAt(value.getCreatedAt()); resetChangedOnNotNull(); } diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java index 0b4e7cb..235ebd2 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantMessageJpaRepository.java @@ -1,12 +1,11 @@ package writeon.domain.assistant; import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.assistant.enums.MessageSenderRole; import java.util.Optional; import java.util.UUID; -import writeon.domain.assistant.enums.MessageSenderRole; - public interface AssistantMessageJpaRepository extends JpaRepository { boolean existsByAssistantIdAndMessageContent_Role(UUID assistantId, MessageSenderRole role); diff --git a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java index 7fb45f0..f28daf5 100644 --- a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java +++ b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java @@ -1,21 +1,13 @@ package writeon.domain.product; import com.fasterxml.uuid.Generators; - -import java.time.LocalDateTime; -import java.util.UUID; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import writeon.domain.common.BaseAuditTimeEntity; + +import java.time.LocalDateTime; +import java.util.UUID; @Getter @Setter @@ -32,14 +24,14 @@ public class ProductFavoritePrompt { @JoinColumn(name = "product_id", nullable = false) private Product product; - @Column(name = "prompt", nullable = false) - private String prompt; + @Column(name = "messageId", nullable = false) + private UUID messageId; @Column(name = "created_at", updatable = false, nullable = false) protected final LocalDateTime createdAt = LocalDateTime.now(); - public ProductFavoritePrompt(Product product, String prompt) { + public ProductFavoritePrompt(Product product, UUID messageId) { this.product = product; - this.prompt = prompt; + this.messageId = messageId; } } diff --git a/domain/src/main/java/writeon/domain/product/enums/ProductException.java b/domain/src/main/java/writeon/domain/product/enums/ProductException.java index b5ff25c..954b367 100644 --- a/domain/src/main/java/writeon/domain/product/enums/ProductException.java +++ b/domain/src/main/java/writeon/domain/product/enums/ProductException.java @@ -12,7 +12,10 @@ public enum ProductException implements CodeInfo { NOT_EXIST(HttpStatus.NOT_FOUND, "PRD-001", "존재하지 않는 작품입니다."), NOT_EXIST_CHARACTER(HttpStatus.NOT_FOUND, "PRD-002", "존재하지 않는 등장인물 입니다."), NOT_EXIST_CUSTOM_FIELD(HttpStatus.NOT_FOUND, "PRD-003", "존재하지 않는 커스텀 필드입니다."), - NOT_EXIST_MEMO(HttpStatus.NOT_FOUND, "PRD-004", "존재하지 않는 메모입니다."); + NOT_EXIST_MEMO(HttpStatus.NOT_FOUND, "PRD-004", "존재하지 않는 메모입니다."), + NOT_EXIST_FAVORITE_PROMPT(HttpStatus.NOT_FOUND, "PRD-005", "존재하지 않는 프롬프트입니다.."), + ALREADY_EXIST_FAVORITE_PROMPT(HttpStatus.BAD_REQUEST, "PRD-006", "이미 즐겨찾기에 추가한 프롬프트입니다."), + INVALID_FAVORITE_PROMPT_TYPE(HttpStatus.BAD_REQUEST, "PRD-007", "자유 대화 기능의 프롬프트만 즐겨찾기에 등록할 수 있습니다."); private final HttpStatus status; private final String code; diff --git a/domain/src/main/java/writeon/domain/product/repository/ProductFavoritePromptJpaRepository.java b/domain/src/main/java/writeon/domain/product/repository/ProductFavoritePromptJpaRepository.java new file mode 100644 index 0000000..144dec6 --- /dev/null +++ b/domain/src/main/java/writeon/domain/product/repository/ProductFavoritePromptJpaRepository.java @@ -0,0 +1,11 @@ +package writeon.domain.product.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import writeon.domain.product.ProductFavoritePrompt; + +import java.util.UUID; + +public interface ProductFavoritePromptJpaRepository extends JpaRepository { + + boolean existsByProduct_IdAndMessageId(UUID productId, UUID messageId); +} diff --git a/sql/init.sql b/sql/init.sql index 915a7f7..9dea770 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -341,15 +341,18 @@ create table product_favorite_prompt ( id uuid default gen_random_uuid() not null constraint product_favorite_prompt_pk - primary key, + primary key, product_id uuid not null, - prompt text not null, + message_id uuid not null, created_at timestamp not null ); alter table product_favorite_prompt owner to postgres; +create index idx_prompt_product_id + on product_favorite_prompt (product_id); + create table assistant ( id uuid not null From 698b9f32ce33a1c06841722a45559fc49a73070d Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Fri, 11 Apr 2025 17:24:10 +0900 Subject: [PATCH 078/107] fix: favorite prompt delete not working (#77) --- .../service/ProductCommandService.java | 1 + .../java/writeon/domain/product/Product.java | 21 +++++++------------ .../domain/product/ProductFavoritePrompt.java | 4 ++++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index c6c2f36..7e3c256 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -127,6 +127,7 @@ public void deleteFavoritePrompt(UUID productId, UUID messageId) { .findFirst() .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_FAVORITE_PROMPT)); + product.deleteFavoritePrompt(favoritePrompt); productFavoritePromptRepository.delete(favoritePrompt); } diff --git a/domain/src/main/java/writeon/domain/product/Product.java b/domain/src/main/java/writeon/domain/product/Product.java index b54d49b..7d09a3e 100644 --- a/domain/src/main/java/writeon/domain/product/Product.java +++ b/domain/src/main/java/writeon/domain/product/Product.java @@ -1,24 +1,15 @@ package writeon.domain.product; import com.fasterxml.uuid.Generators; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.common.BaseAuditTimeEntity; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToMany; -import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.common.BaseAuditTimeEntity; - @Getter @Entity @NoArgsConstructor @@ -70,4 +61,8 @@ public void update(String title, String content) { this.title = title; this.content = content; } + + public void deleteFavoritePrompt(ProductFavoritePrompt favoritePrompt) { + this.favoritePrompts.remove(favoritePrompt); + } } diff --git a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java index f28daf5..8ef20da 100644 --- a/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java +++ b/domain/src/main/java/writeon/domain/product/ProductFavoritePrompt.java @@ -34,4 +34,8 @@ public ProductFavoritePrompt(Product product, UUID messageId) { this.product = product; this.messageId = messageId; } + + public void delete() { + this.product = null; + } } From 43c7dd544374d4aed928d8d0aebd987a3785310f Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 12 Apr 2025 19:06:26 +0900 Subject: [PATCH 079/107] fix: resolve assistant APIs error (#78) --- .../writeon/api/assistant/service/AutoModifyService.java | 4 +++- .../java/writeon/api/assistant/service/ChatService.java | 5 ++++- .../api/assistant/service/DocumentUploadService.java | 6 ++++-- .../java/writeon/api/assistant/service/FeedbackService.java | 4 +++- .../java/writeon/api/assistant/service/PlannerService.java | 2 +- .../writeon/api/assistant/service/UserModifyService.java | 4 +++- .../writeon/domain/assistant/AssistantPlannerMessage.java | 5 ----- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index ae38eb3..1f6728a 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -60,7 +60,9 @@ public SseEmitter streamAutoModify(UUID assistantId) { UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); AutoModifyRequest request = new AutoModifyRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent() + "t" + assistant.getProductId().toString().replaceAll("-", ""), + userSetting, + memberMessage.getContent() ); SseEmitter emitter = new SseEmitter(TIMEOUT); diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index d388fba..f2356c7 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -63,7 +63,10 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); ChatRequest request = new ChatRequest( - userSetting, memberMessage.getContent(), memberMessage.getPrompt(), sessionId + userSetting, + memberMessage.getContent(), + memberMessage.getPrompt(), + sessionId ); SseEmitter emitter = new SseEmitter(TIMEOUT); diff --git a/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java b/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java index a0e7a5a..bdbddc0 100644 --- a/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java +++ b/api/src/main/java/writeon/api/assistant/service/DocumentUploadService.java @@ -14,8 +14,10 @@ public class DocumentUploadService { private final AssistantApiClient assistantApiClient; public void documentUpload(UUID productId, String content) { - DocumentUploadRequest request = - new DocumentUploadRequest(productId.toString().replaceAll("-", ""), content); + DocumentUploadRequest request = new DocumentUploadRequest( + "t" + productId.toString().replaceAll("-", ""), + content + ); assistantApiClient.documentUpload(request) .subscribe(); } diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index d08b3e5..37c1bf9 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -60,7 +60,9 @@ public SseEmitter streamFeedback(UUID assistantId) { UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); FeedbackRequest request = new FeedbackRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent() + "t" + assistant.getProductId().toString().replaceAll("-", ""), + userSetting, + memberMessage.getContent() ); SseEmitter emitter = new SseEmitter(TIMEOUT); diff --git a/api/src/main/java/writeon/api/assistant/service/PlannerService.java b/api/src/main/java/writeon/api/assistant/service/PlannerService.java index f331ee3..7d7a838 100644 --- a/api/src/main/java/writeon/api/assistant/service/PlannerService.java +++ b/api/src/main/java/writeon/api/assistant/service/PlannerService.java @@ -74,7 +74,7 @@ public SseEmitter streamPlanner(UUID assistantId) { .orElseThrow(() -> new BaseException(AssistantException.NOT_EXIST_MESSAGE)); PlannerGenerateRequest request = PlannerGenerateRequest.builder() - .tenantId(assistant.getProductId().toString()) + .tenantId("t" + assistant.getProductId().toString().replaceAll("-", "")) .genre(plannerMessage.getGenre()) .logline(plannerMessage.getLogline()) .section(plannerMessage.getSection()) diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index 301a005..c7b7cd4 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -61,7 +61,9 @@ public SseEmitter streamUserModify(UUID assistantId) { UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); UserModifyRequest request = new UserModifyRequest( - assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent(), memberMessage.getPrompt() + "t" + assistant.getProductId().toString().replaceAll("-", ""), + userSetting, memberMessage.getContent(), + memberMessage.getPrompt() ); SseEmitter emitter = new SseEmitter(TIMEOUT); diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java index a920d91..3ac5a43 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantPlannerMessage.java @@ -26,11 +26,6 @@ public class AssistantPlannerMessage { @Column(name = "section", nullable = false) private String section; - @OneToOne(fetch = FetchType.LAZY) - @MapsId - @JoinColumn(name = "assistant_id") - private AssistantMessage assistantMessage; - @Builder public AssistantPlannerMessage(UUID assistantId, String genre, String logline, String section) { this.assistantId = assistantId; From 1229202be9389e022f9cea19c7946f677eebc410 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 13 Apr 2025 15:05:55 +0900 Subject: [PATCH 080/107] feat: add tomcat configurations for logging (#79) --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index 0617ea9..3c468dd 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 +Subproject commit 3c468dd8813ec376c72c6b5aa7dae482e50081fa From 6a98eb5c574c3eedbeec7e6d6b7e19de02347c93 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:33:51 +0900 Subject: [PATCH 081/107] feat: add product fixed message APIs (#80) --- BE-secret | 2 +- .../product/controller/ProductController.java | 49 ++- .../response/ProductFixedMessageResponse.java | 19 ++ .../service/ProductCommandService.java | 69 ++++- .../product/service/ProductQueryService.java | 31 +- .../src/main/generated/writeon/Indexes.java | 26 ++ domain/src/main/generated/writeon/Keys.java | 10 + domain/src/main/generated/writeon/Public.java | 7 + domain/src/main/generated/writeon/Tables.java | 6 + .../generated/writeon/tables/Product.java | 51 ++++ .../writeon/tables/ProductFavoritePrompt.java | 9 + .../writeon/tables/ProductFixedMessage.java | 283 ++++++++++++++++++ .../tables/pojos/ProductFixedMessage.java | 92 ++++++ .../records/ProductFixedMessageRecord.java | 96 ++++++ .../java/writeon/domain/product/Product.java | 32 +- .../domain/product/ProductFixedMessage.java | 41 +++ sql/init.sql | 13 + 17 files changed, 803 insertions(+), 33 deletions(-) create mode 100644 api/src/main/java/writeon/api/product/response/ProductFixedMessageResponse.java create mode 100644 domain/src/main/generated/writeon/Indexes.java create mode 100644 domain/src/main/generated/writeon/tables/ProductFixedMessage.java create mode 100644 domain/src/main/generated/writeon/tables/pojos/ProductFixedMessage.java create mode 100644 domain/src/main/generated/writeon/tables/records/ProductFixedMessageRecord.java create mode 100644 domain/src/main/java/writeon/domain/product/ProductFixedMessage.java diff --git a/BE-secret b/BE-secret index 3c468dd..0617ea9 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 3c468dd8813ec376c72c6b5aa7dae482e50081fa +Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index 43f2f7c..1a0e893 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -1,25 +1,32 @@ package writeon.api.product.controller; +import org.springframework.web.bind.annotation.DeleteMapping; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.UUID; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import writeon.api.product.request.ProductFavoritePromptCreateRequest; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; import writeon.api.product.response.ProductDetailResponse; import writeon.api.product.response.ProductFavoritePromptResponse; +import writeon.api.product.response.ProductFixedMessageResponse; import writeon.api.product.response.ProductMemoResponse; import writeon.api.product.response.ProductResponse; import writeon.api.product.response.ProductTemplateResponse; import writeon.api.product.service.ProductCommandService; import writeon.api.product.service.ProductQueryService; -import java.util.List; -import java.util.UUID; - @RestController @RequiredArgsConstructor @RequestMapping("/products") @@ -44,11 +51,19 @@ public UUID modify( } @Operation(summary = "프롬프트 즐겨찾기 설정") - @PostMapping("/{productId}/favorite-prompts") + @PostMapping("/{productId}/favorite-prompts/{assistantId}") public void createFavoritePrompt( @PathVariable UUID productId, - @RequestBody ProductFavoritePromptCreateRequest request) { - productCommandService.createFavoritePrompt(productId, request); + @PathVariable UUID assistantId) { + productCommandService.createFavoritePrompt(productId, assistantId); + } + + @Operation(summary = "고정 메세지 설정") + @PostMapping("/{productId}/fixed-messages/{assistantId}") + public void createFixedMessage( + @PathVariable UUID productId, + @PathVariable UUID assistantId) { + productCommandService.createFixedMessage(productId, assistantId); } @Operation(summary = "템플릿 저장") @@ -85,6 +100,12 @@ public List getFavoritePrompts(@PathVariable UUID return productQueryService.getFavoritePrompts(productId); } + @Operation(summary = "고정 메세지 조회") + @GetMapping("/{productId}/fixed-messages") + public ProductFixedMessageResponse getFixedMessage(@PathVariable UUID productId) { + return productQueryService.getFixedMessage(productId); + } + @Operation(summary = "템플릿 조회") @GetMapping("/{productId}/templates") public ProductTemplateResponse getTemplate(@PathVariable UUID productId) { @@ -115,10 +136,16 @@ public void deleteMemo( } @Operation(summary = "프롬프트 즐겨찾기 해제") - @DeleteMapping("/{productId}/favorite-prompts") + @DeleteMapping("/{productId}/favorite-prompts/{messageId}") public void deleteFavoritePrompt( @PathVariable UUID productId, - @RequestParam UUID messageId) { + @PathVariable UUID messageId) { productCommandService.deleteFavoritePrompt(productId, messageId); } + + @Operation(summary = "고정 메세지 해제") + @DeleteMapping("/{productId}/fixed-messages") + public void deleteFixedMessage(@PathVariable UUID productId) { + productCommandService.deleteFixedMessage(productId); + } } diff --git a/api/src/main/java/writeon/api/product/response/ProductFixedMessageResponse.java b/api/src/main/java/writeon/api/product/response/ProductFixedMessageResponse.java new file mode 100644 index 0000000..fb78fa6 --- /dev/null +++ b/api/src/main/java/writeon/api/product/response/ProductFixedMessageResponse.java @@ -0,0 +1,19 @@ +package writeon.api.product.response; + +import java.util.UUID; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +@Getter +public class ProductFixedMessageResponse { + + @Schema(title = "메세지 ID") + private final UUID messageId; + private final String content; + + public ProductFixedMessageResponse(UUID messageId, String content) { + this.messageId = messageId; + this.content = content; + } +} diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 7e3c256..f69fe78 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -1,28 +1,51 @@ package writeon.api.product.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; + +import lombok.RequiredArgsConstructor; import writeon.api.assistant.service.AssistantService; import writeon.api.assistant.service.DocumentUploadService; import writeon.api.common.exception.BaseException; import writeon.api.common.util.MemberUtil; -import writeon.api.product.request.ProductFavoritePromptCreateRequest; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; import writeon.domain.assistant.Assistant; import writeon.domain.assistant.AssistantMessage; +import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.AssistantType; import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.domain.product.*; +import writeon.domain.product.Product; +import writeon.domain.product.ProductCharacter; +import writeon.domain.product.ProductCustomField; +import writeon.domain.product.ProductFavoritePrompt; +import writeon.domain.product.ProductFixedMessage; +import writeon.domain.product.ProductIdeaNote; +import writeon.domain.product.ProductMemo; +import writeon.domain.product.ProductPlot; +import writeon.domain.product.ProductSynopsis; +import writeon.domain.product.ProductWorldview; import writeon.domain.product.enums.ProductException; import writeon.domain.product.enums.ProductSectionType; -import writeon.domain.product.repository.*; - -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; +import writeon.domain.product.repository.ProductCharacterJpaRepository; +import writeon.domain.product.repository.ProductCustomFieldJpaRepository; +import writeon.domain.product.repository.ProductFavoritePromptJpaRepository; +import writeon.domain.product.repository.ProductIdeaNoteJpaRepository; +import writeon.domain.product.repository.ProductJpaRepository; +import writeon.domain.product.repository.ProductMemoJpaRepository; +import writeon.domain.product.repository.ProductPlotJpaRepository; +import writeon.domain.product.repository.ProductSynopsisJpaRepository; +import writeon.domain.product.repository.ProductWorldviewJpaRepository; @Service @RequiredArgsConstructor @@ -56,15 +79,19 @@ public void createMemo(UUID productId, ProductMemoSaveRequest request) { } @Transactional - public void createFavoritePrompt(UUID productId, ProductFavoritePromptCreateRequest request) { + public void createFavoritePrompt(UUID productId, UUID assistantId) { Product product = productQueryService.getById(productId); - Assistant assistant = assistantService.getById(request.getAssistantId()); + Assistant assistant = assistantService.getById(assistantId); + + if (!assistant.getProductId().equals(productId)) { + throw new BaseException(AssistantException.NOT_EXIST); + } // 자유 대화 기능에서만 프롬프트 즐겨찾기 등록 가능 if (!assistant.getType().equals(AssistantType.CHAT)) { throw new BaseException(ProductException.INVALID_FAVORITE_PROMPT_TYPE); } - AssistantMessage message = assistantService.getMessageByAssistantId(request.getAssistantId(), MessageSenderRole.MEMBER); + AssistantMessage message = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); // 이미 즐겨찾기 등록된 프롬프트인지 검증 if (productFavoritePromptRepository.existsByProduct_IdAndMessageId(productId, message.getId())) { @@ -74,6 +101,20 @@ public void createFavoritePrompt(UUID productId, ProductFavoritePromptCreateRequ product.getFavoritePrompts().add(new ProductFavoritePrompt(product, message.getId())); } + @Transactional + public void createFixedMessage(UUID productId, UUID assistantId) { + Product product = productQueryService.getById(productId); + Assistant assistant = assistantService.getById(assistantId); + + if (!assistant.getProductId().equals(productId)) { + throw new BaseException(AssistantException.NOT_EXIST); + } + + AssistantMessage message = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.ASSISTANT); + + product.setFixedMessage(new ProductFixedMessage(message)); + } + @Transactional public void saveTemplate(UUID productId, ProductTemplateSaveRequest request) { Product product = productQueryService.getById(productId); @@ -131,6 +172,12 @@ public void deleteFavoritePrompt(UUID productId, UUID messageId) { productFavoritePromptRepository.delete(favoritePrompt); } + @Transactional + public void deleteFixedMessage(UUID productId) { + Product product = productQueryService.getById(productId); + product.deleteFixedMessage(); + } + private ProductMemo getMemoById(UUID memoId) { return productMemoRepository.findByIdAndCreatedBy(memoId, MemberUtil.getMemberId()) .orElseThrow(() -> new BaseException(ProductException.NOT_EXIST_MEMO)); diff --git a/api/src/main/java/writeon/api/product/service/ProductQueryService.java b/api/src/main/java/writeon/api/product/service/ProductQueryService.java index 72dd4e7..cf7d017 100644 --- a/api/src/main/java/writeon/api/product/service/ProductQueryService.java +++ b/api/src/main/java/writeon/api/product/service/ProductQueryService.java @@ -1,21 +1,29 @@ package writeon.api.product.service; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.Comparator; +import java.util.List; +import java.util.UUID; + +import lombok.RequiredArgsConstructor; import writeon.api.common.exception.BaseException; import writeon.api.common.util.MemberUtil; import writeon.api.product.repository.ProductDao; -import writeon.api.product.response.*; +import writeon.api.product.response.ProductDetailResponse; +import writeon.api.product.response.ProductFavoritePromptResponse; +import writeon.api.product.response.ProductFixedMessageResponse; +import writeon.api.product.response.ProductMemoResponse; +import writeon.api.product.response.ProductResponse; +import writeon.api.product.response.ProductTemplateResponse; +import writeon.domain.assistant.AssistantMessage; import writeon.domain.product.Product; +import writeon.domain.product.ProductFixedMessage; import writeon.domain.product.ProductMemo; import writeon.domain.product.enums.ProductException; import writeon.domain.product.repository.ProductJpaRepository; -import java.util.Comparator; -import java.util.List; -import java.util.UUID; - @Service @RequiredArgsConstructor @Transactional(readOnly = true) @@ -43,6 +51,17 @@ public List getFavoritePrompts(UUID productId) { return productDao.selectFavoritePrompts(productId); } + public ProductFixedMessageResponse getFixedMessage(UUID productId) { + ProductFixedMessage fixedMessage = getById(productId).getFixedMessage(); + + if (fixedMessage == null) { + return null; + } + + AssistantMessage message = fixedMessage.getMessage(); + return new ProductFixedMessageResponse(message.getId(), message.getContent()); + } + public ProductTemplateResponse getTemplate(UUID productId) { return new ProductTemplateResponse(getById(productId)); } diff --git a/domain/src/main/generated/writeon/Indexes.java b/domain/src/main/generated/writeon/Indexes.java new file mode 100644 index 0000000..d5045fb --- /dev/null +++ b/domain/src/main/generated/writeon/Indexes.java @@ -0,0 +1,26 @@ +/* + * This file is generated by jOOQ. + */ +package writeon; + + +import org.jooq.Index; +import org.jooq.OrderField; +import org.jooq.impl.DSL; +import org.jooq.impl.Internal; + +import writeon.tables.ProductFavoritePrompt; + + +/** + * A class modelling indexes of tables in public. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Indexes { + + // ------------------------------------------------------------------------- + // INDEX definitions + // ------------------------------------------------------------------------- + + public static final Index IDX_PROMPT_PRODUCT_ID = Internal.createIndex(DSL.name("idx_prompt_product_id"), ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT, new OrderField[] { ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT.PRODUCT_ID }, false); +} diff --git a/domain/src/main/generated/writeon/Keys.java b/domain/src/main/generated/writeon/Keys.java index d6dc0cc..8a5b132 100644 --- a/domain/src/main/generated/writeon/Keys.java +++ b/domain/src/main/generated/writeon/Keys.java @@ -4,6 +4,7 @@ package writeon; +import org.jooq.ForeignKey; import org.jooq.TableField; import org.jooq.UniqueKey; import org.jooq.impl.DSL; @@ -20,6 +21,7 @@ import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; import writeon.tables.ProductFavoritePrompt; +import writeon.tables.ProductFixedMessage; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -37,6 +39,7 @@ import writeon.tables.records.ProductCharacterRecord; import writeon.tables.records.ProductCustomFieldRecord; import writeon.tables.records.ProductFavoritePromptRecord; +import writeon.tables.records.ProductFixedMessageRecord; import writeon.tables.records.ProductIdeanoteRecord; import writeon.tables.records.ProductMemoRecord; import writeon.tables.records.ProductPlotRecord; @@ -71,6 +74,7 @@ public class Keys { public static final UniqueKey PRODUCT_CHARACTER_PK = Internal.createUniqueKey(ProductCharacter.PRODUCT_CHARACTER, DSL.name("product_character_pk"), new TableField[] { ProductCharacter.PRODUCT_CHARACTER.ID }, true); public static final UniqueKey PRODUCT_CUSTOM_FIELD_PK = Internal.createUniqueKey(ProductCustomField.PRODUCT_CUSTOM_FIELD, DSL.name("product_custom_field_pk"), new TableField[] { ProductCustomField.PRODUCT_CUSTOM_FIELD.ID }, true); public static final UniqueKey PRODUCT_FAVORITE_PROMPT_PK = Internal.createUniqueKey(ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT, DSL.name("product_favorite_prompt_pk"), new TableField[] { ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT.ID }, true); + public static final UniqueKey PRODUCT_FIXED_MESSAGE_PKEY = Internal.createUniqueKey(ProductFixedMessage.PRODUCT_FIXED_MESSAGE, DSL.name("product_fixed_message_pkey"), new TableField[] { ProductFixedMessage.PRODUCT_FIXED_MESSAGE.PRODUCT_ID }, true); public static final UniqueKey PRODUCT_IDEANOTE_PK = Internal.createUniqueKey(ProductIdeanote.PRODUCT_IDEANOTE, DSL.name("product_ideanote_pk"), new TableField[] { ProductIdeanote.PRODUCT_IDEANOTE.ID }, true); public static final UniqueKey PRODUCT_MEMO_PK = Internal.createUniqueKey(ProductMemo.PRODUCT_MEMO, DSL.name("product_memo_pk"), new TableField[] { ProductMemo.PRODUCT_MEMO.ID }, true); public static final UniqueKey PRODUCT_PLOT_PK = Internal.createUniqueKey(ProductPlot.PRODUCT_PLOT, DSL.name("product_plot_pk"), new TableField[] { ProductPlot.PRODUCT_PLOT.ID }, true); @@ -78,4 +82,10 @@ public class Keys { public static final UniqueKey PRODUCT_WORLDVIEW_PK = Internal.createUniqueKey(ProductWorldview.PRODUCT_WORLDVIEW, DSL.name("product_worldview_pk"), new TableField[] { ProductWorldview.PRODUCT_WORLDVIEW.ID }, true); public static final UniqueKey TERMS_PK = Internal.createUniqueKey(Terms.TERMS, DSL.name("terms_pk"), new TableField[] { Terms.TERMS.ID }, true); public static final UniqueKey TERMS_AGREEMENT_PK = Internal.createUniqueKey(TermsAgreement.TERMS_AGREEMENT, DSL.name("terms_agreement_pk"), new TableField[] { TermsAgreement.TERMS_AGREEMENT.TERMS_CD, TermsAgreement.TERMS_AGREEMENT.MEMBER_ID }, true); + + // ------------------------------------------------------------------------- + // FOREIGN KEY definitions + // ------------------------------------------------------------------------- + + public static final ForeignKey PRODUCT_FIXED_MESSAGE__FK_PRODUCT = Internal.createForeignKey(ProductFixedMessage.PRODUCT_FIXED_MESSAGE, DSL.name("fk_product"), new TableField[] { ProductFixedMessage.PRODUCT_FIXED_MESSAGE.PRODUCT_ID }, Keys.PRODUCT_PK, new TableField[] { Product.PRODUCT.ID }, true); } diff --git a/domain/src/main/generated/writeon/Public.java b/domain/src/main/generated/writeon/Public.java index a13ef5d..7a4b7bd 100644 --- a/domain/src/main/generated/writeon/Public.java +++ b/domain/src/main/generated/writeon/Public.java @@ -26,6 +26,7 @@ import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; import writeon.tables.ProductFavoritePrompt; +import writeon.tables.ProductFixedMessage; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -143,6 +144,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public final ProductFavoritePrompt PRODUCT_FAVORITE_PROMPT = ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT; + /** + * The table public.product_fixed_message. + */ + public final ProductFixedMessage PRODUCT_FIXED_MESSAGE = ProductFixedMessage.PRODUCT_FIXED_MESSAGE; + /** * 작품 아이디어 노트 */ @@ -206,6 +212,7 @@ public final List> getTables() { ProductCharacter.PRODUCT_CHARACTER, ProductCustomField.PRODUCT_CUSTOM_FIELD, ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT, + ProductFixedMessage.PRODUCT_FIXED_MESSAGE, ProductIdeanote.PRODUCT_IDEANOTE, ProductMemo.PRODUCT_MEMO, ProductPlot.PRODUCT_PLOT, diff --git a/domain/src/main/generated/writeon/Tables.java b/domain/src/main/generated/writeon/Tables.java index 919f941..57ab1ac 100644 --- a/domain/src/main/generated/writeon/Tables.java +++ b/domain/src/main/generated/writeon/Tables.java @@ -20,6 +20,7 @@ import writeon.tables.ProductCharacter; import writeon.tables.ProductCustomField; import writeon.tables.ProductFavoritePrompt; +import writeon.tables.ProductFixedMessage; import writeon.tables.ProductIdeanote; import writeon.tables.ProductMemo; import writeon.tables.ProductPlot; @@ -130,6 +131,11 @@ public static PgpArmorHeaders PGP_ARMOR_HEADERS( */ public static final ProductFavoritePrompt PRODUCT_FAVORITE_PROMPT = ProductFavoritePrompt.PRODUCT_FAVORITE_PROMPT; + /** + * The table public.product_fixed_message. + */ + public static final ProductFixedMessage PRODUCT_FIXED_MESSAGE = ProductFixedMessage.PRODUCT_FIXED_MESSAGE; + /** * 작품 아이디어 노트 */ diff --git a/domain/src/main/generated/writeon/tables/Product.java b/domain/src/main/generated/writeon/tables/Product.java index 36cf3a7..8c66d01 100644 --- a/domain/src/main/generated/writeon/tables/Product.java +++ b/domain/src/main/generated/writeon/tables/Product.java @@ -10,9 +10,13 @@ import org.jooq.Condition; import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.InverseForeignKey; import org.jooq.Name; +import org.jooq.Path; import org.jooq.PlainSQL; import org.jooq.QueryPart; +import org.jooq.Record; import org.jooq.SQL; import org.jooq.Schema; import org.jooq.Select; @@ -27,6 +31,7 @@ import writeon.Keys; import writeon.Public; +import writeon.tables.ProductFixedMessage.ProductFixedMessagePath; import writeon.tables.records.ProductRecord; @@ -115,6 +120,39 @@ public Product() { this(DSL.name("product"), null); } + public Product(Table path, ForeignKey childPath, InverseForeignKey parentPath) { + super(path, childPath, parentPath, PRODUCT); + } + + /** + * A subtype implementing {@link Path} for simplified path-based joins. + */ + public static class ProductPath extends Product implements Path { + + private static final long serialVersionUID = 1L; + public ProductPath(Table path, ForeignKey childPath, InverseForeignKey parentPath) { + super(path, childPath, parentPath); + } + private ProductPath(Name alias, Table aliased) { + super(alias, aliased); + } + + @Override + public ProductPath as(String alias) { + return new ProductPath(DSL.name(alias), this); + } + + @Override + public ProductPath as(Name alias) { + return new ProductPath(alias, this); + } + + @Override + public ProductPath as(Table alias) { + return new ProductPath(alias.getQualifiedName(), this); + } + } + @Override public Schema getSchema() { return aliased() ? null : Public.PUBLIC; @@ -125,6 +163,19 @@ public UniqueKey getPrimaryKey() { return Keys.PRODUCT_PK; } + private transient ProductFixedMessagePath _productFixedMessage; + + /** + * Get the implicit to-many join path to the + * public.product_fixed_message table + */ + public ProductFixedMessagePath productFixedMessage() { + if (_productFixedMessage == null) + _productFixedMessage = new ProductFixedMessagePath(this, null, Keys.PRODUCT_FIXED_MESSAGE__FK_PRODUCT.getInverseKey()); + + return _productFixedMessage; + } + @Override public Product as(String alias) { return new Product(DSL.name(alias), this); diff --git a/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java index 0559ea7..291aa0e 100644 --- a/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java +++ b/domain/src/main/generated/writeon/tables/ProductFavoritePrompt.java @@ -5,11 +5,14 @@ import java.time.LocalDateTime; +import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.UUID; import org.jooq.Condition; import org.jooq.Field; +import org.jooq.Index; import org.jooq.Name; import org.jooq.PlainSQL; import org.jooq.QueryPart; @@ -25,6 +28,7 @@ import org.jooq.impl.SQLDataType; import org.jooq.impl.TableImpl; +import writeon.Indexes; import writeon.Keys; import writeon.Public; import writeon.tables.records.ProductFavoritePromptRecord; @@ -107,6 +111,11 @@ public Schema getSchema() { return aliased() ? null : Public.PUBLIC; } + @Override + public List getIndexes() { + return Arrays.asList(Indexes.IDX_PROMPT_PRODUCT_ID); + } + @Override public UniqueKey getPrimaryKey() { return Keys.PRODUCT_FAVORITE_PROMPT_PK; diff --git a/domain/src/main/generated/writeon/tables/ProductFixedMessage.java b/domain/src/main/generated/writeon/tables/ProductFixedMessage.java new file mode 100644 index 0000000..ec41b1c --- /dev/null +++ b/domain/src/main/generated/writeon/tables/ProductFixedMessage.java @@ -0,0 +1,283 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables; + + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.UUID; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.InverseForeignKey; +import org.jooq.Name; +import org.jooq.Path; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.Record; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + +import writeon.Keys; +import writeon.Public; +import writeon.tables.Product.ProductPath; +import writeon.tables.records.ProductFixedMessageRecord; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFixedMessage extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.product_fixed_message + */ + public static final ProductFixedMessage PRODUCT_FIXED_MESSAGE = new ProductFixedMessage(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ProductFixedMessageRecord.class; + } + + /** + * The column public.product_fixed_message.product_id. + */ + public final TableField PRODUCT_ID = createField(DSL.name("product_id"), SQLDataType.UUID.nullable(false), this, ""); + + /** + * The column public.product_fixed_message.message_id. + */ + public final TableField MESSAGE_ID = createField(DSL.name("message_id"), SQLDataType.UUID.nullable(false), this, ""); + + private ProductFixedMessage(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private ProductFixedMessage(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased public.product_fixed_message table + * reference + */ + public ProductFixedMessage(String alias) { + this(DSL.name(alias), PRODUCT_FIXED_MESSAGE); + } + + /** + * Create an aliased public.product_fixed_message table + * reference + */ + public ProductFixedMessage(Name alias) { + this(alias, PRODUCT_FIXED_MESSAGE); + } + + /** + * Create a public.product_fixed_message table reference + */ + public ProductFixedMessage() { + this(DSL.name("product_fixed_message"), null); + } + + public ProductFixedMessage(Table path, ForeignKey childPath, InverseForeignKey parentPath) { + super(path, childPath, parentPath, PRODUCT_FIXED_MESSAGE); + } + + /** + * A subtype implementing {@link Path} for simplified path-based joins. + */ + public static class ProductFixedMessagePath extends ProductFixedMessage implements Path { + + private static final long serialVersionUID = 1L; + public ProductFixedMessagePath(Table path, ForeignKey childPath, InverseForeignKey parentPath) { + super(path, childPath, parentPath); + } + private ProductFixedMessagePath(Name alias, Table aliased) { + super(alias, aliased); + } + + @Override + public ProductFixedMessagePath as(String alias) { + return new ProductFixedMessagePath(DSL.name(alias), this); + } + + @Override + public ProductFixedMessagePath as(Name alias) { + return new ProductFixedMessagePath(alias, this); + } + + @Override + public ProductFixedMessagePath as(Table alias) { + return new ProductFixedMessagePath(alias.getQualifiedName(), this); + } + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PRODUCT_FIXED_MESSAGE_PKEY; + } + + @Override + public List> getReferences() { + return Arrays.asList(Keys.PRODUCT_FIXED_MESSAGE__FK_PRODUCT); + } + + private transient ProductPath _product; + + /** + * Get the implicit join path to the public.product table. + */ + public ProductPath product() { + if (_product == null) + _product = new ProductPath(this, Keys.PRODUCT_FIXED_MESSAGE__FK_PRODUCT, null); + + return _product; + } + + @Override + public ProductFixedMessage as(String alias) { + return new ProductFixedMessage(DSL.name(alias), this); + } + + @Override + public ProductFixedMessage as(Name alias) { + return new ProductFixedMessage(alias, this); + } + + @Override + public ProductFixedMessage as(Table alias) { + return new ProductFixedMessage(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public ProductFixedMessage rename(String name) { + return new ProductFixedMessage(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ProductFixedMessage rename(Name name) { + return new ProductFixedMessage(name, null); + } + + /** + * Rename this table + */ + @Override + public ProductFixedMessage rename(Table name) { + return new ProductFixedMessage(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage where(Condition condition) { + return new ProductFixedMessage(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFixedMessage where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFixedMessage where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFixedMessage where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public ProductFixedMessage where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public ProductFixedMessage whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductFixedMessage.java b/domain/src/main/generated/writeon/tables/pojos/ProductFixedMessage.java new file mode 100644 index 0000000..403ef3a --- /dev/null +++ b/domain/src/main/generated/writeon/tables/pojos/ProductFixedMessage.java @@ -0,0 +1,92 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.pojos; + + +import java.io.Serializable; +import java.util.UUID; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFixedMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final UUID productId; + private final UUID messageId; + + public ProductFixedMessage(ProductFixedMessage value) { + this.productId = value.productId; + this.messageId = value.messageId; + } + + public ProductFixedMessage( + UUID productId, + UUID messageId + ) { + this.productId = productId; + this.messageId = messageId; + } + + /** + * Getter for public.product_fixed_message.product_id. + */ + public UUID getProductId() { + return this.productId; + } + + /** + * Getter for public.product_fixed_message.message_id. + */ + public UUID getMessageId() { + return this.messageId; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ProductFixedMessage other = (ProductFixedMessage) obj; + if (this.productId == null) { + if (other.productId != null) + return false; + } + else if (!this.productId.equals(other.productId)) + return false; + if (this.messageId == null) { + if (other.messageId != null) + return false; + } + else if (!this.messageId.equals(other.messageId)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.productId == null) ? 0 : this.productId.hashCode()); + result = prime * result + ((this.messageId == null) ? 0 : this.messageId.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ProductFixedMessage ("); + + sb.append(productId); + sb.append(", ").append(messageId); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/domain/src/main/generated/writeon/tables/records/ProductFixedMessageRecord.java b/domain/src/main/generated/writeon/tables/records/ProductFixedMessageRecord.java new file mode 100644 index 0000000..4d84654 --- /dev/null +++ b/domain/src/main/generated/writeon/tables/records/ProductFixedMessageRecord.java @@ -0,0 +1,96 @@ +/* + * This file is generated by jOOQ. + */ +package writeon.tables.records; + + +import java.util.UUID; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + +import writeon.tables.ProductFixedMessage; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class ProductFixedMessageRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.product_fixed_message.product_id. + */ + public ProductFixedMessageRecord setProductId(UUID value) { + set(0, value); + return this; + } + + /** + * Getter for public.product_fixed_message.product_id. + */ + public UUID getProductId() { + return (UUID) get(0); + } + + /** + * Setter for public.product_fixed_message.message_id. + */ + public ProductFixedMessageRecord setMessageId(UUID value) { + set(1, value); + return this; + } + + /** + * Getter for public.product_fixed_message.message_id. + */ + public UUID getMessageId() { + return (UUID) get(1); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ProductFixedMessageRecord + */ + public ProductFixedMessageRecord() { + super(ProductFixedMessage.PRODUCT_FIXED_MESSAGE); + } + + /** + * Create a detached, initialised ProductFixedMessageRecord + */ + public ProductFixedMessageRecord(UUID productId, UUID messageId) { + super(ProductFixedMessage.PRODUCT_FIXED_MESSAGE); + + setProductId(productId); + setMessageId(messageId); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised ProductFixedMessageRecord + */ + public ProductFixedMessageRecord(writeon.tables.pojos.ProductFixedMessage value) { + super(ProductFixedMessage.PRODUCT_FIXED_MESSAGE); + + if (value != null) { + setProductId(value.getProductId()); + setMessageId(value.getMessageId()); + resetChangedOnNotNull(); + } + } +} diff --git a/domain/src/main/java/writeon/domain/product/Product.java b/domain/src/main/java/writeon/domain/product/Product.java index 7d09a3e..a6bc44e 100644 --- a/domain/src/main/java/writeon/domain/product/Product.java +++ b/domain/src/main/java/writeon/domain/product/Product.java @@ -1,15 +1,24 @@ package writeon.domain.product; import com.fasterxml.uuid.Generators; -import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import writeon.domain.common.BaseAuditTimeEntity; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import writeon.domain.common.BaseAuditTimeEntity; + @Getter @Entity @NoArgsConstructor @@ -57,6 +66,9 @@ public class Product extends BaseAuditTimeEntity { @OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) private List favoritePrompts = new ArrayList<>(); + @OneToOne(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) + private ProductFixedMessage fixedMessage; + public void update(String title, String content) { this.title = title; this.content = content; @@ -65,4 +77,16 @@ public void update(String title, String content) { public void deleteFavoritePrompt(ProductFavoritePrompt favoritePrompt) { this.favoritePrompts.remove(favoritePrompt); } + + public void setFixedMessage(ProductFixedMessage fixedMessage) { + this.fixedMessage = fixedMessage; + fixedMessage.setProduct(this); + } + + public void deleteFixedMessage() { + if (this.fixedMessage != null) { + this.fixedMessage.setProduct(null); + this.fixedMessage = null; + } + } } diff --git a/domain/src/main/java/writeon/domain/product/ProductFixedMessage.java b/domain/src/main/java/writeon/domain/product/ProductFixedMessage.java new file mode 100644 index 0000000..e393e06 --- /dev/null +++ b/domain/src/main/java/writeon/domain/product/ProductFixedMessage.java @@ -0,0 +1,41 @@ +package writeon.domain.product; + +import java.util.UUID; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.MapsId; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import writeon.domain.assistant.AssistantMessage; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "product_fixed_message") +public class ProductFixedMessage { + + @Id + @Column(name = "product_id", updatable = false, nullable = false) + private UUID productId; + + @OneToOne(fetch = FetchType.LAZY) + @MapsId + @JoinColumn(name = "product_id") + private Product product; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "message_id", nullable = false, updatable = false) + private AssistantMessage message; + + public ProductFixedMessage(AssistantMessage message) { + this.message = message; + } +} diff --git a/sql/init.sql b/sql/init.sql index 9dea770..f89ecf2 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -353,6 +353,19 @@ alter table product_favorite_prompt create index idx_prompt_product_id on product_favorite_prompt (product_id); +create table product_fixed_message +( + product_id uuid not null + primary key + constraint fk_product + references product + on delete cascade, + message_id uuid not null +); + +alter table product_fixed_message + owner to postgres; + create table assistant ( id uuid not null From eca808c26a7e021dbc053baa9c9bd5668946d5e1 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Wed, 23 Apr 2025 21:56:27 +0900 Subject: [PATCH 082/107] fix: resolve get planner api issue (#81) --- .../request/ProductTemplateSaveRequest.java | 1 - .../product/response/ProductTemplateResponse.java | 7 +++---- .../api/product/service/ProductCommandService.java | 9 ++++++--- .../assistantapiclient/request/UserSetting.java | 2 +- .../writeon/domain/product/ProductCharacter.java | 14 +++++++------- sql/init.sql | 7 +++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java b/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java index 6d472fe..dfa75e5 100644 --- a/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductTemplateSaveRequest.java @@ -56,7 +56,6 @@ public ProductCharacter toEntity(UUID productId) { .occupation(occupation) .appearance(appearance) .personality(personality) - .characteristic(characteristic) .relationship(relationship) .build(); } diff --git a/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java b/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java index 35f5abd..77ffff7 100644 --- a/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductTemplateResponse.java @@ -5,6 +5,7 @@ import lombok.Setter; import writeon.domain.product.*; +import java.util.Comparator; import java.util.List; import java.util.UUID; @@ -21,6 +22,7 @@ public class ProductTemplateResponse { public ProductTemplateResponse(Product product) { this.id = product.getId(); this.characters = product.getCharacters().stream() + .sorted(Comparator.comparing(ProductCharacter::getSeq)) .map(Character::new) .toList(); this.ideaNote = product.getIdeaNote() != null ? new IdeaNote(product.getIdeaNote()) : null; @@ -46,10 +48,8 @@ public static class Character { private final String occupation; @Schema(name = "외모", nullable = true) private final String appearance; - @Schema(name = "성격", nullable = true) + @Schema(name = "성격/특징", nullable = true) private final String personality; - @Schema(name = "특징", nullable = true) - private final String characteristic; @Schema(name = "주요관계", nullable = true) private final String relationship; @Schema(name = "커스텀 필드 목록", nullable = true) @@ -64,7 +64,6 @@ public Character(ProductCharacter character) { this.occupation = character.getOccupation(); this.appearance = character.getAppearance(); this.personality = character.getPersonality(); - this.characteristic = character.getCharacteristic(); this.relationship = character.getRelationship(); this.customFields = character.getCustomFields().stream() .map(CustomField::new) diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index f69fe78..cc9f388 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -204,9 +204,12 @@ private void modifyCharacters(Product product, List addCharacters = new ArrayList<>(); - requestInfos.forEach(request -> { + for (int i = 0; i < requestInfos.size(); i++) { + var request = requestInfos.get(i); + if (request.getId() == null) { ProductCharacter newCharacter = request.toEntity(product.getId()); + newCharacter.setSeq(i); addCharacters.add(newCharacter); modifyCustomFields(product.getId(), newCharacter.getId(), ProductSectionType.CHARACTER, @@ -218,12 +221,12 @@ private void modifyCharacters(Product product, List customFields = new ArrayList<>(); @Builder - public ProductCharacter(UUID productId, String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship) { + public ProductCharacter(UUID productId, String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String relationship, Integer seq) { this.productId = productId; this.intro = intro; this.name = name; @@ -70,11 +70,11 @@ public ProductCharacter(UUID productId, String intro, String name, Short age, St this.occupation = occupation; this.appearance = appearance; this.personality = personality; - this.characteristic = characteristic; this.relationship = relationship; + this.seq = seq; } - public void update(String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship) { + public void update(String intro, String name, Short age, String gender, String occupation, String appearance, String personality, String relationship, Integer seq) { this.intro = intro; this.name = name; this.age = age; @@ -82,7 +82,7 @@ public void update(String intro, String name, Short age, String gender, String o this.occupation = occupation; this.appearance = appearance; this.personality = personality; - this.characteristic = characteristic; this.relationship = relationship; + this.seq = seq; } } diff --git a/sql/init.sql b/sql/init.sql index f89ecf2..ef05076 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -112,8 +112,8 @@ create table product_character occupation text, appearance text, personality text, - characteristic text, relationship text, + seq integer not null, created_at timestamp not null, created_by uuid not null, updated_at timestamp not null, @@ -129,8 +129,7 @@ comment on column product_character.age is '나이'; comment on column product_character.gender is '성별'; comment on column product_character.occupation is '직업'; comment on column product_character.appearance is '외모'; -comment on column product_character.personality is '성격'; -comment on column product_character.characteristic is '특징'; +comment on column product_character.personality is '성격/특징'; comment on column product_character.relationship is '주요 관계'; comment on column product_character.created_at is '생성일시'; comment on column product_character.created_by is '생성자 ID'; @@ -433,7 +432,7 @@ create table assistant_planner_message assistant_id uuid not null constraint assistant_planner_message_pk primary key, - genre varchar(30) not null, + genre varchar(100) not null, logline text not null, section varchar(30) not null ); From 745791a726ad6d4dc49784378df740c0d10a766f Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 26 Apr 2025 10:50:22 +0900 Subject: [PATCH 083/107] =?UTF-8?q?fix:=20=EC=96=B4=EC=8B=9C=ED=8A=B8?= =?UTF-8?q?=ED=84=B4=ED=8A=B8=20=EC=82=AC=EC=9A=A9=20=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=97=90=EC=84=9C=20=EC=9B=B9=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EC=82=AC=EC=9A=A9=20=EB=82=B4=EC=97=AD=EC=9D=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0=20(#82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/assistant/service/ChatService.java | 4 +- .../writeon/tables/ProductCharacter.java | 10 ++-- .../writeon/tables/ProductSynopsis.java | 2 +- .../tables/pojos/ProductCharacter.java | 40 ++++++------- .../records/ProductCharacterRecord.java | 56 +++++++++---------- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index f2356c7..f7e765a 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -108,7 +108,6 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { public AssistantResponse research(AssistantResearchRequest request) { productQueryService.verifyExist(request.getProductId()); - // assistant 및 message 생성 UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); AssistantMessage memberMessage = AssistantMessage.builder() @@ -126,7 +125,6 @@ public AssistantResponse research(AssistantResearchRequest request) { // 웹 검색 요청 String answer = assistantApiClient.research(researchRequest).block(); - // assistant 응답 저장 AssistantMessage assistantMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.ASSISTANT) @@ -135,6 +133,8 @@ public AssistantResponse research(AssistantResearchRequest request) { .build(); assistantService.createMessage(assistantMessage); + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + return new AssistantResponse(assistantId, answer); } } diff --git a/domain/src/main/generated/writeon/tables/ProductCharacter.java b/domain/src/main/generated/writeon/tables/ProductCharacter.java index 73601a2..2cd41b5 100644 --- a/domain/src/main/generated/writeon/tables/ProductCharacter.java +++ b/domain/src/main/generated/writeon/tables/ProductCharacter.java @@ -96,11 +96,6 @@ public Class getRecordType() { */ public final TableField PERSONALITY = createField(DSL.name("personality"), SQLDataType.CLOB, this, "성격"); - /** - * The column public.product_character.characteristic. 특징 - */ - public final TableField CHARACTERISTIC = createField(DSL.name("characteristic"), SQLDataType.CLOB, this, "특징"); - /** * The column public.product_character.relationship. 주요 관계 */ @@ -126,6 +121,11 @@ public Class getRecordType() { */ public final TableField UPDATED_BY = createField(DSL.name("updated_by"), SQLDataType.UUID.nullable(false), this, "수정자 ID"); + /** + * The column public.product_character.seq. + */ + public final TableField SEQ = createField(DSL.name("seq"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, ""); + private ProductCharacter(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } diff --git a/domain/src/main/generated/writeon/tables/ProductSynopsis.java b/domain/src/main/generated/writeon/tables/ProductSynopsis.java index a198e4d..e320a8e 100644 --- a/domain/src/main/generated/writeon/tables/ProductSynopsis.java +++ b/domain/src/main/generated/writeon/tables/ProductSynopsis.java @@ -59,7 +59,7 @@ public Class getRecordType() { /** * The column public.product_synopsis.genre. 장르 */ - public final TableField GENRE = createField(DSL.name("genre"), SQLDataType.VARCHAR(30).nullable(false), this, "장르"); + public final TableField GENRE = createField(DSL.name("genre"), SQLDataType.VARCHAR(100).nullable(false), this, "장르"); /** * The column public.product_synopsis.length. 분량 diff --git a/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java b/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java index dcab8cf..f488a2b 100644 --- a/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java +++ b/domain/src/main/generated/writeon/tables/pojos/ProductCharacter.java @@ -26,12 +26,12 @@ public class ProductCharacter implements Serializable { private final String occupation; private final String appearance; private final String personality; - private final String characteristic; private final String relationship; private final LocalDateTime createdAt; private final UUID createdBy; private final LocalDateTime updatedAt; private final UUID updatedBy; + private final Integer seq; public ProductCharacter(ProductCharacter value) { this.id = value.id; @@ -43,12 +43,12 @@ public ProductCharacter(ProductCharacter value) { this.occupation = value.occupation; this.appearance = value.appearance; this.personality = value.personality; - this.characteristic = value.characteristic; this.relationship = value.relationship; this.createdAt = value.createdAt; this.createdBy = value.createdBy; this.updatedAt = value.updatedAt; this.updatedBy = value.updatedBy; + this.seq = value.seq; } public ProductCharacter( @@ -61,12 +61,12 @@ public ProductCharacter( String occupation, String appearance, String personality, - String characteristic, String relationship, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, - UUID updatedBy + UUID updatedBy, + Integer seq ) { this.id = id; this.productId = productId; @@ -77,12 +77,12 @@ public ProductCharacter( this.occupation = occupation; this.appearance = appearance; this.personality = personality; - this.characteristic = characteristic; this.relationship = relationship; this.createdAt = createdAt; this.createdBy = createdBy; this.updatedAt = updatedAt; this.updatedBy = updatedBy; + this.seq = seq; } /** @@ -148,13 +148,6 @@ public String getPersonality() { return this.personality; } - /** - * Getter for public.product_character.characteristic. 특징 - */ - public String getCharacteristic() { - return this.characteristic; - } - /** * Getter for public.product_character.relationship. 주요 관계 */ @@ -190,6 +183,13 @@ public UUID getUpdatedBy() { return this.updatedBy; } + /** + * Getter for public.product_character.seq. + */ + public Integer getSeq() { + return this.seq; + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -253,12 +253,6 @@ else if (!this.appearance.equals(other.appearance)) } else if (!this.personality.equals(other.personality)) return false; - if (this.characteristic == null) { - if (other.characteristic != null) - return false; - } - else if (!this.characteristic.equals(other.characteristic)) - return false; if (this.relationship == null) { if (other.relationship != null) return false; @@ -289,6 +283,12 @@ else if (!this.updatedAt.equals(other.updatedAt)) } else if (!this.updatedBy.equals(other.updatedBy)) return false; + if (this.seq == null) { + if (other.seq != null) + return false; + } + else if (!this.seq.equals(other.seq)) + return false; return true; } @@ -305,12 +305,12 @@ public int hashCode() { result = prime * result + ((this.occupation == null) ? 0 : this.occupation.hashCode()); result = prime * result + ((this.appearance == null) ? 0 : this.appearance.hashCode()); result = prime * result + ((this.personality == null) ? 0 : this.personality.hashCode()); - result = prime * result + ((this.characteristic == null) ? 0 : this.characteristic.hashCode()); result = prime * result + ((this.relationship == null) ? 0 : this.relationship.hashCode()); result = prime * result + ((this.createdAt == null) ? 0 : this.createdAt.hashCode()); result = prime * result + ((this.createdBy == null) ? 0 : this.createdBy.hashCode()); result = prime * result + ((this.updatedAt == null) ? 0 : this.updatedAt.hashCode()); result = prime * result + ((this.updatedBy == null) ? 0 : this.updatedBy.hashCode()); + result = prime * result + ((this.seq == null) ? 0 : this.seq.hashCode()); return result; } @@ -327,12 +327,12 @@ public String toString() { sb.append(", ").append(occupation); sb.append(", ").append(appearance); sb.append(", ").append(personality); - sb.append(", ").append(characteristic); sb.append(", ").append(relationship); sb.append(", ").append(createdAt); sb.append(", ").append(createdBy); sb.append(", ").append(updatedAt); sb.append(", ").append(updatedBy); + sb.append(", ").append(seq); sb.append(")"); return sb.toString(); diff --git a/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java b/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java index 26ded55..44bf415 100644 --- a/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java +++ b/domain/src/main/generated/writeon/tables/records/ProductCharacterRecord.java @@ -156,26 +156,11 @@ public String getPersonality() { return (String) get(8); } - /** - * Setter for public.product_character.characteristic. 특징 - */ - public ProductCharacterRecord setCharacteristic(String value) { - set(9, value); - return this; - } - - /** - * Getter for public.product_character.characteristic. 특징 - */ - public String getCharacteristic() { - return (String) get(9); - } - /** * Setter for public.product_character.relationship. 주요 관계 */ public ProductCharacterRecord setRelationship(String value) { - set(10, value); + set(9, value); return this; } @@ -183,14 +168,14 @@ public ProductCharacterRecord setRelationship(String value) { * Getter for public.product_character.relationship. 주요 관계 */ public String getRelationship() { - return (String) get(10); + return (String) get(9); } /** * Setter for public.product_character.created_at. 생성일시 */ public ProductCharacterRecord setCreatedAt(LocalDateTime value) { - set(11, value); + set(10, value); return this; } @@ -198,14 +183,14 @@ public ProductCharacterRecord setCreatedAt(LocalDateTime value) { * Getter for public.product_character.created_at. 생성일시 */ public LocalDateTime getCreatedAt() { - return (LocalDateTime) get(11); + return (LocalDateTime) get(10); } /** * Setter for public.product_character.created_by. 생성자 ID */ public ProductCharacterRecord setCreatedBy(UUID value) { - set(12, value); + set(11, value); return this; } @@ -213,14 +198,14 @@ public ProductCharacterRecord setCreatedBy(UUID value) { * Getter for public.product_character.created_by. 생성자 ID */ public UUID getCreatedBy() { - return (UUID) get(12); + return (UUID) get(11); } /** * Setter for public.product_character.updated_at. 수정일시 */ public ProductCharacterRecord setUpdatedAt(LocalDateTime value) { - set(13, value); + set(12, value); return this; } @@ -228,14 +213,14 @@ public ProductCharacterRecord setUpdatedAt(LocalDateTime value) { * Getter for public.product_character.updated_at. 수정일시 */ public LocalDateTime getUpdatedAt() { - return (LocalDateTime) get(13); + return (LocalDateTime) get(12); } /** * Setter for public.product_character.updated_by. 수정자 ID */ public ProductCharacterRecord setUpdatedBy(UUID value) { - set(14, value); + set(13, value); return this; } @@ -243,7 +228,22 @@ public ProductCharacterRecord setUpdatedBy(UUID value) { * Getter for public.product_character.updated_by. 수정자 ID */ public UUID getUpdatedBy() { - return (UUID) get(14); + return (UUID) get(13); + } + + /** + * Setter for public.product_character.seq. + */ + public ProductCharacterRecord setSeq(Integer value) { + set(14, value); + return this; + } + + /** + * Getter for public.product_character.seq. + */ + public Integer getSeq() { + return (Integer) get(14); } // ------------------------------------------------------------------------- @@ -269,7 +269,7 @@ public ProductCharacterRecord() { /** * Create a detached, initialised ProductCharacterRecord */ - public ProductCharacterRecord(UUID id, UUID productId, String intro, String name, Integer age, String gender, String occupation, String appearance, String personality, String characteristic, String relationship, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy) { + public ProductCharacterRecord(UUID id, UUID productId, String intro, String name, Integer age, String gender, String occupation, String appearance, String personality, String relationship, LocalDateTime createdAt, UUID createdBy, LocalDateTime updatedAt, UUID updatedBy, Integer seq) { super(ProductCharacter.PRODUCT_CHARACTER); setId(id); @@ -281,12 +281,12 @@ public ProductCharacterRecord(UUID id, UUID productId, String intro, String name setOccupation(occupation); setAppearance(appearance); setPersonality(personality); - setCharacteristic(characteristic); setRelationship(relationship); setCreatedAt(createdAt); setCreatedBy(createdBy); setUpdatedAt(updatedAt); setUpdatedBy(updatedBy); + setSeq(seq); resetChangedOnNotNull(); } @@ -306,12 +306,12 @@ public ProductCharacterRecord(writeon.tables.pojos.ProductCharacter value) { setOccupation(value.getOccupation()); setAppearance(value.getAppearance()); setPersonality(value.getPersonality()); - setCharacteristic(value.getCharacteristic()); setRelationship(value.getRelationship()); setCreatedAt(value.getCreatedAt()); setCreatedBy(value.getCreatedBy()); setUpdatedAt(value.getUpdatedAt()); setUpdatedBy(value.getUpdatedBy()); + setSeq(value.getSeq()); resetChangedOnNotNull(); } } From 7ff8394369aca81841e61b0a447b1c6ad80f7f35 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:19:41 +0900 Subject: [PATCH 084/107] =?UTF-8?q?feat:=20=EC=96=B4=EC=8B=9C=EC=8A=A4?= =?UTF-8?q?=ED=84=B4=ED=8A=B8=20=EC=82=AC=EC=9A=A9=20=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=EC=97=90=20=ED=8F=89=EA=B0=80=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assistant/repository/AssistantDao.java | 24 ++++++++++++------- .../response/AssistantHistoryResponse.java | 17 ++++++++----- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index fe7b71e..24e082f 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -1,21 +1,26 @@ package writeon.api.assistant.repository; -import lombok.RequiredArgsConstructor; import org.jooq.Condition; import org.jooq.DSLContext; +import org.jooq.impl.DSL; import org.springframework.stereotype.Repository; -import writeon.api.assistant.response.AssistantHistoryResponse; -import writeon.domain.assistant.enums.AssistantStatus; -import writeon.domain.assistant.enums.AssistantType; -import writeon.domain.assistant.enums.MessageSenderRole; -import writeon.tables.AssistantMessage; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import static writeon.Tables.*; +import lombok.RequiredArgsConstructor; +import writeon.api.assistant.response.AssistantHistoryResponse; +import writeon.domain.assistant.enums.AssistantStatus; +import writeon.domain.assistant.enums.AssistantType; +import writeon.domain.assistant.enums.MessageSenderRole; +import writeon.tables.AssistantMessage; + +import static writeon.Tables.ASSISTANT; +import static writeon.Tables.ASSISTANT_EVALUATION; +import static writeon.Tables.ASSISTANT_MESSAGE; +import static writeon.Tables.PRODUCT_FAVORITE_PROMPT; @Repository @RequiredArgsConstructor @@ -33,7 +38,8 @@ public List selectHistories(UUID productId, UUID assis } return dsl - .select(ASSISTANT, memberMessage, PRODUCT_FAVORITE_PROMPT.MESSAGE_ID.isNotNull(), assistantMessage) + .select(ASSISTANT, memberMessage, PRODUCT_FAVORITE_PROMPT.MESSAGE_ID.isNotNull(), assistantMessage, + DSL.when(ASSISTANT_EVALUATION.ASSISTANT_ID.isNull(), false).otherwise(ASSISTANT_EVALUATION.IS_GOOD)) .from(ASSISTANT) .join(memberMessage) .on(ASSISTANT.ID.eq(memberMessage.ASSISTANT_ID) @@ -43,6 +49,8 @@ public List selectHistories(UUID productId, UUID assis .join(assistantMessage) .on(ASSISTANT.ID.eq(assistantMessage.ASSISTANT_ID) .and(assistantMessage.ROLE.eq(MessageSenderRole.ASSISTANT.getCode()))) + .leftJoin(ASSISTANT_EVALUATION) + .on(ASSISTANT.ID.eq(ASSISTANT_EVALUATION.ASSISTANT_ID)) .where(conditions) .orderBy(ASSISTANT.ID.desc()) .limit(size) diff --git a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java index 4360eae..5b02e21 100644 --- a/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java +++ b/api/src/main/java/writeon/api/assistant/response/AssistantHistoryResponse.java @@ -1,14 +1,15 @@ package writeon.api.assistant.response; import com.fasterxml.jackson.annotation.JsonInclude; + +import java.time.LocalDateTime; +import java.util.UUID; + import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import writeon.tables.records.AssistantMessageRecord; import writeon.tables.records.AssistantRecord; -import java.time.LocalDateTime; -import java.util.UUID; - @Getter public class AssistantHistoryResponse { @@ -19,11 +20,12 @@ public class AssistantHistoryResponse { private final AssistantMessage assistantMessage; private final LocalDateTime createdAt; - public AssistantHistoryResponse(AssistantRecord assistant, AssistantMessageRecord memberMessage, Boolean isFavoritedPrompt, AssistantMessageRecord assistantMessage) { + public AssistantHistoryResponse(AssistantRecord assistant, AssistantMessageRecord memberMessage, + Boolean isFavoritedPrompt, AssistantMessageRecord assistantMessage, Boolean isGood) { this.id = assistant.getId(); this.type = assistant.getType(); this.memberMessage = new MemberMessage(memberMessage, isFavoritedPrompt); - this.assistantMessage = new AssistantMessage(assistantMessage, assistant.getIsApplied()); + this.assistantMessage = new AssistantMessage(assistantMessage, assistant.getIsApplied(), isGood); this.createdAt = assistant.getCreatedAt(); } @@ -57,11 +59,14 @@ public static class AssistantMessage { private final String content; @Schema(title = "답변 적용 여부") private final Boolean isApplied; + @Schema(title = "답변 평가") + private final Boolean isGood; - public AssistantMessage(AssistantMessageRecord message, Boolean isApplied) { + public AssistantMessage(AssistantMessageRecord message, Boolean isApplied, Boolean isGood) { this.id = message.getId(); this.content = message.getContent(); this.isApplied = isApplied; + this.isGood = isGood; } } } From 362c8292d401c7c543b54a014f4b35528443718d Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 30 Apr 2025 22:48:58 +0900 Subject: [PATCH 085/107] feat: setup env for production (#84) --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index 0617ea9..c7b0859 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 +Subproject commit c7b0859933f233fecc0cd70456c7d4c89f2071af From b3b7e58562e96eb397e72d31f7c7407dfbaf01ef Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 5 May 2025 22:18:18 +0900 Subject: [PATCH 086/107] =?UTF-8?q?feat:=20=EB=8F=99=EA=B8=B0=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20assistant=20APIs=20=EC=97=B0=EB=8F=99=20(#85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- .../controller/AssistantController.java | 79 +++++++++-------- ...t.java => AssistantAutoModifyRequest.java} | 2 +- ...Request.java => AssistantChatRequest.java} | 4 +- ...est.java => AssistantFeedbackRequest.java} | 2 +- ...uest.java => AssistantPlannerRequest.java} | 2 +- ...t.java => AssistantUserModifyRequest.java} | 2 +- .../assistant/service/AutoModifyService.java | 41 ++++++++- .../api/assistant/service/ChatService.java | 43 +++++++++- .../assistant/service/FeedbackService.java | 41 ++++++++- .../api/assistant/service/PlannerService.java | 50 ++++++++++- .../assistant/service/UserModifyService.java | 42 ++++++++- .../AssistantApiClient.java | 85 +++++++++++++++++++ 13 files changed, 344 insertions(+), 51 deletions(-) rename api/src/main/java/writeon/api/assistant/request/{AssistantFeedbackMessageRequest.java => AssistantAutoModifyRequest.java} (86%) rename api/src/main/java/writeon/api/assistant/request/{AssistantChatMessageRequest.java => AssistantChatRequest.java} (76%) rename api/src/main/java/writeon/api/assistant/request/{AssistantAutoModifyMessageRequest.java => AssistantFeedbackRequest.java} (86%) rename api/src/main/java/writeon/api/assistant/request/{AssistantPlannerMessageRequest.java => AssistantPlannerRequest.java} (95%) rename api/src/main/java/writeon/api/assistant/request/{AssistantUserModifyMessageRequest.java => AssistantUserModifyRequest.java} (88%) diff --git a/BE-secret b/BE-secret index c7b0859..2dffc3f 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit c7b0859933f233fecc0cd70456c7d4c89f2071af +Subproject commit 2dffc3f41a1e7288ef7f31fc23ec85245f769df8 diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 579b999..d6abfb6 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -1,44 +1,23 @@ package writeon.api.assistant.controller; -import org.springdoc.core.annotations.ParameterObject; -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.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; - -import java.util.UUID; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; -import writeon.api.assistant.request.AssistantChatMessageRequest; -import writeon.api.assistant.request.AssistantEvaluateRequest; -import writeon.api.assistant.request.AssistantFeedbackMessageRequest; -import writeon.api.assistant.request.AssistantHistoryListRequest; -import writeon.api.assistant.request.AssistantPlannerMessageRequest; -import writeon.api.assistant.request.AssistantResearchRequest; -import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import org.springdoc.core.annotations.ParameterObject; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import writeon.api.assistant.request.*; import writeon.api.assistant.response.AssistantHistoryResponse; import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; -import writeon.api.assistant.service.AssistantEvaluationService; -import writeon.api.assistant.service.AssistantService; -import writeon.api.assistant.service.AutoModifyService; -import writeon.api.assistant.service.ChatService; -import writeon.api.assistant.service.FeedbackService; -import writeon.api.assistant.service.PlannerService; -import writeon.api.assistant.service.UserModifyService; +import writeon.api.assistant.service.*; import writeon.api.common.response.CursorResponse; +import java.util.UUID; + @RestController @RequiredArgsConstructor @RequestMapping("/assistant") @@ -59,15 +38,27 @@ public void apply(@PathVariable UUID assistantId) { assistantService.apply(assistantId); } + @Operation(summary = "자동 수정") + @PostMapping("/auto-modify") + public AssistantResponse autoModify(@RequestBody AssistantAutoModifyRequest request) { + return autoModifyService.autoModify(request); + } + @Operation(summary = "자동 수정 메세지 저장") @PostMapping("/auto-modify/messages") - public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoModifyMessageRequest request) { + public MessageCreateResponse createAutoModifyMessage(@RequestBody AssistantAutoModifyRequest request) { return autoModifyService.createMessage(request); } + @Operation(summary = "자유 대화") + @PostMapping("/chat") + public AssistantResponse chat(@RequestBody AssistantChatRequest request) { + return chatService.chat(request); + } + @Operation(summary = "자유 대화 메세지 저장") @PostMapping("/chat/messages") - public MessageCreateResponse createChatMessage(@RequestBody AssistantChatMessageRequest request) { + public MessageCreateResponse createChatMessage(@RequestBody AssistantChatRequest request) { return chatService.createMessage(request); } @@ -79,21 +70,39 @@ public void evaluate( assistantEvaluationService.evaluate(assistantId, request); } + @Operation(summary = "구간 피드백") + @PostMapping("/feedback") + public AssistantResponse feedback(@RequestBody AssistantFeedbackRequest request) { + return feedbackService.feedback(request); + } + @Operation(summary = "구간 피드백 메세지 저장") @PostMapping("/feedback/messages") - public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbackMessageRequest request) { + public MessageCreateResponse createFeedbackMessage(@RequestBody AssistantFeedbackRequest request) { return feedbackService.createMessage(request); } + @Operation(summary = "플래너 AI 완성") + @PostMapping("/planner") + public AssistantResponse planner(@RequestBody AssistantPlannerRequest request) { + return plannerService.planner(request); + } + @Operation(summary = "플래너 AI 완성 메세지 저장") @PostMapping("/planner/messages") - public MessageCreateResponse createPlannerMessage(@RequestBody AssistantPlannerMessageRequest request) { + public MessageCreateResponse createPlannerMessage(@RequestBody AssistantPlannerRequest request) { return plannerService.createMessage(request); } + @Operation(summary = "수동 수정") + @PostMapping("/user-modify") + public AssistantResponse userModify(@RequestBody AssistantUserModifyRequest request) { + return userModifyService.userModify(request); + } + @Operation(summary = "수동 수정 메세지 저장") @PostMapping("/user-modify/messages") - public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyMessageRequest request) { + public MessageCreateResponse createUserModifyMessage(@RequestBody AssistantUserModifyRequest request) { return userModifyService.createMessage(request); } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java similarity index 86% rename from api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java index 698ec7e..2c85d7d 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AssistantFeedbackMessageRequest { +public class AssistantAutoModifyRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java similarity index 76% rename from api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java index 0212f9a..e59a1bf 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantChatMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AssistantChatMessageRequest { +public class AssistantChatRequest { @Schema(title = "작품 ID") private UUID productId; @@ -16,4 +16,6 @@ public class AssistantChatMessageRequest { private String content; @Schema(title = "프롬프트") private String prompt; + @Schema(title = "세션 ID", nullable = true) + private String sessionId; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java similarity index 86% rename from api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java index 938108e..91772e6 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AssistantAutoModifyMessageRequest { +public class AssistantFeedbackRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantPlannerRequest.java similarity index 95% rename from api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantPlannerRequest.java index 311da51..f47cb02 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantPlannerMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantPlannerRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AssistantPlannerMessageRequest { +public class AssistantPlannerRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java similarity index 88% rename from api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java rename to api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java index fcc5b32..e895573 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyMessageRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java @@ -8,7 +8,7 @@ @Getter @Setter -public class AssistantUserModifyMessageRequest { +public class AssistantUserModifyRequest { @Schema(title = "작품 ID") private UUID productId; diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index 1f6728a..d649257 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -4,7 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantAutoModifyMessageRequest; +import writeon.api.assistant.request.AssistantAutoModifyRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; @@ -34,7 +35,43 @@ public class AutoModifyService { private final ProductQueryService productQueryService; @Transactional - public MessageCreateResponse createMessage(AssistantAutoModifyMessageRequest request) { + public AssistantResponse autoModify(AssistantAutoModifyRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + AutoModifyRequest autoModifyRequest = new AutoModifyRequest( + "t" + request.getProductId().toString().replaceAll("-", ""), + userSetting, + memberMessage.getContent() + ); + + String answer = assistantApiClient.autoModify(autoModifyRequest).block(); + + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + + return new AssistantResponse(assistantId, answer); + } + + @Transactional + public MessageCreateResponse createMessage(AssistantAutoModifyRequest request) { productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.AUTO_MODIFY); diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index f7e765a..15f3aee 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantChatMessageRequest; +import writeon.api.assistant.request.AssistantChatRequest; import writeon.api.assistant.request.AssistantResearchRequest; import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; @@ -37,10 +37,49 @@ public class ChatService { private final ProductQueryService productQueryService; @Transactional - public MessageCreateResponse createMessage(AssistantChatMessageRequest request) { + public AssistantResponse chat(AssistantChatRequest request) { productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .prompt(request.getPrompt()) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + ChatRequest chatRequest = new ChatRequest( + userSetting, + memberMessage.getContent(), + memberMessage.getPrompt(), + request.getSessionId() + ); + + String answer = assistantApiClient.chat(chatRequest).block(); + + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + + return new AssistantResponse(assistantId, answer); + } + + @Transactional + public MessageCreateResponse createMessage(AssistantChatRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.CHAT); + AssistantMessage memberMessage = AssistantMessage.builder() .assistantId(assistantId) .role(MessageSenderRole.MEMBER) diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index 37c1bf9..830de12 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -4,7 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantFeedbackMessageRequest; +import writeon.api.assistant.request.AssistantFeedbackRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; @@ -34,7 +35,43 @@ public class FeedbackService { private final ProductQueryService productQueryService; @Transactional - public MessageCreateResponse createMessage(AssistantFeedbackMessageRequest request) { + public AssistantResponse feedback(AssistantFeedbackRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + FeedbackRequest feedbackRequest = new FeedbackRequest( + "t" + request.getProductId().toString().replaceAll("-", ""), + userSetting, + memberMessage.getContent() + ); + + String answer = assistantApiClient.feedback(feedbackRequest).block(); + + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + + return new AssistantResponse(assistantId, answer); + } + + @Transactional + public MessageCreateResponse createMessage(AssistantFeedbackRequest request) { productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.FEEDBACK); diff --git a/api/src/main/java/writeon/api/assistant/service/PlannerService.java b/api/src/main/java/writeon/api/assistant/service/PlannerService.java index 7d7a838..cafebe5 100644 --- a/api/src/main/java/writeon/api/assistant/service/PlannerService.java +++ b/api/src/main/java/writeon/api/assistant/service/PlannerService.java @@ -4,7 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantPlannerMessageRequest; +import writeon.api.assistant.request.AssistantPlannerRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; @@ -36,7 +37,52 @@ public class PlannerService { private final AssistantPlannerMessageJpaRepository assistantPlannerMessageRepository; @Transactional - public MessageCreateResponse createMessage(AssistantPlannerMessageRequest request) { + public AssistantResponse planner(AssistantPlannerRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.PLANNER); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .prompt(request.getPrompt()) + .role(MessageSenderRole.MEMBER) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + AssistantPlannerMessage plannerMessage = AssistantPlannerMessage.builder() + .assistantId(assistantId) + .genre(request.getGenre()) + .logline(request.getLogline()) + .section(request.getSection()) + .build(); + assistantPlannerMessageRepository.save(plannerMessage); + + PlannerGenerateRequest plannerGenerateRequest = PlannerGenerateRequest.builder() + .tenantId("t" + request.getProductId().toString().replaceAll("-", "")) + .genre(plannerMessage.getGenre()) + .logline(plannerMessage.getLogline()) + .section(plannerMessage.getSection()) + .prompt(memberMessage.getPrompt()) + .build(); + + String answer = assistantApiClient.plannerGenerate(plannerGenerateRequest).block(); + + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + + return new AssistantResponse(assistantId, answer); + } + + @Transactional + public MessageCreateResponse createMessage(AssistantPlannerRequest request) { productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.PLANNER); diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index c7b7cd4..fa540f9 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -4,7 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import writeon.api.assistant.request.AssistantUserModifyMessageRequest; +import writeon.api.assistant.request.AssistantUserModifyRequest; +import writeon.api.assistant.response.AssistantResponse; import writeon.api.assistant.response.MessageCreateResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.LogUtil; @@ -34,7 +35,44 @@ public class UserModifyService { private final ProductQueryService productQueryService; @Transactional - public MessageCreateResponse createMessage(AssistantUserModifyMessageRequest request) { + public AssistantResponse userModify(AssistantUserModifyRequest request) { + productQueryService.verifyExist(request.getProductId()); + + UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); + + AssistantMessage memberMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.MEMBER) + .content(request.getContent()) + .prompt(request.getPrompt()) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(memberMessage); + + UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserModifyRequest userModifyRequest = new UserModifyRequest( + "t" + request.getProductId().toString().replaceAll("-", ""), + userSetting, memberMessage.getContent(), + memberMessage.getPrompt() + ); + + String answer = assistantApiClient.userModify(userModifyRequest).block(); + + AssistantMessage assistantMessage = AssistantMessage.builder() + .assistantId(assistantId) + .role(MessageSenderRole.ASSISTANT) + .content(answer) + .createdBy(MemberUtil.getMemberId()) + .build(); + assistantService.createMessage(assistantMessage); + + assistantService.modifyStatus(assistantId, AssistantStatus.IN_PROGRESS); + + return new AssistantResponse(assistantId, answer); + } + + @Transactional + public MessageCreateResponse createMessage(AssistantUserModifyRequest request) { productQueryService.verifyExist(request.getProductId()); UUID assistantId = assistantService.create(request.getProductId(), AssistantType.USER_MODIFY); diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 7711d3b..6dc5e96 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -46,6 +46,23 @@ public Mono research(ResearchRequest request) { .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); } + public Mono autoModify(AutoModifyRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/auto-modify") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamAutoModify(AutoModifyRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder @@ -62,6 +79,23 @@ public Flux streamAutoModify(AutoModifyRequest request) { .bodyToFlux(String.class); } + public Mono chat(ChatRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/chat") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamChat(ChatRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder @@ -78,6 +112,23 @@ public Flux streamChat(ChatRequest request) { .bodyToFlux(String.class); } + public Mono feedback(FeedbackRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/feedback") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamFeedback(FeedbackRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder @@ -94,6 +145,23 @@ public Flux streamFeedback(FeedbackRequest request) { .bodyToFlux(String.class); } + public Mono plannerGenerate(PlannerGenerateRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/planner/generate") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamPlannerGenerate(PlannerGenerateRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder @@ -110,6 +178,23 @@ public Flux streamPlannerGenerate(PlannerGenerateRequest request) { .bodyToFlux(String.class); } + public Mono userModify(UserModifyRequest request) { + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path("/v1/assistant/user-modify") + .build() + ) + .bodyValue(request) + .retrieve() + .onStatus(HttpStatusCode::isError, response -> + response.bodyToMono(String.class) + .doOnNext(errorBody -> System.out.println("Error response: " + errorBody)) + .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) + ) + .bodyToMono(String.class) + .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + } + public Flux streamUserModify(UserModifyRequest request) { return webClient.post() .uri(uriBuilder -> uriBuilder From a05bc98e198dec23bce6bf1ea891a0195ade5718 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Fri, 9 May 2025 23:51:04 +0900 Subject: [PATCH 087/107] feat: update submodule to change mail sender (#86) --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index 2dffc3f..afcb867 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 2dffc3f41a1e7288ef7f31fc23ec85245f769df8 +Subproject commit afcb867e8eb7807bcca19cd0f79faaac6d06e7c1 From 0171f53846b1ef808fd8839c1778f6fec6cbd92b Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sat, 10 May 2025 20:25:20 +0900 Subject: [PATCH 088/107] =?UTF-8?q?fix:=20assistant=20=EB=8B=B5=EB=B3=80?= =?UTF-8?q?=20=ED=8F=89=EA=B0=80=20=EC=8B=9C,=20feedbackType=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EB=90=98=EA=B2=8C=20=EC=88=98=EC=A0=95=20(#87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AssistantEvaluationService.java | 10 +++++----- .../domain/assistant/AssistantEvaluation.java | 13 ++++++++----- .../domain/assistant/enums/FeedbackType.java | 10 +++++++--- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java index 9d46744..e1b90e5 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java @@ -1,11 +1,8 @@ package writeon.api.assistant.service; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import java.util.UUID; - -import lombok.RequiredArgsConstructor; import writeon.api.assistant.request.AssistantEvaluateRequest; import writeon.api.common.exception.BaseException; import writeon.domain.assistant.AssistantEvaluation; @@ -13,6 +10,8 @@ import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.FeedbackType; +import java.util.UUID; + @Service @RequiredArgsConstructor public class AssistantEvaluationService { @@ -29,12 +28,13 @@ public void evaluate(UUID assistantId, AssistantEvaluateRequest request) { if (!request.getIsGood()) { feedback = request.getFeedbackType() == FeedbackType.ETC - ? request.getFeedback() : request.getFeedbackType().getCode(); + ? request.getFeedback() : null; } AssistantEvaluation assistantEvaluation = AssistantEvaluation.builder() .assistantId(assistantId) .isGood(request.getIsGood()) + .feedbackType(request.getFeedbackType()) .feedback(feedback) .build(); diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java index 63f8fcd..940c960 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluation.java @@ -1,13 +1,11 @@ package writeon.domain.assistant; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import org.springframework.data.annotation.CreatedBy; +import writeon.domain.assistant.enums.FeedbackType; import java.time.LocalDateTime; import java.util.UUID; @@ -25,6 +23,10 @@ public class AssistantEvaluation { @Column(name = "is_good", nullable = false) private Boolean isGood; + @Convert(converter = FeedbackType.TypeCodeConverter.class) + @Column(name = "feedback_type") + private FeedbackType feedbackType; + @Column(name = "feedback") private String feedback; @@ -36,9 +38,10 @@ public class AssistantEvaluation { protected UUID createdBy = UUID.randomUUID(); @Builder - public AssistantEvaluation(UUID assistantId, Boolean isGood, String feedback) { + public AssistantEvaluation(UUID assistantId, Boolean isGood, FeedbackType feedbackType, String feedback) { this.assistantId = assistantId; this.isGood = isGood; + this.feedbackType = feedbackType; this.feedback = feedback; } } diff --git a/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java b/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java index 63812f5..9f9cc08 100644 --- a/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java +++ b/domain/src/main/java/writeon/domain/assistant/enums/FeedbackType.java @@ -10,13 +10,17 @@ @RequiredArgsConstructor public enum FeedbackType implements Codable { - AWKWARD_SENTENCE("Awkward sentence"), - INACCURATE_INFO("Inaccurate information"), - UNAPPLIED_SETTING("Unapplied settings"), + AWKWARD_SENTENCE("AWKWARD_SENTENCE"), + INACCURATE_INFO("INACCURATE_INFO"), + UNAPPLIED_SETTING("UNAPPLIED_SETTING"), ETC("ETC"); private final String code; + public static FeedbackType fromCode(final String code) { + return Codable.fromCode(FeedbackType.class, code); + } + @Converter public static class TypeCodeConverter extends AbstractEnumCodeConverter { @Override From 6fb68110cb971b788300daad23dfa02c11453e4d Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Sun, 11 May 2025 23:48:53 +0900 Subject: [PATCH 089/107] =?UTF-8?q?fix:=20assistant=20=EB=8B=B5=EB=B3=80?= =?UTF-8?q?=20=EC=98=81=EA=B5=AC=20=EB=B3=B4=EA=B4=80=20API=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(#88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/build.gradle | 1 + .../controller/AssistantController.java | 6 ++++++ .../assistant/service/AssistantService.java | 10 ++++++++++ .../writeon/domain/assistant/Assistant.java | 18 ++++++++++-------- sql/init.sql | 18 ++++++++++-------- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index 8d30267..e5f0b6d 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -10,6 +10,7 @@ dependencies { /* AWS SDK */ implementation 'software.amazon.awssdk:s3:2.30.31' + implementation("software.amazon.awssdk:netty-nio-client:2.30.31") /* Swagger */ implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index d6abfb6..7cc2b6e 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -161,6 +161,12 @@ public CursorResponse getHistories(@ParameterObject As return assistantService.getHistories(request); } + @Operation(summary = "어시스턴트 답변 영구 보관") + @PutMapping("/{assistantId}/archive") + public void archive(@PathVariable UUID assistantId) { + assistantService.archive(assistantId); + } + @Operation(summary = "어시스턴트 기능 완료 처리") @PutMapping("/{assistantId}/completed") public void completed(@PathVariable UUID assistantId) { diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantService.java b/api/src/main/java/writeon/api/assistant/service/AssistantService.java index 6a7ef9f..b4e8d18 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantService.java @@ -31,6 +31,16 @@ public class AssistantService { private final ProductQueryService productQueryService; + @Transactional + public void archive(UUID assistantId) { + Assistant assistant = getById(assistantId, MemberUtil.getMemberId()); + if (assistant.getStatus() == AssistantStatus.DRAFT) { + throw new BaseException(AssistantException.CANNOT_BE_COMPLETED); + } + + assistant.archive(); + } + @Transactional public void apply(UUID assistantId) { Assistant assistant = getById(assistantId, MemberUtil.getMemberId()); diff --git a/domain/src/main/java/writeon/domain/assistant/Assistant.java b/domain/src/main/java/writeon/domain/assistant/Assistant.java index fc18783..89fd120 100644 --- a/domain/src/main/java/writeon/domain/assistant/Assistant.java +++ b/domain/src/main/java/writeon/domain/assistant/Assistant.java @@ -1,14 +1,7 @@ package writeon.domain.assistant; import com.fasterxml.uuid.Generators; - -import java.util.UUID; - -import jakarta.persistence.Column; -import jakarta.persistence.Convert; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -16,6 +9,8 @@ import writeon.domain.assistant.enums.AssistantType; import writeon.domain.common.BaseTimeEntity; +import java.util.UUID; + @Getter @Entity @NoArgsConstructor @@ -40,6 +35,9 @@ public class Assistant extends BaseTimeEntity { @Column(name = "is_applied", nullable = false) private Boolean isApplied = Boolean.FALSE; + @Column(name = "is_archived", nullable = false) + private Boolean isArchived = Boolean.FALSE; + @Column(name = "created_by", updatable = false, nullable = false) private UUID createdBy; @@ -54,6 +52,10 @@ public void apply() { this.isApplied = Boolean.TRUE; } + public void archive() { + this.isArchived = Boolean.TRUE; + } + public void updateStatus(AssistantStatus status) { this.status = status; } diff --git a/sql/init.sql b/sql/init.sql index ef05076..1d9d5ac 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -367,16 +367,17 @@ alter table product_fixed_message create table assistant ( - id uuid not null + id uuid not null constraint assistant_pk primary key, - product_id uuid not null, - type varchar(20) not null, - status varchar(20) not null, - is_applied boolean default false not null, - created_at timestamp not null, - created_by uuid not null, - updated_at timestamp not null + product_id uuid not null, + type varchar(20) not null, + status varchar(20) not null, + is_applied boolean default false not null, + is_archived boolean default false not null, + created_at timestamp not null, + created_by uuid not null, + updated_at timestamp not null ); comment on table assistant is '어시스턴트'; @@ -384,6 +385,7 @@ comment on column assistant.product_id is '작품 ID'; comment on column assistant.type is '기능 종류'; comment on column assistant.status is '진행 상태'; comment on column assistant.is_applied is '답변 적용 여부'; +comment on column assistant.is_archived is '영구 보관 여부'; comment on column assistant.created_at is '수정일시'; comment on column assistant.created_by is '생성자 ID'; From a3af5524175d6b76c2a95b44920c1cb4e05d1c02 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Wed, 14 May 2025 21:23:59 +0900 Subject: [PATCH 090/107] =?UTF-8?q?fix:=20=EC=96=B4=EC=8B=9C=EC=8A=A4?= =?UTF-8?q?=ED=84=B4=ED=8A=B8=20=EC=9D=B4=EB=A0=A5=EC=9D=B4=20pagination?= =?UTF-8?q?=20=EA=B8=B0=EC=A4=80=20=EA=B0=92=EC=9D=84=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EC=9D=91=EB=8B=B5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/writeon/api/assistant/repository/AssistantDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java index 24e082f..90a9154 100644 --- a/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java +++ b/api/src/main/java/writeon/api/assistant/repository/AssistantDao.java @@ -34,7 +34,7 @@ public List selectHistories(UUID productId, UUID assis List conditions = getConditions(productId); if (assistantId != null) { - conditions.add(ASSISTANT.ID.lt(assistantId)); + conditions.add(ASSISTANT.ID.lessOrEqual(assistantId)); } return dsl From d924db2c8625de0c34b9fd1286a64050523f8540 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Mon, 19 May 2025 11:15:12 +0900 Subject: [PATCH 091/107] =?UTF-8?q?feat:=20=EB=A9=94=EB=AA=A8=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=EC=97=AC=EB=B6=80=20=EC=88=98=EC=A0=95=20API=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- .../product/controller/ProductController.java | 10 ++++ .../request/ProductMemoCompletedRequest.java | 13 ++++ .../request/ProductMemoSaveRequest.java | 38 ++++++------ .../product/response/ProductMemoResponse.java | 59 ++++++++++--------- .../service/ProductCommandService.java | 11 +++- .../writeon/domain/product/ProductMemo.java | 3 +- 7 files changed, 84 insertions(+), 52 deletions(-) create mode 100644 api/src/main/java/writeon/api/product/request/ProductMemoCompletedRequest.java diff --git a/BE-secret b/BE-secret index afcb867..0617ea9 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit afcb867e8eb7807bcca19cd0f79faaac6d06e7c1 +Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index 1a0e893..8ba1fac 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import writeon.api.product.request.ProductMemoCompletedRequest; import writeon.api.product.request.ProductMemoSaveRequest; import writeon.api.product.request.ProductSaveRequest; import writeon.api.product.request.ProductTemplateSaveRequest; @@ -127,6 +128,15 @@ public void modifyMemo( productCommandService.modifyMemo(productId, memoId, request); } + @Operation(summary = "메모 완료 여부 수정") + @PutMapping("/{productId}/memos/{memoId}/completed") + public void modifyMemoCompleted( + @PathVariable UUID productId, + @PathVariable UUID memoId, + @RequestBody ProductMemoCompletedRequest request) { + productCommandService.modifyMemoCompleted(productId, memoId, request.getIsCompleted()); + } + @Operation(summary = "메모 삭제") @DeleteMapping("/{productId}/memos/{memoId}") public void deleteMemo( diff --git a/api/src/main/java/writeon/api/product/request/ProductMemoCompletedRequest.java b/api/src/main/java/writeon/api/product/request/ProductMemoCompletedRequest.java new file mode 100644 index 0000000..6feb416 --- /dev/null +++ b/api/src/main/java/writeon/api/product/request/ProductMemoCompletedRequest.java @@ -0,0 +1,13 @@ +package writeon.api.product.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ProductMemoCompletedRequest { + + @Schema(title = "완료 여부") + private Boolean isCompleted; +} diff --git a/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java index 5fc5be9..d573b92 100644 --- a/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java +++ b/api/src/main/java/writeon/api/product/request/ProductMemoSaveRequest.java @@ -1,20 +1,18 @@ -package writeon.api.product.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class ProductMemoSaveRequest { - - @Schema(title = "제목", nullable = true) - private String title; - @Schema(title = "내용") - private String content; - private String selectedText; - private Integer startIndex; - private Integer endIndex; - @Schema(title = "완료 여부", description = "메모 생성 시, false로 저장됩니다.", nullable = true) - private Boolean isCompleted; -} +package writeon.api.product.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ProductMemoSaveRequest { + + @Schema(title = "제목", nullable = true) + private String title; + @Schema(title = "내용") + private String content; + private String selectedText; + private Integer startIndex; + private Integer endIndex; +} diff --git a/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java index 0e57a3c..8418b7d 100644 --- a/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductMemoResponse.java @@ -1,28 +1,31 @@ -package writeon.api.product.response; - -import writeon.domain.product.ProductMemo; -import lombok.Getter; - -import java.util.UUID; - -@Getter -public class ProductMemoResponse { - - private final UUID id; - private final String title; - private final String content; - private final String selectedText; - private final Integer startIndex; - private final Integer endIndex; - private final Boolean isCompleted; - - public ProductMemoResponse(ProductMemo memo) { - this.id = memo.getId(); - this.title = memo.getTitle(); - this.content = memo.getContent(); - this.selectedText = memo.getSelectedText(); - this.startIndex = memo.getStartIndex(); - this.endIndex = memo.getEndIndex(); - this.isCompleted = memo.getIsCompleted(); - } -} +package writeon.api.product.response; + +import java.time.LocalDateTime; +import java.util.UUID; + +import lombok.Getter; +import writeon.domain.product.ProductMemo; + +@Getter +public class ProductMemoResponse { + + private final UUID id; + private final String title; + private final String content; + private final String selectedText; + private final Integer startIndex; + private final Integer endIndex; + private final Boolean isCompleted; + private final LocalDateTime updatedAt; + + public ProductMemoResponse(ProductMemo memo) { + this.id = memo.getId(); + this.title = memo.getTitle(); + this.content = memo.getContent(); + this.selectedText = memo.getSelectedText(); + this.startIndex = memo.getStartIndex(); + this.endIndex = memo.getEndIndex(); + this.isCompleted = memo.getIsCompleted(); + this.updatedAt = memo.getUpdatedAt(); + } +} diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index cc9f388..8aeed4d 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -147,7 +147,16 @@ public void modifyMemo(UUID productId, UUID memoId, ProductMemoSaveRequest reque ProductMemo memo = getMemoById(memoId); memo.update(request.getTitle(), request.getContent(), request.getSelectedText(), - request.getStartIndex(), request.getEndIndex(), request.getIsCompleted()); + request.getStartIndex(), request.getEndIndex()); + } + + @Transactional + public void modifyMemoCompleted(UUID productId, UUID memoId, Boolean isCompleted) { + productQueryService.verifyExist(productId); + + ProductMemo memo = getMemoById(memoId); + + memo.setIsCompleted(isCompleted); } @Transactional diff --git a/domain/src/main/java/writeon/domain/product/ProductMemo.java b/domain/src/main/java/writeon/domain/product/ProductMemo.java index 6802c3f..8af3acd 100644 --- a/domain/src/main/java/writeon/domain/product/ProductMemo.java +++ b/domain/src/main/java/writeon/domain/product/ProductMemo.java @@ -55,12 +55,11 @@ public ProductMemo(UUID productId, String title, String content, this.endIndex = endIndex; } - public void update(String title, String content, String selectedText, Integer startIndex, Integer endIndex, Boolean isCompleted) { + public void update(String title, String content, String selectedText, Integer startIndex, Integer endIndex) { this.title = title; this.content = content; this.selectedText = selectedText; this.startIndex = startIndex; this.endIndex = endIndex; - this.isCompleted = isCompleted; } } From 3ea3d938126f1799a8adf7b818c88c96774b1e21 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Tue, 27 May 2025 21:39:55 +0900 Subject: [PATCH 092/107] =?UTF-8?q?feat:=20cors=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=A0=84=EC=86=A1=20?= =?UTF-8?q?web-url=20=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20(#91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- api/src/main/java/writeon/api/auth/helper/MailHelper.java | 2 +- .../java/writeon/api/auth/service/AuthCommandService.java | 8 ++++++-- .../main/resources/templates/mail/change-password.html | 2 +- api/src/main/resources/templates/mail/join.html | 5 ++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/BE-secret b/BE-secret index 0617ea9..fd9b071 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 0617ea93e03d61f841f0887cded3f28ee8798592 +Subproject commit fd9b0715cea52f17d07d4a4b5af14eb53bd9d71d diff --git a/api/src/main/java/writeon/api/auth/helper/MailHelper.java b/api/src/main/java/writeon/api/auth/helper/MailHelper.java index bef6a90..087798c 100644 --- a/api/src/main/java/writeon/api/auth/helper/MailHelper.java +++ b/api/src/main/java/writeon/api/auth/helper/MailHelper.java @@ -49,7 +49,7 @@ public enum MailType { @AllArgsConstructor @Builder public static class MailData { - private String token; + private String linkUrl; private String nickname; } } diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index eef0880..aad3b79 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -4,6 +4,7 @@ import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.crypto.bcrypt.BCrypt; import org.springframework.stereotype.Service; import writeon.api.auth.helper.JwtHelper; @@ -53,6 +54,9 @@ public class AuthCommandService { private final JwtHelper jwtHelper; private final MailHelper mailHelper; + @Value("${service.web.url}") + private String WEB_URL; + /** * 토큰 재발급 */ @@ -202,7 +206,7 @@ public void join(JoinRequest request) { request.getEmail(), MailHelper.MailData.builder() .nickname(request.getNickname()) - .token(joinToken.getTokenString()) + .linkUrl( WEB_URL + "/join/complete?joinToken=" + joinToken.getTokenString() ) .build() ); } catch (MessagingException e) { @@ -258,7 +262,7 @@ public void changePassword(ChangePasswordRequest request) { member.getEmail(), MailHelper.MailData.builder() .nickname(member.getNickname()) - .token(changePasswordToken.getTokenString()) + .linkUrl( WEB_URL + "/change-password/complete?changePasswordToken=" + changePasswordToken.getTokenString() ) .build() ); } catch (MessagingException e) { diff --git a/api/src/main/resources/templates/mail/change-password.html b/api/src/main/resources/templates/mail/change-password.html index db4a5df..5ac8c1c 100644 --- a/api/src/main/resources/templates/mail/change-password.html +++ b/api/src/main/resources/templates/mail/change-password.html @@ -10,7 +10,7 @@

비밀번호 재설정을 요청하셨나요? 아래 링크를 클릭하여 새 비밀번호를 설정해 주세요.
- 비밀번호 재설정하기 + 비밀번호 재설정하기

⚠️보안 주의사항 diff --git a/api/src/main/resources/templates/mail/join.html b/api/src/main/resources/templates/mail/join.html index f1a6f4b..01387dc 100644 --- a/api/src/main/resources/templates/mail/join.html +++ b/api/src/main/resources/templates/mail/join.html @@ -11,12 +11,11 @@

계정을 활성화하려면 아래 링크를 클릭하여 이메일 주소를 인증해 주세요.
- 이메일 인증하기 + 이메일 인증하기

위 버튼이 작동하지 않는다면 아래 링크를 복사하여 브라우저 주소창에 붙여넣어 주세요.
- - https://writeon.ai.kr/join/complete?joinToken= +

이메일 인증은 보안을 위해 필수 절차이며, 일정 시간 내에 완료되지 않으면 계정이 비활성화될 수 있습니다.
From 831caffa214dc99750d1cbc1ac45c90162016b36 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 31 May 2025 12:12:25 +0900 Subject: [PATCH 093/107] feat: initialize amplitude SDK (#92) --- api/build.gradle | 4 +++ .../api/auth/service/AuthCommandService.java | 25 ++++++++++++++++++- .../api/common/config/AmplitudeConfig.java | 20 +++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 api/src/main/java/writeon/api/common/config/AmplitudeConfig.java diff --git a/api/build.gradle b/api/build.gradle index e5f0b6d..6e4a76d 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -12,6 +12,10 @@ dependencies { implementation 'software.amazon.awssdk:s3:2.30.31' implementation("software.amazon.awssdk:netty-nio-client:2.30.31") + /* amplitude (tracking tool) */ + implementation 'org.json:json:20201115' + implementation 'com.amplitude:java-sdk:1.+' + /* Swagger */ implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index aad3b79..7fa1035 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -1,9 +1,12 @@ package writeon.api.auth.service; +import com.amplitude.Amplitude; +import com.amplitude.Event; import jakarta.mail.MessagingException; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.crypto.bcrypt.BCrypt; import org.springframework.stereotype.Service; @@ -33,6 +36,7 @@ import writeon.domain.terms.enums.TermsCode; import writeon.domain.terms.repository.TermsAgreeJpaRepository; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; @@ -53,6 +57,7 @@ public class AuthCommandService { private final LoginAttemptJpaRepository loginAttemptJpaRepository; private final JwtHelper jwtHelper; private final MailHelper mailHelper; + private final Amplitude amplitude = Amplitude.getInstance(); @Value("${service.web.url}") private String WEB_URL; @@ -213,6 +218,12 @@ public void join(JoinRequest request) { throw new BaseException(AuthException.MAIL_SEND_FAILED); } + // Amplitude 이벤트 전송 + Event event = new Event("$identify", joinToken.getMember().getId().toString()); + event.userProperties = new JSONObject() + .put("signup_date", DateTimeUtil.convertToString(LocalDate.now())) + .put("account_activation", false); + amplitude.logEvent(event); } /** @@ -238,6 +249,18 @@ public void completeJoin(JoinCompletionRequest request) { // 토큰 무효화 this.invalidateToken(joinToken); + + // Amplitude 이벤트 전송 + final String userId = joinToken.getMember().getId().toString(); + Event userPropEvent = new Event("$identify", userId); + userPropEvent.userProperties = new JSONObject() + .put("account_activation", true); + Event signUpEvent = new Event("signup_complete", userId); + userPropEvent.eventProperties = new JSONObject() + .put("user_id", userId); + + amplitude.logEvent(userPropEvent); + amplitude.logEvent(signUpEvent); } /** @@ -262,7 +285,7 @@ public void changePassword(ChangePasswordRequest request) { member.getEmail(), MailHelper.MailData.builder() .nickname(member.getNickname()) - .linkUrl( WEB_URL + "/change-password/complete?changePasswordToken=" + changePasswordToken.getTokenString() ) + .linkUrl(changePasswordToken.getTokenString()) .build() ); } catch (MessagingException e) { diff --git a/api/src/main/java/writeon/api/common/config/AmplitudeConfig.java b/api/src/main/java/writeon/api/common/config/AmplitudeConfig.java new file mode 100644 index 0000000..d54f356 --- /dev/null +++ b/api/src/main/java/writeon/api/common/config/AmplitudeConfig.java @@ -0,0 +1,20 @@ +package writeon.api.common.config; + +import jakarta.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import com.amplitude.Amplitude; + + +@Configuration +public class AmplitudeConfig { + @Value("${service.tracking.amplitude.api-key}") + private String apiKey; + + @PostConstruct + public void init() { + Amplitude amplitude = Amplitude.getInstance(); + amplitude.init(apiKey); + } + +} From 87e42405105e254bc286b8bac120cf5fe131fe8c Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 31 May 2025 16:47:35 +0900 Subject: [PATCH 094/107] feat: apply amplitude events [part 2] (#93) --- .../service/AssistantEvaluationService.java | 16 +++++++++++++++ .../service/ProductCommandService.java | 20 +++++++++++++++++++ .../AssistantEvaluationJpaRepository.java | 2 ++ 3 files changed, 38 insertions(+) diff --git a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java index e1b90e5..36b94cb 100644 --- a/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java +++ b/api/src/main/java/writeon/api/assistant/service/AssistantEvaluationService.java @@ -1,15 +1,20 @@ package writeon.api.assistant.service; +import com.amplitude.Amplitude; +import com.amplitude.Event; import lombok.RequiredArgsConstructor; +import org.json.JSONObject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import writeon.api.assistant.request.AssistantEvaluateRequest; import writeon.api.common.exception.BaseException; +import writeon.api.common.util.MemberUtil; import writeon.domain.assistant.AssistantEvaluation; import writeon.domain.assistant.AssistantEvaluationJpaRepository; import writeon.domain.assistant.enums.AssistantException; import writeon.domain.assistant.enums.FeedbackType; +import java.util.List; import java.util.UUID; @Service @@ -18,6 +23,7 @@ public class AssistantEvaluationService { private final AssistantEvaluationJpaRepository assistantEvaluationRepository; private final AssistantService assistantService; + private final Amplitude amplitude = Amplitude.getInstance(); @Transactional public void evaluate(UUID assistantId, AssistantEvaluateRequest request) { @@ -39,6 +45,16 @@ public void evaluate(UUID assistantId, AssistantEvaluateRequest request) { .build(); assistantEvaluationRepository.save(assistantEvaluation); + + final UUID memberId = MemberUtil.getMemberId(); + final List evaluations = assistantEvaluationRepository.getByCreatedBy(memberId); + final float totalCount = evaluations.size(); + final float goodCount = evaluations.stream().filter(AssistantEvaluation::getIsGood).toList().size(); + final float percentage = Math.round(goodCount / totalCount * 100 * 10) / 10f; + // amplitude 이벤트 송신 + Event event = new Event("$identify", memberId.toString()); + event.userProperties = new JSONObject().put("ai_feedback_satisfaction", percentage); + amplitude.logEvent(event); } private void verifyEvaluated(UUID assistantId) { diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 8aeed4d..02e6110 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -1,5 +1,8 @@ package writeon.api.product.service; +import com.amplitude.Amplitude; +import com.amplitude.Event; +import org.json.JSONObject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +64,7 @@ public class ProductCommandService { private final ProductSynopsisJpaRepository productSynopsisRepository; private final ProductWorldviewJpaRepository productWorldviewRepository; private final ProductFavoritePromptJpaRepository productFavoritePromptRepository; + private final Amplitude amplitude = Amplitude.getInstance(); private final AssistantService assistantService; private final DocumentUploadService documentUploadService; @@ -292,6 +296,14 @@ private void modifyIdeaNote(Product product, ProductTemplateSaveRequest.IdeaNote if (savedIdeaNote == null) { ProductIdeaNote newIdeaNote = new ProductIdeaNote(product.getId(), requestInfo.getTitle(), requestInfo.getContent()); productIdeaNoteRepository.save(newIdeaNote); + // amplitude 이벤트 전송 + final String memberId = MemberUtil.getMemberId().toString(); + Event event = new Event("$identify", memberId); + event.userProperties = new JSONObject() + .put("$add", new JSONObject() + .put("total_idea_notes_written", 1) + ); + amplitude.logEvent(event); } else { savedIdeaNote.update(requestInfo.getTitle(), requestInfo.getContent()); } @@ -326,6 +338,14 @@ private void modifySynopsis(Product product, ProductTemplateSaveRequest.Synopsis if (savedSynopsis == null) { productSynopsisRepository.save(requestInfo.toEntity(product.getId())); + // amplitude 이벤트 전송 + final String memberId = MemberUtil.getMemberId().toString(); + Event event = new Event("$identify", memberId); + event.userProperties = new JSONObject() + .put("$add", new JSONObject() + .put("total_synopsis_written", 1) + ); + amplitude.logEvent(event); } else { savedSynopsis.update(requestInfo.getGenre(), requestInfo.getLength(), requestInfo.getPurpose(), requestInfo.getLogline(), requestInfo.getExample()); } diff --git a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java index b368042..4423129 100644 --- a/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java +++ b/domain/src/main/java/writeon/domain/assistant/AssistantEvaluationJpaRepository.java @@ -2,7 +2,9 @@ import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; import java.util.UUID; public interface AssistantEvaluationJpaRepository extends JpaRepository { + List getByCreatedBy(UUID createdBy); } From ff03d0169d2cf78e07024b9a21d343ba1924bb12 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:10:58 +0900 Subject: [PATCH 095/107] =?UTF-8?q?feat:=20assistant=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EC=97=90=20=EC=84=A4=EC=A0=95=20=EB=B0=98=EC=98=81=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20=EC=A0=81=EC=9A=A9=20(#94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssistantController.java | 26 +++++++++++++------ .../request/AssistantAutoModifyRequest.java | 2 ++ .../request/AssistantChatRequest.java | 2 ++ .../request/AssistantFeedbackRequest.java | 2 ++ .../request/AssistantResearchRequest.java | 2 ++ .../request/AssistantUserModifyRequest.java | 2 ++ .../assistant/service/AutoModifyService.java | 18 ++++++++++--- .../api/assistant/service/ChatService.java | 26 ++++++++++++++++--- .../assistant/service/FeedbackService.java | 18 ++++++++++--- .../assistant/service/UserModifyService.java | 18 ++++++++++--- .../request/UserSetting.java | 13 ++++++---- 11 files changed, 103 insertions(+), 26 deletions(-) diff --git a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java index 7cc2b6e..3ba5037 100644 --- a/api/src/main/java/writeon/api/assistant/controller/AssistantController.java +++ b/api/src/main/java/writeon/api/assistant/controller/AssistantController.java @@ -114,8 +114,11 @@ public AssistantResponse research(@RequestBody AssistantResearchRequest request) @Operation(summary = "자동 수정 스트리밍") @GetMapping("/auto-modify/stream") - public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { - SseEmitter emitter = autoModifyService.streamAutoModify(assistantId); + public SseEmitter streamAutoModify( + @RequestParam UUID assistantId, + @RequestParam(required = false, defaultValue = "true") Boolean shouldApplySetting + ) { + SseEmitter emitter = autoModifyService.streamAutoModify(assistantId, shouldApplySetting); setResponseHeaderForSSE(); return emitter; } @@ -124,17 +127,21 @@ public SseEmitter streamAutoModify(@RequestParam UUID assistantId) { @GetMapping("/chat/stream") public SseEmitter streamChat( @RequestParam UUID assistantId, - @RequestParam String sessionId + @RequestParam String sessionId, + @RequestParam(required = false, defaultValue = "true") Boolean shouldApplySetting ) { - SseEmitter emitter = chatService.streamChat(assistantId, sessionId); + SseEmitter emitter = chatService.streamChat(assistantId, sessionId, shouldApplySetting); setResponseHeaderForSSE(); return emitter; } @Operation(summary = "구간 피드백 스트리밍") @GetMapping("/feedback/stream") - public SseEmitter streamFeedback(@RequestParam UUID assistantId) { - SseEmitter emitter = feedbackService.streamFeedback(assistantId); + public SseEmitter streamFeedback( + @RequestParam UUID assistantId, + @RequestParam(required = false, defaultValue = "true") Boolean shouldApplySetting + ) { + SseEmitter emitter = feedbackService.streamFeedback(assistantId, shouldApplySetting); setResponseHeaderForSSE(); return emitter; } @@ -149,8 +156,11 @@ public SseEmitter streamPlanner(@RequestParam UUID assistantId) { @Operation(summary = "수동 수정 스트리밍") @GetMapping("/user-modify/stream") - public SseEmitter streamUserModify(@RequestParam UUID assistantId) { - SseEmitter emitter = userModifyService.streamUserModify(assistantId); + public SseEmitter streamUserModify( + @RequestParam UUID assistantId, + @RequestParam(required = false, defaultValue = "true") Boolean shouldApplySetting + ) { + SseEmitter emitter = userModifyService.streamUserModify(assistantId, shouldApplySetting); setResponseHeaderForSSE(); return emitter; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java index 2c85d7d..6d7d996 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantAutoModifyRequest.java @@ -14,4 +14,6 @@ public class AssistantAutoModifyRequest { private UUID productId; @Schema(title = "선택 구간") private String content; + @Schema(title = "설정 반영 여부", nullable = true) + private Boolean shouldApplySetting = true; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java index e59a1bf..d005dd8 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantChatRequest.java @@ -18,4 +18,6 @@ public class AssistantChatRequest { private String prompt; @Schema(title = "세션 ID", nullable = true) private String sessionId; + @Schema(title = "설정 반영 여부", nullable = true) + private Boolean shouldApplySetting = true; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java index 91772e6..21058c3 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantFeedbackRequest.java @@ -14,4 +14,6 @@ public class AssistantFeedbackRequest { private UUID productId; @Schema(title = "선택 구간") private String content; + @Schema(title = "설정 반영 여부", nullable = true) + private Boolean shouldApplySetting = true; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java index 77dc218..8da4f97 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantResearchRequest.java @@ -18,4 +18,6 @@ public class AssistantResearchRequest { private String content; @Schema(title = "프롬프트") private String prompt; + @Schema(title = "설정 반영 여부", nullable = true) + private Boolean shouldApplySetting = true; } diff --git a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java index e895573..ad2e100 100644 --- a/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java +++ b/api/src/main/java/writeon/api/assistant/request/AssistantUserModifyRequest.java @@ -16,4 +16,6 @@ public class AssistantUserModifyRequest { private String content; @Schema(title = "프롬프트", nullable = true) private String prompt; + @Schema(title = "설정 반영 여부", nullable = true) + private Boolean shouldApplySetting = true; } diff --git a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java index d649257..efcf0c9 100644 --- a/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/AutoModifyService.java @@ -48,7 +48,13 @@ public AssistantResponse autoModify(AssistantAutoModifyRequest request) { .build(); assistantService.createMessage(memberMessage); - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserSetting userSetting; + if (request.getShouldApplySetting()) { + userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + } else { + userSetting = new UserSetting(); + } + AutoModifyRequest autoModifyRequest = new AutoModifyRequest( "t" + request.getProductId().toString().replaceAll("-", ""), userSetting, @@ -87,7 +93,7 @@ public MessageCreateResponse createMessage(AssistantAutoModifyRequest request) { return new MessageCreateResponse(assistantId); } - public SseEmitter streamAutoModify(UUID assistantId) { + public SseEmitter streamAutoModify(UUID assistantId, Boolean shouldApplySetting) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); assistantService.verifyAnswered(assistantId); @@ -95,7 +101,13 @@ public SseEmitter streamAutoModify(UUID assistantId) { AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); - UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + UserSetting userSetting; + if (shouldApplySetting) { + userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + } else { + userSetting = new UserSetting(); + } + AutoModifyRequest request = new AutoModifyRequest( "t" + assistant.getProductId().toString().replaceAll("-", ""), userSetting, diff --git a/api/src/main/java/writeon/api/assistant/service/ChatService.java b/api/src/main/java/writeon/api/assistant/service/ChatService.java index 15f3aee..f573336 100644 --- a/api/src/main/java/writeon/api/assistant/service/ChatService.java +++ b/api/src/main/java/writeon/api/assistant/service/ChatService.java @@ -51,7 +51,13 @@ public AssistantResponse chat(AssistantChatRequest request) { .build(); assistantService.createMessage(memberMessage); - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserSetting userSetting; + if (request.getShouldApplySetting()) { + userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + } else { + userSetting = new UserSetting(); + } + ChatRequest chatRequest = new ChatRequest( userSetting, memberMessage.getContent(), @@ -92,7 +98,7 @@ public MessageCreateResponse createMessage(AssistantChatRequest request) { return new MessageCreateResponse(assistantId); } - public SseEmitter streamChat(UUID assistantId, String sessionId) { + public SseEmitter streamChat(UUID assistantId, String sessionId, Boolean shouldApplySetting) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); assistantService.verifyAnswered(assistantId); @@ -100,7 +106,13 @@ public SseEmitter streamChat(UUID assistantId, String sessionId) { AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); - UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + UserSetting userSetting; + if (shouldApplySetting) { + userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + } else { + userSetting = new UserSetting(); + } + ChatRequest request = new ChatRequest( userSetting, memberMessage.getContent(), @@ -158,7 +170,13 @@ public AssistantResponse research(AssistantResearchRequest request) { .build(); assistantService.createMessage(memberMessage); - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserSetting userSetting; + if (request.getShouldApplySetting()) { + userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + } else { + userSetting = new UserSetting(); + } + ResearchRequest researchRequest = new ResearchRequest(userSetting, request.getContent(), request.getPrompt(), request.getSessionId()); // 웹 검색 요청 diff --git a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java index 830de12..1b070e6 100644 --- a/api/src/main/java/writeon/api/assistant/service/FeedbackService.java +++ b/api/src/main/java/writeon/api/assistant/service/FeedbackService.java @@ -48,7 +48,13 @@ public AssistantResponse feedback(AssistantFeedbackRequest request) { .build(); assistantService.createMessage(memberMessage); - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserSetting userSetting; + if (request.getShouldApplySetting()) { + userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + } else { + userSetting = new UserSetting(); + } + FeedbackRequest feedbackRequest = new FeedbackRequest( "t" + request.getProductId().toString().replaceAll("-", ""), userSetting, @@ -87,7 +93,7 @@ public MessageCreateResponse createMessage(AssistantFeedbackRequest request) { return new MessageCreateResponse(assistantId); } - public SseEmitter streamFeedback(UUID assistantId) { + public SseEmitter streamFeedback(UUID assistantId, Boolean shouldApplySetting) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); assistantService.verifyAnswered(assistantId); @@ -95,7 +101,13 @@ public SseEmitter streamFeedback(UUID assistantId) { AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); - UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + UserSetting userSetting; + if (shouldApplySetting) { + userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + } else { + userSetting = new UserSetting(); + } + FeedbackRequest request = new FeedbackRequest( "t" + assistant.getProductId().toString().replaceAll("-", ""), userSetting, diff --git a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java index fa540f9..5e47fda 100644 --- a/api/src/main/java/writeon/api/assistant/service/UserModifyService.java +++ b/api/src/main/java/writeon/api/assistant/service/UserModifyService.java @@ -49,7 +49,13 @@ public AssistantResponse userModify(AssistantUserModifyRequest request) { .build(); assistantService.createMessage(memberMessage); - UserSetting userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + UserSetting userSetting; + if (request.getShouldApplySetting()) { + userSetting = new UserSetting(productQueryService.getById(request.getProductId())); + } else { + userSetting = new UserSetting(); + } + UserModifyRequest userModifyRequest = new UserModifyRequest( "t" + request.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent(), @@ -89,7 +95,7 @@ public MessageCreateResponse createMessage(AssistantUserModifyRequest request) { return new MessageCreateResponse(assistantId); } - public SseEmitter streamUserModify(UUID assistantId) { + public SseEmitter streamUserModify(UUID assistantId, Boolean shouldApplySetting) { Assistant assistant = assistantService.getById(assistantId, MemberUtil.getMemberId()); assistantService.verifyAnswered(assistantId); @@ -97,7 +103,13 @@ public SseEmitter streamUserModify(UUID assistantId) { AssistantMessage memberMessage = assistantService.getMessageByAssistantId(assistantId, MessageSenderRole.MEMBER); - UserSetting userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + UserSetting userSetting; + if (shouldApplySetting) { + userSetting = new UserSetting(productQueryService.getById(assistant.getProductId())); + } else { + userSetting = new UserSetting(); + } + UserModifyRequest request = new UserModifyRequest( "t" + assistant.getProductId().toString().replaceAll("-", ""), userSetting, memberMessage.getContent(), diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java index e0a41f4..62b1ac4 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/request/UserSetting.java @@ -10,11 +10,14 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public class UserSetting { - private final Synopsis synopsis; - private final Worldview worldview; - private final List characters; - private final Plot plot; - private final IdeaNote ideaNote; + private Synopsis synopsis; + private Worldview worldview; + private List characters; + private Plot plot; + private IdeaNote ideaNote; + + public UserSetting() { + } public UserSetting(Product product) { this.characters = product.getCharacters().stream() From f87a3328dd6add86b4df564d2fe897fd613549b5 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:45:47 +0900 Subject: [PATCH 096/107] =?UTF-8?q?feat:=20=EC=9E=91=ED=92=88=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=9D=91=EB=8B=B5=20DTO=EC=97=90=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9D=BC=EC=8B=9C=20=ED=95=84=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../writeon/api/product/response/ProductResponse.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/writeon/api/product/response/ProductResponse.java b/api/src/main/java/writeon/api/product/response/ProductResponse.java index 1391831..b163957 100644 --- a/api/src/main/java/writeon/api/product/response/ProductResponse.java +++ b/api/src/main/java/writeon/api/product/response/ProductResponse.java @@ -1,13 +1,13 @@ package writeon.api.product.response; -import java.time.LocalDateTime; -import java.util.UUID; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import writeon.tables.records.ProductRecord; +import java.time.LocalDateTime; +import java.util.UUID; + @Getter @Setter public class ProductResponse { @@ -17,6 +17,8 @@ public class ProductResponse { private final String title; @Schema(title = "장르", nullable = true) private final String genre; + @Schema(title = "생성일시") + private final LocalDateTime createdAt; @Schema(title = "수정일시") private final LocalDateTime updatedAt; @@ -24,6 +26,7 @@ public ProductResponse(ProductRecord product, String genre) { this.id = product.getId(); this.title = product.getTitle(); this.genre = genre; + this.createdAt = product.getCreatedAt(); this.updatedAt = product.getUpdatedAt(); } } From 0f6741d77f0feb9c0c41a20b9bae384b88848d73 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 8 Jun 2025 18:37:26 +0900 Subject: [PATCH 097/107] =?UTF-8?q?config:=20accessToken=20=EB=A7=8C?= =?UTF-8?q?=EB=A3=8C=EC=8B=9C=EA=B0=84=20=EC=9E=84=EC=8B=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE-secret b/BE-secret index fd9b071..efee608 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit fd9b0715cea52f17d07d4a4b5af14eb53bd9d71d +Subproject commit efee6085fb6dee47ea6ccfabdd9afce68feb112f From e7a22f703f46f10171a5b8d4ed917da068f32f0b Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 8 Jun 2025 19:14:10 +0900 Subject: [PATCH 098/107] =?UTF-8?q?feat:=20createMemo=EA=B0=80=20id?= =?UTF-8?q?=EB=A5=BC=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- .../api/product/controller/ProductController.java | 4 ++-- .../api/product/service/ProductCommandService.java | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BE-secret b/BE-secret index efee608..83087f3 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit efee6085fb6dee47ea6ccfabdd9afce68feb112f +Subproject commit 83087f355e737265187f8e4beb4e08fd03e96886 diff --git a/api/src/main/java/writeon/api/product/controller/ProductController.java b/api/src/main/java/writeon/api/product/controller/ProductController.java index 8ba1fac..8ddfc49 100644 --- a/api/src/main/java/writeon/api/product/controller/ProductController.java +++ b/api/src/main/java/writeon/api/product/controller/ProductController.java @@ -77,10 +77,10 @@ public void createTemplate( @Operation(summary = "메모 생성") @PostMapping("/{productId}/memos") - public void createMemo( + public UUID createMemo( @PathVariable UUID productId, @RequestBody ProductMemoSaveRequest request) { - productCommandService.createMemo(productId, request); + return productCommandService.createMemo(productId, request); } @Operation(summary = "작품 목록 조회") diff --git a/api/src/main/java/writeon/api/product/service/ProductCommandService.java b/api/src/main/java/writeon/api/product/service/ProductCommandService.java index 02e6110..827d690 100644 --- a/api/src/main/java/writeon/api/product/service/ProductCommandService.java +++ b/api/src/main/java/writeon/api/product/service/ProductCommandService.java @@ -75,11 +75,14 @@ public UUID create() { } @Transactional - public void createMemo(UUID productId, ProductMemoSaveRequest request) { + public UUID createMemo(UUID productId, ProductMemoSaveRequest request) { productQueryService.verifyExist(productId); - productMemoRepository.save(new ProductMemo(productId, request.getTitle(), request.getContent(), - request.getSelectedText(), request.getStartIndex(), request.getEndIndex())); + ProductMemo newMemo = new ProductMemo(productId, request.getTitle(), request.getContent(), + request.getSelectedText(), request.getStartIndex(), request.getEndIndex()); + productMemoRepository.save(newMemo); + + return newMemo.getId(); } @Transactional From 148367a325f268a7b59f7d154184739af1afe800 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sun, 8 Jun 2025 20:09:08 +0900 Subject: [PATCH 099/107] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=B3=80=EA=B2=BD=20=EB=A7=81=ED=81=AC=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=20=EB=B3=B4=EB=82=B4=EC=A7=80=EB=8A=94=20=ED=98=84?= =?UTF-8?q?=EC=83=81=20=EC=88=98=EC=A0=95=20(#98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/writeon/api/auth/service/AuthCommandService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index 7fa1035..464f95d 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -285,7 +285,7 @@ public void changePassword(ChangePasswordRequest request) { member.getEmail(), MailHelper.MailData.builder() .nickname(member.getNickname()) - .linkUrl(changePasswordToken.getTokenString()) + .linkUrl(WEB_URL + "/change-password/complete?changePasswordToken=" + changePasswordToken.getTokenString()) .build() ); } catch (MessagingException e) { From 3669ed6c2e5b1294d1e4aaf20f628a8d9ce818e4 Mon Sep 17 00:00:00 2001 From: ByungSun Song <46879319+SBSun@users.noreply.github.com> Date: Thu, 12 Jun 2025 00:42:40 +0900 Subject: [PATCH 100/107] =?UTF-8?q?fix:=20research=20API=20=EC=97=B0?= =?UTF-8?q?=EB=8F=99=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/writeon/assistantapiclient/AssistantApiClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java index 6dc5e96..affbf27 100644 --- a/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java +++ b/assistant-api-client/src/main/java/writeon/assistantapiclient/AssistantApiClient.java @@ -43,7 +43,7 @@ public Mono research(ResearchRequest request) { .flatMap(errorBody -> Mono.error(new RuntimeException(errorBody))) ) .bodyToMono(String.class) - .map(responseBody -> JsonPath.read(responseBody, "$.result.content")); + .map(responseBody -> JsonPath.read(responseBody, "$.result")); } public Mono autoModify(AutoModifyRequest request) { From 17de35ec1859045d2835d74bec1d5fef0758e558 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Thu, 12 Jun 2025 21:49:26 +0900 Subject: [PATCH 101/107] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/validation/IsPasswordValidator.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java index b0a96ac..c41bdb5 100644 --- a/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java +++ b/api/src/main/java/writeon/api/common/validation/IsPasswordValidator.java @@ -3,28 +3,16 @@ import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidatorContext; -import java.util.stream.Stream; - public class IsPasswordValidator implements ConstraintValidator { - final String digit = "0-9"; - final String uppercase = "A-Z"; - final String lowercase = "a-z"; - final String specialCharacters = "@$!%*?&"; + final String regexp + = "(?=(.*[A-Z]))(?=(.*[a-z]))(?=(.*\\d))(?=(.*[\\W_])).{8,}$|^(?=(.*[A-Z]))(?=(.*[a-z]))(?=(.*\\d)).{8,}$|^(?=(.*[A-Z]))(?=(.*[a-z]))(?=(.*[\\W_])).{8,}$|^(?=(.*[A-Z]))(?=(.*\\d))(?=(.*[\\W_])).{8,}$|^(?=(.*[a-z]))(?=(.*\\d))(?=(.*[\\W_])).{8,}"; @Override public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { if (s == null) return true; - final String otherCharacterMatcher = String.format(".*[^%s%s%s%s].*", digit, uppercase, lowercase, specialCharacters); - if (s.matches(otherCharacterMatcher)) - return false; - - long matchCount = Stream.of(digit, uppercase, lowercase, specialCharacters) - .filter(regex -> s.matches(String.format(".*[%s].*", regex))) - .count(); - - return matchCount >= 3; + return s.matches(regexp); } } \ No newline at end of file From c66db9d70908d48a4c8ef74c927e685e4fd17ac1 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 14 Jun 2025 11:46:59 +0900 Subject: [PATCH 102/107] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EC=A0=95=EA=B7=9C?= =?UTF-8?q?=EC=8B=9D=20=EC=A0=9C=EA=B1=B0=20&=20=EC=95=A1=EC=84=B8?= =?UTF-8?q?=EC=8A=A4=20=ED=86=A0=ED=81=B0=20=EB=A7=8C=EB=A3=8C=20=EA=B8=B0?= =?UTF-8?q?=ED=95=9C=20=EB=B3=80=EA=B2=BD=20(#101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE-secret | 2 +- .../api/auth/request/ChangePasswordCompletionRequest.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/BE-secret b/BE-secret index 83087f3..68bcf1e 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 83087f355e737265187f8e4beb4e08fd03e96886 +Subproject commit 68bcf1e00633bb35d83c31b1791e5af2544f1bbb diff --git a/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java b/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java index 576bde1..6f2f561 100644 --- a/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java +++ b/api/src/main/java/writeon/api/auth/request/ChangePasswordCompletionRequest.java @@ -17,7 +17,6 @@ public class ChangePasswordCompletionRequest { private String changePasswordToken; @NotBlank - @IsPassword @Schema(title = "변경할 비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; } From 2308dcaddf345a93acab9b7a43a019f74ff93493 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 14 Jun 2025 11:53:04 +0900 Subject: [PATCH 103/107] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=20=EA=B2=80=EC=A6=9D=20=EC=A0=9C=EA=B1=B0=20(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/writeon/api/auth/request/ChangePasswordRequest.java | 2 ++ api/src/main/java/writeon/api/auth/request/LoginRequest.java | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java b/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java index 9928fce..1511808 100644 --- a/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java +++ b/api/src/main/java/writeon/api/auth/request/ChangePasswordRequest.java @@ -6,12 +6,14 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import writeon.api.common.validation.IsPassword; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor public class ChangePasswordRequest { @NotBlank + @IsPassword @Schema(title = "이메일", requiredMode = Schema.RequiredMode.REQUIRED, example = "example@domain.com") private String email; } diff --git a/api/src/main/java/writeon/api/auth/request/LoginRequest.java b/api/src/main/java/writeon/api/auth/request/LoginRequest.java index 3530ffa..35f9058 100644 --- a/api/src/main/java/writeon/api/auth/request/LoginRequest.java +++ b/api/src/main/java/writeon/api/auth/request/LoginRequest.java @@ -16,7 +16,6 @@ public class LoginRequest { private String email; @NotBlank - @IsPassword @Schema(title = "비밀번호", requiredMode = Schema.RequiredMode.REQUIRED, example = "Writely4Writers!@") private String password; } From 67ad86c9deea8f1e6d7c33a5e295bb4fea76fd46 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 14 Jun 2025 16:49:31 +0900 Subject: [PATCH 104/107] =?UTF-8?q?fix:=20TLS=20=EC=9E=AC=EB=B0=9C?= =?UTF-8?q?=EA=B8=89=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20(#103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/schedule-for-refresh-certification.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-for-refresh-certification.yml b/.github/workflows/schedule-for-refresh-certification.yml index c6b0368..405e517 100644 --- a/.github/workflows/schedule-for-refresh-certification.yml +++ b/.github/workflows/schedule-for-refresh-certification.yml @@ -2,7 +2,7 @@ name: Schedule for refresh certification on: schedule: - - cron: "0 15 1 */2 *" + - cron: "0 15 1 * *" workflow_dispatch: jobs: @@ -25,8 +25,7 @@ jobs: --document-name "AWS-RunShellScript" \ --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ --parameters commands='[ - "docker run -it --rm --name writeon-certbot -p 80:80 -v \"/etc/letsencrypt:/etc/letsencrypt\" -v \"/var/lib/letsencrypt:/var/lib/letsencrypt\" certbot/certbot certonly --standalone --force-renewal -d dev-api.writeon.ai.kr", - "sudo su", + "docker run --rm --name writeon-certbot -p 80:80 -v \"/etc/letsencrypt:/etc/letsencrypt\" -v \"/var/lib/letsencrypt:/var/lib/letsencrypt\" certbot/certbot certonly --standalone --force-renewal -d dev-api.writeon.ai.kr", "cd /etc/letsencrypt/live/dev-api.writeon.ai.kr", "openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -CAfile chain.pem -caname root -password pass:${{ secrets.TLS_KEYSTORE_PASSWORD }}" ]' \ From a059b860ea4723c41a234dd88fc38053f547de45 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Sat, 14 Jun 2025 22:30:22 +0900 Subject: [PATCH 105/107] =?UTF-8?q?chore:=20=EC=9D=B8=EC=A6=9D=20=EC=B6=94?= =?UTF-8?q?=EC=A0=81=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EB=A1=9C=EA=B9=85=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../writeon/api/auth/service/AuthCommandService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java index 464f95d..f25ba6c 100644 --- a/api/src/main/java/writeon/api/auth/service/AuthCommandService.java +++ b/api/src/main/java/writeon/api/auth/service/AuthCommandService.java @@ -17,6 +17,7 @@ import writeon.api.auth.response.LoginFailResponse; import writeon.api.common.exception.BaseException; import writeon.api.common.util.DateTimeUtil; +import writeon.api.common.util.LogUtil; import writeon.api.terms.request.TermsAgreeRequest; import writeon.api.terms.service.TermsQueryService; import writeon.domain.auth.*; @@ -75,6 +76,7 @@ public AuthTokenDto reissueToken(String tokenString) { // 레디스 검사 RefreshToken oldRefreshToken = refreshTokenRedisRepository.findById(tokenString) .orElseThrow(() -> new BaseException(AuthException.REFRESH_TOKEN_NOT_VALID)); + LogUtil.info("invalidate refresh token by reissue: " + tokenString); this.invalidateToken(oldRefreshToken); JwtPayload payload = jwtHelper.getPayload(tokenString); @@ -150,8 +152,10 @@ public AuthTokenDto login(LoginRequest request) { public void logout() { MemberSession memberSession = MemberHelper.getMemberSession(); - refreshTokenRedisRepository.findByMemberId(memberSession.getMemberId()) - .ifPresent(this::invalidateToken); + refreshTokenRedisRepository.findByMemberId(memberSession.getMemberId()).ifPresent((refreshToken) -> { + LogUtil.info("invalidate refresh token by logout: " + refreshToken.getTokenString()); + invalidateToken(refreshToken); + }); } /** @@ -335,7 +339,8 @@ private AuthTokenDto generateAuthTokens(UUID memberId) { .build(); String accessToken = jwtHelper.generateAccessToken(jwtPayload); String refreshToken = jwtHelper.generateRefreshToken(jwtPayload); - refreshTokenRedisRepository.save(new RefreshToken(refreshToken, memberId));; + refreshTokenRedisRepository.save(new RefreshToken(refreshToken, memberId)); + LogUtil.info("issue refresh token: " + refreshToken); return new AuthTokenDto(accessToken, refreshToken); } From 5140337b71b5b58c50358f423630670200eac0ca Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 16 Jun 2025 21:52:03 +0900 Subject: [PATCH 106/107] =?UTF-8?q?feat:=20=EC=9A=B4=EC=98=81=20db=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EB=B0=8F=20ssl=20=EC=84=A4=EC=A0=95=20(#1?= =?UTF-8?q?05)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 34 +++++++++++++---- .../schedule-for-refresh-certification.yml | 38 ++++++++++++++----- BE-secret | 2 +- Dockerfile => Dockerfile-dev | 0 Dockerfile-prod | 10 +++++ 5 files changed, 67 insertions(+), 17 deletions(-) rename Dockerfile => Dockerfile-dev (100%) create mode 100644 Dockerfile-prod diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3b00433..96cc020 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,10 +46,15 @@ jobs: - name: Login to Amazon ECR run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }} - - name: Docker build & push to ECR - run: docker build -t ${{ secrets.ECR_REGISTRY_URI }}:latest -f Dockerfile --push . + - name: Docker build & push to ECR (develop) + if: github.ref == 'refs/heads/develop' + run: docker build -t ${{ secrets.ECR_REGISTRY_URI }}:dev -f Dockerfile-dev --push . - - name: Server Deploy + - name: Docker build & push to ECR (production) + if: github.ref == 'refs/heads/main' + run: docker build -t ${{ secrets.ECR_REGISTRY_URI }}:prod -f Dockerfile-prod --push . + + - name: Server Deploy (develop) run: | aws ssm send-command \ --document-name "AWS-RunShellScript" \ @@ -58,8 +63,23 @@ jobs: "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }}", "cd /root", "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", - "[ $(docker images -q ${{ secrets.ECR_REGISTRY_URI }}:latest | wc -l) -gt 0 ] && docker rmi ${{ secrets.ECR_REGISTRY_URI }}:latest", - "docker pull ${{ secrets.ECR_REGISTRY_URI }}:latest", - "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:latest" + "[ $(docker images -q ${{ secrets.ECR_REGISTRY_URI }}:dev | wc -l) -gt 0 ] && docker rmi ${{ secrets.ECR_REGISTRY_URI }}:dev", + "docker pull ${{ secrets.ECR_REGISTRY_URI }}:dev", + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:dev" + ]' \ + --comment "Deploying Docker container (develop)" + + - name: Server Deploy (production) + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID_PROD }}" \ + --parameters commands='[ + "aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }}", + "cd /root", + "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", + "[ $(docker images -q ${{ secrets.ECR_REGISTRY_URI }}:prod | wc -l) -gt 0 ] && docker rmi ${{ secrets.ECR_REGISTRY_URI }}:prod", + "docker pull ${{ secrets.ECR_REGISTRY_URI }}:prod", + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:prod" ]' \ - --comment "Deploying Docker container" \ No newline at end of file + --comment "Deploying Docker container (production)" \ No newline at end of file diff --git a/.github/workflows/schedule-for-refresh-certification.yml b/.github/workflows/schedule-for-refresh-certification.yml index 405e517..df51bfd 100644 --- a/.github/workflows/schedule-for-refresh-certification.yml +++ b/.github/workflows/schedule-for-refresh-certification.yml @@ -9,9 +9,6 @@ jobs: run-script: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -19,7 +16,10 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.AWS_REGION }} - - name: Refresh let's encrypt certification + - name: Login to Amazon ECR + run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }} + + - name: Refresh let's encrypt certification (develop) run: | aws ssm send-command \ --document-name "AWS-RunShellScript" \ @@ -31,16 +31,36 @@ jobs: ]' \ --comment "Refresh let's encrypt certification" - - name: Login to Amazon ECR - run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REGISTRY_URI }} - - - name: Restart API Server + - name: Restart API Server (develop) run: | aws ssm send-command \ --document-name "AWS-RunShellScript" \ --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ --parameters commands='[ "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", - "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:latest" + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/dev-api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:dev" + ]' \ + --comment "Restart API Server for apply new certification" + + - name: Refresh let's encrypt certification (production) + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID_PROD }}" \ + --parameters commands='[ + "docker run --rm --name writeon-certbot -p 80:80 -v \"/etc/letsencrypt:/etc/letsencrypt\" -v \"/var/lib/letsencrypt:/var/lib/letsencrypt\" certbot/certbot certonly --standalone --force-renewal -d api.writeon.ai.kr", + "cd /etc/letsencrypt/live/api.writeon.ai.kr", + "openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -CAfile chain.pem -caname root -password pass:${{ secrets.TLS_KEYSTORE_PASSWORD }}" + ]' \ + --comment "Refresh let's encrypt certification" + + - name: Restart API Server (production) + run: | + aws ssm send-command \ + --document-name "AWS-RunShellScript" \ + --instance-ids "${{ secrets.EC2_INSTANCE_ID_PROD }}" \ + --parameters commands='[ + "[ $(docker ps --filter 'publish=443' -q | wc -l) -gt 0 ] && docker stop $(docker ps --filter 'publish=443' -q)", + "docker run --rm -d -p 443:443 --name writely-api -v /writely/logs:/writely/logs -v /etc/letsencrypt/live/api.writeon.ai.kr:/writely/cert ${{ secrets.ECR_REGISTRY_URI }}:prod" ]' \ --comment "Restart API Server for apply new certification" \ No newline at end of file diff --git a/BE-secret b/BE-secret index 68bcf1e..73f1191 160000 --- a/BE-secret +++ b/BE-secret @@ -1 +1 @@ -Subproject commit 68bcf1e00633bb35d83c31b1791e5af2544f1bbb +Subproject commit 73f11914444b4f55419d542628f5f4e0c76b5b7e diff --git a/Dockerfile b/Dockerfile-dev similarity index 100% rename from Dockerfile rename to Dockerfile-dev diff --git a/Dockerfile-prod b/Dockerfile-prod new file mode 100644 index 0000000..3bf0bd3 --- /dev/null +++ b/Dockerfile-prod @@ -0,0 +1,10 @@ +FROM openjdk:21-jdk-slim + +WORKDIR /writeon + +ENV TZ=Asia/Seoul +RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime + +COPY api/build/libs/*.jar writeon.jar + +ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "writeon.jar"] \ No newline at end of file From ba1b11850e1f5fab712a2ef5c0900d8d35551486 Mon Sep 17 00:00:00 2001 From: Wichan Kang Date: Mon, 16 Jun 2025 21:57:36 +0900 Subject: [PATCH 107/107] fix: workflow (#106) --- .github/workflows/deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 96cc020..cc8e1d6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -55,6 +55,7 @@ jobs: run: docker build -t ${{ secrets.ECR_REGISTRY_URI }}:prod -f Dockerfile-prod --push . - name: Server Deploy (develop) + if: github.ref == 'refs/heads/develop' run: | aws ssm send-command \ --document-name "AWS-RunShellScript" \ @@ -70,6 +71,7 @@ jobs: --comment "Deploying Docker container (develop)" - name: Server Deploy (production) + if: github.ref == 'refs/heads/main' run: | aws ssm send-command \ --document-name "AWS-RunShellScript" \