From bd2e1372f43eb2e66080cf2b17e308dcd1bb5899 Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 29 May 2024 20:32:46 +0300 Subject: [PATCH] replace amount from pj --- internal/models/privilege.go | 1 - internal/models/reqBodies.go | 1 - internal/repository/privilege/privilege.go | 9 ++------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/internal/models/privilege.go b/internal/models/privilege.go index 999cfc6..c4210d1 100644 --- a/internal/models/privilege.go +++ b/internal/models/privilege.go @@ -9,7 +9,6 @@ type Privilege struct { ID primitive.ObjectID `bson:"_id"` Name string `bson:"name"` PrivilegeID string `bson:"privilegeId"` - Amount int `bson:"amount"` ServiceKey string `bson:"serviceKey"` Description string `bson:"description"` Type string `bson:"type"` diff --git a/internal/models/reqBodies.go b/internal/models/reqBodies.go index ec096e3..f9a430b 100644 --- a/internal/models/reqBodies.go +++ b/internal/models/reqBodies.go @@ -8,7 +8,6 @@ type CreateUpdateReq struct { Type string `json:"type"` Value string `json:"value"` Price float64 `json:"price"` - Amount int `json:"amount"` } type ManyCreateUpdate struct { diff --git a/internal/repository/privilege/privilege.go b/internal/repository/privilege/privilege.go index 73eab99..ee2185b 100644 --- a/internal/repository/privilege/privilege.go +++ b/internal/repository/privilege/privilege.go @@ -68,10 +68,8 @@ func (p *Privilege) Create(ctx context.Context, req *models.CreateUpdateReq) (*m Type: req.Type, Value: req.Value, Price: req.Price, - // amount в хабе не вставляется - Amount: req.Amount, - CreatedAt: time.Now(), - IsDeleted: false, + CreatedAt: time.Now(), + IsDeleted: false, } _, err = p.mdb.InsertOne(ctx, privilege) @@ -102,8 +100,6 @@ func (p *Privilege) Update(ctx context.Context, req *models.CreateUpdateReq) (*m "value": req.Value, "price": req.Price, "updatedAt": time.Now(), - // amount в хабе не вставляется - "amount": req.Amount, }, } @@ -120,7 +116,6 @@ func (p *Privilege) Update(ctx context.Context, req *models.CreateUpdateReq) (*m exist.Value = req.Value exist.Price = req.Price exist.UpdatedAt = time.Now() - exist.Amount = req.Amount return exist, nil }