public async Task <(ScoreSnapshotDetail snapshot, ScoreAccesses access)> CreateSnapshotAsync(Guid ownerId, Guid scoreId, string snapshotName) { // TODO ここで作成されたデータを使い JSON ファイルを作成し S3 に保存する var snapshotId = Guid.NewGuid(); var response = await CreateSnapshotAsync(ownerId, scoreId, snapshotId, snapshotName); var snapshot = ScoreSnapshotDetail.Create(snapshotId, snapshotName, response.dynamoDbScore, response.hashSet); var access = ScoreDatabaseUtils.ConvertToScoreAccess(response.dynamoDbScore.Access); return(snapshot, access); }
public static ScoreDetail Create(DynamoDbScore score, Dictionary <string, string> hashSet) { if (score.Type != DynamoDbScoreTypes.Main) { throw new ArgumentException(nameof(score)); } var data = ScoreData.Create(score.Data); return(new ScoreDetail() { CreateAt = ScoreDatabaseUtils.ConvertFromUnixTimeMilli(score.CreateAt), UpdateAt = ScoreDatabaseUtils.ConvertFromUnixTimeMilli(score.UpdateAt), DataHash = score.DataHash, Data = data, Access = ScoreDatabaseUtils.ConvertToScoreAccess(score.Access), HashSet = hashSet.ToDictionary(x => x.Key, x => x.Value), }); }