Update CollectionService

This commit is contained in:
Daniel Supernault 2022-10-01 00:07:28 -06:00
parent c40b2f091f
commit 3bf792072a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 15 additions and 4 deletions

View file

@ -2648,6 +2648,9 @@ class ApiV1Controller extends Controller
$status->id,
$count
);
$collection->updated_at = now();
$collection->save();
CollectionService::setCollection($collection->id, $collection);
});
}

View file

@ -168,6 +168,10 @@ class CollectionController extends Controller
$count
);
$collection->updated_at = now();
$collection->save();
CollectionService::setCollection($collection->id, $collection);
return StatusService::get($status->id);
}
@ -305,6 +309,10 @@ class CollectionController extends Controller
$item->delete();
$collection->updated_at = now();
$collection->save();
CollectionService::setCollection($collection->id, $collection);
return 200;
}
}

View file

@ -84,8 +84,8 @@ class CollectionService
'description' => $collection->description,
'thumb' => url('/storage/no-preview.png'),
'url' => $collection->url(),
'updated_at' => $collection->updated_at,
'published_at' => $collection->published_at,
'updated_at' => str_replace('+00:00', 'Z', $collection->updated_at->format(DATE_RFC3339_EXTENDED)),
'published_at' => str_replace('+00:00', 'Z', $collection->published_at->format(DATE_RFC3339_EXTENDED)),
];
});
@ -117,8 +117,8 @@ class CollectionService
'description' => $collection->description,
'thumb' => self::getThumb($id),
'url' => $collection->url(),
'updated_at' => $collection->updated_at,
'published_at' => $collection->published_at
'updated_at' => str_replace('+00:00', 'Z', $collection->updated_at->format(DATE_RFC3339_EXTENDED)),
'published_at' => str_replace('+00:00', 'Z', $collection->published_at->format(DATE_RFC3339_EXTENDED)),
];
Cache::put(self::CACHE_KEY . 'get:' . $id, $res, 86400);
$res['post_count'] = self::count($id);