feat: migrate IM identity and snowflake primary keys
This commit is contained in:
@@ -593,6 +593,9 @@ func (s *testProfilesStore) Update(_ types.TenantID, uid types.Uid, patch types.
|
||||
if patch.Signature != nil {
|
||||
profile.Signature = *patch.Signature
|
||||
}
|
||||
if patch.Email != nil {
|
||||
profile.Email = *patch.Email
|
||||
}
|
||||
profile.Version = patch.Version + 1
|
||||
profile.UpdatedAt = time.Now().UTC().Round(time.Millisecond)
|
||||
return profile, nil
|
||||
@@ -2023,7 +2026,7 @@ func TestServeIMMeProfile(t *testing.T) {
|
||||
store.Profiles = profiles
|
||||
defer func() { store.Profiles = oldProfiles }()
|
||||
|
||||
req := httptest.NewRequest(http.MethodPatch, "/v1/im/me/profile", strings.NewReader(`{"nickname":"新昵称","signature":"签名","version":1}`))
|
||||
req := httptest.NewRequest(http.MethodPatch, "/v1/im/me/profile", strings.NewReader(`{"nickname":"新昵称","signature":"签名","email":"me@example.com","version":1}`))
|
||||
req.Header.Set("Authorization", "Bearer token-1")
|
||||
rec := httptest.NewRecorder()
|
||||
serveIMMeProfile(rec, req)
|
||||
@@ -2032,7 +2035,7 @@ func TestServeIMMeProfile(t *testing.T) {
|
||||
t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
data := decodeIMHTTPResponse(t, rec).Data.(map[string]any)
|
||||
if data["nickname"] != "新昵称" || data["version"].(float64) != 2 {
|
||||
if data["nickname"] != "新昵称" || data["email"] != "me@example.com" || data["version"].(float64) != 2 {
|
||||
t.Fatalf("unexpected profile: %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user