diff --git a/account/account.go b/account/account.go index 917d62d..0d02e42 100644 --- a/account/account.go +++ b/account/account.go @@ -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 +} diff --git a/interfaces/account.go b/interfaces/account.go index 66304f0..769856d 100644 --- a/interfaces/account.go +++ b/interfaces/account.go @@ -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 }