Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:optimize sync holder info #234

Open
wants to merge 10 commits into
base: feature/1.11.0
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ public IEnumerable<ValidationResult> Validate(
new[] { "LoginGuardianIdentifier" }
);
}

// if (Type == GuardianIdentifierType.Phone && !VerifyHelper.VerifyPhone(LoginGuardianIdentifier))
// {
// yield return new ValidationResult(
// "Invalid phone number input.",
// new[] { "LoginGuardianIdentifier" }
// );
// }
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/CAServer.Application/ContractAppServiceConstant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public static class QueryLoginGuardianType
{
public const string LoginGuardianRemoved = "LoginGuardianRemoved";
public const string LoginGuardianUnbound = "LoginGuardianUnbound";
public const string LoginGuardianAdded = "LoginGuardianAdded";

}

public static class QueryType
Expand Down
14 changes: 5 additions & 9 deletions src/CAServer.Application/IGraphQLProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public async Task<List<QueryEventDto>> GetLoginGuardianTransactionInfosAsync(
Query = @"
query($chainId:String,$startBlockHeight:Long!,$endBlockHeight:Long!) {
loginGuardianChangeRecordInfo(dto: {chainId:$chainId,startBlockHeight:$startBlockHeight,endBlockHeight:$endBlockHeight}){
id, caHash, caAddress, changeType, manager, loginGuardian{identifierHash}, blockHeight, blockHash}
id, caHash, caAddress, changeType, manager, loginGuardian{identifierHash}, blockHeight, blockHash,isCreateHolder}
}",
Variables = new
{
Expand All @@ -131,23 +131,19 @@ public async Task<List<QueryEventDto>> GetLoginGuardianTransactionInfosAsync(
return new List<QueryEventDto>();
}

var result = new List<QueryEventDto>();
foreach (var record in graphQLResponse.Data.LoginGuardianChangeRecordInfo)
{
result.Add(new QueryEventDto
return graphQLResponse.Data.LoginGuardianChangeRecordInfo.Select(record => new QueryEventDto
{
CaHash = record.CaHash,
ChangeType = record.ChangeType,
Manager = record.Manager,
BlockHeight = record.BlockHeight,
BlockHash = record.BlockHash,
IsCreateHolder = record.IsCreateHolder,
NotLoginGuardian = record.ChangeType == QueryLoginGuardianType.LoginGuardianUnbound
? record.LoginGuardian.IdentifierHash
: null
});
}

return result;
})
.ToList();
}

public async Task<List<QueryEventDto>> GetManagerTransactionInfosAsync(string chainId,
Expand Down
4 changes: 4 additions & 0 deletions src/CAServer.Application/QueryRecords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class ChangeRecordDto
public string Manager { get; set; }
public long BlockHeight { get; set; }
public string BlockHash { get; set; }

public bool IsCreateHolder { get; set; } = false;


}

public class LoginGuardianChangeRecordDto : ChangeRecordDto
Expand Down
Loading
Loading