starting implementation

This commit is contained in:
talksik
2022-05-22 05:35:03 -05:00
parent f98026a3a5
commit 29cc445092
5 changed files with 95 additions and 57 deletions
+9 -13
View File
@@ -1,9 +1,9 @@
import { GoogleUserInfo, User } from "@nirvana/core/models";
import { GoogleUserInfo, User } from '@nirvana/core/models';
import { ObjectId } from "mongodb";
import { UserStatus } from "../../core/models/user.model";
import axios from "axios";
import { collections } from "./database.service";
import { ObjectId } from 'mongodb';
import { UserStatus } from '../../core/models/user.model';
import axios from 'axios';
import { collections } from './database.service';
export class UserService {
static async getUserById(userId: string) {
@@ -62,11 +62,11 @@ export class UserService {
// based on index defined in Mongo atlas
const query = {
$search: {
index: "basic user search",
index: 'basic user search',
text: {
query: searchQuery,
path: {
wildcard: "*",
wildcard: '*',
},
},
},
@@ -95,13 +95,9 @@ export class UserService {
return null;
}
static async getGoogleUserInfoWithAccessToken(
accessToken: string
): Promise<GoogleUserInfo> {
static async getGoogleUserInfoWithAccessToken(accessToken: string): Promise<GoogleUserInfo> {
return (
await axios.get(
`https://www.googleapis.com/oauth2/v1/userinfo?access_token=${accessToken}`
)
await axios.get(`https://www.googleapis.com/oauth2/v1/userinfo?access_token=${accessToken}`)
).data;
}