Skip to content

Commit

Permalink
only set pending to true on record creation
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Nov 14, 2023
1 parent b14edd3 commit 0119f51
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
3 changes: 1 addition & 2 deletions app/resources/server/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (s *DB) Upsert(ctx context.Context, e All) error {
db.Server.Description.SetOptional(e.Description),
db.Server.Banner.SetOptional(e.Banner),
db.Server.Active.Set(e.Active),
db.Server.Pending.Set(e.Pending),
db.Server.LastActive.Set(time.Now()),
).Exec(ctx)
if errors.Is(err, db.ErrNotFound) {
Expand All @@ -86,7 +85,7 @@ func (s *DB) Upsert(ctx context.Context, e All) error {
db.Server.Vn.Set(e.Core.Version),
db.Server.Active.Set(e.Active),
db.Server.Omp.Set(e.Core.IsOmp),
db.Server.Pending.Set(e.Pending),
db.Server.Pending.Set(true),
db.Server.Domain.SetOptional(e.Domain),
db.Server.Description.SetOptional(e.Description),
db.Server.Banner.SetOptional(e.Banner),
Expand Down
3 changes: 0 additions & 3 deletions app/transports/api/legacy/h_postLegacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ func (s *service) postLegacy(w http.ResponseWriter, r *http.Request) {

formatted := server.TransformQueryResult(result, nil)

// Switch pending status to true, let server managers handle this manually or automatically
formatted.Pending = true

if err := s.storer.Upsert(r.Context(), formatted); err != nil {
web.StatusInternalServerError(w, errors.Wrap(err, "failed to query server"))
return
Expand Down
3 changes: 0 additions & 3 deletions app/transports/api/servers/h_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ func (s *service) add(w http.ResponseWriter, r *http.Request) {
return
}

// Switch pending status to true, let server managers handle this manually or automatically
ss.Pending = true

if err := s.storer.Upsert(r.Context(), ss); err != nil {
web.StatusInternalServerError(w, errors.Wrap(err, "failed to upsert server information"))
return
Expand Down

0 comments on commit 0119f51

Please sign in to comment.