Skip to content

Commit d385e16

Browse files
committed
major refactor and add openapi specification 3 to document the api
When correcting a bookmark as admin use the new adminservice and not abuse the PersonalService as until now refactor - rename "shared" to "public" on bookmark refactor - change "likes" to "likeCount" for number of likes on bookmark fix - set "descriptionHtml" when "description" is present clean api - hide field '__v' from api return clean api - hide field 'lastAccessedAt' from api return refactor - rename field 'githubURL' to 'sourceCodeURL' remove unused attribute "category" start editing swagger.yaml refactor - return empty array instead of NOT_FOUND for missing location move scrape endopoint to own router and start with openapi document scrape endpoint in open-api return empty list when looking in personal bookmarks by location improve openapi documentation allow search in personal bookmarks with special filters only allow search in public bookmarks with special filters only add examples to create bookmark and queryParam add stack to error messages when in development rename const to correspond the Error name add create index operation to mongo init script add error types to open api definition and do some corrections there fix openapi and overwrite httpStatus for validation error openapi - move userId and bookmarkId to schema/parameters section openapi - add enum for queryParam update error message by deletion openapi - add batch delete operation to api docs openapi - document suggested-tags method and add missing forbidden 403 openapi - add tags and version endpoint openapi - add tags to the root enable to establish the order of showing In swager-ui openapi - add empty line
1 parent 9dd0c07 commit d385e16

32 files changed

+1190
-331
lines changed

README-docker-compose.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ http://localhost:8480/auth/admin
4141

4242

4343
### Connect to mongo
44+
```
45+
docker exec -it bookmarks-api_mongo /bin/bash
46+
4447
mongo -u bookmarks -p --authenticationDatabase dev-bookmarks
48+
use dev-bookmarks;
49+
50+
4551
db.changeUserPassword("bookmarks", "secret")
52+
```
53+
4654

4755
### echo environment variables
4856
#### mongo

docker-compose-setup/init-mongo.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ db.bookmarks.insert(
3030
"description": "Coding knowledge hub, providing free educational content for professionals involved in software development. The website covers different topics and technologies with posts whose difficulty levels range from beginner to “hard-core” programming.",
3131
"descriptionHtml": "<p>Coding knowledge hub, providing free educational content for professionals involved in software development. The website covers different topics and technologies with posts whose difficulty levels range from beginner to “hard-core” programming.</p>",
3232
"publishedOn": null,
33-
"githubURL": "",
34-
"shared": true,
33+
"sourceCodeURL": "",
34+
"public": true,
3535
"lastAccessedAt": ISODate("2019-10-23T12:22:10.480Z"),
36-
"likes": 0,
36+
"likeCount": 0,
3737
"createdAt": ISODate("2019-10-23T12:22:10.526Z"),
3838
"updatedAt": ISODate("2019-10-23T12:22:10.526Z"),
3939
"__v": 0
@@ -51,10 +51,10 @@ db.bookmarks.insert(
5151
"description": "Bookmarks Manager for Developers & Co",
5252
"descriptionHtml": "<p>Bookmarks Manager for Developers &amp; Co</p>",
5353
"publishedOn": null,
54-
"githubURL": "https://github.com/CodepediaOrg/bookmarks.dev",
55-
"shared": true,
54+
"sourceCodeURL": "https://github.com/CodepediaOrg/bookmarks.dev",
55+
"public": true,
5656
"lastAccessedAt": ISODate("2019-10-23T12:23:53.471Z"),
57-
"likes": 0,
57+
"likeCount": 0,
5858
"createdAt": ISODate("2019-10-23T12:23:53.486Z"),
5959
"updatedAt": ISODate("2019-10-23T12:23:53.486Z"),
6060
"__v": 0
@@ -73,10 +73,10 @@ db.bookmarks.insert(
7373
"description": ":bookmark: :star: Collection of public dev bookmarks, shared with :heart: from www.bookmarks.dev - CodepediaOrg/bookmarks",
7474
"descriptionHtml": "<p>:bookmark: :star: Collection of public dev bookmarks, shared with :heart: from www.bookmarks.dev - CodepediaOrg/bookmarks</p>",
7575
"publishedOn": null,
76-
"githubURL": "https://github.com/CodepediaOrg/bookmarks",
77-
"shared": true,
76+
"sourceCodeURL": "https://github.com/CodepediaOrg/bookmarks",
77+
"public": true,
7878
"lastAccessedAt": ISODate("2019-10-23T12:24:50.804Z"),
79-
"likes": 0,
79+
"likeCount": 0,
8080
"createdAt": ISODate("2019-10-23T12:24:50.823Z"),
8181
"updatedAt": ISODate("2019-10-23T12:24:50.823Z"),
8282
"__v": 0
@@ -90,18 +90,26 @@ db.bookmarks.createIndex(
9090
location: "text",
9191
description: "text",
9292
tags: "text",
93-
githubURL: "text",
93+
sourceCodeURL: "text",
9494
},
9595
{
9696
weights: {
9797
name: 2,
98-
location: 3,
98+
location: 5,
9999
description: 1,
100100
tags: 3,
101-
githubURL: 1
101+
sourceCodeURL: 1
102102
},
103103
name: "full_text_search",
104104
default_language: "none",
105105
language_override: "none"
106106
}
107107
);
108+
109+
db.bookmarks.createIndex(
110+
{ location: 1, userId:1 },
111+
{
112+
unique: true,
113+
name:"unique_user_and_location"
114+
}
115+
);

0 commit comments

Comments
 (0)