Skip to content

Commit d419818

Browse files
authored
feat: add apis to handle bookmark tags (#1081)
* feat: add tag search api * feat: add apis to add/remove bookmark tags * chore: removed debug logger * docs: updated swagger * test: added tests * test: invalid ids * feat: webapp v2 * chore: updated swagger * fix: route params missing * feat: added cors middleware * feat: built api implementation * feat: implemented login in webapp * feat; dark mode in web app * feat: labels + i18n * refactor: remove custom message output in json apis * docs: updated swagger * chore: make lint * chore: make styles * fix: include new webapp dist files (for now)
1 parent 21165aa commit d419818

File tree

128 files changed

+14249
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+14249
-465
lines changed

.cursorrules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Shiori Test Commands
2+
3+
# Run the entire test suite
4+
make unittest
5+
6+
# Run SQLite database tests only
7+
go test -timeout 10s -count=1 -tags test_sqlite_only ./internal/database

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
e2e-report.html
1717

1818
# Dist files
19-
dist/
19+
/dist
2020

2121
# macOS trash files
2222
.DS_Store

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ clean:
6767
## Runs server for local development
6868
.PHONY: run-server
6969
run-server: generate
70-
GIN_MODE=$(GIN_MODE) SHIORI_DEVELOPMENT=$(SHIORI_DEVELOPMENT) SHIORI_DIR=$(SHIORI_DIR) SHIORI_HTTP_SECRET_KEY=shiori SHIORI_HTTP_SERVE_SWAGGER=true go run main.go server --log-level debug
70+
GIN_MODE=$(GIN_MODE) SHIORI_DEVELOPMENT=$(SHIORI_DEVELOPMENT) go run main.go server --log-level debug
71+
72+
## Runs server for local development with v2 web UI
73+
.PHONY: run-server-v2
74+
run-server-v2: generate
75+
GIN_MODE=$(GIN_MODE) SHIORI_DEVELOPMENT=$(SHIORI_DEVELOPMENT) SHIORI_HTTP_SERVE_WEB_UI_V2=true go run main.go server --log-level debug
7176

7277
## Generate swagger docs
7378
.PHONY: swagger

docs/swagger/docs.go

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,119 @@ const docTemplate = `{
384384
}
385385
}
386386
},
387+
"/api/v1/bookmarks/{id}/tags": {
388+
"get": {
389+
"produces": [
390+
"application/json"
391+
],
392+
"tags": [
393+
"Auth"
394+
],
395+
"summary": "Get tags for a bookmark.",
396+
"parameters": [
397+
{
398+
"type": "integer",
399+
"description": "Bookmark ID",
400+
"name": "id",
401+
"in": "path",
402+
"required": true
403+
}
404+
],
405+
"responses": {
406+
"200": {
407+
"description": "OK",
408+
"schema": {
409+
"type": "array",
410+
"items": {
411+
"$ref": "#/definitions/model.TagDTO"
412+
}
413+
}
414+
},
415+
"403": {
416+
"description": "Token not provided/invalid"
417+
},
418+
"404": {
419+
"description": "Bookmark not found"
420+
}
421+
}
422+
},
423+
"post": {
424+
"produces": [
425+
"application/json"
426+
],
427+
"tags": [
428+
"Auth"
429+
],
430+
"summary": "Add a tag to a bookmark.",
431+
"parameters": [
432+
{
433+
"type": "integer",
434+
"description": "Bookmark ID",
435+
"name": "id",
436+
"in": "path",
437+
"required": true
438+
},
439+
{
440+
"description": "Add Tag Payload",
441+
"name": "payload",
442+
"in": "body",
443+
"required": true,
444+
"schema": {
445+
"$ref": "#/definitions/api_v1.bookmarkTagPayload"
446+
}
447+
}
448+
],
449+
"responses": {
450+
"200": {
451+
"description": "OK"
452+
},
453+
"403": {
454+
"description": "Token not provided/invalid"
455+
},
456+
"404": {
457+
"description": "Bookmark or tag not found"
458+
}
459+
}
460+
},
461+
"delete": {
462+
"produces": [
463+
"application/json"
464+
],
465+
"tags": [
466+
"Auth"
467+
],
468+
"summary": "Remove a tag from a bookmark.",
469+
"parameters": [
470+
{
471+
"type": "integer",
472+
"description": "Bookmark ID",
473+
"name": "id",
474+
"in": "path",
475+
"required": true
476+
},
477+
{
478+
"description": "Remove Tag Payload",
479+
"name": "payload",
480+
"in": "body",
481+
"required": true,
482+
"schema": {
483+
"$ref": "#/definitions/api_v1.bookmarkTagPayload"
484+
}
485+
}
486+
],
487+
"responses": {
488+
"200": {
489+
"description": "OK"
490+
},
491+
"403": {
492+
"description": "Token not provided/invalid"
493+
},
494+
"404": {
495+
"description": "Bookmark not found"
496+
}
497+
}
498+
}
499+
},
387500
"/api/v1/system/info": {
388501
"get": {
389502
"description": "Get general system information like Shiori version, database, and OS",
@@ -429,6 +542,12 @@ const docTemplate = `{
429542
"description": "Filter tags by bookmark ID",
430543
"name": "bookmark_id",
431544
"in": "query"
545+
},
546+
{
547+
"type": "string",
548+
"description": "Search tags by name",
549+
"name": "search",
550+
"in": "query"
432551
}
433552
],
434553
"responses": {
@@ -612,6 +731,17 @@ const docTemplate = `{
612731
}
613732
},
614733
"definitions": {
734+
"api_v1.bookmarkTagPayload": {
735+
"type": "object",
736+
"required": [
737+
"tag_id"
738+
],
739+
"properties": {
740+
"tag_id": {
741+
"type": "integer"
742+
}
743+
}
744+
},
615745
"api_v1.bulkUpdateBookmarkTagsPayload": {
616746
"type": "object",
617747
"required": [

docs/swagger/swagger.json

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,119 @@
373373
}
374374
}
375375
},
376+
"/api/v1/bookmarks/{id}/tags": {
377+
"get": {
378+
"produces": [
379+
"application/json"
380+
],
381+
"tags": [
382+
"Auth"
383+
],
384+
"summary": "Get tags for a bookmark.",
385+
"parameters": [
386+
{
387+
"type": "integer",
388+
"description": "Bookmark ID",
389+
"name": "id",
390+
"in": "path",
391+
"required": true
392+
}
393+
],
394+
"responses": {
395+
"200": {
396+
"description": "OK",
397+
"schema": {
398+
"type": "array",
399+
"items": {
400+
"$ref": "#/definitions/model.TagDTO"
401+
}
402+
}
403+
},
404+
"403": {
405+
"description": "Token not provided/invalid"
406+
},
407+
"404": {
408+
"description": "Bookmark not found"
409+
}
410+
}
411+
},
412+
"post": {
413+
"produces": [
414+
"application/json"
415+
],
416+
"tags": [
417+
"Auth"
418+
],
419+
"summary": "Add a tag to a bookmark.",
420+
"parameters": [
421+
{
422+
"type": "integer",
423+
"description": "Bookmark ID",
424+
"name": "id",
425+
"in": "path",
426+
"required": true
427+
},
428+
{
429+
"description": "Add Tag Payload",
430+
"name": "payload",
431+
"in": "body",
432+
"required": true,
433+
"schema": {
434+
"$ref": "#/definitions/api_v1.bookmarkTagPayload"
435+
}
436+
}
437+
],
438+
"responses": {
439+
"200": {
440+
"description": "OK"
441+
},
442+
"403": {
443+
"description": "Token not provided/invalid"
444+
},
445+
"404": {
446+
"description": "Bookmark or tag not found"
447+
}
448+
}
449+
},
450+
"delete": {
451+
"produces": [
452+
"application/json"
453+
],
454+
"tags": [
455+
"Auth"
456+
],
457+
"summary": "Remove a tag from a bookmark.",
458+
"parameters": [
459+
{
460+
"type": "integer",
461+
"description": "Bookmark ID",
462+
"name": "id",
463+
"in": "path",
464+
"required": true
465+
},
466+
{
467+
"description": "Remove Tag Payload",
468+
"name": "payload",
469+
"in": "body",
470+
"required": true,
471+
"schema": {
472+
"$ref": "#/definitions/api_v1.bookmarkTagPayload"
473+
}
474+
}
475+
],
476+
"responses": {
477+
"200": {
478+
"description": "OK"
479+
},
480+
"403": {
481+
"description": "Token not provided/invalid"
482+
},
483+
"404": {
484+
"description": "Bookmark not found"
485+
}
486+
}
487+
}
488+
},
376489
"/api/v1/system/info": {
377490
"get": {
378491
"description": "Get general system information like Shiori version, database, and OS",
@@ -418,6 +531,12 @@
418531
"description": "Filter tags by bookmark ID",
419532
"name": "bookmark_id",
420533
"in": "query"
534+
},
535+
{
536+
"type": "string",
537+
"description": "Search tags by name",
538+
"name": "search",
539+
"in": "query"
421540
}
422541
],
423542
"responses": {
@@ -601,6 +720,17 @@
601720
}
602721
},
603722
"definitions": {
723+
"api_v1.bookmarkTagPayload": {
724+
"type": "object",
725+
"required": [
726+
"tag_id"
727+
],
728+
"properties": {
729+
"tag_id": {
730+
"type": "integer"
731+
}
732+
}
733+
},
604734
"api_v1.bulkUpdateBookmarkTagsPayload": {
605735
"type": "object",
606736
"required": [

0 commit comments

Comments
 (0)