Skip to content

Commit

Permalink
use did as device name (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran authored Dec 26, 2024
1 parent e909306 commit c0b3d81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ 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{"nft_id", "owner", "address", "status", "proposer", "updated_at"}),
DoUpdates: clause.AssignmentColumns([]string{"name", "nft_id", "owner", "address", "status", "proposer", "updated_at"}),
}).Create(t).Error
return errors.Wrap(err, "failed to upsert device")
}
Expand Down
1 change: 1 addition & 0 deletions monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (c *contract) processLogs(logs []types.Log) error {

if err := c.h.UpsertDevice(&db.Device{
ID: e.Did,
Name: e.Did,
NFTID: e.Id.String(),
Owner: e.Owner.String(),
Address: address.String(),
Expand Down

0 comments on commit c0b3d81

Please sign in to comment.