{"size": 1229, "ext": "js", "max_stars_repo_path": "contract/owner.js", "max_stars_repo_name": "rajatkeshar/certificate-dapp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "contract/owner.js", "max_issues_repo_name": "rajatkeshar/certificate-dapp", "max_issues_repo_issues_event_min_datetime": "2021-05-11T16:05:43.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-02T09:03:10.000Z", "max_forks_repo_path": "contract/owner.js", "max_forks_repo_name": "rajatkeshar/certificate-dapp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 40.9666666667, "max_line_length": 109, "alphanum_fraction": 0.6696501221}
module.exports = {
  verifyViewRequest: async function(requesterWalletAddress, assetId, countryCode) {
    app.sdb.lock('requester.verifyViewRequest' + assetId)
    var req = await app.model.Requester.findOne({
        condition: {
            requesterWalletAddress: requesterWalletAddress,
            assetId: assetId
        }
    });
    app.sdb.update('Requester', { ownerWalletAddress: this.trs.senderId + countryCode }, {trsId: req.trsId});
    app.sdb.update('Requester', {ownerTrsTimestamp: new Date().getTime()}, {trsId: req.trsId});
    app.sdb.update('Requester', { ownerStatus: "true" }, {trsId: req.trsId});
    app.sdb.update('Requester', { ownerTrsId: this.trs.id }, {trsId: req.trsId});
  },
  ownerGrantAsset: async function(requesterWalletAddress, assetId, countryCode) {
    app.sdb.lock('requester.ownerGrantViewers' + assetId)
    app.sdb.create('Requester', {
      ownerWalletAddress: this.trs.senderId + countryCode,
      requesterWalletAddress: requesterWalletAddress,
      ownerStatus: "true",
      assetId: assetId,
      ownerTrsId: this.trs.id,
      trsId: this.trs.id,
      initBy: "owner",
      trsTimestamp: new Date().getTime(),
      ownerTrsTimestamp: new Date().getTime()
    })
  }
}
