mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 08:13:49 +10:00
feat(all): upgrade to v3.4.0
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
FROM node:17-alpine as dependencies
|
||||
FROM node:lts-alpine as dependencies
|
||||
|
||||
RUN apk add --no-cache g++ curl make python3 \
|
||||
&& curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
|
||||
@ -11,7 +11,7 @@ COPY ./server/package.json ./server/package.json
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
FROM node:17-alpine as builder
|
||||
FROM node:lts-alpine as builder
|
||||
|
||||
RUN apk add --no-cache g++ curl make python3 \
|
||||
&& curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"lint": "eslint --fix --ext .ts ./src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.67.0",
|
||||
"@aws-sdk/client-s3": "^3.81.0",
|
||||
"@nestjs/axios": "^0.0.7",
|
||||
"@nestjs/common": "^8.4.4",
|
||||
"@nestjs/config": "^2.0.0",
|
||||
@ -31,23 +31,23 @@
|
||||
"class-validator": "^0.13.2",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"csvtojson": "^2.0.10",
|
||||
"dayjs": "^1.11.0",
|
||||
"googleapis": "^100.0.0",
|
||||
"dayjs": "^1.11.1",
|
||||
"google-auth-library": "^8.0.2",
|
||||
"joi": "^17.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"multer": "^1.4.4",
|
||||
"nanoid": "^3.3.2",
|
||||
"nanoid": "^3.3.3",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"passport": "^0.5.2",
|
||||
"passport-jwt": "^4.0.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pg": "^8.7.3",
|
||||
"playwright-chromium": "^1.20.2",
|
||||
"playwright-chromium": "^1.21.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.5.5",
|
||||
"typeorm": "^0.2.34",
|
||||
"typeorm": "0.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -55,17 +55,17 @@
|
||||
"@nestjs/schematics": "^8.0.10",
|
||||
"@reactive-resume/schema": "workspace:*",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/cookie-parser": "^1.4.2",
|
||||
"@types/cookie-parser": "^1.4.3",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/node": "^17.0.23",
|
||||
"eslint": "^8.12.0",
|
||||
"@types/node": "^17.0.30",
|
||||
"eslint": "^8.14.0",
|
||||
"prettier": "^2.6.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"ts-loader": "^9.2.8",
|
||||
"ts-loader": "^9.2.9",
|
||||
"ts-node": "^10.7.0",
|
||||
"tsconfig-paths": "^3.14.1",
|
||||
"typescript": "<4.6.0",
|
||||
"typescript": "^4.6.4",
|
||||
"webpack": "^5.72.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ export class AuthController {
|
||||
}
|
||||
|
||||
@Post('google')
|
||||
async loginWithGoogle(@Body('accessToken') googleAccessToken: string) {
|
||||
const user = await this.authService.authenticateWithGoogle(googleAccessToken);
|
||||
async loginWithGoogle(@Body('credential') credential: string) {
|
||||
const user = await this.authService.authenticateWithGoogle(credential);
|
||||
const accessToken = this.authService.getAccessToken(user.id);
|
||||
|
||||
return { user, accessToken };
|
||||
|
||||
@ -4,7 +4,7 @@ import { JwtService } from '@nestjs/jwt';
|
||||
import { SchedulerRegistry } from '@nestjs/schedule';
|
||||
import bcrypt from 'bcrypt';
|
||||
import { randomInt } from 'crypto';
|
||||
import { google } from 'googleapis';
|
||||
import { OAuth2Client } from 'google-auth-library';
|
||||
|
||||
import { PostgresErrorCode } from '@/database/errorCodes.enum';
|
||||
import { CreateGoogleUserDto } from '@/users/dto/create-google-user.dto';
|
||||
@ -107,17 +107,16 @@ export class AuthService {
|
||||
return this.usersService.findById(payload.id);
|
||||
}
|
||||
|
||||
async authenticateWithGoogle(googleAccessToken: string) {
|
||||
async authenticateWithGoogle(credential: string) {
|
||||
const clientID = this.configService.get<string>('google.clientID');
|
||||
const clientSecret = this.configService.get<string>('google.clientSecret');
|
||||
|
||||
const OAuthClient = new google.auth.OAuth2(clientID, clientSecret);
|
||||
OAuthClient.setCredentials({ access_token: googleAccessToken });
|
||||
|
||||
const { email } = await OAuthClient.getTokenInfo(googleAccessToken);
|
||||
const OAuthClient = new OAuth2Client(clientID, clientSecret);
|
||||
const client = await OAuthClient.verifyIdToken({ idToken: credential });
|
||||
const userPayload = client.getPayload();
|
||||
|
||||
try {
|
||||
const user = await this.usersService.findByEmail(email);
|
||||
const user = await this.usersService.findByEmail(userPayload.email);
|
||||
|
||||
return user;
|
||||
} catch (error: any) {
|
||||
@ -125,14 +124,12 @@ export class AuthService {
|
||||
throw new HttpException(error, HttpStatus.BAD_GATEWAY);
|
||||
}
|
||||
|
||||
const UserInfoClient = google.oauth2('v2').userinfo;
|
||||
const { data } = await UserInfoClient.get({ auth: OAuthClient });
|
||||
const username = data.email.split('@')[0];
|
||||
const username = userPayload.email.split('@')[0];
|
||||
|
||||
const createUserDto: CreateGoogleUserDto = {
|
||||
name: `${data.given_name} ${data.family_name}`,
|
||||
name: `${userPayload.given_name} ${userPayload.family_name}`,
|
||||
username,
|
||||
email: data.email,
|
||||
email: userPayload.email,
|
||||
provider: 'google',
|
||||
};
|
||||
|
||||
|
||||
22037
server/src/fonts/assets/cachedResponse.json
Normal file
22037
server/src/fonts/assets/cachedResponse.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,8 @@ import { Font } from '@reactive-resume/schema';
|
||||
import { get } from 'lodash';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
import cachedResponse from './assets/cachedResponse.json';
|
||||
|
||||
@Injectable()
|
||||
export class FontsService {
|
||||
constructor(private configService: ConfigService, private httpService: HttpService) {}
|
||||
@ -13,8 +15,14 @@ export class FontsService {
|
||||
const apiKey = this.configService.get<string>('google.apiKey');
|
||||
const url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=' + apiKey;
|
||||
|
||||
const response = await firstValueFrom(this.httpService.get(url));
|
||||
const data = get(response.data, 'items', []);
|
||||
let data = [];
|
||||
|
||||
if (apiKey) {
|
||||
const response = await firstValueFrom(this.httpService.get(url));
|
||||
data = get(response.data, 'items', []);
|
||||
} else {
|
||||
data = cachedResponse;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ const defaultState: Partial<Resume> = {
|
||||
basics: {
|
||||
email: '',
|
||||
headline: '',
|
||||
birthdate: '',
|
||||
photo: {
|
||||
url: '',
|
||||
visible: true,
|
||||
|
||||
@ -5,6 +5,7 @@ const sampleData: Partial<Resume> = {
|
||||
name: 'Alexis Jones',
|
||||
email: 'alexis.jones@gmail.com',
|
||||
phone: '+1 800 1200 3820',
|
||||
birthdate: '1995-08-06T00:00:00.000Z',
|
||||
photo: {
|
||||
url: `/images/sample-photo.jpg`,
|
||||
filters: {
|
||||
|
||||
@ -35,6 +35,8 @@ export class ResumeController {
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
async findAllByUser(@User('id') userId: number) {
|
||||
console.log('findAllByUser', userId);
|
||||
|
||||
return this.resumeService.findAllByUser(userId);
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitAny": false,
|
||||
"resolveJsonModule": true,
|
||||
"strictBindCallApply": false,
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"noFallthroughCasesInSwitch": false,
|
||||
|
||||
Reference in New Issue
Block a user