get -> post /fetch

This commit is contained in:
r8zavetr8v 2024-05-30 22:50:27 +03:00
parent 29e877903d
commit 2ff206a35b
2 changed files with 21 additions and 24 deletions

View File

@ -126,7 +126,7 @@ Get new token
### Example ### Example
Request: Request:
``` bash ``` bash
curl --location --request GET 'http://localhost:8081/refresh' \ curl --location --request POST 'http://localhost:8081/refresh' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data '{ --data '{
"token": "token", "token": "token",
@ -170,7 +170,7 @@ Response:
} }
``` ```
## GET **/organizations** ## POST **/organizations/fetch**
Fets list of organizations Fets list of organizations
### Request body: ### Request body:
* cursor (string, optional) * cursor (string, optional)
@ -180,7 +180,7 @@ Fets list of organizations
### Example ### Example
Request: Request:
``` bash ``` bash
curl --location --request GET 'http://localhost:8081/organizations' \ curl --location --request POST 'http://localhost:8081/organizations' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTU4OTU4MTc3MDYsInVpZCI6IjUyNTNkMzdjLTMxZDQtNDgxMi1iZTcxLWE5ODQwMTVlNGVlMyJ9.YjjHWz7FiMM73e-98pZYHCW9tKDZ_mRWKG3m1PcVTo0' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTU4OTU4MTc3MDYsInVpZCI6IjUyNTNkMzdjLTMxZDQtNDgxMi1iZTcxLWE5ODQwMTVlNGVlMyJ9.YjjHWz7FiMM73e-98pZYHCW9tKDZ_mRWKG3m1PcVTo0' \
--data '{ --data '{
@ -271,7 +271,7 @@ Response:
"is_active": false "is_active": false
} }
``` ```
## GET **/organizations/{organization_id}/participants** ## POST **/organizations/{organization_id}/participants/fetch**
Get organization participants Get organization participants
### Request body: ### Request body:
* ids (string array) * ids (string array)
@ -279,7 +279,7 @@ Get organization participants
### Example ### Example
Request: Request:
``` bash ``` bash
curl --request GET \ curl --request POST \
--url http://localhost:8081/organizations/018fb419-c3ad-7cda-81b8-cad30211b5fb/participants \ --url http://localhost:8081/organizations/018fb419-c3ad-7cda-81b8-cad30211b5fb/participants \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTY3OTk5MjgzMzIsInVpZCI6IjAxOGZiNDE5LTliZjctN2QwOS05MzViLTNiOTAyNDc3ZDJkYiJ9.V_d3b8MvuOp01xDGX0g5Ab2nOvdyGL84WO01xPodTro' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTY3OTk5MjgzMzIsInVpZCI6IjAxOGZiNDE5LTliZjctN2QwOS05MzViLTNiOTAyNDc3ZDJkYiJ9.V_d3b8MvuOp01xDGX0g5Ab2nOvdyGL84WO01xPodTro' \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
@ -388,14 +388,14 @@ Response:
} }
``` ```
## GET **/organizations/{organization_id}/multisig** ## POST **/organizations/{organization_id}/multisig/fetch**
Multisig deployment fetch multisigs
### Request body: ### Request body:
### Example ### Example
Request: Request:
``` bash ``` bash
curl --request GET \ curl --request POST \
--url http://localhost:8081/organizations/018fb246-1616-7f1b-9fe2-1a3202224695/multisig \ --url http://localhost:8081/organizations/018fb246-1616-7f1b-9fe2-1a3202224695/multisig \
--header 'Authorization: Bearer token' \ --header 'Authorization: Bearer token' \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
@ -478,7 +478,7 @@ Response:
} }
``` ```
## GET **/organizations/{organization_id}/payrolls** ## POST **/organizations/{organization_id}/payrolls/fetch**
Fetch payrolls Fetch payrolls
### Request body: ### Request body:
* ids ([]string) * ids ([]string)
@ -492,8 +492,6 @@ curl --request POST \
--header 'Authorization: Bearer TOKEN' \ --header 'Authorization: Bearer TOKEN' \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
--data '{ --data '{
"title":"sdjkhfjsdk",
"multisig_id":"018fbb03-d4c5-73be-ab07-6c5f8d3afebc"
}' }'
``` ```
@ -508,7 +506,7 @@ Response:
Confirm payroll Confirm payroll
// todo // todo
## GET **/organizations/{organization_id}/license** ## POST **/organizations/{organization_id}/license/fetch**
Fetch licenses Fetch licenses
## POST **/organizations/{organization_id}/license** ## POST **/organizations/{organization_id}/license**
@ -584,7 +582,7 @@ Response:
} }
``` ```
## GET **/{organization_id}/transactions** ## POST **/{organization_id}/transactions/fetch**
Fetch txs Fetch txs
### Request body: ### Request body:
ready_to_confirm (optional) ready_to_confirm (optional)
@ -593,7 +591,7 @@ pending (optional)
### Example ### Example
Request: Request:
``` bash ``` bash
curl --location --request GET 'http://localhost:8081/organizations/018f9078-af60-7589-af64-9312b97aa7be/transactions' \ curl --location --request POST 'http://localhost:8081/organizations/018f9078-af60-7589-af64-9312b97aa7be/transactions' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \ --header 'Authorization: Bearer TOKEN' \
--data '{ --data '{

View File

@ -106,7 +106,7 @@ func (s *Server) buildRouter() {
router.Post("/join", s.handle(s.controllers.Auth.Join, "join")) router.Post("/join", s.handle(s.controllers.Auth.Join, "join"))
router.Post("/login", s.handle(s.controllers.Auth.Login, "login")) router.Post("/login", s.handle(s.controllers.Auth.Login, "login"))
router.Get("/refresh", s.handle(s.controllers.Auth.Refresh, "refresh")) router.Post("/refresh", s.handle(s.controllers.Auth.Refresh, "refresh"))
// open invite link // open invite link
router.Get("/invite/{hash}", s.handle(s.controllers.Auth.InviteGet, "invite_open")) router.Get("/invite/{hash}", s.handle(s.controllers.Auth.InviteGet, "invite_open"))
@ -116,31 +116,31 @@ func (s *Server) buildRouter() {
router.Route("/organizations", func(r chi.Router) { router.Route("/organizations", func(r chi.Router) {
r = r.With(s.withAuthorization) r = r.With(s.withAuthorization)
r.Get("/", s.handle(s.controllers.Organizations.ListOrganizations, "list_organizations")) r.Post("/fetch", s.handle(s.controllers.Organizations.ListOrganizations, "list_organizations"))
r.Post("/", s.handle(s.controllers.Organizations.NewOrganization, "new_organization")) r.Post("/", s.handle(s.controllers.Organizations.NewOrganization, "new_organization"))
r.Route("/{organization_id}", func(r chi.Router) { r.Route("/{organization_id}", func(r chi.Router) {
r.Route("/payrolls", func(r chi.Router) { r.Route("/payrolls", func(r chi.Router) {
r.Get("/", s.handle(s.controllers.Transactions.ListPayrolls, "list_payrolls")) r.Post("/fetch", s.handle(s.controllers.Transactions.ListPayrolls, "list_payrolls"))
r.Post("/", s.handle(s.controllers.Transactions.NewPayroll, "new_payroll")) r.Post("/", s.handle(s.controllers.Transactions.NewPayroll, "new_payroll"))
r.Put("/", s.handle(s.controllers.Transactions.ConfirmPayroll, "confirm_payroll")) r.Put("/", s.handle(s.controllers.Transactions.ConfirmPayroll, "confirm_payroll"))
r.Post("/salaries", s.handle(nil, "set_salary")) r.Post("/salaries", s.handle(nil, "set_salary"))
r.Get("/salaries", s.handle(nil, "get_salaries")) r.Post("/salaries/fetch", s.handle(nil, "get_salaries"))
}) })
r.Route("/multisig", func(r chi.Router) { r.Route("/multisig", func(r chi.Router) {
r.Post("/", s.handle(s.controllers.Transactions.NewMultisig, "new_multisig")) r.Post("/", s.handle(s.controllers.Transactions.NewMultisig, "new_multisig"))
r.Get("/", s.handle(s.controllers.Transactions.ListMultisigs, "list_multisig")) r.Post("/fetch", s.handle(s.controllers.Transactions.ListMultisigs, "list_multisig"))
}) })
r.Route("/license", func(r chi.Router) { r.Route("/license", func(r chi.Router) {
r.Get("/", nil) // list license r.Post("/fetch", nil) // list license
r.Post("/", nil) // deploy contract r.Post("/", nil) // deploy contract
}) })
r.Route("/participants", func(r chi.Router) { r.Route("/participants", func(r chi.Router) {
r.Get("/", s.handle(s.controllers.Participants.List, "participants_list")) r.Post("/fetch", s.handle(s.controllers.Participants.List, "participants_list"))
r.Post("/", s.handle(s.controllers.Participants.New, "new_participant")) r.Post("/", s.handle(s.controllers.Participants.New, "new_participant"))
// generate new invite link // generate new invite link
@ -151,9 +151,8 @@ func (s *Server) buildRouter() {
}) })
}) })
// Deprecated??
r.Route("/transactions", func(r chi.Router) { r.Route("/transactions", func(r chi.Router) {
r.Get("/", s.handle(s.controllers.Transactions.List, "tx_list")) r.Post("/fetch", s.handle(s.controllers.Transactions.List, "tx_list"))
r.Post("/", s.handle(s.controllers.Transactions.New, "new_tx")) r.Post("/", s.handle(s.controllers.Transactions.New, "new_tx"))
r.Put( r.Put(
"/{tx_id}", "/{tx_id}",