@@ -791,7 +791,7 @@ export class RedisDriver implements Driver {
791791 const cmdOptions = { ...options , ...command . options } ;
792792
793793 switch ( command . type ) {
794- case 'create' :
794+ case 'create' : {
795795 if ( ! command . data ) {
796796 throw new ObjectQLError ( { code : 'DRIVER_QUERY_FAILED' , message : 'Create command requires data' } ) ;
797797 }
@@ -801,8 +801,9 @@ export class RedisDriver implements Driver {
801801 data : created ,
802802 affected : 1
803803 } ;
804+ }
804805
805- case 'update' :
806+ case 'update' : {
806807 if ( ! command . id || ! command . data ) {
807808 throw new ObjectQLError ( { code : 'DRIVER_QUERY_FAILED' , message : 'Update command requires id and data' } ) ;
808809 }
@@ -812,6 +813,7 @@ export class RedisDriver implements Driver {
812813 data : updated ,
813814 affected : 1
814815 } ;
816+ }
815817
816818 case 'delete' :
817819 if ( ! command . id ) {
@@ -823,7 +825,7 @@ export class RedisDriver implements Driver {
823825 affected : 1
824826 } ;
825827
826- case 'bulkCreate' :
828+ case 'bulkCreate' : {
827829 if ( ! command . records || ! Array . isArray ( command . records ) ) {
828830 throw new ObjectQLError ( { code : 'DRIVER_QUERY_FAILED' , message : 'BulkCreate command requires records array' } ) ;
829831 }
@@ -852,8 +854,9 @@ export class RedisDriver implements Driver {
852854 data : bulkCreated ,
853855 affected : command . records . length
854856 } ;
857+ }
855858
856- case 'bulkUpdate' :
859+ case 'bulkUpdate' : {
857860 if ( ! command . updates || ! Array . isArray ( command . updates ) ) {
858861 throw new ObjectQLError ( { code : 'DRIVER_QUERY_FAILED' , message : 'BulkUpdate command requires updates array' } ) ;
859862 }
@@ -901,8 +904,9 @@ export class RedisDriver implements Driver {
901904 data : updateResults ,
902905 affected : updateResults . length
903906 } ;
907+ }
904908
905- case 'bulkDelete' :
909+ case 'bulkDelete' : {
906910 if ( ! command . ids || ! Array . isArray ( command . ids ) ) {
907911 throw new ObjectQLError ( { code : 'DRIVER_QUERY_FAILED' , message : 'BulkDelete command requires ids array' } ) ;
908912 }
@@ -923,6 +927,7 @@ export class RedisDriver implements Driver {
923927 success : true ,
924928 affected : deleted
925929 } ;
930+ }
926931
927932 default :
928933 throw new ObjectQLError ( { code : 'DRIVER_UNSUPPORTED_OPERATION' , message : `Unknown command type: ${ ( command as any ) . type } ` } ) ;
@@ -1372,18 +1377,21 @@ export class RedisDriver implements Driver {
13721377 return sum + ( typeof value === 'number' ? value : 0 ) ;
13731378 } , 0 ) ;
13741379
1375- case '$avg' :
1380+ case '$avg' : {
13761381 const values = records . map ( rec => this . evaluateExpression ( operand , rec ) ) ;
13771382 const numbers = values . filter ( v => typeof v === 'number' ) ;
13781383 return numbers . length > 0 ? numbers . reduce ( ( a , b ) => a + b , 0 ) / numbers . length : null ;
1384+ }
13791385
1380- case '$min' :
1386+ case '$min' : {
13811387 const minValues = records . map ( rec => this . evaluateExpression ( operand , rec ) ) ;
13821388 return Math . min ( ...minValues . filter ( v => typeof v === 'number' ) ) ;
1389+ }
13831390
1384- case '$max' :
1391+ case '$max' : {
13851392 const maxValues = records . map ( rec => this . evaluateExpression ( operand , rec ) ) ;
13861393 return Math . max ( ...maxValues . filter ( v => typeof v === 'number' ) ) ;
1394+ }
13871395
13881396 case '$first' :
13891397 return records . length > 0 ? this . evaluateExpression ( operand , records [ 0 ] ) : null ;
@@ -1394,7 +1402,7 @@ export class RedisDriver implements Driver {
13941402 case '$push' :
13951403 return records . map ( rec => this . evaluateExpression ( operand , rec ) ) ;
13961404
1397- case '$addToSet' :
1405+ case '$addToSet' : {
13981406 const set = new Set ( records . map ( rec => {
13991407 const val = this . evaluateExpression ( operand , rec ) ;
14001408 return typeof val === 'object' ? JSON . stringify ( val ) : val ;
@@ -1409,6 +1417,7 @@ export class RedisDriver implements Driver {
14091417 }
14101418 return v ;
14111419 } ) ;
1420+ }
14121421
14131422 default :
14141423 return null ;
0 commit comments