Take int instead of int64

This commit is contained in:
nemunaire 2023-03-05 03:57:37 +01:00
parent e57b7a7089
commit 91aee60bfb
2 changed files with 8 additions and 8 deletions

View file

@ -228,7 +228,7 @@ func workHandler(c *gin.Context) {
if wid, err := strconv.Atoi(string(c.Param("wid"))); err != nil {
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Bad work identifier."})
return
} else if work, err := getWork(wid); err != nil {
} else if work, err := getWork(int64(wid)); err != nil {
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Work not found."})
return
} else {
@ -331,7 +331,7 @@ func getWorks(cnd string, param ...interface{}) (items []*Work, err error) {
}
}
func getWork(id int) (w *Work, err error) {
func getWork(id int64) (w *Work, err error) {
w = new(Work)
err = DBQueryRow("SELECT id_work, id_category, title, promo, grp, shown, description, tag, submission_url, gradation_repo, corrected, start_availability, end_availability FROM works WHERE id_work=?", id).Scan(&w.Id, &w.IdCategory, &w.Title, &w.Promo, &w.Group, &w.Shown, &w.DescriptionRaw, &w.Tag, &w.SubmissionURL, &w.GradationRepo, &w.Corrected, &w.StartAvailability, &w.EndAvailability)
w.Description = string(blackfriday.Run([]byte(w.DescriptionRaw)))