-
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 #140 from inje-megabrain/feat/post_api
Feat/post api
- Loading branch information
Showing
9 changed files
with
243 additions
and
95 deletions.
There are no files selected for viewing
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,54 @@ | ||
package com.example.just.Dao; | ||
|
||
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; | ||
import com.querydsl.core.types.dsl.PathInits; | ||
|
||
|
||
/** | ||
* QPostLike is a Querydsl query type for PostLike | ||
*/ | ||
@Generated("com.querydsl.codegen.DefaultEntitySerializer") | ||
public class QPostLike extends EntityPathBase<PostLike> { | ||
|
||
private static final long serialVersionUID = -993289340L; | ||
|
||
private static final PathInits INITS = PathInits.DIRECT2; | ||
|
||
public static final QPostLike postLike = new QPostLike("postLike"); | ||
|
||
public final NumberPath<Long> id = createNumber("id", Long.class); | ||
|
||
public final QMember member; | ||
|
||
public final QPost post; | ||
|
||
public QPostLike(String variable) { | ||
this(PostLike.class, forVariable(variable), INITS); | ||
} | ||
|
||
public QPostLike(Path<? extends PostLike> path) { | ||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); | ||
} | ||
|
||
public QPostLike(PathMetadata metadata) { | ||
this(metadata, PathInits.getFor(metadata, INITS)); | ||
} | ||
|
||
public QPostLike(PathMetadata metadata, PathInits inits) { | ||
this(PostLike.class, metadata, inits); | ||
} | ||
|
||
public QPostLike(Class<? extends PostLike> type, PathMetadata metadata, PathInits inits) { | ||
super(type, metadata, inits); | ||
this.member = inits.isInitialized("member") ? new QMember(forProperty("member")) : null; | ||
this.post = inits.isInitialized("post") ? new QPost(forProperty("post"), inits.get("post")) : null; | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.example.just.Dao; | ||
|
||
import javax.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
@Table(name = "post_like") | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class PostLike { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
public PostLike(Post post, Member member) { | ||
this.post = post; | ||
this.member = member; | ||
|
||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/example/just/Repository/PostLikeRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.just.Repository; | ||
|
||
import com.example.just.Dao.Member; | ||
import com.example.just.Dao.Post; | ||
import com.example.just.Dao.PostLike; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface PostLikeRepository extends JpaRepository<PostLike, Long> { | ||
PostLike findByPostAndMember(Post post, Member member); | ||
|
||
List<PostLike> findByMember(Member member); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.