Skip to content

Commit eb415db

Browse files
committed
feat(auth): implement auth flow
1 parent 2727fef commit eb415db

28 files changed

+943
-1007
lines changed

cmd/api/docs/docs.go

Lines changed: 128 additions & 130 deletions
Large diffs are not rendered by default.

cmd/api/docs/swagger.json

Lines changed: 128 additions & 130 deletions
Large diffs are not rendered by default.

cmd/api/docs/swagger.yaml

Lines changed: 90 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ definitions:
3939
password:
4040
minLength: 8
4141
type: string
42-
provider:
43-
type: string
44-
provider_id:
45-
type: string
46-
web_auth_token:
47-
type: string
48-
required:
49-
- web_auth_token
5042
type: object
5143
request.LogoutRequest:
5244
properties:
@@ -66,13 +58,22 @@ definitions:
6658
type: string
6759
country:
6860
type: string
61+
date_of_birth:
62+
type: string
63+
gender:
64+
type: string
65+
nationality:
66+
type: string
67+
phone_number:
68+
type: string
6969
postal_code:
7070
type: string
7171
user_address:
7272
type: string
7373
required:
7474
- city
7575
- country
76+
- nationality
7677
- postal_code
7778
- user_address
7879
type: object
@@ -98,8 +99,25 @@ definitions:
9899
- company_description
99100
- company_name
100101
type: object
102+
request.RegisterPersonalDetailsRequest:
103+
properties:
104+
date_of_birth:
105+
type: string
106+
gender:
107+
type: string
108+
nationality:
109+
type: string
110+
personal_account_type:
111+
type: string
112+
phone_number:
113+
type: string
114+
required:
115+
- nationality
116+
type: object
101117
request.RegisterUserRequest:
102118
properties:
119+
account_type:
120+
type: string
103121
email:
104122
type: string
105123
first_name:
@@ -111,8 +129,6 @@ definitions:
111129
type: string
112130
provider:
113131
type: string
114-
provider_id:
115-
type: string
116132
web_auth_token:
117133
type: string
118134
required:
@@ -125,29 +141,6 @@ definitions:
125141
required:
126142
- session_id
127143
type: object
128-
request.UpdateProfileRequest:
129-
properties:
130-
company_website:
131-
type: string
132-
employment_type:
133-
type: string
134-
first_name:
135-
type: string
136-
gender:
137-
type: string
138-
job_role:
139-
type: string
140-
last_name:
141-
type: string
142-
nationality:
143-
type: string
144-
residential_country:
145-
type: string
146-
required:
147-
- first_name
148-
- last_name
149-
- nationality
150-
type: object
151144
request.VerifyMFARequest:
152145
properties:
153146
code:
@@ -486,42 +479,6 @@ paths:
486479
summary: Logout
487480
tags:
488481
- authentication
489-
/auth/profile/address:
490-
put:
491-
consumes:
492-
- application/json
493-
description: Update address details for a registered user
494-
parameters:
495-
- description: Address details
496-
in: body
497-
name: addressDetails
498-
required: true
499-
schema:
500-
$ref: '#/definitions/request.RegisterAddressDetailsRequest'
501-
produces:
502-
- application/json
503-
responses:
504-
"200":
505-
description: Address details updated successfully
506-
schema:
507-
$ref: '#/definitions/response.SuccessResponse'
508-
"400":
509-
description: Invalid request
510-
schema:
511-
$ref: '#/definitions/response.ErrorResponse'
512-
"401":
513-
description: Unauthorized
514-
schema:
515-
$ref: '#/definitions/response.ErrorResponse'
516-
"500":
517-
description: Internal server error
518-
schema:
519-
$ref: '#/definitions/response.ErrorResponse'
520-
security:
521-
- Bearer: []
522-
summary: Update address details
523-
tags:
524-
- profile
525482
/auth/profile/business:
526483
put:
527484
consumes:
@@ -586,6 +543,42 @@ paths:
586543
summary: Get profile completion status
587544
tags:
588545
- profile
546+
/auth/profile/personal-details:
547+
put:
548+
consumes:
549+
- application/json
550+
description: Update personal details for a registered user
551+
parameters:
552+
- description: Personal details
553+
in: body
554+
name: personalDetails
555+
required: true
556+
schema:
557+
$ref: '#/definitions/request.RegisterPersonalDetailsRequest'
558+
produces:
559+
- application/json
560+
responses:
561+
"200":
562+
description: Personal details updated successfully
563+
schema:
564+
$ref: '#/definitions/response.SuccessResponse'
565+
"400":
566+
description: Invalid request
567+
schema:
568+
$ref: '#/definitions/response.ErrorResponse'
569+
"401":
570+
description: Unauthorized
571+
schema:
572+
$ref: '#/definitions/response.ErrorResponse'
573+
"500":
574+
description: Internal server error
575+
schema:
576+
$ref: '#/definitions/response.ErrorResponse'
577+
security:
578+
- Bearer: []
579+
summary: Update personal details
580+
tags:
581+
- profile
589582
/auth/refresh:
590583
post:
591584
consumes:
@@ -977,56 +970,61 @@ paths:
977970
summary: Change user password
978971
tags:
979972
- users
980-
/users/profile:
981-
get:
973+
/users/employee/profile/complete:
974+
put:
982975
consumes:
983976
- application/json
984-
description: Retrieve authenticated user's profile
977+
description: Update address details for a registered user
978+
parameters:
979+
- description: Address details
980+
in: body
981+
name: addressDetails
982+
required: true
983+
schema:
984+
$ref: '#/definitions/request.RegisterAddressDetailsRequest'
985985
produces:
986986
- application/json
987987
responses:
988988
"200":
989-
description: User profile
989+
description: Address details updated successfully
990990
schema:
991-
$ref: '#/definitions/response.UserResponse'
991+
$ref: '#/definitions/response.SuccessResponse'
992+
"400":
993+
description: Invalid request
994+
schema:
995+
$ref: '#/definitions/response.ErrorResponse'
992996
"401":
993997
description: Unauthorized
994998
schema:
995999
$ref: '#/definitions/response.ErrorResponse'
1000+
"500":
1001+
description: Internal server error
1002+
schema:
1003+
$ref: '#/definitions/response.ErrorResponse'
9961004
security:
997-
- BearerAuth: []
998-
summary: Get user profile
1005+
- Bearer: []
1006+
summary: Update address details
9991007
tags:
1000-
- users
1001-
put:
1008+
- profile
1009+
/users/profile:
1010+
get:
10021011
consumes:
10031012
- application/json
1004-
description: Update authenticated user's profile information
1005-
parameters:
1006-
- description: Profile data to update
1007-
in: body
1008-
name: profile
1009-
required: true
1010-
schema:
1011-
$ref: '#/definitions/request.UpdateProfileRequest'
1013+
description: Retrieve authenticated user's profile
10121014
produces:
10131015
- application/json
10141016
responses:
10151017
"200":
1016-
description: Updated user profile
1018+
description: User profile
10171019
schema:
10181020
$ref: '#/definitions/response.UserResponse'
1019-
"400":
1020-
description: Invalid request
1021-
schema:
1022-
$ref: '#/definitions/response.ErrorResponse'
10231021
"401":
10241022
description: Unauthorized
10251023
schema:
10261024
$ref: '#/definitions/response.ErrorResponse'
10271025
security:
10281026
- BearerAuth: []
1029-
summary: Update user profile
1027+
summary: Get user profile
10301028
tags:
10311029
- users
10321030
/waitlist:

cmd/api/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func main() {
137137

138138
// Create handlers
139139
authHandler := handlers.NewAuthHandler(authService, userService, logger)
140-
userHandler := handlers.NewUserHandler(userService)
140+
userHandler := handlers.NewUserHandler(userService, logger)
141141
waitlistHandler := handlers.NewWaitlistHandler(waitlistService, logger)
142142

143143
// Initialize OpenTelemetry

0 commit comments

Comments
 (0)