fixed dup renchon on report
Cette révision appartient à :
Parent
cf601d1e52
révision
6198c4a618
2 fichiers modifiés avec 7 ajouts et 5 suppressions
|
@ -11,7 +11,7 @@ type TorrentReport struct {
|
|||
UserID uint `gorm:"column:user_id"`
|
||||
|
||||
Torrent Torrent `gorm:"AssociationForeignKey:TorrentID;ForeignKey:torrent_id"`
|
||||
User User `gorm:"AssociationForeignKey:UserID;ForeignKey:ID"`
|
||||
User User `gorm:"AssociationForeignKey:UserID;ForeignKey:user_id"`
|
||||
}
|
||||
|
||||
type TorrentReportJson struct {
|
||||
|
|
|
@ -79,16 +79,18 @@ func ReportTorrentHandler(w http.ResponseWriter, r *http.Request) {
|
|||
idNum, err := strconv.Atoi(id)
|
||||
userID := currentUser.ID
|
||||
|
||||
torrent, _ := torrentService.GetTorrentById(id)
|
||||
//torrent, _ := torrentService.GetTorrentById(id)
|
||||
|
||||
fmt.Println(userID)
|
||||
fmt.Println(currentUser)
|
||||
|
||||
report := model.TorrentReport{
|
||||
Description: r.FormValue("report_type"),
|
||||
TorrentID: uint(idNum),
|
||||
UserID: userID,
|
||||
Torrent: torrent,
|
||||
User: *currentUser,
|
||||
//Torrent: torrent,
|
||||
//User: *currentUser,
|
||||
}
|
||||
fmt.Println(report)
|
||||
|
||||
err = db.ORM.Create(&report).Error
|
||||
if err != nil {
|
||||
|
|
Référencer dans un nouveau ticket