💥 Unified the publisher api

This commit is contained in:
2024-11-09 00:47:19 +08:00
parent f9a01bff70
commit 615fe3ff6c
4 changed files with 19 additions and 12 deletions

View File

@@ -15,6 +15,14 @@ func GetPublisher(id uint, userID uint) (models.Publisher, error) {
return publisher, nil
}
func GetPublisherByName(name string, userID uint) (models.Publisher, error) {
var publisher models.Publisher
if err := database.C.Where("name = ? AND account_id = ?", name, userID).First(&publisher).Error; err != nil {
return publisher, fmt.Errorf("unable to get publisher: %v", err)
}
return publisher, nil
}
func CreatePersonalPublisher(user authm.Account) (models.Publisher, error) {
var publisher models.Publisher
var count int64