feat: WebSocket based implementation of server sent events for cache busting (#527)

* rough implementation of WS based event system for server side notifications of mutation

* fix test construction

* fix deadlock on event bus

* disable linter error

* add item mutation events

* remove old event bus code

* refactor event system to use composables

* refresh items table when new item is added

* fix create form errors

* cleanup unnecessary calls

* fix importer erorrs + limit fn calls on import
This commit is contained in:
Hayden 2023-08-02 13:00:57 -08:00 committed by GitHub
parent cceec06148
commit 2cbcc8bb1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 458 additions and 208 deletions

View file

@ -30,7 +30,7 @@ func useLocations(t *testing.T, len int) []LocationOut {
t.Cleanup(func() {
for _, loc := range out {
err := tRepos.Locations.Delete(context.Background(), loc.ID)
err := tRepos.Locations.delete(context.Background(), loc.ID)
if err != nil {
assert.True(t, ent.IsNotFound(err))
}
@ -49,7 +49,7 @@ func TestLocationRepository_Get(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, loc.ID, foundLoc.ID)
err = tRepos.Locations.Delete(context.Background(), loc.ID)
err = tRepos.Locations.delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
@ -83,7 +83,7 @@ func TestLocationRepository_Create(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, loc.ID, foundLoc.ID)
err = tRepos.Locations.Delete(context.Background(), loc.ID)
err = tRepos.Locations.delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
@ -96,7 +96,7 @@ func TestLocationRepository_Update(t *testing.T) {
Description: fk.Str(100),
}
update, err := tRepos.Locations.Update(context.Background(), updateData)
update, err := tRepos.Locations.UpdateByGroup(context.Background(), tGroup.ID, updateData.ID, updateData)
assert.NoError(t, err)
foundLoc, err := tRepos.Locations.Get(context.Background(), loc.ID)
@ -106,14 +106,14 @@ func TestLocationRepository_Update(t *testing.T) {
assert.Equal(t, update.Name, foundLoc.Name)
assert.Equal(t, update.Description, foundLoc.Description)
err = tRepos.Locations.Delete(context.Background(), loc.ID)
err = tRepos.Locations.delete(context.Background(), loc.ID)
assert.NoError(t, err)
}
func TestLocationRepository_Delete(t *testing.T) {
loc := useLocations(t, 1)[0]
err := tRepos.Locations.Delete(context.Background(), loc.ID)
err := tRepos.Locations.delete(context.Background(), loc.ID)
assert.NoError(t, err)
_, err = tRepos.Locations.Get(context.Background(), loc.ID)