File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Chats } from './collections/chats';
22import { Messages } from './collections/messages' ;
33import { MessageType , Profile } from './models' ;
44import { check , Match } from 'meteor/check' ;
5+ import { Users } from "./collections/users" ;
56
67const nonEmptyString = Match . Where ( ( str ) => {
78 check ( str , String ) ;
@@ -94,5 +95,12 @@ Meteor.methods({
9495 } ,
9596 countMessages ( ) : number {
9697 return Messages . collection . find ( ) . count ( ) ;
98+ } ,
99+ saveFcmToken ( token : string ) : void {
100+ if ( ! this . userId ) throw new Meteor . Error ( 'unauthorized' , 'User must be logged-in to call this method' ) ;
101+
102+ check ( token , nonEmptyString ) ;
103+
104+ Users . collection . update ( { _id : this . userId } , { $set : { "fcmToken" : token } } ) ;
97105 }
98106} ) ;
You can’t perform that action at this time.
0 commit comments