call transaction Dao events only after commit, added totalPages to the search response and updated the tests
This commit is contained in:
@@ -553,7 +553,7 @@ func TestCollectionImport(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + successfull collections save",
|
||||
Name: "authorized as admin + successful collections save",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{
|
||||
@@ -601,7 +601,7 @@ func TestCollectionImport(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + successfull collections save and old non-system collections deletion",
|
||||
Name: "authorized as admin + successful collections save and old non-system collections deletion",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{
|
||||
|
||||
+8
-4
@@ -210,13 +210,17 @@ func (api *realtimeApi) bindEvents() {
|
||||
return nil
|
||||
})
|
||||
|
||||
api.app.OnRecordAfterCreateRequest().Add(func(e *core.RecordCreateEvent) error {
|
||||
api.broadcastRecord("create", e.Record)
|
||||
api.app.OnModelAfterCreate().Add(func(e *core.ModelEvent) error {
|
||||
if record, ok := e.Model.(*models.Record); ok {
|
||||
api.broadcastRecord("create", record)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
api.app.OnRecordAfterUpdateRequest().Add(func(e *core.RecordUpdateEvent) error {
|
||||
api.broadcastRecord("update", e.Record)
|
||||
api.app.OnModelAfterUpdate().Add(func(e *core.ModelEvent) error {
|
||||
if record, ok := e.Model.(*models.Record); ok {
|
||||
api.broadcastRecord("update", record)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user