File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -218,20 +218,20 @@ export const RepoFor = <
218
218
existing : Pick < Dto , 'id' > ,
219
219
input : UpdateShape < TResourceStatic [ 'DB' ] & { } > ,
220
220
) : Promise < Dto > {
221
- const query = e . select (
222
- e . update ( this . resource . db , ( ) => ( {
223
- filter_single : { id : existing . id } as any ,
224
- set : input ,
225
- } ) ) ,
226
- this . hydrate as any ,
221
+ const object = e . cast (
222
+ this . resource . db ,
223
+ e . cast ( e . uuid , existing . id as ID ) ,
227
224
) ;
225
+ const updated = e . update ( object , ( ) => ( {
226
+ set : input ,
227
+ } ) ) ;
228
+ const query = e . select ( updated , this . hydrate as any ) ;
228
229
return ( await this . db . run ( query ) ) as Dto ;
229
230
}
230
231
231
232
async delete ( id : ID ) : Promise < void > {
232
- const query = e . delete ( this . resource . db , ( ) => ( {
233
- filter_single : { id } as any ,
234
- } ) ) ;
233
+ const existing = e . cast ( this . resource . db , e . cast ( e . uuid , id ) ) ;
234
+ const query = e . delete ( existing ) ;
235
235
await this . db . run ( query ) ;
236
236
}
237
237
}
You can’t perform that action at this time.
0 commit comments