File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/Migration/Destinations Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1745,8 +1745,13 @@ protected function importUserTargets(string $userId, array $targets): void
17451745 case 'push ' :
17461746 $ userDoc ??= $ this ->dbForProject ->getDocument ('users ' , $ userId );
17471747
1748+ $ createdAt = $ this ->normalizeDateTime ($ target ['$createdAt ' ] ?? null );
1749+ $ updatedAt = $ this ->normalizeDateTime ($ target ['$updatedAt ' ] ?? null , $ createdAt );
1750+
17481751 $ this ->dbForProject ->createDocument ('targets ' , new UtopiaDocument ([
17491752 '$id ' => $ target ['$id ' ],
1753+ '$createdAt ' => $ createdAt ,
1754+ '$updatedAt ' => $ updatedAt ,
17501755 '$permissions ' => [
17511756 Permission::read (Role::user ($ userId )),
17521757 Permission::update (Role::user ($ userId )),
@@ -1901,9 +1906,16 @@ protected function createProvider(Provider $resource): void
19011906 Query::isNull ('providerInternalId ' ),
19021907 ]);
19031908
1909+ $ userIds = [];
1910+
19041911 foreach ($ targets as $ target ) {
19051912 $ target ->setAttribute ('providerInternalId ' , $ provider ->getSequence ());
19061913 $ this ->dbForProject ->updateDocument ('targets ' , $ target ->getId (), $ target );
1914+ $ userIds [$ target ->getAttribute ('userId ' )] = true ;
1915+ }
1916+
1917+ foreach (array_keys ($ userIds ) as $ userId ) {
1918+ $ this ->dbForProject ->purgeCachedDocument ('users ' , $ userId );
19071919 }
19081920 }
19091921
You can’t perform that action at this time.
0 commit comments