@qelos/auth
Version:
Express Passport authentication service
46 lines (45 loc) • 1.45 kB
TypeScript
import { ObjectId, Document, Model } from 'mongoose';
export interface IUser {
_id?: any;
tenant: string;
username: string;
email?: string;
phone?: string;
password: string;
fullName: string;
firstName: string;
lastName: string;
birthDate: string;
profileImage: string;
salt: string;
roles: string[];
tokens: any[];
metadata: any;
emailVerified?: boolean;
socialLogins?: string[];
lastLogin: {
created: Date;
workspace: ObjectId | string;
};
created: Date;
}
export interface UserDocument extends Omit<IUser, '_id'>, Document {
}
export interface UserModel extends Model<UserDocument> {
comparePassword(password: string, callback: (err: Error, success: boolean) => void): void;
getToken(payload: {
authType: string;
expiresIn?: string;
workspace?: any;
}): any;
getRefreshToken(relatedToken: string): any;
updateToken(authType: string, currentPayload: {
tokenIdentifier: any;
workspace?: any;
}, newIdentifier: string, relatedToken?: string): Promise<UserDocument>;
deleteToken(authType: string, tokenIdentifier: string): Promise<UserDocument>;
getTokenByRelatedTokens(authType: string, tokenIdentifier: string): string;
getUsersList(tenant: string, usersIds: ObjectId[], privilegedUserFields?: string): Promise<string>;
}
declare const User: UserModel;
export default User;