🤔
Cette révision appartient à :
Parent
689b98e82c
révision
9b5515dcb8
2 fichiers modifiés avec 5 ajouts et 8 suppressions
|
@ -10,8 +10,8 @@ type TorrentReport struct {
|
|||
TorrentID uint `gorm:"column:torrent_id"`
|
||||
UserID uint `gorm:"column:user_id"`
|
||||
|
||||
Torrent Torrent `gorm:"AssociationForeignKey:TorrentID;ForeignKey:torrent_id"`
|
||||
User User `gorm:"AssociationForeignKey:UserID;ForeignKey:user_id"`
|
||||
Torrent *Torrent `gorm:"AssociationForeignKey:TorrentID;ForeignKey:torrent_id"`
|
||||
User *User `gorm:"AssociationForeignKey:UserID;ForeignKey:user_id"`
|
||||
}
|
||||
|
||||
type TorrentReportJson struct {
|
||||
|
|
|
@ -79,17 +79,14 @@ func ReportTorrentHandler(w http.ResponseWriter, r *http.Request) {
|
|||
idNum, err := strconv.Atoi(id)
|
||||
userID := currentUser.ID
|
||||
|
||||
//torrent, _ := torrentService.GetTorrentById(id)
|
||||
|
||||
fmt.Println(userID)
|
||||
fmt.Println(currentUser)
|
||||
torrent, _ := torrentService.GetTorrentById(id)
|
||||
|
||||
report := model.TorrentReport{
|
||||
Description: r.FormValue("report_type"),
|
||||
TorrentID: uint(idNum),
|
||||
UserID: userID,
|
||||
//Torrent: torrent,
|
||||
//User: *currentUser,
|
||||
Torrent: &torrent,
|
||||
User: currentUser,
|
||||
}
|
||||
|
||||
err = db.ORM.Create(&report).Error
|
||||
|
|
Référencer dans un nouveau ticket