1335 lines
32 KiB
YAML
1335 lines
32 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.Pagination:
|
|
properties:
|
|
current_page:
|
|
type: integer
|
|
limit:
|
|
type: integer
|
|
total:
|
|
type: integer
|
|
total_pages:
|
|
type: integer
|
|
type: object
|
|
domain.Role:
|
|
enum:
|
|
- super_admin
|
|
- admin
|
|
- student
|
|
- instructor
|
|
- support
|
|
type: string
|
|
x-enum-varnames:
|
|
- RoleSuperAdmin
|
|
- RoleAdmin
|
|
- RoleStudent
|
|
- RoleInstructor
|
|
- RoleSupport
|
|
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.RegisterUserReq:
|
|
properties:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
first_name:
|
|
example: John
|
|
type: string
|
|
last_name:
|
|
example: Doe
|
|
type: string
|
|
otp:
|
|
example: "123456"
|
|
type: string
|
|
password:
|
|
example: password123
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
referral_code:
|
|
example: ABC123
|
|
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.UpdateUserSuspendReq:
|
|
properties:
|
|
suspended:
|
|
example: true
|
|
type: boolean
|
|
user_id:
|
|
example: 123
|
|
type: integer
|
|
required:
|
|
- user_id
|
|
type: object
|
|
handlers.UpdateUserSuspendRes:
|
|
properties:
|
|
suspended:
|
|
type: boolean
|
|
user_id:
|
|
type: integer
|
|
type: object
|
|
handlers.UserProfileRes:
|
|
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.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:
|
|
email:
|
|
example: john.doe@example.com
|
|
type: string
|
|
password:
|
|
example: password123
|
|
type: string
|
|
phone_number:
|
|
example: "1234567890"
|
|
type: string
|
|
required:
|
|
- password
|
|
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
|
|
handlers.updateManagerReq:
|
|
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/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/handlers.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/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/handlers.UserProfileRes'
|
|
"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/{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/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/managers/{id}:
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Update Managers
|
|
parameters:
|
|
- description: Update Managers
|
|
in: body
|
|
name: Managers
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.updateManagerReq'
|
|
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 Managers
|
|
tags:
|
|
- manager
|
|
/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/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/handlers.UserProfileRes'
|
|
"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/handlers.UserProfileRes'
|
|
"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
|
|
/api/v1/user/suspend:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Suspend or unsuspend a user
|
|
parameters:
|
|
- description: Suspend or unsuspend a user
|
|
in: body
|
|
name: updateUserSuspend
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handlers.UpdateUserSuspendReq'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handlers.UpdateUserSuspendRes'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/response.APIResponse'
|
|
summary: Suspend or unsuspend a user
|
|
tags:
|
|
- user
|
|
securityDefinitions:
|
|
Bearer:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|