Skip to content

Commit

Permalink
change device nftid name (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran authored Dec 26, 2024
1 parent 9c167ff commit e909306
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ func (d *DB) Device(id string) (*Device, error) {
func (d *DB) UpsertDevice(t *Device) error {
err := d.db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "id"}},
DoUpdates: clause.AssignmentColumns([]string{"nftid", "owner", "address", "status", "proposer", "updated_at"}),
DoUpdates: clause.AssignmentColumns([]string{"nft_id", "owner", "address", "status", "proposer", "updated_at"}),
}).Create(t).Error
return errors.Wrap(err, "failed to upsert device")
}

func (d *DB) UpdateOwner(nftid *big.Int, owner common.Address) error {
func (d *DB) UpdateOwner(nftID *big.Int, owner common.Address) error {
values := map[string]any{"owner": owner.String()}
err := d.db.Model(&Device{}).Where("nftid = ?", nftid.String()).Updates(values).Error
err := d.db.Model(&Device{}).Where("nft_id = ?", nftID.String()).Updates(values).Error
return errors.Wrap(err, "failed to update device owner")
}

Expand Down

0 comments on commit e909306

Please sign in to comment.