blob: e0031a384f45ff00c2ae4674f427ac41c550fca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Entities;
namespace Timeline.Services.User.RegisterCode
{
public interface IRegisterCodeService
{
/// <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?> GetCodeOwnerAsync(string code, bool onlyEnabled = true);
/// <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?> GetCurrentCodeAsync(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> CreateNewCodeAsync(long userId);
/// <summary>
/// Record a register info for a user.
/// </summary>
/// <param name="userId">The newly-registered user.</param>
/// <param name="registerCode">The register code.</param>
/// <param name="registerTime">The register time.</param>
/// <returns>The created register info.</returns>
Task<UserRegisterInfo> CreateRegisterInfoAsync(long userId, string registerCode, DateTime registerTime);
/// <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?> GetUserRegisterInfoAsync(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>> GetUserRegisterInfoOfIntroducerAsync(long introducerId);
}
}
|