Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Revert "autism"

This reverts commit 59b1e2bb5f.
Cette révision appartient à :
ayame-git 2017-05-09 06:14:31 +03:00
Parent 979bb920b4
révision d3fc3f8b7a
2 fichiers modifiés avec 20 ajouts et 20 suppressions

Voir le fichier

@ -20,23 +20,23 @@ type Feed struct {
}
type Torrents struct {
Id uint `gorm:"column:torrent_id;primary_key"`
Name string `gorm:"column:torrent_name"`
Hash string `gorm:"column:torrent_hash"`
Category int `gorm:"column:category_od"`
Sub_Category int `gorm:"column:sub_category_id"`
Status int `gorm:"column:status_id"`
Date time.Time `gorm:"column:date"`
UploaderId uint `gorm:"column:uploader"`
Downloads int `gorm:"column:downloads"`
Stardom int `gorm:"column:stardom"`
Filesize int64 `gorm:"column:filesize"`
Description string `gorm:"column:description"`
WebsiteLink string `gorm:"column:website_link"`
Id uint `gorm:"column:torrent_id;primary_key"`
Name string `gorm:"column:torrent_name"`
Hash string `gorm:"column:torrent_hash"`
Category int `gorm:"column:category"`
Sub_Category int `gorm:"column:sub_category"`
Status int `gorm:"column:status"`
Date time.Time `gorm:"column:date"`
UploaderId uint `gorm:"column:uploader"`
Downloads int `gorm:"column:downloads"`
Stardom int `gorm:"column:stardom"`
Filesize int64 `gorm:"column:filesize"`
Description string `gorm:"column:description"`
WebsiteLink string `gorm:"column:website_link"`
Uploader *User `gorm:"ForeignKey:uploader"`
OldComments []OldComment `gorm:"ForeignKey:torrent_id"`
Comments []Comment `gorm:"ForeignKey:torrent_id"`
Uploader *User `gorm:"ForeignKey:uploader"`
OldComments []OldComment `gorm:"ForeignKey:torrent_id"`
Comments []Comment `gorm:"ForeignKey:torrent_id"`
}
/* We need JSON Object instead because of Magnet URL that is not in the database but generated dynamically */

Voir le fichier

@ -79,11 +79,11 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
parameters := torrentService.WhereParams{}
conditions := []string{}
if searchCatId != "" {
conditions = append(conditions, "category_id = ?")
conditions = append(conditions, "category = ?")
parameters.Params = append(parameters.Params, searchCatId)
}
if searchSubCatId != "" {
conditions = append(conditions, "sub_category_id = ?")
conditions = append(conditions, "sub_category = ?")
parameters.Params = append(parameters.Params, searchSubCatId)
}
if userId != "" {
@ -92,9 +92,9 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
}
if search_param.Status != "" {
if search_param.Status == "2" {
conditions = append(conditions, "status_id != ?")
conditions = append(conditions, "status != ?")
} else {
conditions = append(conditions, "status_id = ?")
conditions = append(conditions, "status = ?")
}
parameters.Params = append(parameters.Params, search_param.Status)
}