Skip to content

Commit

Permalink
Merge pull request #50 from nikhilnarayanan623/feature/signup-extend
Browse files Browse the repository at this point in the history
user signup side added otp verification
  • Loading branch information
nikhilnarayanan623 authored Jul 31, 2023
2 parents 36540c1 + 93acab7 commit 05bed17
Show file tree
Hide file tree
Showing 17 changed files with 779 additions and 286 deletions.
299 changes: 218 additions & 81 deletions cmd/api/docs/docs.go

Large diffs are not rendered by default.

299 changes: 218 additions & 81 deletions cmd/api/docs/swagger.json

Large diffs are not rendered by default.

214 changes: 144 additions & 70 deletions cmd/api/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ definitions:
required:
- variation_value
type: object
response.OTPResponse:
properties:
otp_id:
type: string
type: object
response.Response:
properties:
data: {}
Expand All @@ -494,6 +499,13 @@ definitions:
success:
type: boolean
type: object
response.TokenResponse:
properties:
access_token:
type: string
refresh_token:
type: string
type: object
info:
contact: {}
paths:
Expand Down Expand Up @@ -740,86 +752,91 @@ paths:
summary: Add to whish list (User)
tags:
- User Profile
/admin/auth/login:
/admin/auth/renew-access-token:
post:
description: API for admin to login with password
operationId: AdminLogin
description: API for admin to renew access token using refresh token
operationId: AdminRenewAccessToken
parameters:
- description: Login credentials
- description: Refresh token
in: body
name: input
required: true
schema:
$ref: '#/definitions/request.Login'
$ref: '#/definitions/request.RefreshToken'
responses:
"200":
description: Successfully logged in
description: Successfully generated access token using refresh token
schema:
$ref: '#/definitions/response.Response'
"400":
description: Invalid input
schema:
$ref: '#/definitions/response.Response'
"401":
description: Wrong password
description: Invalid refresh token
schema:
$ref: '#/definitions/response.Response'
"403":
description: Refresh token blocked
schema:
$ref: '#/definitions/response.Response'
"404":
description: Admin not exist with this details
description: No session found for the given refresh token
schema:
$ref: '#/definitions/response.Response'
"410":
description: Refresh token expired
schema:
$ref: '#/definitions/response.Response'
"500":
description: Failed to login
description: Failed generate access token
schema:
$ref: '#/definitions/response.Response'
security:
- ApiKeyAuth: []
summary: Login with password (Admin)
summary: Renew Access Token (Admin)
tags:
- Admin Authentication
/admin/auth/renew-access-token:
/admin/auth/sign-in:
post:
description: API for admin to renew access token using refresh token
operationId: AdminRenewAccessToken
description: API for admin to login with password
operationId: AdminLogin
parameters:
- description: Refresh token
- description: Login credentials
in: body
name: input
required: true
schema:
$ref: '#/definitions/request.RefreshToken'
$ref: '#/definitions/request.Login'
responses:
"200":
description: Successfully generated access token using refresh token
description: Successfully logged in
schema:
$ref: '#/definitions/response.Response'
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/response.TokenResponse'
type: object
"400":
description: Invalid input
schema:
$ref: '#/definitions/response.Response'
"401":
description: Invalid refresh token
schema:
$ref: '#/definitions/response.Response'
"403":
description: Refresh token blocked
description: Wrong password
schema:
$ref: '#/definitions/response.Response'
"404":
description: No session found for the given refresh token
schema:
$ref: '#/definitions/response.Response'
"410":
description: Refresh token expired
description: Admin not exist with this details
schema:
$ref: '#/definitions/response.Response'
"500":
description: Failed generate access token
description: Failed to login
schema:
$ref: '#/definitions/response.Response'
security:
- ApiKeyAuth: []
summary: Renew Access Token (Admin)
summary: Login with password (Admin)
tags:
- Admin Authentication
/admin/categories:
Expand Down Expand Up @@ -1923,7 +1940,52 @@ paths:
summary: Initialize google auth (User)
tags:
- User Authentication
/auth/login:
/auth/renew-access-token:
post:
description: API for user to renew access token using refresh token
operationId: UserRenewAccessToken
parameters:
- description: Refresh token
in: body
name: input
required: true
schema:
$ref: '#/definitions/request.RefreshToken'
responses:
"200":
description: Successfully generated access token using refresh token
schema:
$ref: '#/definitions/response.Response'
"400":
description: Invalid input
schema:
$ref: '#/definitions/response.Response'
"401":
description: Invalid refresh token
schema:
$ref: '#/definitions/response.Response'
"403":
description: Refresh token blocked
schema:
$ref: '#/definitions/response.Response'
"404":
description: No session found for the given refresh token
schema:
$ref: '#/definitions/response.Response'
"410":
description: Refresh token expired
schema:
$ref: '#/definitions/response.Response'
"500":
description: Failed generate access token
schema:
$ref: '#/definitions/response.Response'
security:
- ApiKeyAuth: []
summary: Renew Access Token (User)
tags:
- User Authentication
/auth/sign-in:
post:
description: API for user to login with email | phone | user_name with password
operationId: UserLogin
Expand All @@ -1938,7 +2000,12 @@ paths:
"200":
description: Successfully logged in
schema:
$ref: '#/definitions/response.Response'
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/response.TokenResponse'
type: object
"400":
description: Invalid inputs
schema:
Expand All @@ -1960,7 +2027,7 @@ paths:
summary: Login with password (User)
tags:
- User Authentication
/auth/login/otp-send:
/auth/sign-in/otp/send:
post:
description: 'API for user to send otp for login enter email | phone | user_name
: otp will send to user registered number'
Expand Down Expand Up @@ -1998,7 +2065,7 @@ paths:
summary: Login with Otp send (User)
tags:
- User Authentication
/auth/login/otp-verify:
/auth/sign-in/otp/verify:
post:
description: API for user to verify otp
operationId: UserLoginOtpVerify
Expand All @@ -2013,7 +2080,12 @@ paths:
"200":
description: Successfully user logged in
schema:
$ref: '#/definitions/response.Response'
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/response.TokenResponse'
type: object
"400":
description: Invalid inputs
schema:
Expand All @@ -2035,82 +2107,84 @@ paths:
summary: Login with Otp verify (User)
tags:
- User Authentication
/auth/renew-access-token:
/auth/sign-up:
post:
description: API for user to renew access token using refresh token
operationId: UserRenewAccessToken
description: API for user to register a new account
operationId: UserSignUp
parameters:
- description: Refresh token
- description: Input Fields
in: body
name: input
required: true
schema:
$ref: '#/definitions/request.RefreshToken'
$ref: '#/definitions/request.UserSignUp'
responses:
"200":
description: Successfully generated access token using refresh token
description: Successfully account created and otp send to registered number
schema:
$ref: '#/definitions/response.Response'
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/response.OTPResponse'
type: object
"400":
description: Invalid input
schema:
$ref: '#/definitions/response.Response'
"401":
description: Invalid refresh token
schema:
$ref: '#/definitions/response.Response'
"403":
description: Refresh token blocked
schema:
$ref: '#/definitions/response.Response'
"404":
description: No session found for the given refresh token
schema:
$ref: '#/definitions/response.Response'
"410":
description: Refresh token expired
"409":
description: A verified user already exist with given user credentials
schema:
$ref: '#/definitions/response.Response'
"500":
description: Failed generate access token
description: Failed to signup
schema:
$ref: '#/definitions/response.Response'
security:
- ApiKeyAuth: []
summary: Renew Access Token (User)
summary: Signup (User)
tags:
- User Authentication
/auth/signup:
/auth/sing-up/verify:
post:
description: API for user to register a new account
operationId: UserSignUp
description: API for user to verify otp on sign up
operationId: UserSignUpVerify
parameters:
- description: Input Fields
- description: Otp Verify Details
in: body
name: input
name: inputs
required: true
schema:
$ref: '#/definitions/request.UserSignUp'
$ref: '#/definitions/request.OTPVerify'
responses:
"200":
description: Successfully Account Created
description: Successfully otp verified for user sign up
schema:
$ref: '#/definitions/response.Response'
allOf:
- $ref: '#/definitions/response.Response'
- properties:
data:
$ref: '#/definitions/response.TokenResponse'
type: object
"400":
description: Invalid input
description: Invalid inputs
schema:
$ref: '#/definitions/response.Response'
"409":
description: A verified user already exist with given user credentials
"401":
description: Otp not matched
schema:
$ref: '#/definitions/response.Response'
"410":
description: Otp Expired
schema:
$ref: '#/definitions/response.Response'
"500":
description: Failed to signup
description: Failed to verify otp
schema:
$ref: '#/definitions/response.Response'
security:
- ApiKeyAuth: []
summary: Signup (User)
summary: UserSingUp verify OTP (User)
tags:
- User Authentication
/carts:
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ ${BINARY_DIR}:

build: ${BINARY_DIR} ## Compile the code, build Executable File
# $(GOCMD) build -o $(BINARY_DIR) -v ./cmd/api
GOARCH=amd64 $(GOCMD) build -v -o $(BINARY_DIR)/api-linux-amd64 ./cmd/api
GOARCH=amd64 $(GOCMD) build -v -o $(BINARY_DIR)/api-linux-amd64 ./cmd/api/main.go
run: ## Start application
$(GOCMD) run ./cmd/api
$(GOCMD) run ./cmd/api/main.go

test: ## Run tests
$(GOCMD) test ./... -cover
Expand Down
Loading

0 comments on commit 05bed17

Please sign in to comment.