Skip to content

Commit

Permalink
feat: implement write review with frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
dujiajun committed Sep 23, 2024
1 parent 5a0a599 commit 53ed299
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions model/converter/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func ConvertReviewFromPO(po po.ReviewPO) model.Review {
IsAnonymous: po.IsAnonymous,
CreatedAt: po.CreatedAt,
UpdatedAt: po.UpdatedAt,
Grade: po.Grade,
}
}

Expand Down Expand Up @@ -56,5 +57,6 @@ func ConvertReviewDTOToPO(dto dto.UpdateReviewDTO, userID int64) po.ReviewPO {
Rating: dto.Rating,
Semester: dto.Semester,
IsAnonymous: dto.IsAnonymous,
Grade: dto.Grade,
}
}
1 change: 1 addition & 0 deletions model/dto/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type UpdateReviewDTO struct {
Comment string `json:"comment" binding:"required"`
Semester string `json:"semester" binding:"required"`
IsAnonymous bool `json:"is_anonymous"`
Grade string `json:"grade"`
}

type CreateReviewResponse struct {
Expand Down
4 changes: 2 additions & 2 deletions model/model/rating.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type RatingInfoDistItemByID struct {
}

type RatingInfoDistItem struct {
Rating int64
Count int64
Rating int64 `json:"rating"`
Count int64 `json:"count"`
}

type RatingInfo struct {
Expand Down
1 change: 1 addition & 0 deletions model/model/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Review struct {
Rating int64 `json:"rating"`
Semester string `json:"semester"`
IsAnonymous bool `json:"is_anonymous"`
Grade string `json:"grade"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
1 change: 1 addition & 0 deletions model/po/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type ReviewPO struct {
Rating int64 `gorm:"index"`
Semester string `gorm:"index"`
IsAnonymous bool
Grade string // 成绩
SearchIndex SearchIndex `gorm:"->:false;<-"`
}

Expand Down

0 comments on commit 53ed299

Please sign in to comment.