-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hp/fix/lint-rules
- Loading branch information
Showing
95 changed files
with
17,631 additions
and
513 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 |
---|---|---|
|
@@ -2,10 +2,13 @@ DATABASE_URL=postgresql://postgres:<your-project-password>@db.<your-project-name | |
SUPABASE_API_URL=https://<your-project-name>.supabase.co | ||
SUPABASE_ANON_KEY= | ||
|
||
RESEND_API_KEY=re_ | ||
SMTP_HOST= | ||
SMTP_PORT= | ||
SMTP_EMAIL_ADDRESS= | ||
SMTP_PASSWORD= | ||
FROM_EMAIL="your-name <[email protected]>" | ||
|
||
JWT_SECRET=secret | ||
|
||
FROM_EMAIL="your-name <[email protected]>" | ||
WEB_FRONTEND_URL=https://keyshade.xyz | ||
WORKSPACE_FRONTEND_URL=https://app.keyshade.xyz |
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,42 @@ | ||
name: Auto-assign issue on /attempt comment | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
auto-assign: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const comment = context.payload.comment; | ||
const issue = context.issue; | ||
const owner = "keyshade-xyz"; | ||
const repo = "keyshade" | ||
if (comment.body.startsWith('/attempt')) { | ||
if (!issue.assignee) { | ||
await github.rest.issues.addAssignees({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
assignees: [comment.user.login] | ||
}); | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
body: 'Assigned the issue to you!' | ||
}); | ||
} else { | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
body: 'This issue is already assigned. Tag a maintainer if you need to take over.' | ||
}); | ||
} | ||
} |
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
Empty file.
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
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,35 @@ | ||
import { Test, TestingModule } from '@nestjs/testing' | ||
import { MockAuthRepository } from '../repository/mock.repository' | ||
import { AUTH_REPOSITORY } from '../repository/interface.repository' | ||
import { AuthService } from '../service/auth.service' | ||
import { MAIL_SERVICE } from '../../mail/services/interface.service' | ||
import { MockMailService } from '../../mail/services/mock.service' | ||
import { JwtService } from '@nestjs/jwt' | ||
import { PrismaService } from '../../prisma/prisma.service' | ||
import { AuthController } from './auth.controller' | ||
import { USER_REPOSITORY } from '../../user/repository/interface.repository' | ||
import { MockUserRepository } from '../../user/repository/mock.repository' | ||
|
||
describe('AuthController', () => { | ||
let controller: AuthController | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [AuthController], | ||
providers: [ | ||
AuthService, | ||
{ provide: MAIL_SERVICE, useClass: MockMailService }, | ||
{ provide: AUTH_REPOSITORY, useClass: MockAuthRepository }, | ||
{ provide: USER_REPOSITORY, useClass: MockUserRepository }, | ||
JwtService, | ||
PrismaService | ||
] | ||
}).compile() | ||
|
||
controller = module.get<AuthController>(AuthController) | ||
}) | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined() | ||
}) | ||
}) |
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,74 @@ | ||
import { Controller, HttpStatus, Param, Post, Query } from '@nestjs/common' | ||
import { AuthService } from '../service/auth.service' | ||
import { UserAuthenticatedResponse } from '../auth.types' | ||
import { Public } from '../../decorators/public.decorator' | ||
import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger' | ||
|
||
@ApiTags('Auth Controller') | ||
@Controller('auth') | ||
export class AuthController { | ||
constructor(private authService: AuthService) {} | ||
|
||
@Public() | ||
@Post('send-otp/:email') | ||
@ApiOperation({ | ||
summary: 'Send OTP', | ||
description: | ||
'This endpoint sends OTPs to an email address. The OTP can then be used to generate valid tokens' | ||
}) | ||
@ApiParam({ | ||
name: 'email', | ||
description: 'Email to send OTP', | ||
required: true | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Send OTP successfully' | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.BAD_REQUEST, | ||
description: 'Email is invalid' | ||
}) | ||
async sendOtp( | ||
@Param('email') | ||
email: string | ||
): Promise<void> { | ||
await this.authService.sendOtp(email) | ||
} | ||
|
||
@Public() | ||
@Post('validate-otp') | ||
@ApiOperation({ | ||
summary: 'Validate OTP', | ||
description: | ||
'This endpoint validates OTPs. If the OTP is valid, it returns a valid token along with the user details' | ||
}) | ||
@ApiParam({ | ||
name: 'email', | ||
description: 'Email to send OTP', | ||
required: true | ||
}) | ||
@ApiParam({ | ||
name: 'otp', | ||
description: 'OTP to validate', | ||
required: true | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Validate OTP successfully' | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.NOT_FOUND, | ||
description: 'Email not found' | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.UNAUTHORIZED, | ||
description: 'OTP is invalid' | ||
}) | ||
async validateOtp( | ||
@Query('email') email: string, | ||
@Query('otp') otp: string | ||
): Promise<UserAuthenticatedResponse> { | ||
return await this.authService.validateOtp(email, otp) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.