@@ -740,7 +740,7 @@ usersApi.checkNoteEditPermission = async function(params) {
740
740
return reject ( false ) ;
741
741
}
742
742
const globalAdmin = params . member . global_admin ;
743
- const isAppAdmin = hasAdminAccess ( params . member , params . qstring . args . app_id ) ;
743
+ const isAppAdmin = hasAdminAccess ( params . member , params . qstring . app_id ) ;
744
744
const noteOwner = ( note . owner + '' === params . member . _id + '' ) ;
745
745
return resolve ( noteOwner || ( isAppAdmin && note . noteType === 'public' ) || ( globalAdmin && note . noteType === 'public' ) ) ;
746
746
}
@@ -780,6 +780,10 @@ usersApi.saveNote = async function(params) {
780
780
'category' : {
781
781
'required' : false ,
782
782
'type' : 'Boolean'
783
+ } ,
784
+ "indicator" : {
785
+ 'required' : false ,
786
+ 'type' : 'String'
783
787
}
784
788
} ;
785
789
const args = params . qstring . args ;
@@ -796,6 +800,7 @@ usersApi.saveNote = async function(params) {
796
800
owner : params . member . _id + "" ,
797
801
created_at : new Date ( ) . getTime ( ) ,
798
802
updated_at : new Date ( ) . getTime ( ) ,
803
+ indicator : args . indicator ,
799
804
} ;
800
805
801
806
if ( args . _id ) {
@@ -910,8 +915,8 @@ usersApi.fetchUserAppIds = async function(params) {
910
915
**/
911
916
usersApi . fetchNotes = async function ( params ) {
912
917
countlyCommon . getPeriodObj ( params ) ;
918
+ // const timestampRange = countlyCommon.getTimestampRangeQuery(params, false);
913
919
914
- const timestampRange = countlyCommon . getTimestampRangeQuery ( params , false ) ;
915
920
let appIds = [ ] ;
916
921
let filtedAppIds = [ ] ;
917
922
try {
@@ -931,21 +936,21 @@ usersApi.fetchNotes = async function(params) {
931
936
}
932
937
const query = {
933
938
'app_id' : { $in : filtedAppIds } ,
934
- 'ts' : timestampRange ,
939
+ 'ts' : { $gte : params . qstring . period [ 0 ] , $lte : params . qstring . period [ 1 ] } ,
935
940
$or : [
936
941
{ 'owner' : params . member . _id + "" } ,
937
942
{ 'noteType' : 'public' } ,
938
943
{ 'emails' : { '$in' : [ params . member . email ] } } ,
939
944
] ,
940
945
} ;
941
-
942
946
if ( params . qstring . category ) {
943
- query . category = params . qstring . category ;
947
+ query . category = { $in : JSON . parse ( params . qstring . category ) } ;
944
948
}
945
949
946
950
if ( params . qstring . note_type ) {
947
951
query . noteType = params . qstring . note_type ;
948
952
}
953
+
949
954
let skip = params . qstring . iDisplayStart || 0 ;
950
955
let limit = params . qstring . iDisplayLength || 5000 ;
951
956
const sEcho = params . qstring . sEcho || 1 ;
@@ -968,6 +973,7 @@ usersApi.fetchNotes = async function(params) {
968
973
log . e ( ' got error while paring query notes request' , e ) ;
969
974
}
970
975
let count = 0 ;
976
+
971
977
common . db . collection ( 'notes' ) . count ( query , function ( error , noteCount ) {
972
978
if ( ! error && noteCount ) {
973
979
count = noteCount ;
0 commit comments