working commit
This commit is contained in:
@@ -17,12 +17,12 @@ import (
|
||||
"mstore/app/handler"
|
||||
"mstore/app/operator"
|
||||
"mstore/pkg/descr"
|
||||
"mstore/pkg/uuid"
|
||||
"mstore/pkg/auxid"
|
||||
)
|
||||
|
||||
func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, password string) (uuid.UUID, error) {
|
||||
func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, password string) (uint64, error) {
|
||||
var err error
|
||||
var res uuid.UUID
|
||||
var res uint64
|
||||
|
||||
apiuri, err := setApiPath(hosturi, "/v3/api/account/create")
|
||||
if err != nil {
|
||||
@@ -54,7 +54,7 @@ func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, passwor
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) GetAccountByID(ctx context.Context, hosturi string, id uuid.UUID) (*descr.AccountShort, error) {
|
||||
func (cli *Client) GetAccountByID(ctx context.Context, hosturi string, id uint64) (*descr.AccountShort, error) {
|
||||
var err error
|
||||
res := &descr.AccountShort{}
|
||||
|
||||
@@ -121,7 +121,7 @@ func (cli *Client) GetAccountByName(ctx context.Context, hosturi, username strin
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) UpdateAccountByID(ctx context.Context, hosturi string, id uuid.UUID, newUsername, newPassword string) error {
|
||||
func (cli *Client) UpdateAccountByID(ctx context.Context, hosturi string, id uint64, newUsername, newPassword string) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/account/update")
|
||||
@@ -215,7 +215,7 @@ func (cli *Client) DeleteAccountByName(ctx context.Context, hosturi, username st
|
||||
return err
|
||||
}
|
||||
|
||||
func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi string, id uuid.UUID) error {
|
||||
func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi string, id uint64) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/account/delete")
|
||||
|
||||
+9
-9
@@ -18,12 +18,12 @@ import (
|
||||
"mstore/app/operator"
|
||||
"mstore/pkg/descr"
|
||||
"mstore/pkg/term"
|
||||
"mstore/pkg/uuid"
|
||||
"mstore/pkg/auxid"
|
||||
)
|
||||
|
||||
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID uuid.UUID, right term.Right, pattern string) (uuid.UUID, error) {
|
||||
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID uint64, right term.Right, pattern string) (uint64, error) {
|
||||
var err error
|
||||
var res uuid.UUID
|
||||
var res uint64
|
||||
|
||||
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
|
||||
if err != nil {
|
||||
@@ -56,9 +56,9 @@ func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, a
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right term.Right, pattern string) (uuid.UUID, error) {
|
||||
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right term.Right, pattern string) (uint64, error) {
|
||||
var err error
|
||||
var res uuid.UUID
|
||||
var res uint64
|
||||
|
||||
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
|
||||
if err != nil {
|
||||
@@ -91,7 +91,7 @@ func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uuid.UUID) (*descr.Grant, error) {
|
||||
func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*descr.Grant, error) {
|
||||
var err error
|
||||
res := &descr.Grant{}
|
||||
|
||||
@@ -124,7 +124,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uuid.UUID) (
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uuid.UUID, newPattern string) error {
|
||||
func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uint64, newPattern string) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/grant/update")
|
||||
@@ -155,7 +155,7 @@ func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uuid
|
||||
return err
|
||||
}
|
||||
|
||||
func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uuid.UUID) error {
|
||||
func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uint64) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/grant/delete")
|
||||
@@ -186,7 +186,7 @@ func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uuid
|
||||
return err
|
||||
}
|
||||
|
||||
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi string, accountID uuid.UUID) ([]descr.Grant, error) {
|
||||
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi string, accountID uint64) ([]descr.Grant, error) {
|
||||
var err error
|
||||
res := make([]descr.Grant, 0)
|
||||
|
||||
|
||||
@@ -9,28 +9,25 @@
|
||||
*/
|
||||
package descr
|
||||
|
||||
import (
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
Username string `json:"username" db:"username"`
|
||||
Passhash string `json:"passhash" db:"passhash"`
|
||||
Disabled bool `json:"disabled" db:"disabled"`
|
||||
CreatedAt string `json:"createdAt" db:"created_at"`
|
||||
UpdatedAt string `json:"updatedAt" db:"updated_at"`
|
||||
CreatedBy uuid.UUID `json:"createdBy" db:"created_by"`
|
||||
UpdatedBy uuid.UUID `json:"updatedBy" db:"updated_by"`
|
||||
CreatedBy uint64 `json:"createdBy" db:"created_by"`
|
||||
UpdatedBy uint64 `json:"updatedBy" db:"updated_by"`
|
||||
}
|
||||
|
||||
type AccountShort struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID uint64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Disabled bool `json:"disabled"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
CreatedBy uuid.UUID `json:"createdBy"`
|
||||
UpdatedBy uuid.UUID `json:"updatedBy"`
|
||||
CreatedBy uint64 `json:"createdBy"`
|
||||
UpdatedBy uint64 `json:"updatedBy"`
|
||||
Grants []Grant `json:"grants"`
|
||||
}
|
||||
|
||||
+3
-7
@@ -9,12 +9,8 @@
|
||||
*/
|
||||
package descr
|
||||
|
||||
import (
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type Blob struct {
|
||||
ID uuid.UUID `db:"id" json:"id"`
|
||||
ID uint64 `db:"id" json:"id"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Reference string `db:"reference" json:"reference"`
|
||||
MediaType string `db:"mediaType" json:"mediaType"`
|
||||
@@ -22,6 +18,6 @@ type Blob struct {
|
||||
Size int64 `db:"size" json:"size"`
|
||||
CreatedAt string `db:"created_at" json:"createdAt"`
|
||||
UpdatedAt string `db:"updated_at" json:"updatedAt"`
|
||||
CreatedBy uuid.UUID `db:"created_by" json:"createdBy,omitempty"`
|
||||
UpdatedBy uuid.UUID `db:"updated_by" json:"updatedBy,omitempty"`
|
||||
CreatedBy uint64 `db:"created_by" json:"createdBy,omitempty"`
|
||||
UpdatedBy uint64 `db:"updated_by" json:"updatedBy,omitempty"`
|
||||
}
|
||||
|
||||
+3
-7
@@ -9,12 +9,8 @@
|
||||
*/
|
||||
package descr
|
||||
|
||||
import (
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type File struct {
|
||||
ID uuid.UUID `db:"id" json:"id,omitempty" yaml:"id,omitempty"`
|
||||
ID uint64 `db:"id" json:"id,omitempty" yaml:"id,omitempty"`
|
||||
Collection string `db:"collection" json:"collection,omitempty" yaml:"collection,omitempty"`
|
||||
Name string `db:"name" json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Type string `db:"type" json:"type,omitempty" yaml:"type,omitempty"`
|
||||
@@ -22,6 +18,6 @@ type File struct {
|
||||
Size int64 `db:"size" json:"size,omitempty" yaml:"size,omitempty"`
|
||||
CreatedAt string `db:"created_at" json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
|
||||
UpdatedAt string `db:"updated_at" json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
|
||||
CreatedBy uuid.UUID `db:"created_by" json:"createdBy,omitempty" yaml:"createdBy,omitempty"`
|
||||
UpdatedBy uuid.UUID `db:"updated_by" json:"updatedBy,omitempty" yaml:"updatedBy,omitempty"`
|
||||
CreatedBy uint64 `db:"created_by" json:"createdBy,omitempty" yaml:"createdBy,omitempty"`
|
||||
UpdatedBy uint64 `db:"updated_by" json:"updatedBy,omitempty" yaml:"updatedBy,omitempty"`
|
||||
}
|
||||
|
||||
+4
-5
@@ -12,16 +12,15 @@ package descr
|
||||
|
||||
import (
|
||||
"mstore/pkg/term"
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type Grant struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
AccountID uuid.UUID `json:"accountID" db:"account_id"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
AccountID uint64 `json:"accountID" db:"account_id"`
|
||||
Right term.Right `json:"right" db:"right"`
|
||||
Pattern string `json:"pattern" db:"pattern"`
|
||||
CreatedAt string `json:"createdAt" db:"created_at"`
|
||||
UpdatedAt string `json:"updatedAt" db:"updated_at"`
|
||||
CreatedBy uuid.UUID `json:"createdBy" db:"created_by"`
|
||||
UpdatedBy uuid.UUID `json:"updatedBy" db:"updated_by"`
|
||||
CreatedBy uint64 `json:"createdBy" db:"created_by"`
|
||||
UpdatedBy uint64 `json:"updatedBy" db:"updated_by"`
|
||||
}
|
||||
|
||||
@@ -9,12 +9,8 @@
|
||||
*/
|
||||
package descr
|
||||
|
||||
import (
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type Manifest struct {
|
||||
ID uuid.UUID `db:"id" json:"id"`
|
||||
ID uint64 `db:"id" json:"id"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Reference string `db:"reference" json:"reference"`
|
||||
ContentType string `db:"contentType" json:"contentType"`
|
||||
@@ -22,8 +18,8 @@ type Manifest struct {
|
||||
Digest string `db:"digest" json:"digest"`
|
||||
CreatedAt string `db:"created_at" json:"createdAt"`
|
||||
UpdatedAt string `db:"updated_at" json:"updatedAt"`
|
||||
CreatedBy uuid.UUID `db:"created_by" json:"createdBy,omitempty"`
|
||||
UpdatedBy uuid.UUID `db:"updated_by" json:"updatedBy,omitempty"`
|
||||
CreatedBy uint64 `db:"created_by" json:"createdBy,omitempty"`
|
||||
UpdatedBy uint64 `db:"updated_by" json:"updatedBy,omitempty"`
|
||||
}
|
||||
|
||||
type Tags struct {
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@
|
||||
package term
|
||||
|
||||
import (
|
||||
"mstore/pkg/uuid"
|
||||
//"mstore/pkg/auxid"
|
||||
)
|
||||
|
||||
type PathUsage string
|
||||
@@ -24,11 +24,11 @@ const (
|
||||
|
||||
const (
|
||||
AnonimousUsername string = "anonymous"
|
||||
AnonymousID uuid.UUID = "10000000-0000-0000-0000-000000000001"
|
||||
AnonymousID uint64 = 1
|
||||
ServerUsername string = "server"
|
||||
ServerID uuid.UUID = "10000000-0000-0000-0000-000000000002"
|
||||
ServerID uint64 = 2
|
||||
InitUsername string = "mstore"
|
||||
InitID uuid.UUID = "10000000-0000-0000-0000-000000000005"
|
||||
InitID uint64 = 5
|
||||
)
|
||||
|
||||
type Right string
|
||||
|
||||
Reference in New Issue
Block a user