-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from study-hub-inu/feat/terms-of-use
Feat/terms of use
- Loading branch information
Showing
9 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
.../generated/querydsl/kr/co/studyhubinu/studyhubserver/notice/domain/QTermsOfUseEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.domain; | ||
|
||
import static com.querydsl.core.types.PathMetadataFactory.*; | ||
|
||
import com.querydsl.core.types.dsl.*; | ||
|
||
import com.querydsl.core.types.PathMetadata; | ||
import javax.annotation.processing.Generated; | ||
import com.querydsl.core.types.Path; | ||
|
||
|
||
/** | ||
* QTermsOfUseEntity is a Querydsl query type for TermsOfUseEntity | ||
*/ | ||
@Generated("com.querydsl.codegen.DefaultEntitySerializer") | ||
public class QTermsOfUseEntity extends EntityPathBase<TermsOfUseEntity> { | ||
|
||
private static final long serialVersionUID = -1621487174L; | ||
|
||
public static final QTermsOfUseEntity termsOfUseEntity = new QTermsOfUseEntity("termsOfUseEntity"); | ||
|
||
public final kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity _super = new kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity(this); | ||
|
||
public final StringPath article = createString("article"); | ||
|
||
public final StringPath content = createString("content"); | ||
|
||
//inherited | ||
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate; | ||
|
||
public final NumberPath<Long> id = createNumber("id", Long.class); | ||
|
||
//inherited | ||
public final DateTimePath<java.time.LocalDateTime> modifiedDate = _super.modifiedDate; | ||
|
||
public final StringPath title = createString("title"); | ||
|
||
public final StringPath version = createString("version"); | ||
|
||
public QTermsOfUseEntity(String variable) { | ||
super(TermsOfUseEntity.class, forVariable(variable)); | ||
} | ||
|
||
public QTermsOfUseEntity(Path<? extends TermsOfUseEntity> path) { | ||
super(path.getType(), path.getMetadata()); | ||
} | ||
|
||
public QTermsOfUseEntity(PathMetadata metadata) { | ||
super(TermsOfUseEntity.class, metadata); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/kr/co/studyhubinu/studyhubserver/notice/domain/TermsOfUseEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.domain; | ||
|
||
import kr.co.studyhubinu.studyhubserver.common.domain.BaseTimeEntity; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "terms_of_use") | ||
public class TermsOfUseEntity extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "terms_of_use_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String title; | ||
|
||
private String article; | ||
|
||
private String content; | ||
|
||
private String version; | ||
|
||
@Builder | ||
public TermsOfUseEntity(String title, String article, String content, String version) { | ||
this.title = title; | ||
this.article = article; | ||
this.content = content; | ||
this.version = version; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...in/java/kr/co/studyhubinu/studyhubserver/notice/dto/response/FindTermsOfUsesResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class FindTermsOfUsesResponse { | ||
|
||
private final Long terms_of_use_id; | ||
private final String title; | ||
private final String article; | ||
private final String content; | ||
|
||
public FindTermsOfUsesResponse(Long terms_of_use_id, String title, String article, String content) { | ||
this.terms_of_use_id = terms_of_use_id; | ||
this.title = title; | ||
this.article = article; | ||
this.content = content; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/kr/co/studyhubinu/studyhubserver/notice/repository/TermsOfUseRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.repository; | ||
|
||
import kr.co.studyhubinu.studyhubserver.notice.domain.TermsOfUseEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface TermsOfUseRepository extends JpaRepository<TermsOfUseEntity, Long>, TermsOfUseRepositoryCustom { | ||
} |
9 changes: 9 additions & 0 deletions
9
...n/java/kr/co/studyhubinu/studyhubserver/notice/repository/TermsOfUseRepositoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.repository; | ||
|
||
import kr.co.studyhubinu.studyhubserver.notice.dto.response.FindTermsOfUsesResponse; | ||
|
||
import java.util.List; | ||
|
||
public interface TermsOfUseRepositoryCustom { | ||
List<FindTermsOfUsesResponse> findAllTermsOfUse(); | ||
} |
36 changes: 36 additions & 0 deletions
36
...va/kr/co/studyhubinu/studyhubserver/notice/repository/TermsOfUseRepositoryCustomImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package kr.co.studyhubinu.studyhubserver.notice.repository; | ||
|
||
import com.querydsl.core.types.Projections; | ||
import com.querydsl.jpa.impl.JPAQuery; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import kr.co.studyhubinu.studyhubserver.notice.domain.QTermsOfUseEntity; | ||
import kr.co.studyhubinu.studyhubserver.notice.dto.response.FindTermsOfUsesResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
import static kr.co.studyhubinu.studyhubserver.notice.domain.QTermsOfUseEntity.termsOfUseEntity; | ||
|
||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class TermsOfUseRepositoryCustomImpl implements TermsOfUseRepositoryCustom{ | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
@Override | ||
public List<FindTermsOfUsesResponse> findAllTermsOfUse() { | ||
QTermsOfUseEntity termsOfUse = termsOfUseEntity; | ||
|
||
JPAQuery<FindTermsOfUsesResponse> data = jpaQueryFactory | ||
.select(Projections.constructor( | ||
FindTermsOfUsesResponse.class, | ||
termsOfUse.id.as("terms_of_use_id"), termsOfUse.title, termsOfUse.article, termsOfUse.content | ||
) | ||
) | ||
.from(termsOfUse); | ||
|
||
return data.fetch(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters