make user torrent list display
Cette révision appartient à :
Parent
d0069b6249
révision
1c44a24ab0
3 fichiers modifiés avec 5 ajouts et 4 suppressions
|
@ -27,7 +27,7 @@ type User struct {
|
|||
Md5 string `json:"md5"`
|
||||
TokenExpiration time.Time `gorm:"column:api_token_expiry"`
|
||||
Language string `gorm:"column:language"`
|
||||
Torrents []Torrents `gorm:"ForeignKey:owner_id"`
|
||||
Torrents []Torrents `gorm:"ForeignKey:UploaderId"`
|
||||
}
|
||||
|
||||
type PublicUser struct {
|
||||
|
@ -38,4 +38,4 @@ type PublicUser struct {
|
|||
type UsersFollowers struct {
|
||||
UserID uint `gorm:"column:userId"`
|
||||
FollowerID uint `gorm:"column:follower_id"`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,10 +243,9 @@ func RetrieveUserByUsername(username string) (*model.PublicUser, string, int, er
|
|||
// RetrieveUserForAdmin retrieves a user for an administrator.
|
||||
func RetrieveUserForAdmin(id string) (model.User, int, error) {
|
||||
var user model.User
|
||||
if db.ORM.First(&user, id).RecordNotFound() {
|
||||
if db.ORM.Preload("Torrents").First(&user, id).RecordNotFound() {
|
||||
return user, http.StatusNotFound, errors.New("User is not found.")
|
||||
}
|
||||
db.ORM.Model(&user).Related("Torrents").Find(&model.Torrents{})
|
||||
return user, http.StatusOK, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<th>{{T "links"}}</th>
|
||||
</tr>
|
||||
{{ range .Torrents }}
|
||||
{{ with .ToJson }}
|
||||
<tr class="torrent-info
|
||||
{{if eq .Status 2}}remake{{end}}
|
||||
{{if eq .Status 3}}trusted{{end}}
|
||||
|
@ -38,6 +39,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</table>
|
||||
<nav class="torrentNav" aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
|
|
Référencer dans un nouveau ticket