working commit

This commit is contained in:
2026-02-13 13:25:16 +02:00
parent c2d231c844
commit 930df60877
11 changed files with 343 additions and 37 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ import (
type CreateGrantParams struct {
AccountID string `json:"accountID"`
Operation string `json:"operation"`
Right string `json:"operation"`
Pattern string `json:"pattern"`
}
type CreateGrantResult struct {
@@ -26,7 +26,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
err := fmt.Errorf("Empty accountId parameters")
return res, err
}
if params.Operation == "" {
if params.Right == "" {
err := fmt.Errorf("Empty operation parameter")
return res, err
}
@@ -35,7 +35,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
return res, err
}
grantExists, _, err := oper.mdb.GetGrantByAccoundIDOperationPattern(ctx, params.AccountID, params.Operation, params.Pattern)
grantExists, _, err := oper.mdb.GetGrantByAccoundIDRightPattern(ctx, params.AccountID, params.Right, params.Pattern)
if err != nil {
return res, err
}
@@ -47,7 +47,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
grantDescr := &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: params.AccountID,
Operation: params.Operation,
Right: params.Right,
Pattern: params.Pattern,
CreatedAt: now,
UpdatedAt: now,