aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-17 22:43:19 +0800
committercrupest <crupest@outlook.com>2022-04-17 22:43:19 +0800
commit7368d0388e78228499f28b33f79891c60639fb57 (patch)
tree9bd2c33c5f6a081438f4692fd9529bee9f787c53 /BackEnd/Timeline/Services
parente7a441b8805f8b02ba37ab1f550fa2939fe9e7f0 (diff)
downloadtimeline-7368d0388e78228499f28b33f79891c60639fb57.tar.gz
timeline-7368d0388e78228499f28b33f79891c60639fb57.tar.bz2
timeline-7368d0388e78228499f28b33f79891c60639fb57.zip
...
Diffstat (limited to 'BackEnd/Timeline/Services')
-rw-r--r--BackEnd/Timeline/Services/User/RegisterCode/IRegisterCodeService.cs51
1 files changed, 45 insertions, 6 deletions
diff --git a/BackEnd/Timeline/Services/User/RegisterCode/IRegisterCodeService.cs b/BackEnd/Timeline/Services/User/RegisterCode/IRegisterCodeService.cs
index e4aa17fa..65decefc 100644
--- a/BackEnd/Timeline/Services/User/RegisterCode/IRegisterCodeService.cs
+++ b/BackEnd/Timeline/Services/User/RegisterCode/IRegisterCodeService.cs
@@ -1,17 +1,56 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Timeline.Entities;
namespace Timeline.Services.User.RegisterCode
{
public interface IRegisterCodeService
{
- string? GetCurrentRegisterCode(long userId);
+ /// <summary>
+ /// Get the owner of a register code or null if the code does not exist or is not enabled.
+ /// </summary>
+ /// <param name="code">The register code.</param>
+ /// <param name="onlyEnabled">If true, only when code is enabled the owner id is returned.</param>
+ /// <returns>A task contains the owner of the register code. Null of the code does not exist or is not enabled.</returns>
+ Task<long?> GetCodeOwner(string code, bool onlyEnabled = true);
- List<string> GetAllRegisterCodes(long userId);
+ /// <summary>
+ /// Get the current enabled register code of the user or null if there is none.
+ /// </summary>
+ /// <param name="userId">The user id.</param>
+ /// <returns>A task contains current enabled register code or null if there is none.</returns>
+ Task<string?> GetCurrentCode(long userId);
- string CreateNewRegisterCode(long userId);
+ /// <summary>
+ /// Create a new register code for a user, enable it and disable the previous one if there is a previous one.
+ /// </summary>
+ /// <param name="userId">The user id.</param>
+ /// <returns>A task contains the new register code.</returns>
+ Task<string> CreateNewCode(long userId);
- List<long> GetUsersIntroducedByCode(string registerCode);
+ /// <summary>
+ /// Record a register info for a user.
+ /// </summary>
+ /// <param name="userId">The newly-registered user.</param>
+ /// <param name="introducerId">The introducer user id.</param>
+ /// <param name="registerCode">The register code.</param>
+ /// <param name="registerTime">The register time.</param>
+ /// <returns>The created register info.</returns>
+ Task<UserRegisterInfo> CreateRegisterInfo(long userId, long introducerId, string registerCode, DateTime registerTime);
- List<long> GetUsersIntroducedByUser(long userId);
+ /// <summary>
+ /// Get register info of a user if there is one.
+ /// </summary>
+ /// <param name="userId">The user id.</param>
+ /// <returns>The user register info if there is one. Or null if there is not.</returns>
+ Task<UserRegisterInfo?> GetUserRegisterInfo(long userId);
+
+ /// <summary>
+ /// Get the list of user register info of the specified introducer.
+ /// </summary>
+ /// <param name="introducerId"></param>
+ /// <returns>The list of user register info.</returns>
+ Task<List<UserRegisterInfo>> GetUserRegisterInfoOfIntroducer(long introducerId);
}
}