Skip to content

Commit

Permalink
add LastSignInAt to User (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
stacurry authored Feb 21, 2025
1 parent 9ba33da commit 006c081
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/usermanagement/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ type User struct {

// A URL reference to an image representing the User.
ProfilePictureURL string `json:"profile_picture_url"`

// The timestamp when the user last signed in.
LastSignInAt string `json:"last_sign_in_at"`
}

// Represents User identities obtained from external identity providers.
Expand Down
14 changes: 14 additions & 0 deletions pkg/usermanagement/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestGetUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand All @@ -56,6 +57,7 @@ func TestGetUser(t *testing.T) {
LastName: "Davis",
EmailVerified: true,
ProfilePictureURL: "https://workoscdn.com/images/v1/123abc",
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -99,6 +101,7 @@ func getUserTestHandler(w http.ResponseWriter, r *http.Request) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
})
Expand All @@ -112,6 +115,7 @@ func getUserTestHandler(w http.ResponseWriter, r *http.Request) {
LastName: "Davis",
EmailVerified: true,
ProfilePictureURL: "https://workoscdn.com/images/v1/123abc",
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
})
Expand Down Expand Up @@ -144,6 +148,7 @@ func TestListUsers(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -176,6 +181,7 @@ func TestListUsers(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -215,6 +221,7 @@ func TestListUsers(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -254,6 +261,7 @@ func listUsersTestHandler(w http.ResponseWriter, r *http.Request) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -301,6 +309,7 @@ func TestCreateUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -344,6 +353,7 @@ func createUserTestHandler(w http.ResponseWriter, r *http.Request) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
})
Expand Down Expand Up @@ -386,6 +396,7 @@ func TestUpdateUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -429,6 +440,7 @@ func updateUserTestHandler(w http.ResponseWriter, r *http.Request) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
})
Expand Down Expand Up @@ -1309,6 +1321,7 @@ func TestSendVerificationEmail(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -1355,6 +1368,7 @@ func sendVerificationEmailTestHandler(w http.ResponseWriter, r *http.Request) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down
7 changes: 7 additions & 0 deletions pkg/usermanagement/usermanagement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestUserManagementGetUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
}
Expand Down Expand Up @@ -62,6 +63,7 @@ func TestUserManagementListUsers(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down Expand Up @@ -91,6 +93,7 @@ func TestUserManagementCreateUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
}
Expand Down Expand Up @@ -121,6 +124,7 @@ func TestUserManagementCreateUserPasswordHash(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
}
Expand Down Expand Up @@ -152,6 +156,7 @@ func TestUserManagementUpdateUser(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
}
Expand Down Expand Up @@ -182,6 +187,7 @@ func TestUserManagementUpdateUserPasswordHash(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
}
Expand Down Expand Up @@ -255,6 +261,7 @@ func TestUsersSendVerificationEmail(t *testing.T) {
FirstName: "Marcelina",
LastName: "Davis",
EmailVerified: true,
LastSignInAt: "2021-06-25T19:07:33.155Z",
CreatedAt: "2021-06-25T19:07:33.155Z",
UpdatedAt: "2021-06-25T19:07:33.155Z",
},
Expand Down

0 comments on commit 006c081

Please sign in to comment.