chore: format with csharpier
This commit is contained in:
parent
2f516dcb73
commit
4f54077c68
59 changed files with 2000 additions and 942 deletions
|
|
@ -6,21 +6,34 @@ namespace Catalogger.Backend.Database.Queries;
|
|||
|
||||
public static class QueryExtensions
|
||||
{
|
||||
public static async ValueTask<Guild> GetGuildAsync(this DatabaseContext db, Snowflake id,
|
||||
CancellationToken ct = default) => await db.GetGuildAsync(id.ToUlong(), ct);
|
||||
public static async ValueTask<Guild> GetGuildAsync(
|
||||
this DatabaseContext db,
|
||||
Snowflake id,
|
||||
CancellationToken ct = default
|
||||
) => await db.GetGuildAsync(id.ToUlong(), ct);
|
||||
|
||||
public static async ValueTask<Guild> GetGuildAsync(this DatabaseContext db, Optional<Snowflake> id,
|
||||
CancellationToken ct = default) => await db.GetGuildAsync(id.ToUlong(), ct);
|
||||
public static async ValueTask<Guild> GetGuildAsync(
|
||||
this DatabaseContext db,
|
||||
Optional<Snowflake> id,
|
||||
CancellationToken ct = default
|
||||
) => await db.GetGuildAsync(id.ToUlong(), ct);
|
||||
|
||||
public static async ValueTask<Guild> GetGuildAsync(this DatabaseContext db, ulong id,
|
||||
CancellationToken ct = default)
|
||||
public static async ValueTask<Guild> GetGuildAsync(
|
||||
this DatabaseContext db,
|
||||
ulong id,
|
||||
CancellationToken ct = default
|
||||
)
|
||||
{
|
||||
var guild = await db.Guilds.FindAsync([id], ct);
|
||||
if (guild == null) throw new CataloggerError("Guild not found, was not initialized during guild create");
|
||||
if (guild == null)
|
||||
throw new CataloggerError("Guild not found, was not initialized during guild create");
|
||||
return guild;
|
||||
}
|
||||
|
||||
public static async Task<Watchlist?> GetWatchlistEntryAsync(this DatabaseContext db, Snowflake guildId,
|
||||
Snowflake userId, CancellationToken ct = default) =>
|
||||
await db.Watchlists.FindAsync([guildId.Value, userId.Value], ct);
|
||||
}
|
||||
public static async Task<Watchlist?> GetWatchlistEntryAsync(
|
||||
this DatabaseContext db,
|
||||
Snowflake guildId,
|
||||
Snowflake userId,
|
||||
CancellationToken ct = default
|
||||
) => await db.Watchlists.FindAsync([guildId.Value, userId.Value], ct);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue