mirror of
https://github.com/go-shiori/shiori.git
synced 2026-04-25 06:25:54 +03:00
[PR #825] [MERGED] refactor(apiv1): accounts api #809
Labels
No labels
component:backend
component:builds
component:builds
component:extension
component:frontend
component:readability
database
database:mysql
database:postgres
database:sqlite
feature:ebooks
github_actions
good first issue
hacktoberfest
note:duplicate?
note:fixed?
note:out-of-scope?
os:windows
priority:high
priority:low
pull-request
resolution:as-intended
resolution:cant-reproduce
resolution:duplicate
resolution:fixed
resolution:wontfix
tag:TBD
tag:big-task
tag:help-wanted
tag:huge-data
tag:meta
tag:more-info
tag:next
tag:no-stale
tag:requires-migrations
tag:research
tag:security 🛡️
tag:stale
tag:waiting-for-assignee
type:bug
type:documentation
type:enhancement
type:meta
type:ux
user:cli
user:web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shiori#809
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/go-shiori/shiori/pull/825
Author: @fmartingr
Created: 1/27/2024
Status: ✅ Merged
Merged: 2/22/2025
Merged by: @fmartingr
Base:
master← Head:fmartingr/issue657📝 Commits (10+)
463f16flist account and create account795b39cdeleteaccount (wip)14e54a4Merge remote-tracking branch 'origin/master' into fmartingr/issue657da169feremove old accounts code8c02f9dfix from mergee88bfe3remove serve method from makefile21d3066ListAccounts, password hash on domain56f441emake lint0835804more permissive assertion744b2d5Merge remote-tracking branch 'origin/master' into fmartingr/issue657📊 Changes
67 files changed (+3816 additions, -1038 deletions)
View changed files
➖
.githooks/pre-commit(+0 -11)📝
.github/workflows/_e2e.yml(+13 -0)📝
.gitignore(+2 -1)📝
Makefile(+3 -3)📝
docs/swagger/docs.go(+174 -4)📝
docs/swagger/swagger.json(+174 -4)📝
docs/swagger/swagger.yaml(+115 -4)📝
e2e/e2eutil/containers.go(+6 -6)➕
e2e/playwright/accounts_test.go(+412 -0)➕
e2e/playwright/auth_test.go(+159 -0)➕
e2e/playwright/playwright_test.go(+7 -0)➕
e2e/playwright/reporter.go(+158 -0)➕
e2e/playwright/testhelper.go(+208 -0)➕
e2e/server/auth_test.go(+34 -0)📝
go.mod(+8 -6)📝
go.sum(+19 -145)📝
internal/cmd/root.go(+6 -5)📝
internal/core/core.go(+3 -1)📝
internal/database/database.go(+29 -14)📝
internal/database/database_test.go(+197 -74)...and 47 more files
📄 Description
AccountsDomaintoAuthDomainto handle authentication logic in a separate layer.AccountsDomainwhich contains logic related to managing Accounts and is the layer that communicates with teh database.AccountDTOobject.Accountis the exact database representation of the row,AccountDTOis the object we can transfer around in the rest of the code with more fields, helper methods, etc. Is also the object used in creates/updates for the Accounts with included validation.Accountusages around the code to beAccountDTO.Databaseinterface changes:Database.ListAccounts(formerlyDatabase.GetAccounts). UsingList*to better differentiate between the method that return one account and the one that return many.ListAccountOptionsto filter by keyword, username and owner. Also allows retrieving the password field which is disabled by default.DeleteAccountreplacesDeleteAccounts. Now only deletes one account, iteration logic moved to theAccountsDomain.SaveAccountis not calledCreateAccountAdminRequired/api/v1/auth/accountto allow updating the entire user data, not only the settings. This should be backwards compatible.model.Ptrhelper that return an object as a pointer of itselfValidationErrorerror type to return directly from domains and have details available to expose to the API.NewAdminUserandoptions.WithAuthTokento avoid boilerplate in tests.Closes #657
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.