Skip to content

Commit 2e54d4d

Browse files
committed
Increment topic subscriber totals after direct DB write
1 parent 3f5934e commit 2e54d4d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Migration/Destinations/Appwrite.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,15 @@ protected function createSubscriber(Subscriber $resource): void
19421942
$resource->getProviderType(),
19431943
]),
19441944
]));
1945+
1946+
$totalAttribute = match ($resource->getProviderType()) {
1947+
'email' => 'emailTotal',
1948+
'sms' => 'smsTotal',
1949+
'push' => 'pushTotal',
1950+
default => throw new \Exception('Unknown provider type: ' . $resource->getProviderType()),
1951+
};
1952+
1953+
$this->database->increaseDocumentAttribute('topics', $resource->getTopicId(), $totalAttribute);
19451954
}
19461955

19471956
/**

0 commit comments

Comments
 (0)