-
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.
- Loading branch information
Showing
8 changed files
with
165 additions
and
12 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
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,16 @@ | ||
package com.hotdog.controllers; | ||
|
||
import com.hotdog.repositories.PostsRepo; | ||
import com.hotdog.repositories.TagsRepo; | ||
import org.springframework.stereotype.Controller; | ||
|
||
@Controller | ||
public class TagsController { | ||
|
||
private final TagsRepo tagsRepo; | ||
public TagsController(TagsRepo tagsRepo) { | ||
this.tagsRepo = tagsRepo; | ||
} | ||
|
||
|
||
} |
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,56 @@ | ||
package com.hotdog.entities; | ||
|
||
|
||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotNull; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Entity | ||
@Table(name = "tags") | ||
public class Tags { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private int tag_id; | ||
@NotNull | ||
private String tag_name; | ||
|
||
@ManyToMany(cascade = CascadeType.ALL) | ||
@JoinTable( | ||
name = "post_tags", | ||
joinColumns = {@JoinColumn(name = "tag_id")}, | ||
inverseJoinColumns = {@JoinColumn(name = "post_id")} | ||
) | ||
Set<Posts> posts = new HashSet<>(); | ||
|
||
protected Tags() {} | ||
|
||
public Tags(String tag_name){ | ||
this.tag_name = tag_name; | ||
} | ||
|
||
public int getTag_id() { | ||
return tag_id; | ||
} | ||
|
||
public void setTag_id(int tag_id) { | ||
this.tag_id = tag_id; | ||
} | ||
|
||
public String getTag_name() { | ||
return tag_name; | ||
} | ||
|
||
public void setTag_name(String tag_name) { | ||
this.tag_name = tag_name; | ||
} | ||
|
||
public Set<Posts> getPosts() { | ||
return posts; | ||
} | ||
|
||
public void setPosts(Set<Posts> posts) { | ||
this.posts = posts; | ||
} | ||
} |
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 com.hotdog.repositories; | ||
|
||
import com.hotdog.entities.Posts; | ||
import com.hotdog.entities.Tags; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface TagsRepo extends CrudRepository<Tags, Long> { | ||
|
||
} |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<#import "parts/common.ftlh" as comm> | ||
<#import "parts/navbar.ftlh" as navbar> | ||
|
||
|
||
<@comm.page> | ||
<@navbar.nav/> | ||
<div > | ||
<img src="/img/logo/bg.jpg" style="width: 100% ; opacity: 50%"> | ||
</div> | ||
</@comm.page> |
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