-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature-exclude-deleted-organisations
- Loading branch information
Showing
80 changed files
with
2,283 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,33 @@ | ||
NODE_ENV=development | ||
PROFILE=local | ||
PORT=5000 | ||
HOST= | ||
REDIS_PORT= 6379 | ||
DB_SSL=true | ||
NODE_ENV=development | ||
|
||
PORT=3008 | ||
|
||
JWT_SECRET=someSecrets | ||
JWT_EXPIRY_TIMEFRAME=3600 | ||
|
||
|
||
REDIS_HOST=localhost | ||
REDIS_PORT=6379 | ||
DB_TYPE= | ||
|
||
DB_TYPE=postgres | ||
DB_USERNAME= | ||
DB_PASSWORD= | ||
DB_HOST= | ||
DB_NAME=hng | ||
DB_HOST=localhost | ||
DB_DATABASE= | ||
DB_ENTITIES=dist/src/modules/**/entities/**/*.entity{.ts,.js} | ||
DB_MIGRATIONS=dist/db/migrations/*{.ts,.js} | ||
POSGRES_USER=$DB_USERNAME | ||
POST | ||
JWT_SECRET=gsgs | ||
JWT_EXPIRY_TIMEFRAME=1500000 | ||
DB_SSL=false | ||
JWT_REFRESH_SECRET=bbp | ||
JWT_REFRESH_EXPIRY_TIMEFRAME=15 | ||
GOOGLE_REDIRECT_URI= | ||
|
||
JWT_SECRET=someSecrets | ||
JWT_EXPIRY_TIMEFRAME=3600 | ||
|
||
ADMIN_SECRET_KEY=sometext | ||
|
||
GOOGLE_CLIENT_SECRET= | ||
GOOGLE_CLIENT_ID= | ||
OAUTH_LOGIN_REDIRECT= | ||
SMTP_HOST= | ||
|
||
SMTP_HOST=sandbox.smtp.mailtrap.io | ||
SMTP_PORT=587 | ||
SERVER_NAME=Boilerplate | ||
SERVER_NAME=api | ||
SMTP_USER= | ||
SMTP_PASSWORD= | ||
FRONTEND_URL= | ||
ADMIN_SECRET= | ||
SUPPORT_EMAIL= | ||
AUTH_PASSWORD= | ||
BASE_URL= | ||
FLUTTERWAVE_SECRET_KEY= | ||
FLUTTERWAVE_BASE_URL= | ||
SMTP_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { registerAs } from '@nestjs/config'; | ||
|
||
export default registerAs('s3', () => ({ | ||
accessKey: process.env.AWS_ACCESS_KEY || '', | ||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '', | ||
region: process.env.AWS_REGION || 'us-east-2', | ||
bucketName: process.env.AWS_S3_BUCKET_NAME || '', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
gerge branch 'dev' into feat/s3-resume-upload | ||
# Please enter a commit message to explain why this merge is necessary, | ||
# especially if it merges an updated upstream into a topic branch. | ||
# | ||
# Lines starting with '#' will be ignored, and an empty message aborts | ||
# the commit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Injectable, CanActivate, ExecutionContext } from '@nestjs/common'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { Repository } from 'typeorm'; | ||
import { Job } from '../modules/jobs/entities/job.entity'; | ||
|
||
@Injectable() | ||
export class JobOwnerGuard implements CanActivate { | ||
constructor( | ||
@InjectRepository(Job) | ||
private readonly jobRepository: Repository<Job> | ||
) {} | ||
|
||
async canActivate(context: ExecutionContext): Promise<boolean> { | ||
const request = context.switchToHttp().getRequest(); | ||
const jobId = request.params.id; | ||
const userId = request.user.sub; | ||
|
||
if (!jobId || !userId) return false; | ||
|
||
const job = await this.jobRepository.findOne({ | ||
where: { id: jobId }, | ||
relations: ['user'], | ||
}); | ||
|
||
if (!job) return false; | ||
|
||
return job.user.id === userId; | ||
} | ||
} |
Oops, something went wrong.