File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- export interface ICredentialToken {
2- _id : string ;
1+ import type { IRocketChatRecord } from './IRocketChatRecord' ;
32
3+ export interface ICredentialToken extends IRocketChatRecord {
44 userInfo : {
55 username ?: string ;
66 attributes ?: any ;
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ import type { ICredentialToken } from '@rocket.chat/core-typings';
33import type { IBaseModel } from './IBaseModel' ;
44
55export interface ICredentialTokensModel extends IBaseModel < ICredentialToken > {
6- create ( _id : string , userInfo : ICredentialToken [ 'userInfo' ] ) : Promise < ICredentialToken > ;
6+ create ( _id : string , userInfo : ICredentialToken [ 'userInfo' ] ) : Promise < void > ;
77 findOneNotExpiredById ( _id : string ) : Promise < ICredentialToken | null > ;
88}
Original file line number Diff line number Diff line change 11import type { ICredentialToken , RocketChatRecordDeleted } from '@rocket.chat/core-typings' ;
2- import type { ICredentialTokensModel } from '@rocket.chat/model-typings' ;
2+ import type { ICredentialTokensModel , InsertionModel } from '@rocket.chat/model-typings' ;
33import type { Collection , Db , IndexDescription } from 'mongodb' ;
44
55import { BaseRaw } from './BaseRaw' ;
@@ -13,16 +13,15 @@ export class CredentialTokensRaw extends BaseRaw<ICredentialToken> implements IC
1313 return [ { key : { expireAt : 1 } , sparse : true , expireAfterSeconds : 0 } ] ;
1414 }
1515
16- async create ( _id : string , userInfo : ICredentialToken [ 'userInfo' ] ) : Promise < ICredentialToken > {
16+ async create ( _id : string , userInfo : ICredentialToken [ 'userInfo' ] ) : Promise < void > {
1717 const validForMilliseconds = 60000 ; // Valid for 60 seconds
18- const token = {
18+ const token : InsertionModel < ICredentialToken > = {
1919 _id,
2020 userInfo,
2121 expireAt : new Date ( Date . now ( ) + validForMilliseconds ) ,
2222 } ;
2323
2424 await this . insertOne ( token ) ;
25- return token ;
2625 }
2726
2827 findOneNotExpiredById ( _id : string ) : Promise < ICredentialToken | null > {
You can’t perform that action at this time.
0 commit comments