-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add IncreaseViewCount, IncreaseLikeCount, FindNextItems API
- Loading branch information
Showing
9 changed files
with
342 additions
and
5 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
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 item_dto | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/team-nerd-planet/api-server/internal/entity" | ||
) | ||
|
||
type FindNextReq struct { | ||
ExcludedIds []int64 `url:"excluded_ids"` // 제외할 글 ID 목록 | ||
Limit int32 `url:"limit" validate:"required"` // 글 목록 개수 제한 | ||
} | ||
|
||
type FindNextRes struct { | ||
ItemID uint `json:"item_id"` // 글 DB ID | ||
ItemTitle string `json:"item_title"` // 글 제목 | ||
ItemDescription string `json:"item_description"` // 글 설명 | ||
ItemLink string `json:"item_link"` // 글 URL | ||
ItemThumbnail *string `json:"item_thumbnail"` // 글 썸네일 | ||
ItemPublished time.Time `json:"item_published"` // 글 개시 시간 | ||
ItemSummary *string `json:"item_summary"` // 글 요약 내용 | ||
ItemViews uint `json:"item_views"` // 조회 수 | ||
ItemLikes uint `json:"item_likes"` // 좋아요 수 | ||
FeedName string `json:"feed_name"` // 회사 이름 | ||
FeedTitle string `json:"feed_title"` // 회사 Feed 제목 | ||
FeedLink string `json:"feed_link"` // 회사 URL | ||
CompanySize entity.CompanySizeType `json:"company_size"` // 회사 규모 | ||
JobTagIDArr []int64 `json:"job_tags_id_arr"` // 관련 직무 DB ID 배열 | ||
SkillTagIDArr []int64 `json:"skill_tags_id_arr"` // 관련 스킬 DB ID 배열 | ||
} | ||
|
||
func NewFindNextRes(itemViews []entity.ItemView) []FindNextRes { | ||
res := make([]FindNextRes, len(itemViews)) | ||
|
||
for i, itemView := range itemViews { | ||
res[i] = FindNextRes{ | ||
ItemID: itemView.ItemID, | ||
ItemTitle: itemView.ItemTitle, | ||
ItemDescription: itemView.ItemDescription, | ||
ItemLink: itemView.ItemLink, | ||
ItemThumbnail: itemView.ItemThumbnail, | ||
ItemPublished: itemView.ItemPublished, | ||
ItemSummary: itemView.ItemSummary, | ||
ItemViews: itemView.ItemViews, | ||
ItemLikes: itemView.ItemLikes, | ||
FeedName: itemView.FeedName, | ||
FeedTitle: itemView.FeedTitle, | ||
FeedLink: itemView.FeedLink, | ||
CompanySize: itemView.CompanySize, | ||
JobTagIDArr: itemView.JobTagIDArr, | ||
SkillTagIDArr: itemView.SkillTagIDArr, | ||
} | ||
} | ||
|
||
return res | ||
} |
9 changes: 9 additions & 0 deletions
9
internal/controller/rest/dto/item_dto/increase_like_count_dto.go
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 item_dto | ||
|
||
type IncreaseLikeCountReq struct { | ||
Id int64 `json:"item_id" binding:"required"` // 좋아요 수를 증가시킬 글의 ID | ||
} | ||
|
||
type IncreaseLikeCountRes struct { | ||
ItemLikeCount int64 `json:"item_like_count"` // 증가된 글의 종아요 수 | ||
} |
9 changes: 9 additions & 0 deletions
9
internal/controller/rest/dto/item_dto/increase_view_count_dto.go
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 item_dto | ||
|
||
type IncreaseViewCountReq struct { | ||
Id int64 `json:"item_id" binding:"required"` // 조회 수를 증가시킬 글의 ID | ||
} | ||
|
||
type IncreaseViewCountRes struct { | ||
ItemViewCount int64 `json:"item_view_count"` // 증가된 글의 조회 수 | ||
} |
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.