♻️ No idea, but errors all gone
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using DysonNetwork.Shared.Models;
|
||||
using MagicOnion;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace DysonNetwork.Shared.Services;
|
||||
|
||||
@@ -59,4 +62,247 @@ public interface IAccountService : IService<IAccountService>
|
||||
/// <param name="userInfo">The OpenID Connect user information</param>
|
||||
/// <returns>The newly created account</returns>
|
||||
Task<Account> CreateAccount(OidcUserInfo userInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an account by its ID.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <param name="withProfile">Join the profile table or not.</param>
|
||||
/// <returns>The account if found, otherwise null.</returns>
|
||||
Task<Account?> GetAccountById(Guid accountId, bool withProfile = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an account profile by account ID.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <returns>The account profile if found, otherwise null.</returns>
|
||||
Task<Profile?> GetAccountProfile(Guid accountId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an authentication challenge by its ID.
|
||||
/// </summary>
|
||||
/// <param name="challengeId">The ID of the challenge.</param>
|
||||
/// <returns>The authentication challenge if found, otherwise null.</returns>
|
||||
Task<Challenge?> GetAuthChallenge(Guid challengeId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an authentication challenge by account ID, IP address, and user agent.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <param name="ipAddress">The IP address.</param>
|
||||
/// <param name="userAgent">The user agent.</param>
|
||||
/// <param name="now">The current instant.</param>
|
||||
/// <returns>The authentication challenge if found, otherwise null.</returns>
|
||||
Task<Challenge?> GetAuthChallenge(Guid accountId, string? ipAddress, string? userAgent, NodaTime.Instant now);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new authentication challenge.
|
||||
/// </summary>
|
||||
/// <param name="challenge">The challenge to create.</param>
|
||||
/// <returns>The created challenge.</returns>
|
||||
Task<Challenge> CreateAuthChallenge(Challenge challenge);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets an account authentication factor by its ID and account ID.
|
||||
/// </summary>
|
||||
/// <param name="factorId">The ID of the factor.</param>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <returns>The account authentication factor if found, otherwise null.</returns>
|
||||
Task<AccountAuthFactor?> GetAccountAuthFactor(Guid factorId, Guid accountId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of account authentication factors for a given account ID.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <returns>A list of account authentication factors.</returns>
|
||||
Task<List<AccountAuthFactor>> GetAccountAuthFactors(Guid accountId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an authentication session by its ID.
|
||||
/// </summary>
|
||||
/// <param name="sessionId">The ID of the session.</param>
|
||||
/// <returns>The authentication session if found, otherwise null.</returns>
|
||||
Task<Session?> GetAuthSession(Guid sessionId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a magic spell by its ID.
|
||||
/// </summary>
|
||||
/// <param name="spellId">The ID of the magic spell.</param>
|
||||
/// <returns>The magic spell if found, otherwise null.</returns>
|
||||
Task<MagicSpell?> GetMagicSpell(Guid spellId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an abuse report by its ID.
|
||||
/// </summary>
|
||||
/// <param name="reportId">The ID of the abuse report.</param>
|
||||
/// <returns>The abuse report if found, otherwise null.</returns>
|
||||
Task<AbuseReport?> GetAbuseReport(Guid reportId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new abuse report.
|
||||
/// </summary>
|
||||
/// <param name="resourceIdentifier">The identifier of the resource being reported.</param>
|
||||
/// <param name="type">The type of abuse report.</param>
|
||||
/// <param name="reason">The reason for the report.</param>
|
||||
/// <param name="accountId">The ID of the account making the report.</param>
|
||||
/// <returns>The created abuse report.</returns>
|
||||
Task<AbuseReport> CreateAbuseReport(string resourceIdentifier, AbuseReportType type, string reason, Guid accountId);
|
||||
|
||||
/// <summary>
|
||||
/// Counts abuse reports.
|
||||
/// </summary>
|
||||
/// <param name="includeResolved">Whether to include resolved reports.</param>
|
||||
/// <returns>The count of abuse reports.</returns>
|
||||
Task<int> CountAbuseReports(bool includeResolved = false);
|
||||
|
||||
/// <summary>
|
||||
/// Counts abuse reports by a specific user.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <param name="includeResolved">Whether to include resolved reports.</param>
|
||||
/// <returns>The count of abuse reports by the user.</returns>
|
||||
Task<int> CountUserAbuseReports(Guid accountId, bool includeResolved = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of abuse reports.
|
||||
/// </summary>
|
||||
/// <param name="skip">Number of reports to skip.</param>
|
||||
/// <param name="take">Number of reports to take.</param>
|
||||
/// <param name="includeResolved">Whether to include resolved reports.</param>
|
||||
/// <returns>A list of abuse reports.</returns>
|
||||
Task<List<AbuseReport>> GetAbuseReports(int skip = 0, int take = 20, bool includeResolved = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of abuse reports by a specific user.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <param name="skip">Number of reports to skip.</param>
|
||||
/// <param name="take">Number of reports to take.</param>
|
||||
/// <param name="includeResolved">Whether to include resolved reports.</param>
|
||||
/// <returns>A list of abuse reports by the user.</returns>
|
||||
Task<List<AbuseReport>> GetUserAbuseReports(Guid accountId, int skip = 0, int take = 20, bool includeResolved = false);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves an abuse report.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the report to resolve.</param>
|
||||
/// <param name="resolution">The resolution message.</param>
|
||||
/// <returns>The resolved abuse report.</returns>
|
||||
Task<AbuseReport> ResolveAbuseReport(Guid id, string resolution);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the count of pending abuse reports.
|
||||
/// </summary>
|
||||
/// <returns>The count of pending abuse reports.</returns>
|
||||
Task<int> GetPendingAbuseReportsCount();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a relationship with a specific status exists between two accounts.
|
||||
/// </summary>
|
||||
/// <param name="accountId1">The ID of the first account.</param>
|
||||
/// <param name="accountId2">The ID of the second account.</param>
|
||||
/// <param name="status">The relationship status to check for.</param>
|
||||
/// <returns>True if the relationship exists, otherwise false.</returns>
|
||||
Task<bool> HasRelationshipWithStatus(Guid accountId1, Guid accountId2, RelationshipStatus status);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the statuses for a list of account IDs.
|
||||
/// </summary>
|
||||
/// <param name="accountIds">A list of account IDs.</param>
|
||||
/// <returns>A dictionary where the key is the account ID and the value is the status.</returns>
|
||||
Task<Dictionary<Guid, Status>> GetStatuses(List<Guid> accountIds);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a notification to an account.
|
||||
/// </summary>
|
||||
/// <param name="account">The target account.</param>
|
||||
/// <param name="topic">The notification topic.</param>
|
||||
/// <param name="title">The notification title.</param>
|
||||
/// <param name="subtitle">The notification subtitle.</param>
|
||||
/// <param name="body">The notification body.</param>
|
||||
/// <param name="actionUri">The action URI for the notification.</param>
|
||||
/// <returns>A task representing the asynchronous operation.</returns>
|
||||
Task SendNotification(Account account, string topic, string title, string? subtitle, string body, string? actionUri = null);
|
||||
|
||||
/// <summary>
|
||||
/// Lists the friends of an account.
|
||||
/// </summary>
|
||||
/// <param name="account">The account.</param>
|
||||
/// <returns>A list of friend accounts.</returns>
|
||||
Task<List<Account>> ListAccountFriends(Account account);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies an authentication factor code.
|
||||
/// </summary>
|
||||
/// <param name="factor">The authentication factor.</param>
|
||||
/// <param name="code">The code to verify.</param>
|
||||
/// <returns>True if the code is valid, otherwise false.</returns>
|
||||
Task<bool> VerifyFactorCode(AccountAuthFactor factor, string code);
|
||||
|
||||
/// <summary>
|
||||
/// Send the auth factor verification code to users, for factors like in-app code and email.
|
||||
/// Sometimes it requires a hint, like a part of the user's email address to ensure the user is who own the account.
|
||||
/// </summary>
|
||||
/// <param name="account">The owner of the auth factor</param>
|
||||
/// <param name="factor">The auth factor needed to send code</param>
|
||||
/// <param name="hint">The part of the contact method for verification</param>
|
||||
Task SendFactorCode(Account account, AccountAuthFactor factor, string? hint = null);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an action log entry.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of action log.</param>
|
||||
/// <param name="meta">Additional metadata for the action log.</param>
|
||||
/// <param name="request">The HTTP request.</param>
|
||||
/// <param name="account">The account associated with the action.</param>
|
||||
/// <returns>The created action log.</returns>
|
||||
Task<ActionLog> CreateActionLogFromRequest(string type, Dictionary<string, object> meta, string? ipAddress, string? userAgent, Account? account = null);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new session.
|
||||
/// </summary>
|
||||
/// <param name="lastGrantedAt">The last granted instant.</param>
|
||||
/// <param name="expiredAt">The expiration instant.</param>
|
||||
/// <param name="account">The associated account.</param>
|
||||
/// <param name="challenge">The associated challenge.</param>
|
||||
/// <returns>The created session.</returns>
|
||||
Task<Session> CreateSession(NodaTime.Instant lastGrantedAt, NodaTime.Instant expiredAt, Account account, Challenge challenge);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the LastGrantedAt for a session.
|
||||
/// </summary>
|
||||
/// <param name="sessionId">The ID of the session.</param>
|
||||
/// <param name="lastGrantedAt">The new LastGrantedAt instant.</param>
|
||||
Task UpdateSessionLastGrantedAt(Guid sessionId, NodaTime.Instant lastGrantedAt);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the LastSeenAt for an account profile.
|
||||
/// </summary>
|
||||
/// <param name="accountId">The ID of the account.</param>
|
||||
/// <param name="lastSeenAt">The new LastSeenAt instant.</param>
|
||||
Task UpdateAccountProfileLastSeenAt(Guid accountId, NodaTime.Instant lastSeenAt);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a token for a session.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <returns>The token string.</returns>
|
||||
string CreateToken(Session session);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the AuthConstants.CookieTokenName.
|
||||
/// </summary>
|
||||
/// <returns>The cookie token name.</returns>
|
||||
string GetAuthCookieTokenName();
|
||||
|
||||
/// <summary>
|
||||
/// Searches for accounts by a search term.
|
||||
/// </summary>
|
||||
/// <param name="searchTerm">The term to search for.</param>
|
||||
/// <returns>A list of matching accounts.</returns>
|
||||
Task<List<Account>> SearchAccountsAsync(string searchTerm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user