Skip to content

Commit

Permalink
fix(restock): Remove one CreatedAt because it was in double
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptTF committed Oct 16, 2024
1 parent dbb60de commit 7a3b1f4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion backend/api/restock.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (s *Server) CreateRestock(c echo.Context) error {
CreatedBy: usr.Id,
CreatedByName: usr.Name(),
},
CreatedAt: time.Now().Unix(),
}

_, err = s.DBackend.WithTransaction(c.Request().Context(), func(ctx mongo.SessionContext) (interface{}, error) {
Expand Down
2 changes: 1 addition & 1 deletion backend/internal/db/mongo/restock_crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (b *Backend) CreateRestock(ctx context.Context, tx *models.Restock) error {
ctx, cancel := b.TimeoutContext(ctx)
defer cancel()

tx.CreatedAt = time.Now().Unix()
tx.CreatedAt = uint64(time.Now().Unix())

_, err := b.db.Collection(RestocksCollection).InsertOne(ctx, tx)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions backend/internal/models/restocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ type (
Restock struct {
PrivateID primitive.ObjectID `bson:"_id,omitempty" json:"-"`
autogen.Restock `bson:",inline"`

CreatedAt int64 `bson:"created_at" json:"created_at"`
}
)

Expand Down

0 comments on commit 7a3b1f4

Please sign in to comment.