@@ -16,7 +16,7 @@ router.get('/', async (request, response, next) => {
16
16
const sort = request . query . sort ;
17
17
const { page, limit} = PaginationQueryParamsHelper . getPageAndLimit ( request ) ;
18
18
19
- if ( searchText ) {
19
+ if ( searchText ) {
20
20
const bookmarks = await publicBookmarksSearchService . findPublicBookmarks ( searchText , page , limit , sort , searcMode ) ;
21
21
response . send ( bookmarks ) ;
22
22
} else {
@@ -29,7 +29,7 @@ router.get('/', async (request, response, next) => {
29
29
*/
30
30
router . get ( '/' , async ( request , response , next ) => {
31
31
const location = request . query . location ;
32
- if ( location ) {
32
+ if ( location ) {
33
33
const bookmarksForLocation = await PublicBookmarksService . getPublicBookmarkByLocation ( location ) ;
34
34
35
35
return response . send ( bookmarksForLocation ) ;
@@ -38,11 +38,20 @@ router.get('/', async (request, response, next) => {
38
38
}
39
39
} ) ;
40
40
41
+ /**
42
+ * Get Bookmark by shareableId
43
+ */
44
+ router . get ( '/shared/:shareableId' , async ( request , response , next ) => {
45
+ const shareableId = request . params . shareableId ;
46
+ const sharedBookmark = await PublicBookmarksService . getBookmarkBySharableId ( shareableId ) ;
47
+
48
+ return response . json ( sharedBookmark ) ;
49
+ } ) ;
50
+
41
51
/**
42
52
* When no filter send latest public bookmarks
43
53
*/
44
54
router . get ( '/' , async ( request , response ) => {
45
-
46
55
const { page, limit} = PaginationQueryParamsHelper . getPageAndLimit ( request ) ;
47
56
const bookmarks = await PublicBookmarksService . getLatestPublicBookmarks ( page , limit ) ;
48
57
@@ -71,7 +80,7 @@ router.get('/tagged/:tag', async (request, response) => {
71
80
/* GET title of bookmark given its url - might be moved to front-end */
72
81
router . get ( '/scrape' , async function ( request , response , next ) {
73
82
const location = request . query . location ;
74
- if ( location ) {
83
+ if ( location ) {
75
84
const webpageData = await PublicBookmarksService . getScrapedDataForLocation ( location ) ;
76
85
77
86
return response . send ( webpageData ) ;
0 commit comments