replace amount from pj

This commit is contained in:
Pavel 2024-05-29 20:32:46 +03:00
parent 71fd522c46
commit bd2e1372f4
3 changed files with 2 additions and 9 deletions

@ -9,7 +9,6 @@ type Privilege struct {
ID primitive.ObjectID `bson:"_id"` ID primitive.ObjectID `bson:"_id"`
Name string `bson:"name"` Name string `bson:"name"`
PrivilegeID string `bson:"privilegeId"` PrivilegeID string `bson:"privilegeId"`
Amount int `bson:"amount"`
ServiceKey string `bson:"serviceKey"` ServiceKey string `bson:"serviceKey"`
Description string `bson:"description"` Description string `bson:"description"`
Type string `bson:"type"` Type string `bson:"type"`

@ -8,7 +8,6 @@ type CreateUpdateReq struct {
Type string `json:"type"` Type string `json:"type"`
Value string `json:"value"` Value string `json:"value"`
Price float64 `json:"price"` Price float64 `json:"price"`
Amount int `json:"amount"`
} }
type ManyCreateUpdate struct { type ManyCreateUpdate struct {

@ -68,10 +68,8 @@ func (p *Privilege) Create(ctx context.Context, req *models.CreateUpdateReq) (*m
Type: req.Type, Type: req.Type,
Value: req.Value, Value: req.Value,
Price: req.Price, Price: req.Price,
// amount в хабе не вставляется CreatedAt: time.Now(),
Amount: req.Amount, IsDeleted: false,
CreatedAt: time.Now(),
IsDeleted: false,
} }
_, err = p.mdb.InsertOne(ctx, privilege) _, err = p.mdb.InsertOne(ctx, privilege)
@ -102,8 +100,6 @@ func (p *Privilege) Update(ctx context.Context, req *models.CreateUpdateReq) (*m
"value": req.Value, "value": req.Value,
"price": req.Price, "price": req.Price,
"updatedAt": time.Now(), "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.Value = req.Value
exist.Price = req.Price exist.Price = req.Price
exist.UpdatedAt = time.Now() exist.UpdatedAt = time.Now()
exist.Amount = req.Amount
return exist, nil return exist, nil
} }