detached 2ae1fc7

refactor(favorites): remove folder contracts

commit
2ae1fc75ab94794b0a7d0215211e372d4fac229d
author
brice · · 2026-06-28 07:04 UTC
parent
eb3068f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
9 files · +64 -922
M .mockery.yaml +0 -1
@@ -152,7 +152,6 @@ packages:
152152 interfaces:
153153 ContentWhitelistRepository: {}
154154 FavoriteRepository: {}
155- FolderRepository: {}
156155 HistoryRepository: {}
157156 SessionRepository: {}
158157 SessionStateRepository: {}
@@ -152,7 +152,6 @@ packages:
152 interfaces:152 interfaces:
153 ContentWhitelistRepository: {}153 ContentWhitelistRepository: {}
154 FavoriteRepository: {}154 FavoriteRepository: {}
155- FolderRepository: {}
156 HistoryRepository: {}155 HistoryRepository: {}
157 SessionRepository: {}156 SessionRepository: {}
158 SessionStateRepository: {}157 SessionStateRepository: {}
M internal/application/dto/favorites.go +4 -6
@@ -4,11 +4,10 @@ import "github.com/bnema/dumber/internal/domain/entity"
44
55 // FavoriteCreateInput contains fields needed to create a favorite from a UI port.
66 type FavoriteCreateInput struct {
7- URL string `json:"url"`
8- Title string `json:"title"`
9- FaviconURL string `json:"favicon_url"`
10- FolderID *entity.FolderID `json:"folder_id"`
11- Tags []entity.TagID `json:"tags"`
7+ URL string `json:"url"`
8+ Title string `json:"title"`
9+ FaviconURL string `json:"favicon_url"`
10+ Tags []entity.TagID `json:"tags"`
1211 }
1312
1413 // FavoriteUpdateInput contains editable favorite metadata.
@@ -16,6 +15,5 @@ type FavoriteUpdateInput struct {
1615 ID entity.FavoriteID `json:"id"`
1716 Title string `json:"title"`
1817 FaviconURL string `json:"favicon_url"`
19- FolderID *entity.FolderID `json:"folder_id"`
2018 ShortcutKey *int `json:"shortcut_key"`
2119 }
@@ -4,11 +4,10 @@ import "github.com/bnema/dumber/internal/domain/entity"
4 4
5 // FavoriteCreateInput contains fields needed to create a favorite from a UI port.5 // FavoriteCreateInput contains fields needed to create a favorite from a UI port.
6 type FavoriteCreateInput struct {6 type FavoriteCreateInput struct {
7- URL string `json:"url"`7+ URL string `json:"url"`
8- Title string `json:"title"`8+ Title string `json:"title"`
9- FaviconURL string `json:"favicon_url"`9+ FaviconURL string `json:"favicon_url"`
10- FolderID *entity.FolderID `json:"folder_id"`10+ Tags []entity.TagID `json:"tags"`
11- Tags []entity.TagID `json:"tags"`
12 }11 }
13 12
14 // FavoriteUpdateInput contains editable favorite metadata.13 // FavoriteUpdateInput contains editable favorite metadata.
@@ -16,6 +15,5 @@ type FavoriteUpdateInput struct {
16 ID entity.FavoriteID `json:"id"`15 ID entity.FavoriteID `json:"id"`
17 Title string `json:"title"`16 Title string `json:"title"`
18 FaviconURL string `json:"favicon_url"`17 FaviconURL string `json:"favicon_url"`
19- FolderID *entity.FolderID `json:"folder_id"`
20 ShortcutKey *int `json:"shortcut_key"`18 ShortcutKey *int `json:"shortcut_key"`
21 }19 }
M internal/application/port/homepage.go +1 -7
@@ -24,8 +24,7 @@ type HomepageHistory interface {
2424 DeleteByDomain(ctx context.Context, domain string) error
2525 }
2626
27-// HomepageFavorites provides favorites/folders/tags operations
28-// needed by the WebUI homepage handlers.
27+// HomepageFavorites provides favorite and tag operations needed by the WebUI homepage handlers.
2928 type HomepageFavorites interface {
3029 GetAll(ctx context.Context) ([]*entity.Favorite, error)
3130 AddFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)
@@ -33,11 +32,6 @@ type HomepageFavorites interface {
3332 DeleteFavorite(ctx context.Context, id entity.FavoriteID) error
3433 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
3534 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
36- Move(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error
37- GetAllFolders(ctx context.Context) ([]*entity.Folder, error)
38- CreateFolder(ctx context.Context, name, icon string, parentID *entity.FolderID) (*entity.Folder, error)
39- DeleteFolder(ctx context.Context, id entity.FolderID) error
40- UpdateFolder(ctx context.Context, id entity.FolderID, name, icon string) error
4135 GetAllTags(ctx context.Context) ([]*entity.Tag, error)
4236 AddTag(ctx context.Context, name, color string) (*entity.Tag, error)
4337 DeleteTag(ctx context.Context, id entity.TagID) error
@@ -24,8 +24,7 @@ type HomepageHistory interface {
24 DeleteByDomain(ctx context.Context, domain string) error24 DeleteByDomain(ctx context.Context, domain string) error
25 }25 }
26 26
27-// HomepageFavorites provides favorites/folders/tags operations27+// HomepageFavorites provides favorite and tag operations needed by the WebUI homepage handlers.
28-// needed by the WebUI homepage handlers.
29 type HomepageFavorites interface {28 type HomepageFavorites interface {
30 GetAll(ctx context.Context) ([]*entity.Favorite, error)29 GetAll(ctx context.Context) ([]*entity.Favorite, error)
31 AddFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)30 AddFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)
@@ -33,11 +32,6 @@ type HomepageFavorites interface {
33 DeleteFavorite(ctx context.Context, id entity.FavoriteID) error32 DeleteFavorite(ctx context.Context, id entity.FavoriteID) error
34 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error33 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
35 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)34 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
36- Move(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error
37- GetAllFolders(ctx context.Context) ([]*entity.Folder, error)
38- CreateFolder(ctx context.Context, name, icon string, parentID *entity.FolderID) (*entity.Folder, error)
39- DeleteFolder(ctx context.Context, id entity.FolderID) error
40- UpdateFolder(ctx context.Context, id entity.FolderID, name, icon string) error
41 GetAllTags(ctx context.Context) ([]*entity.Tag, error)35 GetAllTags(ctx context.Context) ([]*entity.Tag, error)
42 AddTag(ctx context.Context, name, color string) (*entity.Tag, error)36 AddTag(ctx context.Context, name, color string) (*entity.Tag, error)
43 DeleteTag(ctx context.Context, id entity.TagID) error37 DeleteTag(ctx context.Context, id entity.TagID) error
M internal/application/port/mocks/homepage.go +0 -331
@@ -982,86 +982,6 @@ func (_c *MockHomepageFavorites_AddTag_Call) RunAndReturn(run func(ctx context.C
982982 return _c
983983 }
984984
985-// CreateFolder provides a mock function for the type MockHomepageFavorites
986-func (_mock *MockHomepageFavorites) CreateFolder(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error) {
987- ret := _mock.Called(ctx, name, icon, parentID)
988-
989- if len(ret) == 0 {
990- panic("no return value specified for CreateFolder")
991- }
992-
993- var r0 *entity.Folder
994- var r1 error
995- if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) (*entity.Folder, error)); ok {
996- return returnFunc(ctx, name, icon, parentID)
997- }
998- if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) *entity.Folder); ok {
999- r0 = returnFunc(ctx, name, icon, parentID)
1000- } else {
1001- if ret.Get(0) != nil {
1002- r0 = ret.Get(0).(*entity.Folder)
1003- }
1004- }
1005- if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, *entity.FolderID) error); ok {
1006- r1 = returnFunc(ctx, name, icon, parentID)
1007- } else {
1008- r1 = ret.Error(1)
1009- }
1010- return r0, r1
1011-}
1012-
1013-// MockHomepageFavorites_CreateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolder'
1014-type MockHomepageFavorites_CreateFolder_Call struct {
1015- *mock.Call
1016-}
1017-
1018-// CreateFolder is a helper method to define mock.On call
1019-// - ctx context.Context
1020-// - name string
1021-// - icon string
1022-// - parentID *entity.FolderID
1023-func (_e *MockHomepageFavorites_Expecter) CreateFolder(ctx any, name any, icon any, parentID any) *MockHomepageFavorites_CreateFolder_Call {
1024- return &MockHomepageFavorites_CreateFolder_Call{Call: _e.mock.On("CreateFolder", ctx, name, icon, parentID)}
1025-}
1026-
1027-func (_c *MockHomepageFavorites_CreateFolder_Call) Run(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID)) *MockHomepageFavorites_CreateFolder_Call {
1028- _c.Call.Run(func(args mock.Arguments) {
1029- var arg0 context.Context
1030- if args[0] != nil {
1031- arg0 = args[0].(context.Context)
1032- }
1033- var arg1 string
1034- if args[1] != nil {
1035- arg1 = args[1].(string)
1036- }
1037- var arg2 string
1038- if args[2] != nil {
1039- arg2 = args[2].(string)
1040- }
1041- var arg3 *entity.FolderID
1042- if args[3] != nil {
1043- arg3 = args[3].(*entity.FolderID)
1044- }
1045- run(
1046- arg0,
1047- arg1,
1048- arg2,
1049- arg3,
1050- )
1051- })
1052- return _c
1053-}
1054-
1055-func (_c *MockHomepageFavorites_CreateFolder_Call) Return(folder *entity.Folder, err error) *MockHomepageFavorites_CreateFolder_Call {
1056- _c.Call.Return(folder, err)
1057- return _c
1058-}
1059-
1060-func (_c *MockHomepageFavorites_CreateFolder_Call) RunAndReturn(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error)) *MockHomepageFavorites_CreateFolder_Call {
1061- _c.Call.Return(run)
1062- return _c
1063-}
1064-
1065985 // DeleteFavorite provides a mock function for the type MockHomepageFavorites
1066986 func (_mock *MockHomepageFavorites) DeleteFavorite(ctx context.Context, id entity.FavoriteID) error {
1067987 ret := _mock.Called(ctx, id)
@@ -1119,63 +1039,6 @@ func (_c *MockHomepageFavorites_DeleteFavorite_Call) RunAndReturn(run func(ctx c
11191039 return _c
11201040 }
11211041
1122-// DeleteFolder provides a mock function for the type MockHomepageFavorites
1123-func (_mock *MockHomepageFavorites) DeleteFolder(ctx context.Context, id entity.FolderID) error {
1124- ret := _mock.Called(ctx, id)
1125-
1126- if len(ret) == 0 {
1127- panic("no return value specified for DeleteFolder")
1128- }
1129-
1130- var r0 error
1131- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
1132- r0 = returnFunc(ctx, id)
1133- } else {
1134- r0 = ret.Error(0)
1135- }
1136- return r0
1137-}
1138-
1139-// MockHomepageFavorites_DeleteFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFolder'
1140-type MockHomepageFavorites_DeleteFolder_Call struct {
1141- *mock.Call
1142-}
1143-
1144-// DeleteFolder is a helper method to define mock.On call
1145-// - ctx context.Context
1146-// - id entity.FolderID
1147-func (_e *MockHomepageFavorites_Expecter) DeleteFolder(ctx any, id any) *MockHomepageFavorites_DeleteFolder_Call {
1148- return &MockHomepageFavorites_DeleteFolder_Call{Call: _e.mock.On("DeleteFolder", ctx, id)}
1149-}
1150-
1151-func (_c *MockHomepageFavorites_DeleteFolder_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockHomepageFavorites_DeleteFolder_Call {
1152- _c.Call.Run(func(args mock.Arguments) {
1153- var arg0 context.Context
1154- if args[0] != nil {
1155- arg0 = args[0].(context.Context)
1156- }
1157- var arg1 entity.FolderID
1158- if args[1] != nil {
1159- arg1 = args[1].(entity.FolderID)
1160- }
1161- run(
1162- arg0,
1163- arg1,
1164- )
1165- })
1166- return _c
1167-}
1168-
1169-func (_c *MockHomepageFavorites_DeleteFolder_Call) Return(err error) *MockHomepageFavorites_DeleteFolder_Call {
1170- _c.Call.Return(err)
1171- return _c
1172-}
1173-
1174-func (_c *MockHomepageFavorites_DeleteFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockHomepageFavorites_DeleteFolder_Call {
1175- _c.Call.Return(run)
1176- return _c
1177-}
1178-
11791042 // DeleteTag provides a mock function for the type MockHomepageFavorites
11801043 func (_mock *MockHomepageFavorites) DeleteTag(ctx context.Context, id entity.TagID) error {
11811044 ret := _mock.Called(ctx, id)
@@ -1295,68 +1158,6 @@ func (_c *MockHomepageFavorites_GetAll_Call) RunAndReturn(run func(ctx context.C
12951158 return _c
12961159 }
12971160
1298-// GetAllFolders provides a mock function for the type MockHomepageFavorites
1299-func (_mock *MockHomepageFavorites) GetAllFolders(ctx context.Context) ([]*entity.Folder, error) {
1300- ret := _mock.Called(ctx)
1301-
1302- if len(ret) == 0 {
1303- panic("no return value specified for GetAllFolders")
1304- }
1305-
1306- var r0 []*entity.Folder
1307- var r1 error
1308- if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
1309- return returnFunc(ctx)
1310- }
1311- if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
1312- r0 = returnFunc(ctx)
1313- } else {
1314- if ret.Get(0) != nil {
1315- r0 = ret.Get(0).([]*entity.Folder)
1316- }
1317- }
1318- if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1319- r1 = returnFunc(ctx)
1320- } else {
1321- r1 = ret.Error(1)
1322- }
1323- return r0, r1
1324-}
1325-
1326-// MockHomepageFavorites_GetAllFolders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllFolders'
1327-type MockHomepageFavorites_GetAllFolders_Call struct {
1328- *mock.Call
1329-}
1330-
1331-// GetAllFolders is a helper method to define mock.On call
1332-// - ctx context.Context
1333-func (_e *MockHomepageFavorites_Expecter) GetAllFolders(ctx any) *MockHomepageFavorites_GetAllFolders_Call {
1334- return &MockHomepageFavorites_GetAllFolders_Call{Call: _e.mock.On("GetAllFolders", ctx)}
1335-}
1336-
1337-func (_c *MockHomepageFavorites_GetAllFolders_Call) Run(run func(ctx context.Context)) *MockHomepageFavorites_GetAllFolders_Call {
1338- _c.Call.Run(func(args mock.Arguments) {
1339- var arg0 context.Context
1340- if args[0] != nil {
1341- arg0 = args[0].(context.Context)
1342- }
1343- run(
1344- arg0,
1345- )
1346- })
1347- return _c
1348-}
1349-
1350-func (_c *MockHomepageFavorites_GetAllFolders_Call) Return(folders []*entity.Folder, err error) *MockHomepageFavorites_GetAllFolders_Call {
1351- _c.Call.Return(folders, err)
1352- return _c
1353-}
1354-
1355-func (_c *MockHomepageFavorites_GetAllFolders_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockHomepageFavorites_GetAllFolders_Call {
1356- _c.Call.Return(run)
1357- return _c
1358-}
1359-
13601161 // GetAllTags provides a mock function for the type MockHomepageFavorites
13611162 func (_mock *MockHomepageFavorites) GetAllTags(ctx context.Context) ([]*entity.Tag, error) {
13621163 ret := _mock.Called(ctx)
@@ -1487,69 +1288,6 @@ func (_c *MockHomepageFavorites_GetByShortcut_Call) RunAndReturn(run func(ctx co
14871288 return _c
14881289 }
14891290
1490-// Move provides a mock function for the type MockHomepageFavorites
1491-func (_mock *MockHomepageFavorites) Move(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
1492- ret := _mock.Called(ctx, id, folderID)
1493-
1494- if len(ret) == 0 {
1495- panic("no return value specified for Move")
1496- }
1497-
1498- var r0 error
1499- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
1500- r0 = returnFunc(ctx, id, folderID)
1501- } else {
1502- r0 = ret.Error(0)
1503- }
1504- return r0
1505-}
1506-
1507-// MockHomepageFavorites_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move'
1508-type MockHomepageFavorites_Move_Call struct {
1509- *mock.Call
1510-}
1511-
1512-// Move is a helper method to define mock.On call
1513-// - ctx context.Context
1514-// - id entity.FavoriteID
1515-// - folderID *entity.FolderID
1516-func (_e *MockHomepageFavorites_Expecter) Move(ctx any, id any, folderID any) *MockHomepageFavorites_Move_Call {
1517- return &MockHomepageFavorites_Move_Call{Call: _e.mock.On("Move", ctx, id, folderID)}
1518-}
1519-
1520-func (_c *MockHomepageFavorites_Move_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockHomepageFavorites_Move_Call {
1521- _c.Call.Run(func(args mock.Arguments) {
1522- var arg0 context.Context
1523- if args[0] != nil {
1524- arg0 = args[0].(context.Context)
1525- }
1526- var arg1 entity.FavoriteID
1527- if args[1] != nil {
1528- arg1 = args[1].(entity.FavoriteID)
1529- }
1530- var arg2 *entity.FolderID
1531- if args[2] != nil {
1532- arg2 = args[2].(*entity.FolderID)
1533- }
1534- run(
1535- arg0,
1536- arg1,
1537- arg2,
1538- )
1539- })
1540- return _c
1541-}
1542-
1543-func (_c *MockHomepageFavorites_Move_Call) Return(err error) *MockHomepageFavorites_Move_Call {
1544- _c.Call.Return(err)
1545- return _c
1546-}
1547-
1548-func (_c *MockHomepageFavorites_Move_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockHomepageFavorites_Move_Call {
1549- _c.Call.Return(run)
1550- return _c
1551-}
1552-
15531291 // SetShortcut provides a mock function for the type MockHomepageFavorites
15541292 func (_mock *MockHomepageFavorites) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
15551293 ret := _mock.Called(ctx, id, key)
@@ -1807,75 +1545,6 @@ func (_c *MockHomepageFavorites_UpdateFavorite_Call) RunAndReturn(run func(ctx c
18071545 return _c
18081546 }
18091547
1810-// UpdateFolder provides a mock function for the type MockHomepageFavorites
1811-func (_mock *MockHomepageFavorites) UpdateFolder(ctx context.Context, id entity.FolderID, name string, icon string) error {
1812- ret := _mock.Called(ctx, id, name, icon)
1813-
1814- if len(ret) == 0 {
1815- panic("no return value specified for UpdateFolder")
1816- }
1817-
1818- var r0 error
1819- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, string, string) error); ok {
1820- r0 = returnFunc(ctx, id, name, icon)
1821- } else {
1822- r0 = ret.Error(0)
1823- }
1824- return r0
1825-}
1826-
1827-// MockHomepageFavorites_UpdateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFolder'
1828-type MockHomepageFavorites_UpdateFolder_Call struct {
1829- *mock.Call
1830-}
1831-
1832-// UpdateFolder is a helper method to define mock.On call
1833-// - ctx context.Context
1834-// - id entity.FolderID
1835-// - name string
1836-// - icon string
1837-func (_e *MockHomepageFavorites_Expecter) UpdateFolder(ctx any, id any, name any, icon any) *MockHomepageFavorites_UpdateFolder_Call {
1838- return &MockHomepageFavorites_UpdateFolder_Call{Call: _e.mock.On("UpdateFolder", ctx, id, name, icon)}
1839-}
1840-
1841-func (_c *MockHomepageFavorites_UpdateFolder_Call) Run(run func(ctx context.Context, id entity.FolderID, name string, icon string)) *MockHomepageFavorites_UpdateFolder_Call {
1842- _c.Call.Run(func(args mock.Arguments) {
1843- var arg0 context.Context
1844- if args[0] != nil {
1845- arg0 = args[0].(context.Context)
1846- }
1847- var arg1 entity.FolderID
1848- if args[1] != nil {
1849- arg1 = args[1].(entity.FolderID)
1850- }
1851- var arg2 string
1852- if args[2] != nil {
1853- arg2 = args[2].(string)
1854- }
1855- var arg3 string
1856- if args[3] != nil {
1857- arg3 = args[3].(string)
1858- }
1859- run(
1860- arg0,
1861- arg1,
1862- arg2,
1863- arg3,
1864- )
1865- })
1866- return _c
1867-}
1868-
1869-func (_c *MockHomepageFavorites_UpdateFolder_Call) Return(err error) *MockHomepageFavorites_UpdateFolder_Call {
1870- _c.Call.Return(err)
1871- return _c
1872-}
1873-
1874-func (_c *MockHomepageFavorites_UpdateFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, name string, icon string) error) *MockHomepageFavorites_UpdateFolder_Call {
1875- _c.Call.Return(run)
1876- return _c
1877-}
1878-
18791548 // UpdateTag provides a mock function for the type MockHomepageFavorites
18801549 func (_mock *MockHomepageFavorites) UpdateTag(ctx context.Context, id entity.TagID, name string, color string) error {
18811550 ret := _mock.Called(ctx, id, name, color)
@@ -982,86 +982,6 @@ func (_c *MockHomepageFavorites_AddTag_Call) RunAndReturn(run func(ctx context.C
982 return _c982 return _c
983 }983 }
984 984
985-// CreateFolder provides a mock function for the type MockHomepageFavorites
986-func (_mock *MockHomepageFavorites) CreateFolder(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error) {
987- ret := _mock.Called(ctx, name, icon, parentID)
988-
989- if len(ret) == 0 {
990- panic("no return value specified for CreateFolder")
991- }
992-
993- var r0 *entity.Folder
994- var r1 error
995- if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) (*entity.Folder, error)); ok {
996- return returnFunc(ctx, name, icon, parentID)
997- }
998- if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) *entity.Folder); ok {
999- r0 = returnFunc(ctx, name, icon, parentID)
1000- } else {
1001- if ret.Get(0) != nil {
1002- r0 = ret.Get(0).(*entity.Folder)
1003- }
1004- }
1005- if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, *entity.FolderID) error); ok {
1006- r1 = returnFunc(ctx, name, icon, parentID)
1007- } else {
1008- r1 = ret.Error(1)
1009- }
1010- return r0, r1
1011-}
1012-
1013-// MockHomepageFavorites_CreateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolder'
1014-type MockHomepageFavorites_CreateFolder_Call struct {
1015- *mock.Call
1016-}
1017-
1018-// CreateFolder is a helper method to define mock.On call
1019-// - ctx context.Context
1020-// - name string
1021-// - icon string
1022-// - parentID *entity.FolderID
1023-func (_e *MockHomepageFavorites_Expecter) CreateFolder(ctx any, name any, icon any, parentID any) *MockHomepageFavorites_CreateFolder_Call {
1024- return &MockHomepageFavorites_CreateFolder_Call{Call: _e.mock.On("CreateFolder", ctx, name, icon, parentID)}
1025-}
1026-
1027-func (_c *MockHomepageFavorites_CreateFolder_Call) Run(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID)) *MockHomepageFavorites_CreateFolder_Call {
1028- _c.Call.Run(func(args mock.Arguments) {
1029- var arg0 context.Context
1030- if args[0] != nil {
1031- arg0 = args[0].(context.Context)
1032- }
1033- var arg1 string
1034- if args[1] != nil {
1035- arg1 = args[1].(string)
1036- }
1037- var arg2 string
1038- if args[2] != nil {
1039- arg2 = args[2].(string)
1040- }
1041- var arg3 *entity.FolderID
1042- if args[3] != nil {
1043- arg3 = args[3].(*entity.FolderID)
1044- }
1045- run(
1046- arg0,
1047- arg1,
1048- arg2,
1049- arg3,
1050- )
1051- })
1052- return _c
1053-}
1054-
1055-func (_c *MockHomepageFavorites_CreateFolder_Call) Return(folder *entity.Folder, err error) *MockHomepageFavorites_CreateFolder_Call {
1056- _c.Call.Return(folder, err)
1057- return _c
1058-}
1059-
1060-func (_c *MockHomepageFavorites_CreateFolder_Call) RunAndReturn(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error)) *MockHomepageFavorites_CreateFolder_Call {
1061- _c.Call.Return(run)
1062- return _c
1063-}
1064-
1065 // DeleteFavorite provides a mock function for the type MockHomepageFavorites985 // DeleteFavorite provides a mock function for the type MockHomepageFavorites
1066 func (_mock *MockHomepageFavorites) DeleteFavorite(ctx context.Context, id entity.FavoriteID) error {986 func (_mock *MockHomepageFavorites) DeleteFavorite(ctx context.Context, id entity.FavoriteID) error {
1067 ret := _mock.Called(ctx, id)987 ret := _mock.Called(ctx, id)
@@ -1119,63 +1039,6 @@ func (_c *MockHomepageFavorites_DeleteFavorite_Call) RunAndReturn(run func(ctx c
1119 return _c1039 return _c
1120 }1040 }
1121 1041
1122-// DeleteFolder provides a mock function for the type MockHomepageFavorites
1123-func (_mock *MockHomepageFavorites) DeleteFolder(ctx context.Context, id entity.FolderID) error {
1124- ret := _mock.Called(ctx, id)
1125-
1126- if len(ret) == 0 {
1127- panic("no return value specified for DeleteFolder")
1128- }
1129-
1130- var r0 error
1131- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
1132- r0 = returnFunc(ctx, id)
1133- } else {
1134- r0 = ret.Error(0)
1135- }
1136- return r0
1137-}
1138-
1139-// MockHomepageFavorites_DeleteFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFolder'
1140-type MockHomepageFavorites_DeleteFolder_Call struct {
1141- *mock.Call
1142-}
1143-
1144-// DeleteFolder is a helper method to define mock.On call
1145-// - ctx context.Context
1146-// - id entity.FolderID
1147-func (_e *MockHomepageFavorites_Expecter) DeleteFolder(ctx any, id any) *MockHomepageFavorites_DeleteFolder_Call {
1148- return &MockHomepageFavorites_DeleteFolder_Call{Call: _e.mock.On("DeleteFolder", ctx, id)}
1149-}
1150-
1151-func (_c *MockHomepageFavorites_DeleteFolder_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockHomepageFavorites_DeleteFolder_Call {
1152- _c.Call.Run(func(args mock.Arguments) {
1153- var arg0 context.Context
1154- if args[0] != nil {
1155- arg0 = args[0].(context.Context)
1156- }
1157- var arg1 entity.FolderID
1158- if args[1] != nil {
1159- arg1 = args[1].(entity.FolderID)
1160- }
1161- run(
1162- arg0,
1163- arg1,
1164- )
1165- })
1166- return _c
1167-}
1168-
1169-func (_c *MockHomepageFavorites_DeleteFolder_Call) Return(err error) *MockHomepageFavorites_DeleteFolder_Call {
1170- _c.Call.Return(err)
1171- return _c
1172-}
1173-
1174-func (_c *MockHomepageFavorites_DeleteFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockHomepageFavorites_DeleteFolder_Call {
1175- _c.Call.Return(run)
1176- return _c
1177-}
1178-
1179 // DeleteTag provides a mock function for the type MockHomepageFavorites1042 // DeleteTag provides a mock function for the type MockHomepageFavorites
1180 func (_mock *MockHomepageFavorites) DeleteTag(ctx context.Context, id entity.TagID) error {1043 func (_mock *MockHomepageFavorites) DeleteTag(ctx context.Context, id entity.TagID) error {
1181 ret := _mock.Called(ctx, id)1044 ret := _mock.Called(ctx, id)
@@ -1295,68 +1158,6 @@ func (_c *MockHomepageFavorites_GetAll_Call) RunAndReturn(run func(ctx context.C
1295 return _c1158 return _c
1296 }1159 }
1297 1160
1298-// GetAllFolders provides a mock function for the type MockHomepageFavorites
1299-func (_mock *MockHomepageFavorites) GetAllFolders(ctx context.Context) ([]*entity.Folder, error) {
1300- ret := _mock.Called(ctx)
1301-
1302- if len(ret) == 0 {
1303- panic("no return value specified for GetAllFolders")
1304- }
1305-
1306- var r0 []*entity.Folder
1307- var r1 error
1308- if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
1309- return returnFunc(ctx)
1310- }
1311- if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
1312- r0 = returnFunc(ctx)
1313- } else {
1314- if ret.Get(0) != nil {
1315- r0 = ret.Get(0).([]*entity.Folder)
1316- }
1317- }
1318- if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1319- r1 = returnFunc(ctx)
1320- } else {
1321- r1 = ret.Error(1)
1322- }
1323- return r0, r1
1324-}
1325-
1326-// MockHomepageFavorites_GetAllFolders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllFolders'
1327-type MockHomepageFavorites_GetAllFolders_Call struct {
1328- *mock.Call
1329-}
1330-
1331-// GetAllFolders is a helper method to define mock.On call
1332-// - ctx context.Context
1333-func (_e *MockHomepageFavorites_Expecter) GetAllFolders(ctx any) *MockHomepageFavorites_GetAllFolders_Call {
1334- return &MockHomepageFavorites_GetAllFolders_Call{Call: _e.mock.On("GetAllFolders", ctx)}
1335-}
1336-
1337-func (_c *MockHomepageFavorites_GetAllFolders_Call) Run(run func(ctx context.Context)) *MockHomepageFavorites_GetAllFolders_Call {
1338- _c.Call.Run(func(args mock.Arguments) {
1339- var arg0 context.Context
1340- if args[0] != nil {
1341- arg0 = args[0].(context.Context)
1342- }
1343- run(
1344- arg0,
1345- )
1346- })
1347- return _c
1348-}
1349-
1350-func (_c *MockHomepageFavorites_GetAllFolders_Call) Return(folders []*entity.Folder, err error) *MockHomepageFavorites_GetAllFolders_Call {
1351- _c.Call.Return(folders, err)
1352- return _c
1353-}
1354-
1355-func (_c *MockHomepageFavorites_GetAllFolders_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockHomepageFavorites_GetAllFolders_Call {
1356- _c.Call.Return(run)
1357- return _c
1358-}
1359-
1360 // GetAllTags provides a mock function for the type MockHomepageFavorites1161 // GetAllTags provides a mock function for the type MockHomepageFavorites
1361 func (_mock *MockHomepageFavorites) GetAllTags(ctx context.Context) ([]*entity.Tag, error) {1162 func (_mock *MockHomepageFavorites) GetAllTags(ctx context.Context) ([]*entity.Tag, error) {
1362 ret := _mock.Called(ctx)1163 ret := _mock.Called(ctx)
@@ -1487,69 +1288,6 @@ func (_c *MockHomepageFavorites_GetByShortcut_Call) RunAndReturn(run func(ctx co
1487 return _c1288 return _c
1488 }1289 }
1489 1290
1490-// Move provides a mock function for the type MockHomepageFavorites
1491-func (_mock *MockHomepageFavorites) Move(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
1492- ret := _mock.Called(ctx, id, folderID)
1493-
1494- if len(ret) == 0 {
1495- panic("no return value specified for Move")
1496- }
1497-
1498- var r0 error
1499- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
1500- r0 = returnFunc(ctx, id, folderID)
1501- } else {
1502- r0 = ret.Error(0)
1503- }
1504- return r0
1505-}
1506-
1507-// MockHomepageFavorites_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move'
1508-type MockHomepageFavorites_Move_Call struct {
1509- *mock.Call
1510-}
1511-
1512-// Move is a helper method to define mock.On call
1513-// - ctx context.Context
1514-// - id entity.FavoriteID
1515-// - folderID *entity.FolderID
1516-func (_e *MockHomepageFavorites_Expecter) Move(ctx any, id any, folderID any) *MockHomepageFavorites_Move_Call {
1517- return &MockHomepageFavorites_Move_Call{Call: _e.mock.On("Move", ctx, id, folderID)}
1518-}
1519-
1520-func (_c *MockHomepageFavorites_Move_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockHomepageFavorites_Move_Call {
1521- _c.Call.Run(func(args mock.Arguments) {
1522- var arg0 context.Context
1523- if args[0] != nil {
1524- arg0 = args[0].(context.Context)
1525- }
1526- var arg1 entity.FavoriteID
1527- if args[1] != nil {
1528- arg1 = args[1].(entity.FavoriteID)
1529- }
1530- var arg2 *entity.FolderID
1531- if args[2] != nil {
1532- arg2 = args[2].(*entity.FolderID)
1533- }
1534- run(
1535- arg0,
1536- arg1,
1537- arg2,
1538- )
1539- })
1540- return _c
1541-}
1542-
1543-func (_c *MockHomepageFavorites_Move_Call) Return(err error) *MockHomepageFavorites_Move_Call {
1544- _c.Call.Return(err)
1545- return _c
1546-}
1547-
1548-func (_c *MockHomepageFavorites_Move_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockHomepageFavorites_Move_Call {
1549- _c.Call.Return(run)
1550- return _c
1551-}
1552-
1553 // SetShortcut provides a mock function for the type MockHomepageFavorites1291 // SetShortcut provides a mock function for the type MockHomepageFavorites
1554 func (_mock *MockHomepageFavorites) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {1292 func (_mock *MockHomepageFavorites) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
1555 ret := _mock.Called(ctx, id, key)1293 ret := _mock.Called(ctx, id, key)
@@ -1807,75 +1545,6 @@ func (_c *MockHomepageFavorites_UpdateFavorite_Call) RunAndReturn(run func(ctx c
1807 return _c1545 return _c
1808 }1546 }
1809 1547
1810-// UpdateFolder provides a mock function for the type MockHomepageFavorites
1811-func (_mock *MockHomepageFavorites) UpdateFolder(ctx context.Context, id entity.FolderID, name string, icon string) error {
1812- ret := _mock.Called(ctx, id, name, icon)
1813-
1814- if len(ret) == 0 {
1815- panic("no return value specified for UpdateFolder")
1816- }
1817-
1818- var r0 error
1819- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, string, string) error); ok {
1820- r0 = returnFunc(ctx, id, name, icon)
1821- } else {
1822- r0 = ret.Error(0)
1823- }
1824- return r0
1825-}
1826-
1827-// MockHomepageFavorites_UpdateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFolder'
1828-type MockHomepageFavorites_UpdateFolder_Call struct {
1829- *mock.Call
1830-}
1831-
1832-// UpdateFolder is a helper method to define mock.On call
1833-// - ctx context.Context
1834-// - id entity.FolderID
1835-// - name string
1836-// - icon string
1837-func (_e *MockHomepageFavorites_Expecter) UpdateFolder(ctx any, id any, name any, icon any) *MockHomepageFavorites_UpdateFolder_Call {
1838- return &MockHomepageFavorites_UpdateFolder_Call{Call: _e.mock.On("UpdateFolder", ctx, id, name, icon)}
1839-}
1840-
1841-func (_c *MockHomepageFavorites_UpdateFolder_Call) Run(run func(ctx context.Context, id entity.FolderID, name string, icon string)) *MockHomepageFavorites_UpdateFolder_Call {
1842- _c.Call.Run(func(args mock.Arguments) {
1843- var arg0 context.Context
1844- if args[0] != nil {
1845- arg0 = args[0].(context.Context)
1846- }
1847- var arg1 entity.FolderID
1848- if args[1] != nil {
1849- arg1 = args[1].(entity.FolderID)
1850- }
1851- var arg2 string
1852- if args[2] != nil {
1853- arg2 = args[2].(string)
1854- }
1855- var arg3 string
1856- if args[3] != nil {
1857- arg3 = args[3].(string)
1858- }
1859- run(
1860- arg0,
1861- arg1,
1862- arg2,
1863- arg3,
1864- )
1865- })
1866- return _c
1867-}
1868-
1869-func (_c *MockHomepageFavorites_UpdateFolder_Call) Return(err error) *MockHomepageFavorites_UpdateFolder_Call {
1870- _c.Call.Return(err)
1871- return _c
1872-}
1873-
1874-func (_c *MockHomepageFavorites_UpdateFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, name string, icon string) error) *MockHomepageFavorites_UpdateFolder_Call {
1875- _c.Call.Return(run)
1876- return _c
1877-}
1878-
1879 // UpdateTag provides a mock function for the type MockHomepageFavorites1548 // UpdateTag provides a mock function for the type MockHomepageFavorites
1880 func (_mock *MockHomepageFavorites) UpdateTag(ctx context.Context, id entity.TagID, name string, color string) error {1549 func (_mock *MockHomepageFavorites) UpdateTag(ctx context.Context, id entity.TagID, name string, color string) error {
1881 ret := _mock.Called(ctx, id, name, color)1550 ret := _mock.Called(ctx, id, name, color)
M internal/application/port/systemviews.go +1 -6
@@ -22,19 +22,14 @@ type SystemviewHistoryService interface {
2222 DeleteDomain(ctx context.Context, domain string) error
2323 }
2424
25-// SystemviewFavoritesService exposes favorite, folder, and tag operations.
25+// SystemviewFavoritesService exposes favorite and tag operations.
2626 type SystemviewFavoritesService interface {
2727 List(ctx context.Context) ([]*entity.Favorite, error)
2828 CreateFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)
2929 UpdateFavorite(ctx context.Context, input dto.FavoriteUpdateInput) (*entity.Favorite, error)
3030 DeleteFavorite(ctx context.Context, id int64) error
31- ListFolders(ctx context.Context) ([]*entity.Folder, error)
3231 ListTags(ctx context.Context) ([]*entity.Tag, error)
3332 SetShortcut(ctx context.Context, favoriteID int64, shortcutKey *int) error
34- SetFolder(ctx context.Context, favoriteID int64, folderID *int64) error
35- CreateFolder(ctx context.Context, name, icon string, parentID *int64) (*entity.Folder, error)
36- UpdateFolder(ctx context.Context, id int64, name, icon string) error
37- DeleteFolder(ctx context.Context, id int64) error
3833 CreateTag(ctx context.Context, name, color string) (*entity.Tag, error)
3934 UpdateTag(ctx context.Context, id int64, name, color string) error
4035 DeleteTag(ctx context.Context, id int64) error
@@ -22,19 +22,14 @@ type SystemviewHistoryService interface {
22 DeleteDomain(ctx context.Context, domain string) error22 DeleteDomain(ctx context.Context, domain string) error
23 }23 }
24 24
25-// SystemviewFavoritesService exposes favorite, folder, and tag operations.25+// SystemviewFavoritesService exposes favorite and tag operations.
26 type SystemviewFavoritesService interface {26 type SystemviewFavoritesService interface {
27 List(ctx context.Context) ([]*entity.Favorite, error)27 List(ctx context.Context) ([]*entity.Favorite, error)
28 CreateFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)28 CreateFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)
29 UpdateFavorite(ctx context.Context, input dto.FavoriteUpdateInput) (*entity.Favorite, error)29 UpdateFavorite(ctx context.Context, input dto.FavoriteUpdateInput) (*entity.Favorite, error)
30 DeleteFavorite(ctx context.Context, id int64) error30 DeleteFavorite(ctx context.Context, id int64) error
31- ListFolders(ctx context.Context) ([]*entity.Folder, error)
32 ListTags(ctx context.Context) ([]*entity.Tag, error)31 ListTags(ctx context.Context) ([]*entity.Tag, error)
33 SetShortcut(ctx context.Context, favoriteID int64, shortcutKey *int) error32 SetShortcut(ctx context.Context, favoriteID int64, shortcutKey *int) error
34- SetFolder(ctx context.Context, favoriteID int64, folderID *int64) error
35- CreateFolder(ctx context.Context, name, icon string, parentID *int64) (*entity.Folder, error)
36- UpdateFolder(ctx context.Context, id int64, name, icon string) error
37- DeleteFolder(ctx context.Context, id int64) error
38 CreateTag(ctx context.Context, name, color string) (*entity.Tag, error)33 CreateTag(ctx context.Context, name, color string) (*entity.Tag, error)
39 UpdateTag(ctx context.Context, id int64, name, color string) error34 UpdateTag(ctx context.Context, id int64, name, color string) error
40 DeleteTag(ctx context.Context, id int64) error35 DeleteTag(ctx context.Context, id int64) error
M internal/domain/entity/favorite.go +6 -55
@@ -1,13 +1,13 @@
11 package entity
22
3-import "time"
3+import (
4+ "strings"
5+ "time"
6+)
47
58 // FavoriteID uniquely identifies a favorite/bookmark.
69 type FavoriteID int64
710
8-// FolderID uniquely identifies a bookmark folder.
9-type FolderID int64
10-
1111 // TagID uniquely identifies a tag.
1212 type TagID int64
1313
@@ -17,9 +17,8 @@ type Favorite struct {
1717 URL string `json:"url"`
1818 Title string `json:"title"`
1919 FaviconURL string `json:"favicon_url"`
20- FolderID *FolderID `json:"folder_id"` // nil = root level
2120 ShortcutKey *int `json:"shortcut_key"` // 1-9 for quick access (Alt+1 through Alt+9)
22- Position int `json:"position"` // Order within folder
21+ Position int `json:"position"` // Order within tag or default list
2322 Tags []Tag `json:"tags,omitempty"`
2423 CreatedAt time.Time `json:"created_at"`
2524 UpdatedAt time.Time `json:"updated_at"`
@@ -41,11 +40,6 @@ func (f *Favorite) HasShortcut() bool {
4140 return f.ShortcutKey != nil && *f.ShortcutKey >= 1 && *f.ShortcutKey <= 9
4241 }
4342
44-// InFolder returns true if this favorite is in a folder.
45-func (f *Favorite) InFolder() bool {
46- return f.FolderID != nil
47-}
48-
4943 // HasTag returns true if this favorite has the given tag.
5044 func (f *Favorite) HasTag(tagID TagID) bool {
5145 for _, t := range f.Tags {
@@ -56,29 +50,6 @@ func (f *Favorite) HasTag(tagID TagID) bool {
5650 return false
5751 }
5852
59-// Folder represents a container for organizing favorites.
60-type Folder struct {
61- ID FolderID `json:"id"`
62- Name string `json:"name"`
63- Icon string `json:"icon"` // Optional icon identifier
64- ParentID *FolderID `json:"parent_id"` // nil = root level
65- Position int `json:"position"` // Order within parent
66- CreatedAt time.Time `json:"created_at"`
67-}
68-
69-// NewFolder creates a new folder.
70-func NewFolder(name string) *Folder {
71- return &Folder{
72- Name: name,
73- CreatedAt: time.Now(),
74- }
75-}
76-
77-// IsRoot returns true if this folder is at root level.
78-func (f *Folder) IsRoot() bool {
79- return f.ParentID == nil
80-}
81-
8253 // Tag represents a label that can be applied to favorites.
8354 type Tag struct {
8455 ID TagID `json:"id"`
@@ -90,28 +61,8 @@ type Tag struct {
9061 // NewTag creates a new tag with default color.
9162 func NewTag(name string) *Tag {
9263 return &Tag{
93- Name: name,
64+ Name: strings.TrimSpace(name),
9465 Color: "#808080", // Default gray
9566 CreatedAt: time.Now(),
9667 }
9768 }
98-
99-// FavoriteTree represents a hierarchical view of folders and favorites.
100-type FavoriteTree struct {
101- RootFolders []*Folder
102- RootFavorites []*Favorite
103- FolderMap map[FolderID]*Folder // Quick lookup
104- ChildFolders map[FolderID][]*Folder // Children of each folder
105- ChildFavorites map[FolderID][]*Favorite // Favorites in each folder
106-}
107-
108-// NewFavoriteTree creates an empty favorite tree.
109-func NewFavoriteTree() *FavoriteTree {
110- return &FavoriteTree{
111- RootFolders: make([]*Folder, 0),
112- RootFavorites: make([]*Favorite, 0),
113- FolderMap: make(map[FolderID]*Folder),
114- ChildFolders: make(map[FolderID][]*Folder),
115- ChildFavorites: make(map[FolderID][]*Favorite),
116- }
117-}
@@ -1,13 +1,13 @@
1 package entity1 package entity
2 2
3-import "time"3+import (
4+ "strings"
5+ "time"
6+)
4 7
5 // FavoriteID uniquely identifies a favorite/bookmark.8 // FavoriteID uniquely identifies a favorite/bookmark.
6 type FavoriteID int649 type FavoriteID int64
7 10
8-// FolderID uniquely identifies a bookmark folder.
9-type FolderID int64
10-
11 // TagID uniquely identifies a tag.11 // TagID uniquely identifies a tag.
12 type TagID int6412 type TagID int64
13 13
@@ -17,9 +17,8 @@ type Favorite struct {
17 URL string `json:"url"`17 URL string `json:"url"`
18 Title string `json:"title"`18 Title string `json:"title"`
19 FaviconURL string `json:"favicon_url"`19 FaviconURL string `json:"favicon_url"`
20- FolderID *FolderID `json:"folder_id"` // nil = root level
21 ShortcutKey *int `json:"shortcut_key"` // 1-9 for quick access (Alt+1 through Alt+9)20 ShortcutKey *int `json:"shortcut_key"` // 1-9 for quick access (Alt+1 through Alt+9)
22- Position int `json:"position"` // Order within folder21+ Position int `json:"position"` // Order within tag or default list
23 Tags []Tag `json:"tags,omitempty"`22 Tags []Tag `json:"tags,omitempty"`
24 CreatedAt time.Time `json:"created_at"`23 CreatedAt time.Time `json:"created_at"`
25 UpdatedAt time.Time `json:"updated_at"`24 UpdatedAt time.Time `json:"updated_at"`
@@ -41,11 +40,6 @@ func (f *Favorite) HasShortcut() bool {
41 return f.ShortcutKey != nil && *f.ShortcutKey >= 1 && *f.ShortcutKey <= 940 return f.ShortcutKey != nil && *f.ShortcutKey >= 1 && *f.ShortcutKey <= 9
42 }41 }
43 42
44-// InFolder returns true if this favorite is in a folder.
45-func (f *Favorite) InFolder() bool {
46- return f.FolderID != nil
47-}
48-
49 // HasTag returns true if this favorite has the given tag.43 // HasTag returns true if this favorite has the given tag.
50 func (f *Favorite) HasTag(tagID TagID) bool {44 func (f *Favorite) HasTag(tagID TagID) bool {
51 for _, t := range f.Tags {45 for _, t := range f.Tags {
@@ -56,29 +50,6 @@ func (f *Favorite) HasTag(tagID TagID) bool {
56 return false50 return false
57 }51 }
58 52
59-// Folder represents a container for organizing favorites.
60-type Folder struct {
61- ID FolderID `json:"id"`
62- Name string `json:"name"`
63- Icon string `json:"icon"` // Optional icon identifier
64- ParentID *FolderID `json:"parent_id"` // nil = root level
65- Position int `json:"position"` // Order within parent
66- CreatedAt time.Time `json:"created_at"`
67-}
68-
69-// NewFolder creates a new folder.
70-func NewFolder(name string) *Folder {
71- return &Folder{
72- Name: name,
73- CreatedAt: time.Now(),
74- }
75-}
76-
77-// IsRoot returns true if this folder is at root level.
78-func (f *Folder) IsRoot() bool {
79- return f.ParentID == nil
80-}
81-
82 // Tag represents a label that can be applied to favorites.53 // Tag represents a label that can be applied to favorites.
83 type Tag struct {54 type Tag struct {
84 ID TagID `json:"id"`55 ID TagID `json:"id"`
@@ -90,28 +61,8 @@ type Tag struct {
90 // NewTag creates a new tag with default color.61 // NewTag creates a new tag with default color.
91 func NewTag(name string) *Tag {62 func NewTag(name string) *Tag {
92 return &Tag{63 return &Tag{
93- Name: name,64+ Name: strings.TrimSpace(name),
94 Color: "#808080", // Default gray65 Color: "#808080", // Default gray
95 CreatedAt: time.Now(),66 CreatedAt: time.Now(),
96 }67 }
97 }68 }
98-
99-// FavoriteTree represents a hierarchical view of folders and favorites.
100-type FavoriteTree struct {
101- RootFolders []*Folder
102- RootFavorites []*Favorite
103- FolderMap map[FolderID]*Folder // Quick lookup
104- ChildFolders map[FolderID][]*Folder // Children of each folder
105- ChildFavorites map[FolderID][]*Favorite // Favorites in each folder
106-}
107-
108-// NewFavoriteTree creates an empty favorite tree.
109-func NewFavoriteTree() *FavoriteTree {
110- return &FavoriteTree{
111- RootFolders: make([]*Folder, 0),
112- RootFavorites: make([]*Favorite, 0),
113- FolderMap: make(map[FolderID]*Folder),
114- ChildFolders: make(map[FolderID][]*Folder),
115- ChildFavorites: make(map[FolderID][]*Favorite),
116- }
117-}
A internal/domain/entity/favorite_test.go +28 -0
@@ -0,0 +1,28 @@
1+package entity
2+
3+import "testing"
4+
5+func TestFavoriteSupportsMultipleTagsAndNoTags(t *testing.T) {
6+ fav := NewFavorite("https://example.com", "Example")
7+ if fav.HasTag(TagID(1)) {
8+ t.Fatal("new favorite unexpectedly has tag")
9+ }
10+
11+ fav.Tags = []Tag{{ID: 1, Name: "Go"}, {ID: 2, Name: "Docs"}}
12+ if !fav.HasTag(1) || !fav.HasTag(2) {
13+ t.Fatalf("favorite tags not detected: %+v", fav.Tags)
14+ }
15+ if fav.HasTag(3) {
16+ t.Fatal("favorite reported missing tag as present")
17+ }
18+}
19+
20+func TestTagStoresTrimmedDisplayNameAndColor(t *testing.T) {
21+ tag := NewTag(" Read Later ")
22+ if tag.Name != "Read Later" {
23+ t.Fatalf("tag name = %q", tag.Name)
24+ }
25+ if tag.Color == "" {
26+ t.Fatal("tag default color is empty")
27+ }
28+}
@@ -0,0 +1,28 @@
1+package entity
2+
3+import "testing"
4+
5+func TestFavoriteSupportsMultipleTagsAndNoTags(t *testing.T) {
6+ fav := NewFavorite("https://example.com", "Example")
7+ if fav.HasTag(TagID(1)) {
8+ t.Fatal("new favorite unexpectedly has tag")
9+ }
10+
11+ fav.Tags = []Tag{{ID: 1, Name: "Go"}, {ID: 2, Name: "Docs"}}
12+ if !fav.HasTag(1) || !fav.HasTag(2) {
13+ t.Fatalf("favorite tags not detected: %+v", fav.Tags)
14+ }
15+ if fav.HasTag(3) {
16+ t.Fatal("favorite reported missing tag as present")
17+ }
18+}
19+
20+func TestTagStoresTrimmedDisplayNameAndColor(t *testing.T) {
21+ tag := NewTag(" Read Later ")
22+ if tag.Name != "Read Later" {
23+ t.Fatalf("tag name = %q", tag.Name)
24+ }
25+ if tag.Color == "" {
26+ t.Fatal("tag default color is empty")
27+ }
28+}
M internal/domain/repository/favorite.go +3 -30
@@ -20,19 +20,15 @@ type FavoriteRepository interface {
2020 // GetAll retrieves all favorites.
2121 GetAll(ctx context.Context) ([]*entity.Favorite, error)
2222
23- // GetByFolder retrieves favorites in a specific folder.
24- // Pass nil for root-level favorites.
25- GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)
23+ // GetByTag retrieves favorites with a specific tag.
24+ GetByTag(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error)
2625
2726 // GetByShortcut retrieves the favorite with the given shortcut key (1-9).
2827 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
2928
30- // UpdatePosition updates a favorite's position within its folder.
29+ // UpdatePosition updates a favorite's position.
3130 UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error
3231
33- // SetFolder moves a favorite to a different folder.
34- SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error
35-
3632 // SetShortcut assigns a keyboard shortcut (1-9) or nil to remove.
3733 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
3834
@@ -40,29 +36,6 @@ type FavoriteRepository interface {
4036 Delete(ctx context.Context, id entity.FavoriteID) error
4137 }
4238
43-// FolderRepository defines operations for bookmark folder persistence.
44-type FolderRepository interface {
45- // Save creates or updates a folder.
46- Save(ctx context.Context, folder *entity.Folder) error
47-
48- // FindByID retrieves a folder by its ID.
49- FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error)
50-
51- // GetAll retrieves all folders.
52- GetAll(ctx context.Context) ([]*entity.Folder, error)
53-
54- // GetChildren retrieves child folders of a parent.
55- // Pass nil for root-level folders.
56- GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)
57-
58- // UpdatePosition updates a folder's position within its parent.
59- UpdatePosition(ctx context.Context, id entity.FolderID, position int) error
60-
61- // Delete removes a folder by ID.
62- // Favorites in the folder should be moved to root.
63- Delete(ctx context.Context, id entity.FolderID) error
64-}
65-
6639 // TagRepository defines operations for tag persistence.
6740 type TagRepository interface {
6841 // Save creates or updates a tag.
@@ -20,19 +20,15 @@ type FavoriteRepository interface {
20 // GetAll retrieves all favorites.20 // GetAll retrieves all favorites.
21 GetAll(ctx context.Context) ([]*entity.Favorite, error)21 GetAll(ctx context.Context) ([]*entity.Favorite, error)
22 22
23- // GetByFolder retrieves favorites in a specific folder.23+ // GetByTag retrieves favorites with a specific tag.
24- // Pass nil for root-level favorites.24+ GetByTag(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error)
25- GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)
26 25
27 // GetByShortcut retrieves the favorite with the given shortcut key (1-9).26 // GetByShortcut retrieves the favorite with the given shortcut key (1-9).
28 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)27 GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)
29 28
30- // UpdatePosition updates a favorite's position within its folder.29+ // UpdatePosition updates a favorite's position.
31 UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error30 UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error
32 31
33- // SetFolder moves a favorite to a different folder.
34- SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error
35-
36 // SetShortcut assigns a keyboard shortcut (1-9) or nil to remove.32 // SetShortcut assigns a keyboard shortcut (1-9) or nil to remove.
37 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error33 SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error
38 34
@@ -40,29 +36,6 @@ type FavoriteRepository interface {
40 Delete(ctx context.Context, id entity.FavoriteID) error36 Delete(ctx context.Context, id entity.FavoriteID) error
41 }37 }
42 38
43-// FolderRepository defines operations for bookmark folder persistence.
44-type FolderRepository interface {
45- // Save creates or updates a folder.
46- Save(ctx context.Context, folder *entity.Folder) error
47-
48- // FindByID retrieves a folder by its ID.
49- FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error)
50-
51- // GetAll retrieves all folders.
52- GetAll(ctx context.Context) ([]*entity.Folder, error)
53-
54- // GetChildren retrieves child folders of a parent.
55- // Pass nil for root-level folders.
56- GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)
57-
58- // UpdatePosition updates a folder's position within its parent.
59- UpdatePosition(ctx context.Context, id entity.FolderID, position int) error
60-
61- // Delete removes a folder by ID.
62- // Favorites in the folder should be moved to root.
63- Delete(ctx context.Context, id entity.FolderID) error
64-}
65-
66 // TagRepository defines operations for tag persistence.39 // TagRepository defines operations for tag persistence.
67 type TagRepository interface {40 type TagRepository interface {
68 // Save creates or updates a tag.41 // Save creates or updates a tag.
M internal/domain/repository/mocks/favorite.go +21 -486
@@ -293,55 +293,55 @@ func (_c *MockFavoriteRepository_GetAll_Call) RunAndReturn(run func(ctx context.
293293 return _c
294294 }
295295
296-// GetByFolder provides a mock function for the type MockFavoriteRepository
297-func (_mock *MockFavoriteRepository) GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error) {
298- ret := _mock.Called(ctx, folderID)
296+// GetByTag provides a mock function for the type MockFavoriteRepository
297+func (_mock *MockFavoriteRepository) GetByTag(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error) {
298+ ret := _mock.Called(ctx, tagID)
299299
300300 if len(ret) == 0 {
301- panic("no return value specified for GetByFolder")
301+ panic("no return value specified for GetByTag")
302302 }
303303
304304 var r0 []*entity.Favorite
305305 var r1 error
306- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Favorite, error)); ok {
307- return returnFunc(ctx, folderID)
306+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) ([]*entity.Favorite, error)); ok {
307+ return returnFunc(ctx, tagID)
308308 }
309- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Favorite); ok {
310- r0 = returnFunc(ctx, folderID)
309+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) []*entity.Favorite); ok {
310+ r0 = returnFunc(ctx, tagID)
311311 } else {
312312 if ret.Get(0) != nil {
313313 r0 = ret.Get(0).([]*entity.Favorite)
314314 }
315315 }
316- if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {
317- r1 = returnFunc(ctx, folderID)
316+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.TagID) error); ok {
317+ r1 = returnFunc(ctx, tagID)
318318 } else {
319319 r1 = ret.Error(1)
320320 }
321321 return r0, r1
322322 }
323323
324-// MockFavoriteRepository_GetByFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByFolder'
325-type MockFavoriteRepository_GetByFolder_Call struct {
324+// MockFavoriteRepository_GetByTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByTag'
325+type MockFavoriteRepository_GetByTag_Call struct {
326326 *mock.Call
327327 }
328328
329-// GetByFolder is a helper method to define mock.On call
329+// GetByTag is a helper method to define mock.On call
330330 // - ctx context.Context
331-// - folderID *entity.FolderID
332-func (_e *MockFavoriteRepository_Expecter) GetByFolder(ctx any, folderID any) *MockFavoriteRepository_GetByFolder_Call {
333- return &MockFavoriteRepository_GetByFolder_Call{Call: _e.mock.On("GetByFolder", ctx, folderID)}
331+// - tagID entity.TagID
332+func (_e *MockFavoriteRepository_Expecter) GetByTag(ctx any, tagID any) *MockFavoriteRepository_GetByTag_Call {
333+ return &MockFavoriteRepository_GetByTag_Call{Call: _e.mock.On("GetByTag", ctx, tagID)}
334334 }
335335
336-func (_c *MockFavoriteRepository_GetByFolder_Call) Run(run func(ctx context.Context, folderID *entity.FolderID)) *MockFavoriteRepository_GetByFolder_Call {
336+func (_c *MockFavoriteRepository_GetByTag_Call) Run(run func(ctx context.Context, tagID entity.TagID)) *MockFavoriteRepository_GetByTag_Call {
337337 _c.Call.Run(func(args mock.Arguments) {
338338 var arg0 context.Context
339339 if args[0] != nil {
340340 arg0 = args[0].(context.Context)
341341 }
342- var arg1 *entity.FolderID
342+ var arg1 entity.TagID
343343 if args[1] != nil {
344- arg1 = args[1].(*entity.FolderID)
344+ arg1 = args[1].(entity.TagID)
345345 }
346346 run(
347347 arg0,
@@ -351,12 +351,12 @@ func (_c *MockFavoriteRepository_GetByFolder_Call) Run(run func(ctx context.Cont
351351 return _c
352352 }
353353
354-func (_c *MockFavoriteRepository_GetByFolder_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetByFolder_Call {
354+func (_c *MockFavoriteRepository_GetByTag_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetByTag_Call {
355355 _c.Call.Return(favorites, err)
356356 return _c
357357 }
358358
359-func (_c *MockFavoriteRepository_GetByFolder_Call) RunAndReturn(run func(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetByFolder_Call {
359+func (_c *MockFavoriteRepository_GetByTag_Call) RunAndReturn(run func(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetByTag_Call {
360360 _c.Call.Return(run)
361361 return _c
362362 }
@@ -486,69 +486,6 @@ func (_c *MockFavoriteRepository_Save_Call) RunAndReturn(run func(ctx context.Co
486486 return _c
487487 }
488488
489-// SetFolder provides a mock function for the type MockFavoriteRepository
490-func (_mock *MockFavoriteRepository) SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
491- ret := _mock.Called(ctx, id, folderID)
492-
493- if len(ret) == 0 {
494- panic("no return value specified for SetFolder")
495- }
496-
497- var r0 error
498- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
499- r0 = returnFunc(ctx, id, folderID)
500- } else {
501- r0 = ret.Error(0)
502- }
503- return r0
504-}
505-
506-// MockFavoriteRepository_SetFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFolder'
507-type MockFavoriteRepository_SetFolder_Call struct {
508- *mock.Call
509-}
510-
511-// SetFolder is a helper method to define mock.On call
512-// - ctx context.Context
513-// - id entity.FavoriteID
514-// - folderID *entity.FolderID
515-func (_e *MockFavoriteRepository_Expecter) SetFolder(ctx any, id any, folderID any) *MockFavoriteRepository_SetFolder_Call {
516- return &MockFavoriteRepository_SetFolder_Call{Call: _e.mock.On("SetFolder", ctx, id, folderID)}
517-}
518-
519-func (_c *MockFavoriteRepository_SetFolder_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockFavoriteRepository_SetFolder_Call {
520- _c.Call.Run(func(args mock.Arguments) {
521- var arg0 context.Context
522- if args[0] != nil {
523- arg0 = args[0].(context.Context)
524- }
525- var arg1 entity.FavoriteID
526- if args[1] != nil {
527- arg1 = args[1].(entity.FavoriteID)
528- }
529- var arg2 *entity.FolderID
530- if args[2] != nil {
531- arg2 = args[2].(*entity.FolderID)
532- }
533- run(
534- arg0,
535- arg1,
536- arg2,
537- )
538- })
539- return _c
540-}
541-
542-func (_c *MockFavoriteRepository_SetFolder_Call) Return(err error) *MockFavoriteRepository_SetFolder_Call {
543- _c.Call.Return(err)
544- return _c
545-}
546-
547-func (_c *MockFavoriteRepository_SetFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockFavoriteRepository_SetFolder_Call {
548- _c.Call.Return(run)
549- return _c
550-}
551-
552489 // SetShortcut provides a mock function for the type MockFavoriteRepository
553490 func (_mock *MockFavoriteRepository) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
554491 ret := _mock.Called(ctx, id, key)
@@ -675,408 +612,6 @@ func (_c *MockFavoriteRepository_UpdatePosition_Call) RunAndReturn(run func(ctx
675612 return _c
676613 }
677614
678-// NewMockFolderRepository creates a new instance of MockFolderRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
679-// The first argument is typically a *testing.T value.
680-func NewMockFolderRepository(t interface {
681- mock.TestingT
682- Cleanup(func())
683-}) *MockFolderRepository {
684- mock := &MockFolderRepository{}
685- mock.Mock.Test(t)
686-
687- t.Cleanup(func() { mock.AssertExpectations(t) })
688-
689- return mock
690-}
691-
692-// MockFolderRepository is an autogenerated mock type for the FolderRepository type
693-type MockFolderRepository struct {
694- mock.Mock
695-}
696-
697-type MockFolderRepository_Expecter struct {
698- mock *mock.Mock
699-}
700-
701-func (_m *MockFolderRepository) EXPECT() *MockFolderRepository_Expecter {
702- return &MockFolderRepository_Expecter{mock: &_m.Mock}
703-}
704-
705-// Delete provides a mock function for the type MockFolderRepository
706-func (_mock *MockFolderRepository) Delete(ctx context.Context, id entity.FolderID) error {
707- ret := _mock.Called(ctx, id)
708-
709- if len(ret) == 0 {
710- panic("no return value specified for Delete")
711- }
712-
713- var r0 error
714- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
715- r0 = returnFunc(ctx, id)
716- } else {
717- r0 = ret.Error(0)
718- }
719- return r0
720-}
721-
722-// MockFolderRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
723-type MockFolderRepository_Delete_Call struct {
724- *mock.Call
725-}
726-
727-// Delete is a helper method to define mock.On call
728-// - ctx context.Context
729-// - id entity.FolderID
730-func (_e *MockFolderRepository_Expecter) Delete(ctx any, id any) *MockFolderRepository_Delete_Call {
731- return &MockFolderRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
732-}
733-
734-func (_c *MockFolderRepository_Delete_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_Delete_Call {
735- _c.Call.Run(func(args mock.Arguments) {
736- var arg0 context.Context
737- if args[0] != nil {
738- arg0 = args[0].(context.Context)
739- }
740- var arg1 entity.FolderID
741- if args[1] != nil {
742- arg1 = args[1].(entity.FolderID)
743- }
744- run(
745- arg0,
746- arg1,
747- )
748- })
749- return _c
750-}
751-
752-func (_c *MockFolderRepository_Delete_Call) Return(err error) *MockFolderRepository_Delete_Call {
753- _c.Call.Return(err)
754- return _c
755-}
756-
757-func (_c *MockFolderRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockFolderRepository_Delete_Call {
758- _c.Call.Return(run)
759- return _c
760-}
761-
762-// FindByID provides a mock function for the type MockFolderRepository
763-func (_mock *MockFolderRepository) FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error) {
764- ret := _mock.Called(ctx, id)
765-
766- if len(ret) == 0 {
767- panic("no return value specified for FindByID")
768- }
769-
770- var r0 *entity.Folder
771- var r1 error
772- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) (*entity.Folder, error)); ok {
773- return returnFunc(ctx, id)
774- }
775- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) *entity.Folder); ok {
776- r0 = returnFunc(ctx, id)
777- } else {
778- if ret.Get(0) != nil {
779- r0 = ret.Get(0).(*entity.Folder)
780- }
781- }
782- if returnFunc, ok := ret.Get(1).(func(context.Context, entity.FolderID) error); ok {
783- r1 = returnFunc(ctx, id)
784- } else {
785- r1 = ret.Error(1)
786- }
787- return r0, r1
788-}
789-
790-// MockFolderRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
791-type MockFolderRepository_FindByID_Call struct {
792- *mock.Call
793-}
794-
795-// FindByID is a helper method to define mock.On call
796-// - ctx context.Context
797-// - id entity.FolderID
798-func (_e *MockFolderRepository_Expecter) FindByID(ctx any, id any) *MockFolderRepository_FindByID_Call {
799- return &MockFolderRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
800-}
801-
802-func (_c *MockFolderRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_FindByID_Call {
803- _c.Call.Run(func(args mock.Arguments) {
804- var arg0 context.Context
805- if args[0] != nil {
806- arg0 = args[0].(context.Context)
807- }
808- var arg1 entity.FolderID
809- if args[1] != nil {
810- arg1 = args[1].(entity.FolderID)
811- }
812- run(
813- arg0,
814- arg1,
815- )
816- })
817- return _c
818-}
819-
820-func (_c *MockFolderRepository_FindByID_Call) Return(folder *entity.Folder, err error) *MockFolderRepository_FindByID_Call {
821- _c.Call.Return(folder, err)
822- return _c
823-}
824-
825-func (_c *MockFolderRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) (*entity.Folder, error)) *MockFolderRepository_FindByID_Call {
826- _c.Call.Return(run)
827- return _c
828-}
829-
830-// GetAll provides a mock function for the type MockFolderRepository
831-func (_mock *MockFolderRepository) GetAll(ctx context.Context) ([]*entity.Folder, error) {
832- ret := _mock.Called(ctx)
833-
834- if len(ret) == 0 {
835- panic("no return value specified for GetAll")
836- }
837-
838- var r0 []*entity.Folder
839- var r1 error
840- if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
841- return returnFunc(ctx)
842- }
843- if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
844- r0 = returnFunc(ctx)
845- } else {
846- if ret.Get(0) != nil {
847- r0 = ret.Get(0).([]*entity.Folder)
848- }
849- }
850- if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
851- r1 = returnFunc(ctx)
852- } else {
853- r1 = ret.Error(1)
854- }
855- return r0, r1
856-}
857-
858-// MockFolderRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
859-type MockFolderRepository_GetAll_Call struct {
860- *mock.Call
861-}
862-
863-// GetAll is a helper method to define mock.On call
864-// - ctx context.Context
865-func (_e *MockFolderRepository_Expecter) GetAll(ctx any) *MockFolderRepository_GetAll_Call {
866- return &MockFolderRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
867-}
868-
869-func (_c *MockFolderRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockFolderRepository_GetAll_Call {
870- _c.Call.Run(func(args mock.Arguments) {
871- var arg0 context.Context
872- if args[0] != nil {
873- arg0 = args[0].(context.Context)
874- }
875- run(
876- arg0,
877- )
878- })
879- return _c
880-}
881-
882-func (_c *MockFolderRepository_GetAll_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetAll_Call {
883- _c.Call.Return(folders, err)
884- return _c
885-}
886-
887-func (_c *MockFolderRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockFolderRepository_GetAll_Call {
888- _c.Call.Return(run)
889- return _c
890-}
891-
892-// GetChildren provides a mock function for the type MockFolderRepository
893-func (_mock *MockFolderRepository) GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error) {
894- ret := _mock.Called(ctx, parentID)
895-
896- if len(ret) == 0 {
897- panic("no return value specified for GetChildren")
898- }
899-
900- var r0 []*entity.Folder
901- var r1 error
902- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Folder, error)); ok {
903- return returnFunc(ctx, parentID)
904- }
905- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Folder); ok {
906- r0 = returnFunc(ctx, parentID)
907- } else {
908- if ret.Get(0) != nil {
909- r0 = ret.Get(0).([]*entity.Folder)
910- }
911- }
912- if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {
913- r1 = returnFunc(ctx, parentID)
914- } else {
915- r1 = ret.Error(1)
916- }
917- return r0, r1
918-}
919-
920-// MockFolderRepository_GetChildren_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChildren'
921-type MockFolderRepository_GetChildren_Call struct {
922- *mock.Call
923-}
924-
925-// GetChildren is a helper method to define mock.On call
926-// - ctx context.Context
927-// - parentID *entity.FolderID
928-func (_e *MockFolderRepository_Expecter) GetChildren(ctx any, parentID any) *MockFolderRepository_GetChildren_Call {
929- return &MockFolderRepository_GetChildren_Call{Call: _e.mock.On("GetChildren", ctx, parentID)}
930-}
931-
932-func (_c *MockFolderRepository_GetChildren_Call) Run(run func(ctx context.Context, parentID *entity.FolderID)) *MockFolderRepository_GetChildren_Call {
933- _c.Call.Run(func(args mock.Arguments) {
934- var arg0 context.Context
935- if args[0] != nil {
936- arg0 = args[0].(context.Context)
937- }
938- var arg1 *entity.FolderID
939- if args[1] != nil {
940- arg1 = args[1].(*entity.FolderID)
941- }
942- run(
943- arg0,
944- arg1,
945- )
946- })
947- return _c
948-}
949-
950-func (_c *MockFolderRepository_GetChildren_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetChildren_Call {
951- _c.Call.Return(folders, err)
952- return _c
953-}
954-
955-func (_c *MockFolderRepository_GetChildren_Call) RunAndReturn(run func(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)) *MockFolderRepository_GetChildren_Call {
956- _c.Call.Return(run)
957- return _c
958-}
959-
960-// Save provides a mock function for the type MockFolderRepository
961-func (_mock *MockFolderRepository) Save(ctx context.Context, folder *entity.Folder) error {
962- ret := _mock.Called(ctx, folder)
963-
964- if len(ret) == 0 {
965- panic("no return value specified for Save")
966- }
967-
968- var r0 error
969- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Folder) error); ok {
970- r0 = returnFunc(ctx, folder)
971- } else {
972- r0 = ret.Error(0)
973- }
974- return r0
975-}
976-
977-// MockFolderRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
978-type MockFolderRepository_Save_Call struct {
979- *mock.Call
980-}
981-
982-// Save is a helper method to define mock.On call
983-// - ctx context.Context
984-// - folder *entity.Folder
985-func (_e *MockFolderRepository_Expecter) Save(ctx any, folder any) *MockFolderRepository_Save_Call {
986- return &MockFolderRepository_Save_Call{Call: _e.mock.On("Save", ctx, folder)}
987-}
988-
989-func (_c *MockFolderRepository_Save_Call) Run(run func(ctx context.Context, folder *entity.Folder)) *MockFolderRepository_Save_Call {
990- _c.Call.Run(func(args mock.Arguments) {
991- var arg0 context.Context
992- if args[0] != nil {
993- arg0 = args[0].(context.Context)
994- }
995- var arg1 *entity.Folder
996- if args[1] != nil {
997- arg1 = args[1].(*entity.Folder)
998- }
999- run(
1000- arg0,
1001- arg1,
1002- )
1003- })
1004- return _c
1005-}
1006-
1007-func (_c *MockFolderRepository_Save_Call) Return(err error) *MockFolderRepository_Save_Call {
1008- _c.Call.Return(err)
1009- return _c
1010-}
1011-
1012-func (_c *MockFolderRepository_Save_Call) RunAndReturn(run func(ctx context.Context, folder *entity.Folder) error) *MockFolderRepository_Save_Call {
1013- _c.Call.Return(run)
1014- return _c
1015-}
1016-
1017-// UpdatePosition provides a mock function for the type MockFolderRepository
1018-func (_mock *MockFolderRepository) UpdatePosition(ctx context.Context, id entity.FolderID, position int) error {
1019- ret := _mock.Called(ctx, id, position)
1020-
1021- if len(ret) == 0 {
1022- panic("no return value specified for UpdatePosition")
1023- }
1024-
1025- var r0 error
1026- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, int) error); ok {
1027- r0 = returnFunc(ctx, id, position)
1028- } else {
1029- r0 = ret.Error(0)
1030- }
1031- return r0
1032-}
1033-
1034-// MockFolderRepository_UpdatePosition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePosition'
1035-type MockFolderRepository_UpdatePosition_Call struct {
1036- *mock.Call
1037-}
1038-
1039-// UpdatePosition is a helper method to define mock.On call
1040-// - ctx context.Context
1041-// - id entity.FolderID
1042-// - position int
1043-func (_e *MockFolderRepository_Expecter) UpdatePosition(ctx any, id any, position any) *MockFolderRepository_UpdatePosition_Call {
1044- return &MockFolderRepository_UpdatePosition_Call{Call: _e.mock.On("UpdatePosition", ctx, id, position)}
1045-}
1046-
1047-func (_c *MockFolderRepository_UpdatePosition_Call) Run(run func(ctx context.Context, id entity.FolderID, position int)) *MockFolderRepository_UpdatePosition_Call {
1048- _c.Call.Run(func(args mock.Arguments) {
1049- var arg0 context.Context
1050- if args[0] != nil {
1051- arg0 = args[0].(context.Context)
1052- }
1053- var arg1 entity.FolderID
1054- if args[1] != nil {
1055- arg1 = args[1].(entity.FolderID)
1056- }
1057- var arg2 int
1058- if args[2] != nil {
1059- arg2 = args[2].(int)
1060- }
1061- run(
1062- arg0,
1063- arg1,
1064- arg2,
1065- )
1066- })
1067- return _c
1068-}
1069-
1070-func (_c *MockFolderRepository_UpdatePosition_Call) Return(err error) *MockFolderRepository_UpdatePosition_Call {
1071- _c.Call.Return(err)
1072- return _c
1073-}
1074-
1075-func (_c *MockFolderRepository_UpdatePosition_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, position int) error) *MockFolderRepository_UpdatePosition_Call {
1076- _c.Call.Return(run)
1077- return _c
1078-}
1079-
1080615 // NewMockTagRepository creates a new instance of MockTagRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1081616 // The first argument is typically a *testing.T value.
1082617 func NewMockTagRepository(t interface {
@@ -293,55 +293,55 @@ func (_c *MockFavoriteRepository_GetAll_Call) RunAndReturn(run func(ctx context.
293 return _c293 return _c
294 }294 }
295 295
296-// GetByFolder provides a mock function for the type MockFavoriteRepository296+// GetByTag provides a mock function for the type MockFavoriteRepository
297-func (_mock *MockFavoriteRepository) GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error) {297+func (_mock *MockFavoriteRepository) GetByTag(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error) {
298- ret := _mock.Called(ctx, folderID)298+ ret := _mock.Called(ctx, tagID)
299 299
300 if len(ret) == 0 {300 if len(ret) == 0 {
301- panic("no return value specified for GetByFolder")301+ panic("no return value specified for GetByTag")
302 }302 }
303 303
304 var r0 []*entity.Favorite304 var r0 []*entity.Favorite
305 var r1 error305 var r1 error
306- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Favorite, error)); ok {306+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) ([]*entity.Favorite, error)); ok {
307- return returnFunc(ctx, folderID)307+ return returnFunc(ctx, tagID)
308 }308 }
309- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Favorite); ok {309+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) []*entity.Favorite); ok {
310- r0 = returnFunc(ctx, folderID)310+ r0 = returnFunc(ctx, tagID)
311 } else {311 } else {
312 if ret.Get(0) != nil {312 if ret.Get(0) != nil {
313 r0 = ret.Get(0).([]*entity.Favorite)313 r0 = ret.Get(0).([]*entity.Favorite)
314 }314 }
315 }315 }
316- if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {316+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.TagID) error); ok {
317- r1 = returnFunc(ctx, folderID)317+ r1 = returnFunc(ctx, tagID)
318 } else {318 } else {
319 r1 = ret.Error(1)319 r1 = ret.Error(1)
320 }320 }
321 return r0, r1321 return r0, r1
322 }322 }
323 323
324-// MockFavoriteRepository_GetByFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByFolder'324+// MockFavoriteRepository_GetByTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByTag'
325-type MockFavoriteRepository_GetByFolder_Call struct {325+type MockFavoriteRepository_GetByTag_Call struct {
326 *mock.Call326 *mock.Call
327 }327 }
328 328
329-// GetByFolder is a helper method to define mock.On call329+// GetByTag is a helper method to define mock.On call
330 // - ctx context.Context330 // - ctx context.Context
331-// - folderID *entity.FolderID331+// - tagID entity.TagID
332-func (_e *MockFavoriteRepository_Expecter) GetByFolder(ctx any, folderID any) *MockFavoriteRepository_GetByFolder_Call {332+func (_e *MockFavoriteRepository_Expecter) GetByTag(ctx any, tagID any) *MockFavoriteRepository_GetByTag_Call {
333- return &MockFavoriteRepository_GetByFolder_Call{Call: _e.mock.On("GetByFolder", ctx, folderID)}333+ return &MockFavoriteRepository_GetByTag_Call{Call: _e.mock.On("GetByTag", ctx, tagID)}
334 }334 }
335 335
336-func (_c *MockFavoriteRepository_GetByFolder_Call) Run(run func(ctx context.Context, folderID *entity.FolderID)) *MockFavoriteRepository_GetByFolder_Call {336+func (_c *MockFavoriteRepository_GetByTag_Call) Run(run func(ctx context.Context, tagID entity.TagID)) *MockFavoriteRepository_GetByTag_Call {
337 _c.Call.Run(func(args mock.Arguments) {337 _c.Call.Run(func(args mock.Arguments) {
338 var arg0 context.Context338 var arg0 context.Context
339 if args[0] != nil {339 if args[0] != nil {
340 arg0 = args[0].(context.Context)340 arg0 = args[0].(context.Context)
341 }341 }
342- var arg1 *entity.FolderID342+ var arg1 entity.TagID
343 if args[1] != nil {343 if args[1] != nil {
344- arg1 = args[1].(*entity.FolderID)344+ arg1 = args[1].(entity.TagID)
345 }345 }
346 run(346 run(
347 arg0,347 arg0,
@@ -351,12 +351,12 @@ func (_c *MockFavoriteRepository_GetByFolder_Call) Run(run func(ctx context.Cont
351 return _c351 return _c
352 }352 }
353 353
354-func (_c *MockFavoriteRepository_GetByFolder_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetByFolder_Call {354+func (_c *MockFavoriteRepository_GetByTag_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetByTag_Call {
355 _c.Call.Return(favorites, err)355 _c.Call.Return(favorites, err)
356 return _c356 return _c
357 }357 }
358 358
359-func (_c *MockFavoriteRepository_GetByFolder_Call) RunAndReturn(run func(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetByFolder_Call {359+func (_c *MockFavoriteRepository_GetByTag_Call) RunAndReturn(run func(ctx context.Context, tagID entity.TagID) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetByTag_Call {
360 _c.Call.Return(run)360 _c.Call.Return(run)
361 return _c361 return _c
362 }362 }
@@ -486,69 +486,6 @@ func (_c *MockFavoriteRepository_Save_Call) RunAndReturn(run func(ctx context.Co
486 return _c486 return _c
487 }487 }
488 488
489-// SetFolder provides a mock function for the type MockFavoriteRepository
490-func (_mock *MockFavoriteRepository) SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
491- ret := _mock.Called(ctx, id, folderID)
492-
493- if len(ret) == 0 {
494- panic("no return value specified for SetFolder")
495- }
496-
497- var r0 error
498- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
499- r0 = returnFunc(ctx, id, folderID)
500- } else {
501- r0 = ret.Error(0)
502- }
503- return r0
504-}
505-
506-// MockFavoriteRepository_SetFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFolder'
507-type MockFavoriteRepository_SetFolder_Call struct {
508- *mock.Call
509-}
510-
511-// SetFolder is a helper method to define mock.On call
512-// - ctx context.Context
513-// - id entity.FavoriteID
514-// - folderID *entity.FolderID
515-func (_e *MockFavoriteRepository_Expecter) SetFolder(ctx any, id any, folderID any) *MockFavoriteRepository_SetFolder_Call {
516- return &MockFavoriteRepository_SetFolder_Call{Call: _e.mock.On("SetFolder", ctx, id, folderID)}
517-}
518-
519-func (_c *MockFavoriteRepository_SetFolder_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockFavoriteRepository_SetFolder_Call {
520- _c.Call.Run(func(args mock.Arguments) {
521- var arg0 context.Context
522- if args[0] != nil {
523- arg0 = args[0].(context.Context)
524- }
525- var arg1 entity.FavoriteID
526- if args[1] != nil {
527- arg1 = args[1].(entity.FavoriteID)
528- }
529- var arg2 *entity.FolderID
530- if args[2] != nil {
531- arg2 = args[2].(*entity.FolderID)
532- }
533- run(
534- arg0,
535- arg1,
536- arg2,
537- )
538- })
539- return _c
540-}
541-
542-func (_c *MockFavoriteRepository_SetFolder_Call) Return(err error) *MockFavoriteRepository_SetFolder_Call {
543- _c.Call.Return(err)
544- return _c
545-}
546-
547-func (_c *MockFavoriteRepository_SetFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockFavoriteRepository_SetFolder_Call {
548- _c.Call.Return(run)
549- return _c
550-}
551-
552 // SetShortcut provides a mock function for the type MockFavoriteRepository489 // SetShortcut provides a mock function for the type MockFavoriteRepository
553 func (_mock *MockFavoriteRepository) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {490 func (_mock *MockFavoriteRepository) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
554 ret := _mock.Called(ctx, id, key)491 ret := _mock.Called(ctx, id, key)
@@ -675,408 +612,6 @@ func (_c *MockFavoriteRepository_UpdatePosition_Call) RunAndReturn(run func(ctx
675 return _c612 return _c
676 }613 }
677 614
678-// NewMockFolderRepository creates a new instance of MockFolderRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
679-// The first argument is typically a *testing.T value.
680-func NewMockFolderRepository(t interface {
681- mock.TestingT
682- Cleanup(func())
683-}) *MockFolderRepository {
684- mock := &MockFolderRepository{}
685- mock.Mock.Test(t)
686-
687- t.Cleanup(func() { mock.AssertExpectations(t) })
688-
689- return mock
690-}
691-
692-// MockFolderRepository is an autogenerated mock type for the FolderRepository type
693-type MockFolderRepository struct {
694- mock.Mock
695-}
696-
697-type MockFolderRepository_Expecter struct {
698- mock *mock.Mock
699-}
700-
701-func (_m *MockFolderRepository) EXPECT() *MockFolderRepository_Expecter {
702- return &MockFolderRepository_Expecter{mock: &_m.Mock}
703-}
704-
705-// Delete provides a mock function for the type MockFolderRepository
706-func (_mock *MockFolderRepository) Delete(ctx context.Context, id entity.FolderID) error {
707- ret := _mock.Called(ctx, id)
708-
709- if len(ret) == 0 {
710- panic("no return value specified for Delete")
711- }
712-
713- var r0 error
714- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
715- r0 = returnFunc(ctx, id)
716- } else {
717- r0 = ret.Error(0)
718- }
719- return r0
720-}
721-
722-// MockFolderRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
723-type MockFolderRepository_Delete_Call struct {
724- *mock.Call
725-}
726-
727-// Delete is a helper method to define mock.On call
728-// - ctx context.Context
729-// - id entity.FolderID
730-func (_e *MockFolderRepository_Expecter) Delete(ctx any, id any) *MockFolderRepository_Delete_Call {
731- return &MockFolderRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
732-}
733-
734-func (_c *MockFolderRepository_Delete_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_Delete_Call {
735- _c.Call.Run(func(args mock.Arguments) {
736- var arg0 context.Context
737- if args[0] != nil {
738- arg0 = args[0].(context.Context)
739- }
740- var arg1 entity.FolderID
741- if args[1] != nil {
742- arg1 = args[1].(entity.FolderID)
743- }
744- run(
745- arg0,
746- arg1,
747- )
748- })
749- return _c
750-}
751-
752-func (_c *MockFolderRepository_Delete_Call) Return(err error) *MockFolderRepository_Delete_Call {
753- _c.Call.Return(err)
754- return _c
755-}
756-
757-func (_c *MockFolderRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockFolderRepository_Delete_Call {
758- _c.Call.Return(run)
759- return _c
760-}
761-
762-// FindByID provides a mock function for the type MockFolderRepository
763-func (_mock *MockFolderRepository) FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error) {
764- ret := _mock.Called(ctx, id)
765-
766- if len(ret) == 0 {
767- panic("no return value specified for FindByID")
768- }
769-
770- var r0 *entity.Folder
771- var r1 error
772- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) (*entity.Folder, error)); ok {
773- return returnFunc(ctx, id)
774- }
775- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) *entity.Folder); ok {
776- r0 = returnFunc(ctx, id)
777- } else {
778- if ret.Get(0) != nil {
779- r0 = ret.Get(0).(*entity.Folder)
780- }
781- }
782- if returnFunc, ok := ret.Get(1).(func(context.Context, entity.FolderID) error); ok {
783- r1 = returnFunc(ctx, id)
784- } else {
785- r1 = ret.Error(1)
786- }
787- return r0, r1
788-}
789-
790-// MockFolderRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
791-type MockFolderRepository_FindByID_Call struct {
792- *mock.Call
793-}
794-
795-// FindByID is a helper method to define mock.On call
796-// - ctx context.Context
797-// - id entity.FolderID
798-func (_e *MockFolderRepository_Expecter) FindByID(ctx any, id any) *MockFolderRepository_FindByID_Call {
799- return &MockFolderRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
800-}
801-
802-func (_c *MockFolderRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_FindByID_Call {
803- _c.Call.Run(func(args mock.Arguments) {
804- var arg0 context.Context
805- if args[0] != nil {
806- arg0 = args[0].(context.Context)
807- }
808- var arg1 entity.FolderID
809- if args[1] != nil {
810- arg1 = args[1].(entity.FolderID)
811- }
812- run(
813- arg0,
814- arg1,
815- )
816- })
817- return _c
818-}
819-
820-func (_c *MockFolderRepository_FindByID_Call) Return(folder *entity.Folder, err error) *MockFolderRepository_FindByID_Call {
821- _c.Call.Return(folder, err)
822- return _c
823-}
824-
825-func (_c *MockFolderRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) (*entity.Folder, error)) *MockFolderRepository_FindByID_Call {
826- _c.Call.Return(run)
827- return _c
828-}
829-
830-// GetAll provides a mock function for the type MockFolderRepository
831-func (_mock *MockFolderRepository) GetAll(ctx context.Context) ([]*entity.Folder, error) {
832- ret := _mock.Called(ctx)
833-
834- if len(ret) == 0 {
835- panic("no return value specified for GetAll")
836- }
837-
838- var r0 []*entity.Folder
839- var r1 error
840- if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
841- return returnFunc(ctx)
842- }
843- if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
844- r0 = returnFunc(ctx)
845- } else {
846- if ret.Get(0) != nil {
847- r0 = ret.Get(0).([]*entity.Folder)
848- }
849- }
850- if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
851- r1 = returnFunc(ctx)
852- } else {
853- r1 = ret.Error(1)
854- }
855- return r0, r1
856-}
857-
858-// MockFolderRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
859-type MockFolderRepository_GetAll_Call struct {
860- *mock.Call
861-}
862-
863-// GetAll is a helper method to define mock.On call
864-// - ctx context.Context
865-func (_e *MockFolderRepository_Expecter) GetAll(ctx any) *MockFolderRepository_GetAll_Call {
866- return &MockFolderRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
867-}
868-
869-func (_c *MockFolderRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockFolderRepository_GetAll_Call {
870- _c.Call.Run(func(args mock.Arguments) {
871- var arg0 context.Context
872- if args[0] != nil {
873- arg0 = args[0].(context.Context)
874- }
875- run(
876- arg0,
877- )
878- })
879- return _c
880-}
881-
882-func (_c *MockFolderRepository_GetAll_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetAll_Call {
883- _c.Call.Return(folders, err)
884- return _c
885-}
886-
887-func (_c *MockFolderRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockFolderRepository_GetAll_Call {
888- _c.Call.Return(run)
889- return _c
890-}
891-
892-// GetChildren provides a mock function for the type MockFolderRepository
893-func (_mock *MockFolderRepository) GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error) {
894- ret := _mock.Called(ctx, parentID)
895-
896- if len(ret) == 0 {
897- panic("no return value specified for GetChildren")
898- }
899-
900- var r0 []*entity.Folder
901- var r1 error
902- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Folder, error)); ok {
903- return returnFunc(ctx, parentID)
904- }
905- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Folder); ok {
906- r0 = returnFunc(ctx, parentID)
907- } else {
908- if ret.Get(0) != nil {
909- r0 = ret.Get(0).([]*entity.Folder)
910- }
911- }
912- if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {
913- r1 = returnFunc(ctx, parentID)
914- } else {
915- r1 = ret.Error(1)
916- }
917- return r0, r1
918-}
919-
920-// MockFolderRepository_GetChildren_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChildren'
921-type MockFolderRepository_GetChildren_Call struct {
922- *mock.Call
923-}
924-
925-// GetChildren is a helper method to define mock.On call
926-// - ctx context.Context
927-// - parentID *entity.FolderID
928-func (_e *MockFolderRepository_Expecter) GetChildren(ctx any, parentID any) *MockFolderRepository_GetChildren_Call {
929- return &MockFolderRepository_GetChildren_Call{Call: _e.mock.On("GetChildren", ctx, parentID)}
930-}
931-
932-func (_c *MockFolderRepository_GetChildren_Call) Run(run func(ctx context.Context, parentID *entity.FolderID)) *MockFolderRepository_GetChildren_Call {
933- _c.Call.Run(func(args mock.Arguments) {
934- var arg0 context.Context
935- if args[0] != nil {
936- arg0 = args[0].(context.Context)
937- }
938- var arg1 *entity.FolderID
939- if args[1] != nil {
940- arg1 = args[1].(*entity.FolderID)
941- }
942- run(
943- arg0,
944- arg1,
945- )
946- })
947- return _c
948-}
949-
950-func (_c *MockFolderRepository_GetChildren_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetChildren_Call {
951- _c.Call.Return(folders, err)
952- return _c
953-}
954-
955-func (_c *MockFolderRepository_GetChildren_Call) RunAndReturn(run func(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)) *MockFolderRepository_GetChildren_Call {
956- _c.Call.Return(run)
957- return _c
958-}
959-
960-// Save provides a mock function for the type MockFolderRepository
961-func (_mock *MockFolderRepository) Save(ctx context.Context, folder *entity.Folder) error {
962- ret := _mock.Called(ctx, folder)
963-
964- if len(ret) == 0 {
965- panic("no return value specified for Save")
966- }
967-
968- var r0 error
969- if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Folder) error); ok {
970- r0 = returnFunc(ctx, folder)
971- } else {
972- r0 = ret.Error(0)
973- }
974- return r0
975-}
976-
977-// MockFolderRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
978-type MockFolderRepository_Save_Call struct {
979- *mock.Call
980-}
981-
982-// Save is a helper method to define mock.On call
983-// - ctx context.Context
984-// - folder *entity.Folder
985-func (_e *MockFolderRepository_Expecter) Save(ctx any, folder any) *MockFolderRepository_Save_Call {
986- return &MockFolderRepository_Save_Call{Call: _e.mock.On("Save", ctx, folder)}
987-}
988-
989-func (_c *MockFolderRepository_Save_Call) Run(run func(ctx context.Context, folder *entity.Folder)) *MockFolderRepository_Save_Call {
990- _c.Call.Run(func(args mock.Arguments) {
991- var arg0 context.Context
992- if args[0] != nil {
993- arg0 = args[0].(context.Context)
994- }
995- var arg1 *entity.Folder
996- if args[1] != nil {
997- arg1 = args[1].(*entity.Folder)
998- }
999- run(
1000- arg0,
1001- arg1,
1002- )
1003- })
1004- return _c
1005-}
1006-
1007-func (_c *MockFolderRepository_Save_Call) Return(err error) *MockFolderRepository_Save_Call {
1008- _c.Call.Return(err)
1009- return _c
1010-}
1011-
1012-func (_c *MockFolderRepository_Save_Call) RunAndReturn(run func(ctx context.Context, folder *entity.Folder) error) *MockFolderRepository_Save_Call {
1013- _c.Call.Return(run)
1014- return _c
1015-}
1016-
1017-// UpdatePosition provides a mock function for the type MockFolderRepository
1018-func (_mock *MockFolderRepository) UpdatePosition(ctx context.Context, id entity.FolderID, position int) error {
1019- ret := _mock.Called(ctx, id, position)
1020-
1021- if len(ret) == 0 {
1022- panic("no return value specified for UpdatePosition")
1023- }
1024-
1025- var r0 error
1026- if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, int) error); ok {
1027- r0 = returnFunc(ctx, id, position)
1028- } else {
1029- r0 = ret.Error(0)
1030- }
1031- return r0
1032-}
1033-
1034-// MockFolderRepository_UpdatePosition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePosition'
1035-type MockFolderRepository_UpdatePosition_Call struct {
1036- *mock.Call
1037-}
1038-
1039-// UpdatePosition is a helper method to define mock.On call
1040-// - ctx context.Context
1041-// - id entity.FolderID
1042-// - position int
1043-func (_e *MockFolderRepository_Expecter) UpdatePosition(ctx any, id any, position any) *MockFolderRepository_UpdatePosition_Call {
1044- return &MockFolderRepository_UpdatePosition_Call{Call: _e.mock.On("UpdatePosition", ctx, id, position)}
1045-}
1046-
1047-func (_c *MockFolderRepository_UpdatePosition_Call) Run(run func(ctx context.Context, id entity.FolderID, position int)) *MockFolderRepository_UpdatePosition_Call {
1048- _c.Call.Run(func(args mock.Arguments) {
1049- var arg0 context.Context
1050- if args[0] != nil {
1051- arg0 = args[0].(context.Context)
1052- }
1053- var arg1 entity.FolderID
1054- if args[1] != nil {
1055- arg1 = args[1].(entity.FolderID)
1056- }
1057- var arg2 int
1058- if args[2] != nil {
1059- arg2 = args[2].(int)
1060- }
1061- run(
1062- arg0,
1063- arg1,
1064- arg2,
1065- )
1066- })
1067- return _c
1068-}
1069-
1070-func (_c *MockFolderRepository_UpdatePosition_Call) Return(err error) *MockFolderRepository_UpdatePosition_Call {
1071- _c.Call.Return(err)
1072- return _c
1073-}
1074-
1075-func (_c *MockFolderRepository_UpdatePosition_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, position int) error) *MockFolderRepository_UpdatePosition_Call {
1076- _c.Call.Return(run)
1077- return _c
1078-}
1079-
1080 // NewMockTagRepository creates a new instance of MockTagRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.615 // NewMockTagRepository creates a new instance of MockTagRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1081 // The first argument is typically a *testing.T value.616 // The first argument is typically a *testing.T value.
1082 func NewMockTagRepository(t interface {617 func NewMockTagRepository(t interface {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close