feat: migrate IM identity and snowflake primary keys

This commit is contained in:
richjohnrambo
2026-08-18 01:15:21 +08:00
parent db322d80dd
commit bf562c7d56
27 changed files with 1071 additions and 482 deletions
+5 -2
View File
@@ -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)
}
}