File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { AuditPlugin } from '@andes/mongoose-plugin-audit';
33
44
55export const insumoSchema = new mongoose . Schema ( {
6- insumo : String ,
6+ nombre : String ,
77 tipo : {
88 type : String ,
99 enum : [ 'dispositivo' , 'nutricion' , 'magistral' ]
@@ -14,4 +14,4 @@ export const insumoSchema = new mongoose.Schema({
1414
1515insumoSchema . plugin ( AuditPlugin ) ;
1616
17- export const Insumo = mongoose . model ( 'insumo' , insumoSchema , 'insumo ' ) ;
17+ export const Insumo = mongoose . model ( 'insumo' , insumoSchema , 'insumos ' ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,14 @@ class InsumosResource extends ResourceBase {
77 resourceName = 'insumos' ;
88 middlewares = [ Auth . authenticate ( ) ] ;
99 searchFileds = {
10- insumo : MongoQuery . partialString ,
10+ nombre : ( value : any ) => {
11+ if ( value && value . charAt ( 0 ) === '^' ) {
12+ const searchPattern = value . substring ( 1 ) ;
13+ const escaped = searchPattern . replace ( / [ . * + ? ^ $ { } ( ) | [ \\ ] \\ \\ ] / g, '\\$&' ) ;
14+ return { $regex : escaped , $options : 'i' } ;
15+ }
16+ return value ;
17+ } ,
1118 tipo : MongoQuery . inArray ,
1219 requiereEspecificacion : MongoQuery . equalMatch ,
1320 } ;
You can’t perform that action at this time.
0 commit comments