Skip to content

Commit

Permalink
add updatedAt field in role assingment entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Oct 23, 2023
1 parent f8139d7 commit 285bd65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type RoleAssignment @entity {
revocable: Boolean!
data: Bytes!
createdAt: BigInt!
updatedAt: BigInt!
}

type Role @entity {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ export function findOrCreateRoleAssignment(
roleAssignment.nft = nft.id
roleAssignment.grantor = grantor.id
roleAssignment.grantee = grantee.id
roleAssignment.createdAt = event.block.timestamp
}

roleAssignment.expirationDate = event.params._expirationDate
roleAssignment.revocable = event.params._revocable
roleAssignment.data = event.params._data
roleAssignment.createdAt = event.block.timestamp
roleAssignment.updatedAt = event.block.timestamp
roleAssignment.save()
return roleAssignment
}
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function createMockRoleAssignment(
newRoleAssignment.revocable = true
newRoleAssignment.data = Bytes.fromUTF8('data')
newRoleAssignment.createdAt = BigInt.fromI32(123)
newRoleAssignment.updatedAt = BigInt.fromI32(123)
newRoleAssignment.save()
return newRoleAssignment
}
Expand Down

0 comments on commit 285bd65

Please sign in to comment.