Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(apiv1): accounts api #825

Open
wants to merge 116 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
463f16f
list account and create account
fmartingr Jan 27, 2024
795b39c
deleteaccount (wip)
fmartingr Feb 4, 2024
14e54a4
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Jun 3, 2024
da169fe
remove old accounts code
fmartingr Jun 3, 2024
8c02f9d
fix from merge
fmartingr Jun 3, 2024
e88bfe3
remove serve method from makefile
fmartingr Jun 3, 2024
21d3066
ListAccounts, password hash on domain
fmartingr Jun 3, 2024
56f441e
make lint
fmartingr Jun 3, 2024
0835804
more permissive assertion
fmartingr Jun 3, 2024
744b2d5
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Jun 3, 2024
7c09384
rename test
fmartingr Jun 3, 2024
fee6cf7
update account
fmartingr Jun 3, 2024
4f41104
Authorization
fmartingr Jun 4, 2024
a397c59
updated api calls
fmartingr Jun 4, 2024
6ba4722
apis, pointers, auth
fmartingr Jun 4, 2024
e126bee
swagger
fmartingr Jun 4, 2024
a90e01a
stylecheck
fmartingr Jun 4, 2024
eaf10f2
APIv1: Accounts
fmartingr Jun 6, 2024
64f533d
Merge remote-tracking branch 'origin' into fmartingr/issue657
fmartingr Jun 8, 2024
b79340a
domain validation
fmartingr Jun 8, 2024
9c48019
tests
fmartingr Jun 8, 2024
046863c
swagger
fmartingr Jun 8, 2024
3069f00
error handling
fmartingr Jun 8, 2024
1dcf601
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Jun 8, 2024
2ba22f2
fix system account changes
fmartingr Jun 8, 2024
7618d4a
Cleanup database interface
fmartingr Jun 8, 2024
4386df7
test cleanup
fmartingr Jun 8, 2024
ed7027e
fixed nil references
fmartingr Jun 8, 2024
a91515c
Merge branch 'master' into fmartingr/issue657
fmartingr Aug 27, 2024
eef7a6b
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Dec 21, 2024
44ba621
feat: Add logout endpoint to auth routes
fmartingr Dec 21, 2024
6773a48
feat: Add logoutHandler for stateless JWT token logout
fmartingr Dec 21, 2024
9615c6f
fixed some bug catched in tests
fmartingr Dec 21, 2024
44ba938
auth/account patch
fmartingr Dec 22, 2024
72c5459
prettier
fmartingr Dec 22, 2024
0903c48
remove test logs
fmartingr Dec 22, 2024
09713e6
fixed incorrect number of parameters
fmartingr Dec 22, 2024
e2801ea
Merge branch 'master' into fmartingr/issue657
fmartingr Dec 22, 2024
0794e12
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Dec 22, 2024
da30237
Merge branch 'fmartingr/issue657' of github.com:go-shiori/shiori into…
fmartingr Dec 22, 2024
b451b43
fixed swagger docs
fmartingr Dec 22, 2024
6ad75ba
enable swagger in dev environment
fmartingr Dec 22, 2024
9af5528
errors.Wrap -> fmt.Errorf
fmartingr Dec 22, 2024
41bca47
test: Add comprehensive test cases for accounts API handlers
fmartingr Dec 22, 2024
94ee6c3
fix: Resolve test failures in accounts_test.go
fmartingr Dec 22, 2024
7c22944
test: Add tests for duplicate username handling in account creation a…
fmartingr Dec 22, 2024
222efbc
feat: Add username uniqueness checks for account creation and update
fmartingr Dec 22, 2024
62b4fc3
linted
fmartingr Dec 22, 2024
7f24a68
Merge branch 'master' into fmartingr/issue657
fmartingr Dec 22, 2024
9a81510
test: Add comprehensive tests for auth domain token and credential va…
fmartingr Dec 22, 2024
c9e87f2
test: Add comprehensive test cases for auth domain token creation and…
fmartingr Dec 22, 2024
71d8f6c
test: Add comprehensive error handling test cases for accounts domain
fmartingr Dec 22, 2024
ada2910
refactor: Remove `SaveAccountSettings` method from database implement…
fmartingr Dec 23, 2024
61ba0d2
test: Add test cases for password update functionality
fmartingr Dec 23, 2024
96846c5
test(e2e): auth login
fmartingr Dec 23, 2024
c1efe01
lint
fmartingr Dec 23, 2024
9734436
send regular context to domain
fmartingr Dec 24, 2024
fa6fc0d
fixed e2e auth tests
fmartingr Dec 24, 2024
55d0711
test: Add auth_test.go for end-to-end authentication testing
fmartingr Dec 24, 2024
81d8317
feat: Add comprehensive authentication tests using Playwright and tes…
fmartingr Dec 24, 2024
e26ba53
fix: Handle multiple return values in Playwright test methods
fmartingr Dec 24, 2024
a9b086d
error message
fmartingr Dec 24, 2024
989137c
e2e playwrigth tests
fmartingr Dec 24, 2024
a598034
ci: setup playwrigth
fmartingr Dec 24, 2024
4700b54
refactor: Update Playwright tests to use locator-based API
fmartingr Dec 24, 2024
a18f347
refactor: Remove unnecessary alias for playwright-go expect import
fmartingr Dec 24, 2024
98cde25
refactor: Replace deprecated expect package with WaitFor() method in …
fmartingr Dec 24, 2024
a887677
fix: Resolve linting issues in e2e Playwright tests
fmartingr Dec 24, 2024
02104d1
remove npm ci from e2e ci
fmartingr Dec 24, 2024
a52b374
make playwright available in path
fmartingr Dec 25, 2024
bf3bb33
typo
fmartingr Dec 25, 2024
5ff058a
re enabled ci
fmartingr Dec 25, 2024
0ed8e85
base e2e accounts test
fmartingr Dec 26, 2024
fdbcec7
more account e2e
fmartingr Dec 27, 2024
6a602d9
feat: Add HTML test reporter with screenshots and detailed results
fmartingr Dec 27, 2024
2d25209
feat: Embed screenshots as base64 in HTML test report
fmartingr Dec 27, 2024
09adfb4
refactor: Remove GitHub step summary functionality from test helper
fmartingr Dec 27, 2024
3cf1d34
refactor: Make reporter global to share test results across test helpers
fmartingr Dec 27, 2024
6ba8dea
refactor: Add HandleSuccess method to TestHelper for consistent test …
fmartingr Dec 27, 2024
9af21f7
feat: Add descriptive messages to all test assertions in TestHelper
fmartingr Dec 27, 2024
c14dc3f
test: Add descriptive messages to assertions in accounts_test.go
fmartingr Dec 27, 2024
dfcada7
test: Add descriptive error messages to assertions in accounts_test.go
fmartingr Dec 27, 2024
a8f1380
feat: Add descriptive messages to assertions in accounts_test.go
fmartingr Dec 27, 2024
491575c
refactor: Update assertion functions to receive *testing.T as first a…
fmartingr Dec 27, 2024
6a6a8e4
refactor: Update accounts_test.go assertions to pass *testing.T argument
fmartingr Dec 27, 2024
83253d8
refactor: Update accounts_test.go assertions to use *testing.T argument
fmartingr Dec 27, 2024
ef69a6d
refactor: Update `accounts_test.go` to use `*testing.T` argument in `…
fmartingr Dec 27, 2024
ad15ad6
refactor: Update `th.Require()` calls with `t *testing.T` argument in…
fmartingr Dec 27, 2024
64b243c
assert helper
fmartingr Dec 27, 2024
4e060ab
refactor: Refactor `False` test helper to use `Assert` function consi…
fmartingr Dec 27, 2024
12d3364
refactor: Refactor `Equal` test helper to use `Assert` function
fmartingr Dec 27, 2024
35e2c46
refactor: Simplify Error test helper to use Assert function
fmartingr Dec 27, 2024
dbd42f0
refactor: Refactor `NoError` to use `Assert` function for consistent …
fmartingr Dec 27, 2024
0fa8dad
typo
fmartingr Dec 27, 2024
f4d2382
refactor: Differentiate between test cases and assertions in reporter
fmartingr Dec 27, 2024
3cbc10e
refactor: Simplify AddResult method signature and use error message f…
fmartingr Dec 27, 2024
8f26319
refactor: Simplify test report with focused failure details and scree…
fmartingr Dec 27, 2024
1003fbb
refactor: Ensure assertions are always called in PlaywrightRequire he…
fmartingr Dec 27, 2024
e364085
refactor: Update test error messages to be action-oriented
fmartingr Dec 27, 2024
6bcd28c
refactor: Update error messages to be more action-oriented in account…
fmartingr Dec 27, 2024
7c3b260
refactor: Update error messages to be action-oriented in accounts_tes…
fmartingr Dec 27, 2024
171a567
refactor: Improve error messages in auth_test.go for better test read…
fmartingr Dec 27, 2024
896700c
refactor: Improve screenshot handling and test result reporting in Pl…
fmartingr Dec 27, 2024
d1c8906
fix: Improve test reporting with detailed error messages and logging
fmartingr Dec 27, 2024
7a835bf
refactor: Remove unused runningInCI field from TestHelper struct
fmartingr Dec 27, 2024
6be9d8f
fix: Improve message formatting in Assert method for better reporting
fmartingr Dec 27, 2024
ee49d48
assertions
fmartingr Dec 27, 2024
9b7c389
test: Add `Require()` calls to 007 test for improved error handling
fmartingr Dec 27, 2024
4aa650c
refactor: Update test reporter to include error details and improve H…
fmartingr Dec 27, 2024
bbf260c
fix: Properly escape and render base64 screenshot in HTML report
fmartingr Dec 27, 2024
144168a
fix: Correct base64 screenshot rendering in test reporter
fmartingr Dec 27, 2024
7d77aab
fixed tests + html report
fmartingr Dec 27, 2024
3953ce7
feat: Add artifact upload for e2e test report
fmartingr Dec 27, 2024
b051ede
make lint
fmartingr Dec 27, 2024
f24f367
Merge branch 'master' into fmartingr/issue657
fmartingr Jan 2, 2025
dbb8ad7
Merge remote-tracking branch 'origin/master' into fmartingr/issue657
fmartingr Jan 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ help:
clean:
rm -rf dist

## Runs the legacy http API for local development
.PHONY: serve
serve:
SHIORI_DEVELOPMENT=$(SHIORI_DEVELOPMENT) SHIORI_DIR=$(SHIORI_DIR) go run main.go serve

## Runs server for local development
.PHONY: run-server
run-server:
Expand Down
153 changes: 142 additions & 11 deletions docs/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,124 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/accounts": {
"get": {
"description": "List accounts",
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "List accounts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Create an account",
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/accounts/{id}": {
"delete": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Delete an account",
"responses": {
"204": {
"description": "No content",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"patch": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Update an account",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/auth/account": {
"patch": {
"produces": [
Expand All @@ -23,14 +141,14 @@ const docTemplate = `{
"tags": [
"Auth"
],
"summary": "Perform actions on the currently logged-in user.",
"summary": "Update account information",
"parameters": [
{
"description": "Config data",
"description": "Account data",
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api_v1.settingRequestPayload"
"$ref": "#/definitions/model.AccountDTO"
}
}
],
Expand Down Expand Up @@ -321,14 +439,6 @@ const docTemplate = `{
}
}
},
"api_v1.settingRequestPayload": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
}
}
},
"api_v1.updateCachePayload": {
"type": "object",
"required": [
Expand Down Expand Up @@ -375,6 +485,27 @@ const docTemplate = `{
}
}
},
"model.AccountDTO": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"id": {
"type": "integer"
},
"owner": {
"type": "boolean"
},
"passowrd": {
"description": "Used only to store, not to retrieve",
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.BookmarkDTO": {
"type": "object",
"properties": {
Expand Down
153 changes: 142 additions & 11 deletions docs/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,124 @@
"contact": {}
},
"paths": {
"/api/v1/accounts": {
"get": {
"description": "List accounts",
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "List accounts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Create an account",
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/accounts/{id}": {
"delete": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Delete an account",
"responses": {
"204": {
"description": "No content",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"patch": {
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Update an account",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.AccountDTO"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/auth/account": {
"patch": {
"produces": [
Expand All @@ -12,14 +130,14 @@
"tags": [
"Auth"
],
"summary": "Perform actions on the currently logged-in user.",
"summary": "Update account information",
"parameters": [
{
"description": "Config data",
"description": "Account data",
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api_v1.settingRequestPayload"
"$ref": "#/definitions/model.AccountDTO"
}
}
],
Expand Down Expand Up @@ -310,14 +428,6 @@
}
}
},
"api_v1.settingRequestPayload": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
}
}
},
"api_v1.updateCachePayload": {
"type": "object",
"required": [
Expand Down Expand Up @@ -364,6 +474,27 @@
}
}
},
"model.AccountDTO": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"id": {
"type": "integer"
},
"owner": {
"type": "boolean"
},
"passowrd": {
"description": "Used only to store, not to retrieve",
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.BookmarkDTO": {
"type": "object",
"properties": {
Expand Down
Loading
Loading