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 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 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
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