right type used
This commit is contained in:
+16
-16
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"mstore/pkg/auxpwd"
|
||||
"mstore/pkg/auxtool"
|
||||
"mstore/pkg/auxuuid"
|
||||
"mstore/pkg/descr"
|
||||
"mstore/pkg/uuid"
|
||||
)
|
||||
|
||||
type CreateAccountParams struct {
|
||||
@@ -15,10 +15,10 @@ type CreateAccountParams struct {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
type CreateAccountResult struct {
|
||||
AccountID auxuuid.UUID `json:"accountId"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
}
|
||||
|
||||
func (oper *Operator) CreateAccount(ctx context.Context, operatorID auxuuid.UUID, params *CreateAccountParams) (*CreateAccountResult, error) {
|
||||
func (oper *Operator) CreateAccount(ctx context.Context, operatorID uuid.UUID, params *CreateAccountParams) (*CreateAccountResult, error) {
|
||||
var err error
|
||||
res := &CreateAccountResult{}
|
||||
|
||||
@@ -43,7 +43,7 @@ func (oper *Operator) CreateAccount(ctx context.Context, operatorID auxuuid.UUID
|
||||
now := auxtool.TimeNow()
|
||||
passhash := auxpwd.MakeSHA256Hash([]byte(params.Password))
|
||||
accountDescr := &descr.Account{
|
||||
ID: auxuuid.NewUUID(),
|
||||
ID: uuid.NewUUID(),
|
||||
Username: params.Username,
|
||||
Passhash: passhash,
|
||||
Disabled: false,
|
||||
@@ -62,14 +62,14 @@ func (oper *Operator) CreateAccount(ctx context.Context, operatorID auxuuid.UUID
|
||||
|
||||
// GetAccount
|
||||
type GetAccountParams struct {
|
||||
Username string `json:"username"`
|
||||
AccountID auxuuid.UUID `json:"accountId"`
|
||||
Username string `json:"username"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
}
|
||||
type GetAccountResult struct {
|
||||
Account *descr.AccountShort `json:"account"`
|
||||
}
|
||||
|
||||
func (oper *Operator) GetAccount(ctx context.Context, operatorID auxuuid.UUID, params *GetAccountParams) (*GetAccountResult, error) {
|
||||
func (oper *Operator) GetAccount(ctx context.Context, operatorID uuid.UUID, params *GetAccountParams) (*GetAccountResult, error) {
|
||||
var err error
|
||||
res := &GetAccountResult{}
|
||||
|
||||
@@ -128,15 +128,15 @@ func (oper *Operator) GetAccount(ctx context.Context, operatorID auxuuid.UUID, p
|
||||
}
|
||||
|
||||
type UpdateAccountParams struct {
|
||||
Username string `json:"username"`
|
||||
AccountID auxuuid.UUID `json:"accountId"`
|
||||
NewUsername string `json:"newUsername"`
|
||||
NewPassword string `json:"newPassword"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Username string `json:"username"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
NewUsername string `json:"newUsername"`
|
||||
NewPassword string `json:"newPassword"`
|
||||
Disabled bool `json:"disabled"`
|
||||
}
|
||||
type UpdateAccountResult struct{}
|
||||
|
||||
func (oper *Operator) UpdateAccount(ctx context.Context, operatorID auxuuid.UUID, params *UpdateAccountParams) (*UpdateAccountResult, error) {
|
||||
func (oper *Operator) UpdateAccount(ctx context.Context, operatorID uuid.UUID, params *UpdateAccountParams) (*UpdateAccountResult, error) {
|
||||
var err error
|
||||
res := &UpdateAccountResult{}
|
||||
if params.Username == "" && params.AccountID == "" {
|
||||
@@ -195,12 +195,12 @@ func (oper *Operator) UpdateAccount(ctx context.Context, operatorID auxuuid.UUID
|
||||
}
|
||||
|
||||
type DeleteAccountParams struct {
|
||||
Username string `json:"username"`
|
||||
AccountID auxuuid.UUID `json:"accountId"`
|
||||
Username string `json:"username"`
|
||||
AccountID uuid.UUID `json:"accountId"`
|
||||
}
|
||||
type DeleteAccountResult struct{}
|
||||
|
||||
func (oper *Operator) DeleteAccount(ctx context.Context, operatorID auxuuid.UUID, params *DeleteAccountParams) (*DeleteAccountResult, error) {
|
||||
func (oper *Operator) DeleteAccount(ctx context.Context, operatorID uuid.UUID, params *DeleteAccountParams) (*DeleteAccountResult, error) {
|
||||
var err error
|
||||
res := &DeleteAccountResult{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user