forked from fa/breadcrumb-the-shire
Moves bookmarks from core hardcoding into modules/bookmarks/ as a
fully self-contained module, following the same pattern as addressbook.
Module contributions via platform slots:
- aside.tab_panel: bookmark sidebar panel
- topbar.right_item: bookmark toggle button
- layout.body_end_template: bookmark/group dialogs
- layout.head_style: bookmark CSS (form + sidebar)
- runtime.component: bookmark-save and bookmark-panel (phase: late)
- search.resource_item: bookmarks in global search (user-scoped via {{userId}})
Backend fully in module namespace (MintyPHP\Module\Bookmarks\*):
- Service: BookmarkService, BookmarkServicesFactory, BookmarkRepositoryFactory
- Repository: BookmarkRepository, BookmarkGroupRepository, BookmarkNavigationRepository
- Support: BookmarkUrlNormalizer
- Providers: BookmarksSessionProvider, BookmarksLayoutProvider, BookmarksSearchProvider
Core cleanup:
- Removed all bookmark-specific markup from core templates
- Removed core DI registrations for bookmark services
- Removed core bookmark pages, JS, CSS
- AuthSessionTenantContextService delegates to module SessionProvider
Architecture guards:
- NoBookmarksHardcodingTest: verifies zero bookmark references in core
- testModuleClassesUseModuleNamespace: prevents core namespace leakage
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Module\Bookmarks\Repository;
|
|
|
|
interface BookmarkRepositoryInterface
|
|
{
|
|
/**
|
|
* @param array{limit?: int, offset?: int} $options
|
|
* @return list<array<string, mixed>>
|
|
*/
|
|
public function listByUser(int $userId, array $options = []): array;
|
|
|
|
public function nextBookmarkSortOrder(int $userId, ?int $groupId): int;
|
|
|
|
public function countByUser(int $userId): int;
|
|
|
|
/** @return array<string, mixed>|false */
|
|
public function findById(int $id, int $userId): array|false;
|
|
|
|
/** @return array<string, mixed>|false */
|
|
public function findByUserAndUrl(int $userId, string $url): array|false;
|
|
|
|
public function create(array $data): int|false;
|
|
|
|
public function update(int $id, int $userId, array $data): bool;
|
|
|
|
public function delete(int $id, int $userId): bool;
|
|
|
|
/** @param list<array{id: int, sort_order: int}> $idOrderPairs */
|
|
public function updateSortOrders(int $userId, array $idOrderPairs): bool;
|
|
|
|
/** @return list<array<string, mixed>> */
|
|
public function listByGroup(int $userId, int $groupId): array;
|
|
|
|
public function unsetGroupId(int $bookmarkId, int $userId, int $sortOrder): bool;
|
|
}
|