Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/utils/validator/torrent/forms.go

50 lignes
1.8 KiB
Go
Brut Vue normale Historique

2017-06-29 01:06:30 +02:00
package torrentValidator
// TorrentRequest struct
// Same json name as the constant!
type TorrentRequest struct {
2017-08-02 18:04:44 +02:00
ID uint `validate:"-" form:"-" json:"-"`
2017-07-03 01:47:31 +02:00
Name string `validate:"required" form:"name" json:"name,omitempty"`
Magnet string `json:"magnet,omitempty" form:"magnet"`
Category string `validate:"required" form:"c" json:"c"`
Remake bool `json:"remake,omitempty" form:"remake"`
Description string `json:"desc,omitempty" form:"desc"`
Status int `json:"status,omitempty" form:"status"`
Hidden bool `json:"hidden,omitempty" form:"hidden"`
CaptchaID string `json:"-" form:"captchaID"`
WebsiteLink string `validate:"uri" json:"website_link,omitempty" form:"website_link"`
SubCategory int `json:"sub_category,omitempty" form:"sub_category"`
Languages []string `json:"languages,omitempty" form:"languages"`
2017-06-29 01:06:30 +02:00
2017-07-03 01:47:31 +02:00
Infohash string `json:"hash,omitempty" form:"hash"`
CategoryID int `json:"-" form:"category_id"`
SubCategoryID int `json:"-" form:"subcategory_id"`
2017-06-29 01:06:30 +02:00
Filesize int64 `json:"filesize,omitempty"`
Filepath string `json:"-"`
FileList []uploadedFile `json:"filelist,omitempty"`
Trackers []string `json:"trackers,omitempty"`
Tags string `json:"tags,omitempty" form:"tags"`
2017-06-29 01:06:30 +02:00
}
// UpdateRequest struct
type UpdateRequest struct {
2017-07-02 18:00:12 +02:00
ID uint `json:"id"`
2017-06-29 01:06:30 +02:00
Update TorrentRequest `json:"update"`
}
// Use this, because we seem to avoid using models, and we would need
// the torrent ID to create the File in the DB
type uploadedFile struct {
Path []string `json:"path"`
Filesize int64 `json:"filesize"`
}
// ReassignForm : Structure for reassign Form used by the reassign page
type ReassignForm struct {
AssignTo uint
By string
Data string
Torrents []uint
}