feat: add PinByID

This commit is contained in:
Derrick Hammer 2024-01-17 17:14:45 -05:00
parent 8ff09b5f02
commit b56a8ba5ac
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 13 additions and 0 deletions

View File

@ -184,3 +184,15 @@ func (s AccountServiceImpl) PinByHash(hash string, accountID uint) error {
return nil
}
func (s AccountServiceImpl) PinByID(uploadId uint, accountID uint) error {
// Create a pin with the retrieved upload ID and matching account ID
pinQuery := models.Pin{UploadID: uploadId, UserID: accountID}
result := s.portal.Database().Create(&pinQuery)
if result.Error != nil {
return result.Error
}
return nil
}

View File

@ -13,4 +13,5 @@ type AccountService interface {
AccountPins(id uint64, createdAfter uint64) ([]models.Pin, error)
DeletePinByHash(hash string, accountID uint) error
PinByHash(hash string, accountID uint) error
PinByID(uploadId uint, accountID uint) error
}