-
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 #163 from gelecekbilimde/enhancement/category-mana…
…gement GBS-23 | Implemented category management functionalities
- Loading branch information
Showing
23 changed files
with
609 additions
and
322 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...e/scienceplatform/post/util/PostUtil.java → .../scienceplatform/media/util/SlugUtil.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
78 changes: 69 additions & 9 deletions
78
src/main/java/org/gelecekbilimde/scienceplatform/post/controller/CategoryController.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
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
16 changes: 16 additions & 0 deletions
16
.../gelecekbilimde/scienceplatform/post/model/mapper/CategoryToCategoriesResponseMapper.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,16 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.mapper; | ||
|
||
import org.gelecekbilimde.scienceplatform.common.model.mapper.BaseMapper; | ||
import org.gelecekbilimde.scienceplatform.post.model.Category; | ||
import org.gelecekbilimde.scienceplatform.post.model.response.CategoriesResponse; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper | ||
public interface CategoryToCategoriesResponseMapper extends BaseMapper<Category, CategoriesResponse> { | ||
|
||
static CategoryToCategoriesResponseMapper initialize() { | ||
return Mappers.getMapper(CategoryToCategoriesResponseMapper.class); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...org/gelecekbilimde/scienceplatform/post/model/mapper/CategoryToSummaryResponseMapper.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,16 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.mapper; | ||
|
||
import org.gelecekbilimde.scienceplatform.common.model.mapper.BaseMapper; | ||
import org.gelecekbilimde.scienceplatform.post.model.Category; | ||
import org.gelecekbilimde.scienceplatform.post.model.response.CategorySummaryResponse; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper | ||
public interface CategoryToSummaryResponseMapper extends BaseMapper<Category, CategorySummaryResponse> { | ||
|
||
static CategoryToSummaryResponseMapper initialize() { | ||
return Mappers.getMapper(CategoryToSummaryResponseMapper.class); | ||
} | ||
|
||
} |
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
22 changes: 18 additions & 4 deletions
22
...ain/java/org/gelecekbilimde/scienceplatform/post/model/request/CategoryCreateRequest.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 |
---|---|---|
@@ -1,18 +1,32 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Builder; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Positive; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
public class CategoryCreateRequest { | ||
|
||
@NotBlank | ||
@Size(min = 2, max = 50) | ||
private String name; | ||
private Integer order; | ||
private String slug; | ||
|
||
@NotBlank | ||
@Size(min = 2, max = 255) | ||
private String description; | ||
|
||
@NotNull | ||
@Positive | ||
private Integer orderNumber; | ||
|
||
@Size(max = 50) | ||
private String icon; | ||
|
||
@Positive | ||
private Long parentId; | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/gelecekbilimde/scienceplatform/post/model/request/CategoryListRequest.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,23 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import jakarta.validation.constraints.AssertTrue; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.gelecekbilimde.scienceplatform.common.model.request.PagingRequest; | ||
|
||
import java.util.Set; | ||
|
||
@Getter | ||
@Setter | ||
public class CategoryListRequest extends PagingRequest { | ||
|
||
@JsonIgnore | ||
@AssertTrue | ||
@Override | ||
public boolean isOrderPropertyAccepted() { | ||
final Set<String> acceptedFilterFields = Set.of("createdAt"); | ||
return this.isPropertyAccepted(acceptedFilterFields); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...ain/java/org/gelecekbilimde/scienceplatform/post/model/request/CategoryUpdateRequest.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,22 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class CategoryUpdateRequest { | ||
|
||
@NotBlank | ||
@Size(min = 2, max = 50) | ||
private String name; | ||
|
||
@NotBlank | ||
@Size(min = 2, max = 255) | ||
private String description; | ||
|
||
private Long parentId; | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/gelecekbilimde/scienceplatform/post/model/response/CategoriesResponse.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,21 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.response; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter | ||
public class CategoriesResponse { | ||
|
||
private Long id; | ||
private Long parentId; | ||
private String name; | ||
private Long orderNumber; | ||
private String slug; | ||
private String icon; | ||
private String createdBy; | ||
private LocalDateTime createdAt; | ||
|
||
} |
12 changes: 8 additions & 4 deletions
12
src/main/java/org/gelecekbilimde/scienceplatform/post/model/response/CategoryResponse.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 |
---|---|---|
@@ -1,19 +1,23 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.response; | ||
|
||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Builder | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter | ||
public class CategoryResponse { | ||
private Long id; | ||
private String name; | ||
private Long order; | ||
private String description; | ||
private Long orderNumber; | ||
private String slug; | ||
private String icon; | ||
|
||
private Long parentId; | ||
private String createdBy; | ||
private LocalDateTime createdAt; | ||
private String updatedBy; | ||
private LocalDateTime updatedAt; | ||
} |
17 changes: 17 additions & 0 deletions
17
.../java/org/gelecekbilimde/scienceplatform/post/model/response/CategorySummaryResponse.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,17 @@ | ||
package org.gelecekbilimde.scienceplatform.post.model.response; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class CategorySummaryResponse { | ||
|
||
private Long id; | ||
private Long parentId; | ||
private String name; | ||
private Long orderNumber; | ||
private String slug; | ||
private String icon; | ||
|
||
} |
Oops, something went wrong.