1390 lines
33 KiB
YAML
1390 lines
33 KiB
YAML
definitions:
|
|
domain.ErrorResponse:
|
|
properties:
|
|
error:
|
|
type: string
|
|
message:
|
|
type: string
|
|
type: object
|
|
domain.LogEntry:
|
|
properties:
|
|
caller:
|
|
type: string
|
|
env:
|
|
type: string
|
|
fields:
|
|
additionalProperties: true
|
|
type: object
|
|
level:
|
|
type: string
|
|
message:
|
|
type: string
|
|
service:
|
|
type: string
|
|
stacktrace:
|
|
type: string
|
|
timestamp:
|
|
type: string
|
|
type: object
|
|
domain.LogResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/domain.LogEntry'
|
|
type: array
|
|
message:
|
|
type: string
|
|
pagination:
|
|
$ref: '#/definitions/domain.Pagination'
|
|
type: object
|
|
domain.OtpFor:
|
|
enum:
|
|
- reset
|
|
- register
|
|
type: string
|
|
x-enum-varnames:
|
|
- OtpReset
|
|
- OtpRegister
|
|
domain.OtpMedium:
|
|
enum:
|
|
- email
|
|
- sms
|
|
type: string
|
|
x-enum-varnames:
|
|
- OtpMediumEmail
|
|
- OtpMediumSms
|
|
domain.Pagination:
|
|
properties:
|
|
current_page:
|
|
type: integer
|
|
limit:
|
|
type: integer
|
|
total:
|
|
type: integer
|
|
total_pages:
|
|
type: integer
|
|
type: object
|
|
domain.RegisterUserReq:
|
|
properties:
|
|
age:
|
|
type: integer
|
|
country:
|
|
type: string
|
|
educationLevel:
|
|
type: string
|
|
email:
|
|
type: string
|
|
firstName:
|
|
type: string
|
|
lastName:
|
|
type: string
|
|
organizationID:
|
|
$ref: '#/definitions/domain.ValidInt64'
|
|
otp:
|
|
type: string
|
|
otpMedium:
|
|
$ref: '#/definitions/domain.OtpMedium'
|
|
password:
|
|
type: string
|
|
phoneNumber:
|
|
type: string
|
|
preferredLanguage:
|
|
type: string
|
|
region:
|
|
type: string
|
|
role:
|
|
type: string
|
|
userName:
|
|
type: string
|
|
type: object
|
|
domain.Response:
|
|
properties:
|
|
data: {}
|
|
message:
|
|
type: string
|
|
metadata: {}
|
|
status_code:
|
|
type: integer
|
|
success:
|
|
type: boolean
|
|
type: object
|
|
domain.Role:
|
|
enum:
|
|
- super_admin
|
|
- admin
|
|
- student
|
|
- instructor
|
|
- support
|
|
type: string
|
|
x-enum-varnames:
|
|
- RoleSuperAdmin
|
|
- RoleAdmin
|
|
- RoleStudent
|
|
- RoleInstructor
|
|
- RoleSupport
|
|
domain.UserProfileResponse:
|
|
properties:
|
|
age:
|
|
type: integer
|
|
country:
|
|
type: string
|
|
created_at:
|
|
type: string
|
|
education_level:
|
|
type: string
|
|
email:
|
|
type: string
|
|
email_verified:
|
|
type: boolean
|
|
first_name:
|
|
type: string
|
|
id:
|
|
type: integer
|
|
last_login:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
organization_id:
|
|
type: integer
|
|
phone_number:
|
|
type: string
|
|
phone_verified:
|
|
type: boolean
|
|
preferred_language:
|
|
type: string
|
|
profile_completed:
|
|
type: boolean
|
|
profile_picture_url:
|
|
type: string
|
|
region:
|
|
type: string
|
|
role:
|
|
$ref: '#/definitions/domain.Role'
|
|
status:
|
|
$ref: '#/definitions/domain.UserStatus'
|
|
updated_at:
|
|
type: string
|
|
user_name:
|
|
type: string
|
|
type: object
|
|
domain.UserStatus:
|
|
enum:
|
|
- PENDING
|
|
- ACTIVE
|
|
- SUSPENDED
|
|
- DEACTIVATED
|
|
type: string
|
|
x-enum-varnames:
|
|
- UserStatusPending
|
|
- UserStatusActive
|
|
- UserStatusSuspended
|
|
- UserStatusDeactivated
|
|
domain.ValidInt64:
|
|
properties:
|
|
valid:
|
|
type: boolean
|
|
value:
|
|
type: integer
|
|
type: object
|
|
domain.VerifyOtpReq:
|
|
properties:
|
|
email:
|
|
description: Required if medium is email
|
|
type: string
|
|
otp:
|
|
type: string
|
|
otp_for:
|
|
$ref: '#/definitions/domain.OtpFor'
|
|
otp_medium:
|
|
allOf:
|
|
- $ref: '#/definitions/domain.OtpMedium'
|
|
enum:
|
|
- email
|
|
- sms
|
|
phone_number:
|
|
description: Required if medium is SMS
|
|
type: string
|
|
required:
|
|
- otp
|
|
- otp_for
|
|
- otp_medium
|
|
type: object
|
|
handlers.AdminProfileRes:
|
|
properties:
|
|
created_at:
|
|
type: string
|
|
email:
|
|
type: string
|
|
email_verified:
|
|
type: boolean
|
|
first_name:
|
|
type: string
|
|
id:
|
|
type: integer
|
|
last_login:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
phone_verified:
|
|
type: boolean
|
|
role:
|
|
$ref: '#/definitions/domain.Role'
|
|
suspended:
|
|
type: boolean
|
|
suspended_at:
|
|
type: string
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
handlers.AdminRes:
|
|
properties:
|
|
created_at:
|
|
type: string
|
|
email:
|
|
type: string
|
|
email_verified:
|
|
type: boolean
|
|
first_name:
|
|
type: string
|
|
id:
|
|
type: integer
|
|
last_login:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
phone_verified:
|
|
type: boolean
|
|
role:
|
|
$ref: '#/definitions/domain.Role'
|
|
suspended:
|
|
type: boolean
|
|
suspended_at:
|
|
type: string
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
handlers.CheckPhoneEmailExistReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
type: object
|
|
handlers.CheckPhoneEmailExistRes:
|
|
properties:
|
|
email_exist:
|
|
type: boolean
|
|
phone_number_exist:
|
|
type: boolean
|
|
type: object
|
|
handlers.CreateAdminReq:
|
|
properties:
|
|
company_id:
|
|
example: 1
|
|
type: integer
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
first_name:
|
|
example: John
|
|
type: string
|
|
last_name:
|
|
example: Doe
|
|
type: string
|
|
password:
|
|
example: password123
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
type: object
|
|
handlers.CustomerProfileRes:
|
|
properties:
|
|
created_at:
|
|
type: string
|
|
email:
|
|
type: string
|
|
email_verified:
|
|
type: boolean
|
|
first_name:
|
|
type: string
|
|
id:
|
|
type: integer
|
|
last_login:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
phone_verified:
|
|
type: boolean
|
|
referral_code:
|
|
type: string
|
|
role:
|
|
$ref: '#/definitions/domain.Role'
|
|
suspended:
|
|
type: boolean
|
|
suspended_at:
|
|
type: string
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
handlers.LoginAdminRes:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
refresh_token:
|
|
type: string
|
|
role:
|
|
type: string
|
|
type: object
|
|
handlers.RegisterCodeReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
type: object
|
|
handlers.ResetCodeReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
type: object
|
|
handlers.ResetPasswordReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
otp:
|
|
example: "123456"
|
|
type: string
|
|
password:
|
|
example: newpassword123
|
|
minLength: 8
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
required:
|
|
- otp
|
|
- password
|
|
type: object
|
|
handlers.SearchUserByNameOrPhoneReq:
|
|
properties:
|
|
query:
|
|
type: string
|
|
role:
|
|
$ref: '#/definitions/domain.Role'
|
|
type: object
|
|
handlers.loginAdminReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
password:
|
|
example: password123
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
required:
|
|
- password
|
|
type: object
|
|
handlers.loginCustomerReq:
|
|
properties:
|
|
password:
|
|
example: password123
|
|
type: string
|
|
user_name:
|
|
example: johndoe
|
|
type: string
|
|
required:
|
|
- password
|
|
- user_name
|
|
type: object
|
|
handlers.loginCustomerRes:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
refresh_token:
|
|
type: string
|
|
role:
|
|
type: string
|
|
type: object
|
|
handlers.logoutReq:
|
|
properties:
|
|
refresh_token:
|
|
example: <refresh-token>
|
|
type: string
|
|
required:
|
|
- refresh_token
|
|
type: object
|
|
handlers.refreshToken:
|
|
properties:
|
|
access_token:
|
|
example: <jwt-token>
|
|
type: string
|
|
refresh_token:
|
|
example: <refresh-token>
|
|
type: string
|
|
required:
|
|
- access_token
|
|
- refresh_token
|
|
type: object
|
|
handlers.updateAdminReq:
|
|
properties:
|
|
company_id:
|
|
example: 1
|
|
type: integer
|
|
first_name:
|
|
example: John
|
|
type: string
|
|
last_name:
|
|
example: Doe
|
|
type: string
|
|
suspended:
|
|
example: false
|
|
type: boolean
|
|
type: object
|
|
response.APIResponse:
|
|
properties:
|
|
data: {}
|
|
message:
|
|
type: string
|
|
metadata: {}
|
|
page:
|
|
type: integer
|
|
status:
|
|
$ref: '#/definitions/response.Status'
|
|
timestamp:
|
|
type: string
|
|
total:
|
|
type: integer
|
|
type: object
|
|
response.Status:
|
|
enum:
|
|
- error
|
|
- success
|
|
type: string
|
|
x-enum-varnames:
|
|
- Error
|
|
- Success
|
|
info:
|
|
contact:
|
|
email: support@swagger.io
|
|
name: API Support
|
|
url: http://www.swagger.io/support
|
|
description: This is server for Yimaru.
|
|
license:
|
|
name: Apache 2.0
|
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
termsOfService: http://swagger.io/terms/
|
|
title: Yimaru API
|
|
version: 1.0.1
|
|
paths:
|
|
/api/v1/{tenant_slug}/admin-login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Login customer
|
|
parameters:
|
|
- description: Login admin
|
|
in: body
|
|
name: login
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.loginAdminReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.LoginAdminRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Login customer
|
|
tags:
|
|
- auth
|
|
/api/v1/{tenant_slug}/customer-login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Login customer
|
|
parameters:
|
|
- description: Login customer
|
|
in: body
|
|
name: login
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.loginCustomerReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.loginCustomerRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Login customer
|
|
tags:
|
|
- auth
|
|
/api/v1/{tenant_slug}/user/{user_name}/is-pending:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Returns whether the specified user has a status of "pending"
|
|
parameters:
|
|
- description: User Name
|
|
in: path
|
|
name: user_name
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/domain.Response'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
summary: Check if user status is pending
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/admin-profile:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get user profile
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.AdminProfileRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
security:
|
|
- Bearer: []
|
|
summary: Get user profile
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/checkPhoneEmailExist:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Check if phone number or email exist
|
|
parameters:
|
|
- description: Check phone number or email exist
|
|
in: body
|
|
name: checkPhoneEmailExist
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.CheckPhoneEmailExistReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.CheckPhoneEmailExistRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Check if phone number or email exist
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/customer-profile:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get user profile
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.CustomerProfileRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
security:
|
|
- Bearer: []
|
|
summary: Get user profile
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/register:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Register user
|
|
parameters:
|
|
- description: Register user
|
|
in: body
|
|
name: registerUser
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/domain.RegisterUserReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Register user
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/resetPassword:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Reset tenant password
|
|
parameters:
|
|
- description: Reset password
|
|
in: body
|
|
name: resetPassword
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.ResetPasswordReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Reset tenant password
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/sendRegisterCode:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Send register code
|
|
parameters:
|
|
- description: Send register code
|
|
in: body
|
|
name: registerCode
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.RegisterCodeReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Send register code
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/sendResetCode:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Send reset code
|
|
parameters:
|
|
- description: Send reset code
|
|
in: body
|
|
name: resetCode
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.ResetCodeReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Send reset code
|
|
tags:
|
|
- user
|
|
/api/v1/{tenant_slug}/user/verify-otp:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Verify OTP for registration or other actions
|
|
parameters:
|
|
- description: Verify OTP
|
|
in: body
|
|
name: verifyOtp
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/domain.VerifyOtpReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Verify OTP
|
|
tags:
|
|
- user
|
|
/api/v1/admin:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get all Admins
|
|
parameters:
|
|
- description: Page number
|
|
in: query
|
|
name: page
|
|
type: integer
|
|
- description: Page size
|
|
in: query
|
|
name: page_size
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.AdminRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Get all Admins
|
|
tags:
|
|
- admin
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Create Admin
|
|
parameters:
|
|
- description: Create admin
|
|
in: body
|
|
name: manger
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.CreateAdminReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Create Admin
|
|
tags:
|
|
- admin
|
|
/api/v1/admin/{id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get a single admin by id
|
|
parameters:
|
|
- description: User ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.AdminRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Get admin by id
|
|
tags:
|
|
- admin
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Update Admin
|
|
parameters:
|
|
- description: Update Admin
|
|
in: body
|
|
name: admin
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.updateAdminReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Update Admin
|
|
tags:
|
|
- admin
|
|
/api/v1/auth/logout:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Logout customer
|
|
parameters:
|
|
- description: Logout customer
|
|
in: body
|
|
name: logout
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.logoutReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Logout customer
|
|
tags:
|
|
- auth
|
|
/api/v1/auth/refresh:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Refresh token
|
|
parameters:
|
|
- description: tokens
|
|
in: body
|
|
name: refresh
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.refreshToken'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.loginCustomerRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Refresh token
|
|
tags:
|
|
- auth
|
|
/api/v1/logs:
|
|
get:
|
|
description: Fetches application logs from MongoDB with pagination, level filtering,
|
|
and search
|
|
parameters:
|
|
- description: Filter logs by level (debug, info, warn, error, dpanic, panic,
|
|
fatal)
|
|
in: query
|
|
name: level
|
|
type: string
|
|
- description: Search term to match against message or fields
|
|
in: query
|
|
name: search
|
|
type: string
|
|
- default: 1
|
|
description: 'Page number for pagination (default: 1)'
|
|
in: query
|
|
name: page
|
|
type: integer
|
|
- default: 50
|
|
description: 'Number of items per page (default: 50, max: 100)'
|
|
in: query
|
|
name: limit
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: Paginated list of application logs
|
|
schema:
|
|
$ref: '#/definitions/domain.LogResponse'
|
|
"400":
|
|
description: Invalid request parameters
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
"500":
|
|
description: Internal server error
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
summary: Retrieve application logs with filtering and pagination
|
|
tags:
|
|
- Logs
|
|
/api/v1/super-login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Login super-admin
|
|
parameters:
|
|
- description: Login super-admin
|
|
in: body
|
|
name: login
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.loginAdminReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.LoginAdminRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Login super-admin
|
|
tags:
|
|
- auth
|
|
/api/v1/t-approver/{id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get a single admin by id
|
|
parameters:
|
|
- description: User ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.AdminRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Get admin by id
|
|
tags:
|
|
- admin
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Update Admin
|
|
parameters:
|
|
- description: Update Admin
|
|
in: body
|
|
name: admin
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.updateAdminReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Update Admin
|
|
tags:
|
|
- admin
|
|
/api/v1/tenant:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Check if phone number or email exist
|
|
parameters:
|
|
- description: Check phone number or email exist
|
|
in: body
|
|
name: checkPhoneEmailExist
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.CheckPhoneEmailExistReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.CheckPhoneEmailExistRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Check if phone number or email exist
|
|
tags:
|
|
- user
|
|
/api/v1/user/{user_name}/is-unique:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Returns whether the specified user_name is available (unique)
|
|
parameters:
|
|
- description: User Name
|
|
in: path
|
|
name: user_name
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/domain.Response'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/domain.ErrorResponse'
|
|
summary: Check if user_name is unique
|
|
tags:
|
|
- user
|
|
/api/v1/user/delete/{id}:
|
|
delete:
|
|
consumes:
|
|
- application/json
|
|
description: Delete a user by their ID
|
|
parameters:
|
|
- description: User ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Delete user by ID
|
|
tags:
|
|
- user
|
|
/api/v1/user/resetPassword:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Reset password
|
|
parameters:
|
|
- description: Reset password
|
|
in: body
|
|
name: resetPassword
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.ResetPasswordReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Reset password
|
|
tags:
|
|
- user
|
|
/api/v1/user/search:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Search for user using name or phone
|
|
parameters:
|
|
- description: Search for using his name or phone
|
|
in: body
|
|
name: searchUserByNameOrPhone
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.SearchUserByNameOrPhoneReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/domain.UserProfileResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Search for user using name or phone
|
|
tags:
|
|
- user
|
|
/api/v1/user/sendResetCode:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Send reset code
|
|
parameters:
|
|
- description: Send reset code
|
|
in: body
|
|
name: resetCode
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.ResetCodeReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Send reset code
|
|
tags:
|
|
- user
|
|
/api/v1/user/single/{id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Get a single user by id
|
|
parameters:
|
|
- description: User ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/domain.UserProfileResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"401":
|
|
description: Unauthorized
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Get user by id
|
|
tags:
|
|
- user
|
|
securityDefinitions:
|
|
Bearer:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|