Implement FCM
This commit is contained in:
@@ -110,3 +110,17 @@ func (r *UserRepositoryImpl) Count(ctx context.Context, filters map[string]inter
|
||||
err := query.Count(&count).Error
|
||||
return count, err
|
||||
}
|
||||
|
||||
func (r *UserRepositoryImpl) UpdateFcmToken(ctx context.Context, id uuid.UUID, fcmToken string) error {
|
||||
return r.db.WithContext(ctx).Model(&entities.User{}).
|
||||
Where("id = ?", id).
|
||||
Update("fcm_token", fcmToken).Error
|
||||
}
|
||||
|
||||
func (r *UserRepositoryImpl) GetUsersWithFcmTokenByOrganization(ctx context.Context, organizationID uuid.UUID) ([]*entities.User, error) {
|
||||
var users []*entities.User
|
||||
err := r.db.WithContext(ctx).
|
||||
Where("organization_id = ? AND is_active = ? AND fcm_token IS NOT NULL AND fcm_token != ''", organizationID, true).
|
||||
Find(&users).Error
|
||||
return users, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user