Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.24.0 #761

Merged
merged 219 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
ac3dce2
feat: Added a new route /onboard which will create a project and the …
Aug 8, 2024
ee9a3c5
feat: Added a new usecase OnBoardUser
Aug 8, 2024
9dbeeca
feat: Added OnboardUserCommand for having the method parameter for ex…
Aug 8, 2024
5a40b8b
feat: Add DTO for onboard route controller to handle user survey form…
Aug 8, 2024
1cd094a
feat: Added OnboardUser and the execute method to update the user sur…
Aug 8, 2024
4fc4557
feat: Renamed ICreateTemplateData to IUpdateTemplateData
Aug 8, 2024
fcfee97
refactor: Removed mutation function from here and added it in the hoo…
Aug 8, 2024
3c3f3f4
feat: Added static constants for the CreateProjectForm component
Aug 8, 2024
8b7b711
feat: Added darkGrey color
Aug 8, 2024
be2208e
feat: Renamed ICreateTemplateData to IUpdateTemplateData
Aug 8, 2024
19bb7fc
refactor: Streamlined custom hook from the CreateProjectForm
Aug 8, 2024
d33de3f
feat: Added nboard user route and api key
Aug 8, 2024
f7e9f23
feat: Added alignment and width adjustments
Aug 8, 2024
8c05019
feat: Added companySixe, role and source
Aug 8, 2024
3bbeea7
feat: Added fields companySize, role and source
Aug 8, 2024
e4e6699
feat: Added fields companySize, role and source in user schema
Aug 8, 2024
6bd9c2d
feat: Added fields companySize, role and source
Aug 8, 2024
5851a42
feat: File deleted
Aug 8, 2024
306560d
feat: Added enum AVAILABLE_BILLABLEMETRIC_CODE_ENUM
Aug 8, 2024
60275d4
refactor: Removed creatLead method call,added signupMethod as Github …
Aug 8, 2024
888dd62
refactor: Removed creatLead method call,added signupMethod as Email w…
Aug 8, 2024
efb8bbf
feat: Added enum LEAD_SIGNUP_USING which have enum members such as Gi…
Aug 8, 2024
18cb0d2
feat: Added LeadService and storing the lead values in the zoho crm
Aug 8, 2024
c4d181c
feat: Added Signup Method,Mentioned Role,Lead Source and Company Size…
Aug 8, 2024
86fce0d
refactor: Made label same as value
Aug 8, 2024
66c38bd
feat: Added signupMethod field in UserEntity
Aug 8, 2024
a9d857f
feat: Added signupMethod field in UserSchema
Aug 8, 2024
1bd3c40
refactor: Removed export member onboard-user.types
Aug 8, 2024
04bf14e
refactor: Shifted onboardUserRoute from UserController to AuthController
Aug 8, 2024
a1f3fa5
feat: Added LeadService in providers
Aug 8, 2024
538b98b
feat: Exported member onboard user dto
Aug 8, 2024
2dd0b49
refactor: Shifter onboard-user-dto file
Aug 8, 2024
3b34b51
feat: Added necessary dependencies
Aug 8, 2024
3c140f7
refactor: Shifted onboard-user-command file
Aug 8, 2024
2d7f531
refactor: Shifted onboard-user-usecase file
Aug 8, 2024
3b01b65
feat: Reordered imports
Aug 8, 2024
dd8aa27
refactor: Removed onboardUserRoute from here
Aug 8, 2024
7f6d005
refactor: Removed usecase OnboardUser from here
Aug 8, 2024
0e42f65
feat: FIles moved to other locations
Aug 8, 2024
bb83465
refactor: Shifted OnboardUserForm file
Aug 8, 2024
ffce70c
feat: Setted _projectId from profieInfo._ProjectId using setProfileInfo
Aug 8, 2024
651469a
feat: Onboard user api route changed from user/onboard to auth/onboard
Aug 8, 2024
bda1859
feat: CreateProjectForm remaned to OnboardUserForm
Aug 8, 2024
77edc45
feat: Added onboarding field in IOnboardUserData
Aug 8, 2024
9ef2688
feat: Added verify route and the usecase
Aug 10, 2024
2d72597
feat: Exported member verify dto
Aug 10, 2024
e4695d8
feat: Added class Verify dto for the intermediate method argument in …
Aug 10, 2024
3591bf9
feat: Added isEmailVerified to true in case of user signup using github
Aug 10, 2024
f3b7624
feat: Added and exported verify usecase
Aug 10, 2024
528aed9
feat: Added API message INVALID_VERIFICATION_CODE
Aug 10, 2024
036f32b
feat: Redirect unverified users to verification, others to home/onboard
Aug 10, 2024
76b311b
refactor: Update payment service for user onboarding and OTP email
Aug 10, 2024
2fb0f90
feat: Added VerifyCommand as a argument bridge between controller and…
Aug 10, 2024
bec2184
feat: Add Verify use case for OTP-based user verification
Aug 10, 2024
caefb97
refactor: Took subject from EMAIL_SUBJECT
Aug 10, 2024
879c3d5
feat: Added well formatted email for otp send to users
Aug 10, 2024
7d0d1bc
feat: Added exception InvalidVerificationCodeException to handle and …
Aug 10, 2024
76f965f
feat: Added Function to generate user friendly random 6 digit OTP
Aug 10, 2024
6376fed
feat: Added new icon RedoICon
Aug 10, 2024
e9f2e1c
feat: Added VERIFY_EMAIL as an API_KEYS
Aug 10, 2024
de6e368
feat: Added condition to check the response screen from backend
Aug 10, 2024
31848e9
feat: Added condition to check the response screen from backend
Aug 10, 2024
d4799d4
feat: Added condition to check the response screen from backend
Aug 10, 2024
64d5fb0
feat: Added route auth/verify
Aug 10, 2024
69ae877
feat: Added firstName of user in the verification email
Aug 10, 2024
27d422e
feat: Removed unused code
Aug 10, 2024
c22e547
feat: Removed log
Aug 10, 2024
6feada1
feat: Added enum value as subject from EMAIL_SUBJECT
Aug 10, 2024
ef55005
feat: Added function generateVerificationCode
Aug 10, 2024
cb130f3
fix: Download sample with dynamic schema
chavda-bhavik Aug 10, 2024
1a516ec
`fix:` Download sample with dynamic schema (#739)
chavda-bhavik Aug 10, 2024
13ea11a
Feat/user onboard survey form (#729)
chavda-bhavik Aug 10, 2024
ff2801e
feat: Renamed backend url for qqueue-manager to API_ROOT_URL from API…
chavda-bhavik Aug 10, 2024
03d3ffe
`feat:` Renamed backend url for qqueue-manager to API_ROOT_URL from A…
chavda-bhavik Aug 10, 2024
0f9467f
feat: Added resend otp route
Aug 10, 2024
928f50f
feat: Added and exported resend otp usecase
Aug 10, 2024
5c1ced3
feat: Added ResendOTP usecase
Aug 10, 2024
d413c53
refactor: Changed the redo icon to a ned undo icon
Aug 10, 2024
d56d22b
feat: Added RESEND_OTP API_KEYS
Aug 10, 2024
479f638
feat: Added condition to check if screen from backend is verify then …
Aug 10, 2024
9123169
feat: Removed log
Aug 10, 2024
2d1361d
feat: Added useVerify custom hook to make otp verfication request and…
Aug 10, 2024
3c1bed5
feat: Added RESEND_OTP route
Aug 10, 2024
b4ef51c
feat: Added otp verification page UI
Aug 10, 2024
590a3b2
feat: Added fields isEmailVerified and verificationCode
Aug 10, 2024
f205a5e
feat: Added isEmailVerified and it`s default value to false
Aug 10, 2024
ab065e1
feat: Added firstName of user in IVerificationEmailOptions and used t…
Aug 10, 2024
ae5cd52
feat: Added IScreenResponse and screen in it
Aug 10, 2024
ff9963d
feat: Added enums SCREENS and EMAIL_SUBJECT
Aug 10, 2024
2e68d7c
refactor: Importing generateVerificationCode in shared
Aug 10, 2024
2df1df7
refactor: Moved generateVerificationCode in shared
Aug 10, 2024
eab6308
fix: mark import as 'Completed' after data is sent to frontend
Sidd-77 Aug 11, 2024
0faf9ec
Merge branch 'next' into feat/email-otp-verification
chavda-bhavik Aug 12, 2024
f8cbfe0
fix: mark import as 'Completed' after data is sent to frontend (#742)
chavda-bhavik Aug 12, 2024
77101e3
feat: Redirect user to onboard screen in self host
Aug 12, 2024
b92294f
feat: Added appropriate success screens while resetting the password
Aug 12, 2024
5148ac0
feat: Renamed SIGNIN_ONBOARDING to SIGNUP_ONBOARDING
Aug 12, 2024
efc8a2a
feat: Added function call to handle the screen based on backend response
Aug 12, 2024
f737c0a
feat: Added function call to handle the screen based on backend response
Aug 12, 2024
d551274
feat: Added function call to handle the screen based on backend response
Aug 12, 2024
7dccab1
feat: Added function call to handle the screen based on backend response
Aug 12, 2024
c4ad8d5
feat: Renamed SIGNIN_ONBOARDING to SIGNUP_ONBOARDING
Aug 12, 2024
90a16c7
feat: Added handleRouteBasedOnScreenResponse to navigate the user bas…
Aug 12, 2024
61acedb
Merge branch 'feat/email-otp-verification' of https://github.com/impl…
Aug 12, 2024
b9b76b5
fix: Widget closeWidget event not removing widget container
chavda-bhavik Aug 12, 2024
260a885
`Fix` Widget closeWidget event not removing widget container (#744)
chavda-bhavik Aug 12, 2024
3458788
Feat/email otp verification (#741)
chavda-bhavik Aug 13, 2024
1905807
feat: Craco config for the deepeply nested objects having DeePartial
Aug 13, 2024
208d44e
feat: Added sample Download title of the button
Aug 13, 2024
8d59fa7
feat: Removed dependency for react-datepicker and moment
Aug 13, 2024
bf1d384
feat: Merging the WIDGET_TEXTS and data.value.texts
Aug 13, 2024
6818ebb
feat: Took texts as prop
Aug 13, 2024
e7da3de
feat: Took texts from useAppState and used that
Aug 13, 2024
11a5455
feat: Took texts of type WIDGET_TEXTS and used that
Aug 13, 2024
db38bb7
feat: Passed texts to Layout and then from it to Heading
Aug 13, 2024
027740e
feat: Used TEXTS
Aug 13, 2024
0aa045d
feat: Passed texts as props to several components
Aug 13, 2024
90d3c15
feat: Took texts as prop as passed to AppContextProvider
Aug 13, 2024
ef8e959
feat: Passed texts as prop
Aug 13, 2024
53dc2dc
feat: Passed texts as prop
Aug 13, 2024
febc515
feat: Passed texts as prop
Aug 13, 2024
4bb85e5
feat: Passed texts as prop and used wherever necsessary
Aug 13, 2024
140f8be
feat: Passed texts as prop to subsequent components
Aug 13, 2024
8c037d8
feat: Passed texts as prop and used wherever necsessary
Aug 13, 2024
e6ec484
feat: Passed texts as prop and used wherever necsessary
Aug 13, 2024
877f0ad
feat: Passed texts as prop and used to pass as prop to other componen…
Aug 13, 2024
ec01528
feat: Passed texts as prop to subsequent components
Aug 13, 2024
2606a88
feat: Used passed texts as pro wherever necsessary
Aug 13, 2024
3809bf2
feat: Passed texts as prop to subsequent components
Aug 13, 2024
8af4d4b
feat: Passed texts as prop to subsequent components
Aug 13, 2024
0a90b5b
feat: Used passed texts as pro wherever necsessary
Aug 13, 2024
8824960
feat: Used passed texts as pro wherever necsessary
Aug 13, 2024
3e947fd
feat: Removed export member text.config
Aug 13, 2024
bb870f0
feat: Used passed texts as pro wherever necsessary
Aug 13, 2024
d59fd04
feat: Passed texts to AppContext.Provider
Aug 13, 2024
e22416d
feat: Defined texts of type WIDGET_TEXTS
Aug 13, 2024
3a626c8
refactor: file moved to other location
Aug 13, 2024
957151c
feat: Changed TEXTS to WIDGET_TEXTS
Aug 13, 2024
93e94bd
feat: Changed TEXTS to WIDGET_TEXTS
Aug 13, 2024
4c2fa4e
feat: Exported member texts.config
Aug 13, 2024
32c2965
feat: Defined texts of type CustomTexts
Aug 13, 2024
91512a9
feat: Added texts to have the user define custom text in the widget
Aug 13, 2024
9d1e92b
feat: Defined texts of type CustomTexts
Aug 13, 2024
64ac790
feat: Added file pnpm.lock.yaml
Aug 13, 2024
1895cdc
feat: Removed sample texts of the button
Aug 13, 2024
6ba463a
feat: Removed optional texts and nested objects
Aug 13, 2024
503dba0
Feat/widget text customisation (#745)
chavda-bhavik Aug 13, 2024
fc6ea2c
feat: Added apiKey from environmentRepository and if exists navigatin…
Aug 13, 2024
36f422b
feat: Disabled the button when first visit on the page
Aug 13, 2024
5634aa9
feat: Added autofocus and required in PinInput
Aug 13, 2024
753428e
feat: Removed comments
Aug 13, 2024
056e13c
feat: Added autofocus and required in PinInput
Aug 13, 2024
a3d161c
feat: Disabled the button when first visit on the page
Aug 13, 2024
218a44b
feat: Added apiKey from environmentRepository and if exists navigatin…
Aug 13, 2024
07070b9
feat: Added apiKey from environmentRepository and if exists navigatin…
Aug 13, 2024
19655cf
Merge branch 'feat/widget-text-customizations'
Aug 13, 2024
067dfb0
Feat/widget text customizations (#747)
chavda-bhavik Aug 13, 2024
dc30998
feat: Added apiKey from environmentRepository and if exists navigatin…
chavda-bhavik Aug 13, 2024
a4d3c14
feat: Changed Get request of route verify/resend to Post
Aug 13, 2024
67628e6
feat: Added condition to check if user`s email is not verified then r…
Aug 13, 2024
8dea7b4
feat: Handled black space project creation
Aug 13, 2024
95c352a
feat: Added NOTIFICATION_KEYS OTP_CODE_RESENT_SUCCESSFULLY
Aug 13, 2024
7c5339f
refactor: Resend verification otp
Aug 13, 2024
a82d919
feat: Changed verify/resend route`s request from GET to POST
Aug 13, 2024
1766b2c
feat: Added message to accept as ReactNode along with message
Aug 13, 2024
0b15aee
refactor: Handled form errors of empty form submission
Aug 13, 2024
428c038
feat: Auth modification
Aug 13, 2024
a0d80b5
feat: Added file data points limitation
chavda-bhavik Aug 14, 2024
bcd4626
feat: Formatted message
chavda-bhavik Aug 14, 2024
39cd7d9
feat: Message improvements
chavda-bhavik Aug 14, 2024
f6cc5fa
`feat` file size limit (#748)
chavda-bhavik Aug 14, 2024
d26fbf1
Fix: resolve CRLF and LF issue
Aug 14, 2024
34419b4
feat: Added verify route with cookie send
Aug 14, 2024
36247ac
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
e512f97
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
33d3265
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
b3c67ac
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
7ff3605
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
3870110
feat: Returning token with boolean value isEmailVerified
Aug 14, 2024
916e7c4
feat: Added api keys INVALID_VERIFICATION_CODE and proper message in it
Aug 14, 2024
2725ed4
feat: Added middleware routes
Aug 14, 2024
f1642d4
feat: Added setProfileInfo and setted it to profile data
Aug 14, 2024
217d3c4
feat: Added setProfileInfo and setted it to profile data
Aug 14, 2024
03a3db0
refactor: Optimized useVerfiy hook
Aug 14, 2024
97db5d4
Fix: resolve CRLF and LF issue (#749)
chavda-bhavik Aug 14, 2024
4830af5
feat: Added api message OTP_CODE_RESENT_SUCCESSFULLY
Aug 14, 2024
e8b9d39
refactor: Added useRef to countdown
Aug 14, 2024
858f258
feat: Added me api call
Aug 14, 2024
415dd98
feat: Added optional type ReactNode to message
Aug 14, 2024
4101702
feat: Onboarding improvements
Aug 14, 2024
ac1a0a7
feat: Removed console.log and code optimization
chavda-bhavik Aug 15, 2024
a43b1fc
feat: merged otp verification branch
chavda-bhavik Aug 15, 2024
9f018fd
fix: Texts key issue
chavda-bhavik Aug 15, 2024
a85aee9
feat: Added update-user route
chavda-bhavik Aug 15, 2024
bfab42f
feat: Updated redirect checks to excempt password-reset
chavda-bhavik Aug 15, 2024
14dfd91
feat: Added facility to update email
chavda-bhavik Aug 15, 2024
051cd6c
feat: Excempted sensitive information from user
chavda-bhavik Aug 15, 2024
432080d
Feat/widget text customizations (#750)
chavda-bhavik Aug 15, 2024
8d23b4c
feat: Exported types from react SDK
chavda-bhavik Aug 16, 2024
3162a54
fix: Login page getting reloading
chavda-bhavik Aug 16, 2024
6a731cb
feat: Removed unused craco config
chavda-bhavik Aug 16, 2024
27e06b8
feat: Text names rename
chavda-bhavik Aug 16, 2024
88e9e51
feat: Streamlined the widget texts
chavda-bhavik Aug 16, 2024
2d081da
`feat` optimization (#753)
chavda-bhavik Aug 16, 2024
0d12cfe
fix: Excel default data not accepting data with array
chavda-bhavik Aug 16, 2024
c03ab88
`fix:` Excel default data not accepting data with array (#754)
chavda-bhavik Aug 16, 2024
802b04c
v0.24.0
chavda-bhavik Aug 16, 2024
0e0e223
feat: Updated docker-compose images version
chavda-bhavik Aug 16, 2024
ef1524b
Merge branch 'next' into release/v0.24.0
chavda-bhavik Aug 16, 2024
1fb0de8
Release v0.24.0 (#755)
chavda-bhavik Aug 16, 2024
f08798a
feat: Updated resend limit to 120 seconds
chavda-bhavik Aug 16, 2024
6eb02fd
`feat:` Updated resend limit to 120 seconds (#757)
chavda-bhavik Aug 16, 2024
098bac4
feat: Added verify user migration
chavda-bhavik Aug 16, 2024
65575dd
`feat:` Added verify user migration (#758)
chavda-bhavik Aug 16, 2024
0d3bdb3
feat: Updated text grammer
chavda-bhavik Aug 16, 2024
77edd57
feat: streamlined widget data params
chavda-bhavik Aug 16, 2024
be91271
feat: Handled unwanted external service exceptions
chavda-bhavik Aug 16, 2024
873b6e7
feat: Handled edge case with self hosted Impler
chavda-bhavik Aug 16, 2024
3791833
`feat` widget optimization (#759)
chavda-bhavik Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"arrowParens": "always",
"endOfLine": "lf"
"endOfLine": "auto"
}
8 changes: 4 additions & 4 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/api",
"version": "0.23.1",
"version": "0.24.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand All @@ -19,9 +19,9 @@
"test": "cross-env TZ=UTC NODE_ENV=test E2E_RUNNER=true mocha --timeout 10000 --require ts-node/register --exit src/**/**/*.spec.ts"
},
"dependencies": {
"@impler/dal": "^0.23.1",
"@impler/services": "^0.23.1",
"@impler/shared": "^0.23.1",
"@impler/dal": "^0.24.0",
"@impler/services": "^0.24.0",
"@impler/shared": "^0.24.0",
"@nestjs/common": "^9.1.2",
"@nestjs/core": "^9.1.2",
"@nestjs/jwt": "^10.0.1",
Expand Down
88 changes: 84 additions & 4 deletions apps/api/src/app/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,38 @@ import {
Controller,
Get,
Post,
Put,
Res,
UseGuards,
UseInterceptors,
} from '@nestjs/common';

import { IJwtPayload } from '@impler/shared';
import { AuthService } from './services/auth.service';
import { IStrategyResponse } from '@shared/types/auth.types';
import { CONSTANTS, COOKIE_CONFIG } from '@shared/constants';
import { UserSession } from '@shared/framework/user.decorator';
import { ApiException } from '@shared/exceptions/api.exception';
import { StrategyUser } from './decorators/strategy-user.decorator';
import { RegisterUserDto, LoginUserDto, RequestForgotPasswordDto, ResetPasswordDto } from './dtos';
import {
RegisterUser,
RegisterUserCommand,
RegisterUserDto,
LoginUserDto,
RequestForgotPasswordDto,
ResetPasswordDto,
OnboardUserDto,
VerifyDto,
UpdateUserDto,
} from './dtos';
import {
Verify,
LoginUser,
ResendOTP,
UpdateUser,
OnboardUser,
RegisterUser,
ResetPassword,
LoginUserCommand,
RegisterUserCommand,
ResetPasswordCommand,
RequestForgotPassword,
RequestForgotPasswordCommand,
Expand All @@ -36,8 +50,13 @@ import {
@UseInterceptors(ClassSerializerInterceptor)
export class AuthController {
constructor(
private registerUser: RegisterUser,
private verify: Verify,
private resendOTP: ResendOTP,
private loginUser: LoginUser,
private updateUser: UpdateUser,
private onboardUser: OnboardUser,
private authService: AuthService,
private registerUser: RegisterUser,
private resetPassword: ResetPassword,
private requestForgotPassword: RequestForgotPassword
) {}
Expand Down Expand Up @@ -88,6 +107,18 @@ export class AuthController {
return user;
}

@Put('/me')
async updateUserRoute(@UserSession() user: IJwtPayload, @Body() body: UpdateUserDto, @Res() response: Response) {
const { success, token } = await this.updateUser.execute(user._id, body);
if (token)
response.cookie(CONSTANTS.AUTH_COOKIE_NAME, token, {
...COOKIE_CONFIG,
domain: process.env.COOKIE_DOMAIN,
});

response.send({ success });
}

@Get('/logout')
logout(@Res() response: Response) {
response.clearCookie(CONSTANTS.AUTH_COOKIE_NAME, {
Expand All @@ -112,6 +143,50 @@ export class AuthController {
response.send(registeredUser);
}

@Post('/verify')
async verifyRoute(@Body() body: VerifyDto, @UserSession() user: IJwtPayload, @Res() response: Response) {
const { token, screen } = await this.verify.execute(user._id, { code: body.otp });
response.cookie(CONSTANTS.AUTH_COOKIE_NAME, token, {
...COOKIE_CONFIG,
domain: process.env.COOKIE_DOMAIN,
});

response.send({ screen });
}

@Post('/onboard')
async onboardUserRoute(
@Body() body: OnboardUserDto,
@UserSession() user: IJwtPayload,
@Res({ passthrough: true }) res: Response
) {
const projectWithEnvironment = await this.onboardUser.execute({
_userId: user._id,
projectName: body.projectName,
role: body.role,
companySize: body.companySize,
source: body.source,
});
const token = this.authService.getSignedToken(
{
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
profilePicture: user.profilePicture,
isEmailVerified: user.isEmailVerified,
accessToken: projectWithEnvironment.environment.apiKeys[0].key,
},
projectWithEnvironment.project._id
);
res.cookie(CONSTANTS.AUTH_COOKIE_NAME, token, {
...COOKIE_CONFIG,
domain: process.env.COOKIE_DOMAIN,
});

return projectWithEnvironment;
}

@Post('/login')
async login(@Body() body: LoginUserDto, @Res() response: Response) {
const loginUser = await this.loginUser.execute(
Expand Down Expand Up @@ -145,4 +220,9 @@ export class AuthController {

response.send(resetPassword);
}

@Post('verify/resend')
async resendOTPRoute(@UserSession() user: IJwtPayload) {
return await this.resendOTP.execute(user._id);
}
}
15 changes: 8 additions & 7 deletions apps/api/src/app/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Global, MiddlewareConsumer, Module, NestModule, Provider, RequestMethod } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import * as passport from 'passport';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { Global, MiddlewareConsumer, Module, NestModule, Provider, RequestMethod } from '@nestjs/common';

import { USE_CASES } from './usecases';
import { CONSTANTS } from '@shared/constants';
import { PassportModule } from '@nestjs/passport';
import { AuthController } from './auth.controller';
import { PaymentAPIService } from '@impler/services';
import { AuthService } from './services/auth.service';
import { SharedModule } from '../shared/shared.module';
import { GitHubStrategy } from './services/passport/github.strategy';
import { JwtStrategy } from './services/passport/jwt.strategy';
import { LeadService } from '@shared/services/lead.service';
import { PaymentAPIService } from '@impler/services';
import { JwtStrategy } from './services/passport/jwt.strategy';
import { GitHubStrategy } from './services/passport/github.strategy';

const AUTH_STRATEGIES: Provider[] = [JwtStrategy];

Expand All @@ -33,7 +34,7 @@ if (process.env.GITHUB_OAUTH_CLIENT_ID) {
}),
],
controllers: [AuthController],
providers: [AuthService, ...AUTH_STRATEGIES, ...USE_CASES, LeadService, PaymentAPIService],
providers: [AuthService, LeadService, ...AUTH_STRATEGIES, ...USE_CASES, PaymentAPIService],
exports: [AuthService],
})
export class AuthModule implements NestModule {
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/app/auth/dtos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ export * from './register-user.dto';
export * from './login-user.dto';
export * from './request-forgot-password.dto';
export * from './reset-password.dto';
export * from './onboard-user.dto';
export * from './verify.dto';
export * from './update-user.dto';
32 changes: 32 additions & 0 deletions apps/api/src/app/auth/dtos/onboard-user.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IsDefined, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class OnboardUserDto {
@ApiProperty({
description: 'Size of the company',
})
@IsString()
@IsDefined()
companySize: string;

@ApiProperty({
description: 'Role of the user',
})
@IsString()
@IsDefined()
role: string;

@ApiProperty({
description: 'Source from where the user heard about us',
})
@IsString()
@IsDefined()
source: string;

@ApiProperty({
description: 'Name of the Project',
})
@IsString()
@IsDefined()
projectName: string;
}
11 changes: 11 additions & 0 deletions apps/api/src/app/auth/dtos/update-user.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsOptional } from 'class-validator';

export class UpdateUserDto {
@ApiProperty({
description: 'Email of the user',
})
@IsEmail()
@IsOptional()
email?: string;
}
7 changes: 7 additions & 0 deletions apps/api/src/app/auth/dtos/verify.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IsDefined, IsString } from 'class-validator';

export class VerifyDto {
@IsString()
@IsDefined()
otp: string;
}
19 changes: 10 additions & 9 deletions apps/api/src/app/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { JwtService } from '@nestjs/jwt';
import { Injectable, UnauthorizedException } from '@nestjs/common';

import { IJwtPayload } from '@impler/shared';
import { CONSTANTS } from '@shared/constants';
import { CONSTANTS, LEAD_SIGNUP_USING } from '@shared/constants';
import { PaymentAPIService } from '@impler/services';
import { LeadService } from '@shared/services/lead.service';
import { UserEntity, UserRepository, EnvironmentRepository } from '@impler/dal';
import { UserNotFoundException } from '@shared/exceptions/user-not-found.exception';
import { IAuthenticationData, IStrategyResponse } from '@shared/types/auth.types';
Expand All @@ -15,7 +14,6 @@ import { IncorrectLoginCredentials } from '@shared/exceptions/incorrect-login-cr
export class AuthService {
constructor(
private jwtService: JwtService,
private leadService: LeadService,
private userRepository: UserRepository,
private environmentRepository: EnvironmentRepository,
private paymentAPIService: PaymentAPIService
Expand All @@ -30,18 +28,14 @@ export class AuthService {
if (!user) {
const userObj: Partial<UserEntity> = {
email: profile.email,
isEmailVerified: true,
firstName: profile.firstName,
lastName: profile.lastName,
signupMethod: LEAD_SIGNUP_USING.GITHUB,
profilePicture: profile.avatar_url,
...(provider ? { tokens: [provider] } : {}),
};
user = await this.userRepository.create(userObj);
await this.leadService.createLead({
'First Name': user.firstName,
'Last Name': user.lastName,
'Lead Email': user.email,
'Lead Source': 'Github Signup',
});
userCreated = true;

const userData = {
Expand Down Expand Up @@ -71,6 +65,7 @@ export class AuthService {
lastName: user.lastName,
profilePicture: user.profilePicture,
accessToken: apiKey?.apiKey,
isEmailVerified: user.isEmailVerified,
},
apiKey?.projectId
),
Expand Down Expand Up @@ -104,6 +99,7 @@ export class AuthService {
firstName: user.firstName,
lastName: user.lastName,
accessToken: apiKey?.apiKey,
isEmailVerified: user.isEmailVerified,
},
apiKey?.projectId
),
Expand All @@ -123,6 +119,7 @@ export class AuthService {
firstName: user.firstName,
lastName: user.lastName,
accessToken: apiKey?.apiKey,
isEmailVerified: user.isEmailVerified,
},
apiKey?.projectId
);
Expand All @@ -134,6 +131,7 @@ export class AuthService {
firstName: string;
lastName: string;
email: string;
isEmailVerified: boolean;
profilePicture?: string;
accessToken?: string;
},
Expand All @@ -148,6 +146,7 @@ export class AuthService {
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
isEmailVerified: user.isEmailVerified,
profilePicture: user.profilePicture,
accessToken: user.accessToken,
},
Expand Down Expand Up @@ -196,6 +195,7 @@ export class AuthService {
firstName: user.firstName,
lastName: user.lastName,
accessToken: apiKey,
isEmailVerified: user.isEmailVerified,
},
environment._projectId
);
Expand All @@ -211,6 +211,7 @@ export class AuthService {
firstName: user.firstName,
lastName: user.lastName,
accessToken: apiKey?.apiKey,
isEmailVerified: user.isEmailVerified,
},
apiKey?.projectId
);
Expand Down
Loading
Loading