Skip to content

Commit

Permalink
Develop (#71)
Browse files Browse the repository at this point in the history
* Update workflows

* Fix file version filter

* Remove extension manifest from upload result (#68)

* Remove ExtensionManifest from UploadResult

* Fix Discord author support (#70)
  • Loading branch information
manuelmayer-dev authored Oct 14, 2023
1 parent db5b32b commit f026cee
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ExtensionEntity : BaseCreatedUpdatedEntity
public string Author { get; set; } = string.Empty;
public string? Description { get; set; }
public string GitHubRepository { get; set; } = string.Empty;
public string? DSupportUserId { get; set; }
public ulong? DSupportUserId { get; set; }
public ICollection<ExtensionFileEntity>? ExtensionFiles { get; set; }
public ICollection<ExtensionDownloadInfoEntity>? Downloads { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,16 @@ public async ValueTask UpdateDescription(string packageId, string description)

await _context.UpdateAsync(extensionEntity);
}

public async Task UpdateAuthorDiscordUserId(string packageId, ulong? extensionManifestAuthorDiscordUserId)
{
if (!extensionManifestAuthorDiscordUserId.HasValue)
{
return;
}

await _context.Set<ExtensionEntity>()
.Where(x => x.PackageId == packageId)
.ExecuteUpdateAsync(x => x.SetProperty(e => e.DSupportUserId, extensionManifestAuthorDiscordUserId.Value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public interface IExtensionRepository
public ValueTask DeleteExtensionAsync(string packageId);
public ValueTask<ExtensionEntity> UpdateExtensionAsync(ExtensionEntity extensionEntity);
public ValueTask UpdateDescription(string packageId, string description);
public Task UpdateAuthorDiscordUserId(string extensionManifestPackageId, ulong? extensionManifestAuthorDiscordUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class Extension
public string? Description { get; set; }
public string? Category { get; set; }
public string? GitHubRepository { get; set; }
public string? DSupportUserId { get; set; }
public ulong? DSupportUserId { get; set; }
public IList<ExtensionFile>? ExtensionFiles { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ExtensionManifest
public string? Category { get; set; }

[JsonPropertyName("author-discord-userid")]
public string? AuthorDiscordUserId { get; set; }
public ulong? AuthorDiscordUserId { get; set; }

[JsonPropertyName("repository")]
public string? Repository { get; set; } = "";
Expand Down
2 changes: 2 additions & 0 deletions src/ExtensionStoreAPI.Core/Managers/ExtensionFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public async Task<ExtensionFileUploadResult> CreateFileAsync(Stream packageStrea
}

await _extensionRepository.UpdateDescription(extensionManifest.PackageId!, description);
await _extensionRepository.UpdateAuthorDiscordUserId(extensionManifest.PackageId!,
extensionManifest.AuthorDiscordUserId);
return result;
}

Expand Down

0 comments on commit f026cee

Please sign in to comment.