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/models/tag/create.go

20 lignes
429 o
Go
Brut Vue normale Historique

2017-07-29 15:20:57 +02:00
package tags
import "github.com/NyaaPantsu/nyaa/models"
func Create(tag string, tagType string, torrent *models.Torrent, user *models.User) (*models.Tag, error) {
newTag := &models.Tag{
Tag: tag,
Type: tagType,
TorrentID: torrent.ID,
UserID: user.ID,
Weight: user.Pantsu,
Accepted: false,
}
if err := models.ORM.Create(newTag).Error; err != nil {
return newTag, err
}
return newTag, nil
}