Skip to content

Commit b5cd7c7

Browse files
moved createdAt, lastLoginAt & validSince into UserRecord
1 parent c12f0eb commit b5cd7c7

File tree

4 files changed

+33
-42
lines changed

4 files changed

+33
-42
lines changed

FirebaseAdmin/FirebaseAdmin/Auth/ExportedUserRecord.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,16 @@ namespace FirebaseAdmin.Auth
2020
/// </summary>
2121
public sealed class ExportedUserRecord : UserRecord
2222
{
23-
private readonly long createdAt;
24-
private readonly long lastLoginAt;
25-
private readonly long validSince;
2623
private readonly string passwordHash;
2724
private readonly string passwordSalt;
2825

29-
internal ExportedUserRecord(string uid, long createdAt, long lastLoginAt, long validSince, string passwordHash, string passwordSalt)
30-
: base(uid)
31-
{
32-
this.createdAt = createdAt;
33-
this.lastLoginAt = lastLoginAt;
34-
this.validSince = validSince;
35-
this.passwordHash = passwordHash;
36-
this.passwordSalt = passwordSalt;
37-
}
38-
3926
internal ExportedUserRecord(GetAccountInfoResponse.User user)
4027
: base(user)
4128
{
42-
this.createdAt = user.CreatedAt;
43-
this.lastLoginAt = user.LastLoginAt;
44-
this.validSince = user.ValidSince;
4529
this.passwordHash = user.PasswordHash;
4630
this.passwordSalt = user.PasswordSalt;
4731
}
4832

49-
/// <summary>
50-
/// Gets the timestamp representing the time that the user account was created.
51-
/// </summary>
52-
public long CreatedAt
53-
{
54-
get => this.createdAt;
55-
}
56-
57-
/// <summary>
58-
/// Gets the timestamp representing the last time that the user has logged in.
59-
/// </summary>
60-
public long LastLoginAt
61-
{
62-
get => this.lastLoginAt;
63-
}
64-
65-
/// <summary>
66-
/// Gets the timestamp representing the time that the user account was first valid.
67-
/// </summary>
68-
public long ValidSince
69-
{
70-
get => this.validSince;
71-
}
72-
7333
/// <summary>
7434
/// Gets the user's password hash as a base64-encoded string.
7535
/// If the Firebase Auth hashing algorithm (SCRYPT) was used to create the user account,

FirebaseAdmin/FirebaseAdmin/Auth/FirebaseAuth.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public PagedAsyncEnumerable<ExportedUserRecords, ExportedUserRecord> ListUsersAs
358358
var userManager = this.IfNotDeleted(() => this.userManager.Value);
359359

360360
var restPagedAsyncEnumerable = new RestPagedAsyncEnumerable<ListUsersRequest, ExportedUserRecords, ExportedUserRecord>(
361-
() => userManager.CreateUserRecordServiceRequest(requestOptions),
361+
() => userManager.CreateListUserRequest(requestOptions),
362362
new ListUsersPageManager());
363363

364364
return restPagedAsyncEnumerable;

FirebaseAdmin/FirebaseAdmin/Auth/FirebaseUserManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public async Task<UserRecord> GetUserById(
9999
return new UserRecord(user);
100100
}
101101

102-
public ListUsersRequest CreateUserRecordServiceRequest(ListUsersOptions requestOptions)
102+
public ListUsersRequest CreateListUserRequest(ListUsersOptions requestOptions)
103103
{
104104
return new ListUsersRequest(this.baseUrl, this.httpClient, requestOptions);
105105
}

FirebaseAdmin/FirebaseAdmin/Auth/UserRecord.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class UserRecord : IUserInfo
4040
private long tokensValidAfterTimestamp;
4141
private UserMetadata userMetaData;
4242
private IReadOnlyDictionary<string, object> customClaims;
43+
private long createdAt;
44+
private long lastLoginAt;
45+
private long validSince;
4346

4447
/// <summary>
4548
/// Initializes a new instance of the <see cref="UserRecord"/> class with the specified user ID.
@@ -96,6 +99,10 @@ internal UserRecord(GetAccountInfoResponse.User user)
9699
this.tokensValidAfterTimestamp = user.ValidSince * 1000;
97100
this.userMetaData = new UserMetadata(user.CreatedAt, user.LastLoginAt);
98101
this.customClaims = UserRecord.ParseCustomClaims(user.CustomClaims);
102+
103+
this.createdAt = user.CreatedAt;
104+
this.lastLoginAt = user.LastLoginAt;
105+
this.validSince = user.ValidSince;
99106
}
100107

101108
/// <summary>
@@ -177,6 +184,30 @@ public string ProviderId
177184
/// </summary>
178185
public long TokensValidAfterTimestamp => this.tokensValidAfterTimestamp;
179186

187+
/// <summary>
188+
/// Gets the timestamp representing the time that the user account was created.
189+
/// </summary>
190+
public long CreatedAt
191+
{
192+
get => this.createdAt;
193+
}
194+
195+
/// <summary>
196+
/// Gets the timestamp representing the last time that the user has logged in.
197+
/// </summary>
198+
public long LastLoginAt
199+
{
200+
get => this.lastLoginAt;
201+
}
202+
203+
/// <summary>
204+
/// Gets the timestamp representing the time that the user account was first valid.
205+
/// </summary>
206+
public long ValidSince
207+
{
208+
get => this.validSince;
209+
}
210+
180211
/// <summary>
181212
/// Gets additional user metadata.
182213
/// </summary>

0 commit comments

Comments
 (0)