You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a test case that uses this library's testing infrastructure. Should be able to just add it to the testing directory.
import{expect}from'chai';importfeathersfrom'@feathersjs/feathers';importknexfrom'knex';importservicefrom'../src';importPeoplefrom'./people';import{Model}from'objection';constdb=knex({client: 'sqlite3',debug: false,connection: {filename: './db.sqlite'},useNullAsDefault: false});// Bind Objection.jsModel.knex(db);constapp=feathers().use('/people',service({model: People,id: 'id',multi: ['create','patch'],whitelist: ['$and','$like','$between','$notBetween'],events: ['testing']}));constpeople=app.service('people');functionclean(done){db.schema.dropTableIfExists('people').then(()=>{returndb.schema.createTable('people',(table)=>{table.increments('id');table.string('name');table.integer('age');table.integer('time');table.boolean('created');}).then(()=>done());});}describe('Additional Patch Test',()=>{before(clean);after(clean);beforeEach(async()=>{awaitpeople.create([{id: 1,name: 'Ahmed',age: 35},{id: 2,name: 'Hans'},{id: 3,name: 'Samantha'}]);});afterEach(async()=>{try{awaitpeople.remove(1);}catch(err){}try{awaitpeople.remove(2);}catch(err){}try{awaitpeople.remove(3);}catch(err){}});it('patch with null id and query',()=>{returnpeople.patch(null,{age: 42},{query: {age: null}}).then((data)=>{expect(data.length).to.be.equal(2);});});});
Expected
We should be able to patch multiple items and get back the changed items, even if the data changed is in the original query.
What happens?
If the data used to find the items in the original query changes, the patch operation succeeds in changing the items in the database, but then fails and throws a NotFound: No record found of id 'null error, rather than returning the data.
This is breaking functionality like "soft delete" for me.
The text was updated successfully, but these errors were encountered:
It is an expected behavior in the sense that it has always behaved this way, but the behavior could not align with the expected behavior from FeathersJS database adapters.
I'll keep the ticket opened until I can verify this.
I wrote a test case that uses this library's testing infrastructure. Should be able to just add it to the testing directory.
Expected
We should be able to
patch
multiple items and get back the changed items, even if the data changed is in the original query.What happens?
If the data used to find the items in the original query changes, the patch operation succeeds in changing the items in the database, but then fails and throws a
NotFound: No record found of id 'null
error, rather than returning the data.This is breaking functionality like "soft delete" for me.
The text was updated successfully, but these errors were encountered: