Yimaru-BackEnd/docs/swagger.yaml

2362 lines
57 KiB
YAML

definitions:
domain.AssessmentOption:
properties:
id:
format: int64
type: integer
isCorrect:
type: boolean
optionText:
type: string
type: object
domain.AssessmentQuestion:
properties:
description:
type: string
difficultyLevel:
type: string
id:
format: int64
type: integer
options:
items:
$ref: '#/definitions/domain.AssessmentOption'
type: array
questionType:
type: string
title:
type: string
type: object
domain.Course:
properties:
categoryID:
format: int64
type: integer
description:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
title:
type: string
type: object
domain.CourseCategory:
properties:
createdAt:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
name:
description: '"Learning English", "Other Courses"'
type: string
type: object
domain.ErrorResponse:
properties:
error:
type: string
message:
type: string
type: object
domain.Level:
properties:
description:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
levelIndex:
description: 1,2,3...
type: integer
numberOfModules:
type: integer
numberOfPractices:
type: integer
numberOfVideos:
type: integer
programID:
format: int64
type: integer
title:
description: '"Beginner", "Level 1"'
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.Module:
properties:
content:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
levelID:
format: int64
type: integer
order:
type: integer
title:
type: string
type: object
domain.ModuleVideo:
properties:
description:
type: string
duration:
description: seconds
type: integer
id:
format: int64
type: integer
instructorId:
type: string
isActive:
type: boolean
moduleID:
format: int64
type: integer
publishSettings:
$ref: '#/definitions/domain.PublishSettings'
resolution:
description: '"720p", "1080p"'
type: string
thumbnail:
type: string
title:
type: string
videoURL:
type: string
type: object
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.Practice:
properties:
bannerImage:
type: string
description:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
ownerID:
format: int64
type: integer
ownerType:
description: '"LEVEL" | "MODULE"'
type: string
persona:
type: string
title:
type: string
type: object
domain.PracticeQuestion:
properties:
id:
format: int64
type: integer
practiceID:
format: int64
type: integer
question:
type: string
questionVoicePrompt:
type: string
sampleAnswer:
type: string
sampleAnswerVoicePrompt:
type: string
tips:
type: string
type:
description: MCQ, TRUE_FALSE, SHORT
type: string
type: object
domain.Program:
properties:
courseID:
format: int64
type: integer
description:
type: string
id:
format: int64
type: integer
isActive:
type: boolean
order:
description: ordering inside course
type: integer
thumbnail:
type: string
title:
type: string
type: object
domain.PublishSettings:
properties:
isPublished:
type: boolean
publishDate:
type: string
visibility:
description: '"public", "private", "unlisted"'
type: string
type: object
domain.RegisterUserReq:
properties:
age:
type: integer
country:
type: string
education_level:
type: string
email:
type: string
favoutite_topic:
type: string
first_name:
type: string
language_challange:
type: string
language_goal:
type: string
last_name:
type: string
learning_goal:
type: string
nick_name:
type: string
occupation:
type: string
otp_medium:
$ref: '#/definitions/domain.OtpMedium'
password:
type: string
phone_number:
type: string
preferred_language:
type: string
region:
type: string
role:
type: string
user_name:
type: string
type: object
domain.ResendOtpReq:
properties:
user_name:
type: string
required:
- user_name
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.SubmitAssessmentReq:
properties:
answers:
items:
$ref: '#/definitions/domain.UserAnswer'
minItems: 1
type: array
required:
- answers
type: object
domain.UpdateKnowledgeLevelReq:
properties:
knowledge_level:
description: BEGINNER, INTERMEDIATE, ADVANCED
type: string
user_id:
type: integer
type: object
domain.UserAnswer:
properties:
isCorrect:
type: boolean
questionID:
format: int64
type: integer
selectedOptionID:
format: int64
type: integer
shortAnswer:
type: string
type: object
domain.UserProfileResponse:
properties:
age:
type: integer
country:
type: string
created_at:
type: string
education_level:
type: string
email:
type: string
email_verified:
type: boolean
favoutite_topic:
type: string
first_name:
type: string
id:
type: integer
initial_assessment_completed:
description: Profile fields
type: boolean
language_challange:
type: string
language_goal:
type: string
last_login:
type: string
last_name:
type: string
learning_goal:
type: string
nick_name:
type: string
occupation:
type: string
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.VerifyOtpReq:
properties:
otp:
type: string
user_name:
type: string
required:
- otp
- user_name
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:
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.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:
otp:
example: "123456"
type: string
password:
example: newpassword123
minLength: 8
type: string
user_name:
example: johndoe
type: string
required:
- otp
- password
- user_name
type: object
handlers.SearchUserByNameOrPhoneReq:
properties:
query:
type: string
role:
$ref: '#/definitions/domain.Role'
type: object
handlers.SendSingleAfroSMSReq:
properties:
message:
example: Hello world
type: string
recipient:
example: "+251912345678"
type: string
required:
- message
- recipient
type: object
handlers.loginAdminReq:
properties:
password:
example: password123
type: string
user_name:
example: adminuser
type: string
required:
- password
- user_name
type: object
handlers.loginUserReq:
properties:
password:
example: password123
type: string
user_name:
example: johndoe
type: string
required:
- password
- user_name
type: object
handlers.loginUserRes:
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:
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 user
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 user
tags:
- auth
/api/v1/{tenant_slug}/assessment/submit:
post:
consumes:
- application/json
description: Evaluates user responses, calculates knowledge level, updates user
profile, and sends notification
parameters:
- description: User ID
in: path
name: user_id
required: true
type: integer
- description: Assessment responses
in: body
name: payload
required: true
schema:
$ref: '#/definitions/domain.SubmitAssessmentReq'
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: Submit initial knowledge assessment
tags:
- assessment
/api/v1/{tenant_slug}/otp/resend:
post:
consumes:
- application/json
description: Resend OTP if the previous one is expired
parameters:
- description: Resend OTP
in: body
name: resendOtp
required: true
schema:
$ref: '#/definitions/domain.ResendOtpReq'
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: Resend OTP
tags:
- otp
/api/v1/{tenant_slug}/user-login:
post:
consumes:
- application/json
description: Login user
parameters:
- description: Login user
in: body
name: login
required: true
schema:
$ref: '#/definitions/handlers.loginUserReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.loginUserRes'
"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 user
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/knowledge-level:
put:
consumes:
- application/json
description: Updates the knowledge level of the specified user after initial
assessment
parameters:
- description: User ID
in: path
name: user_id
required: true
type: integer
- description: Knowledge level
in: body
name: knowledge_level
required: true
schema:
$ref: '#/definitions/domain.UpdateKnowledgeLevelReq'
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: Update user's knowledge level
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/user-profile:
get:
consumes:
- application/json
description: Get user profile
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'
security:
- Bearer: []
summary: Get user profile
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/assessment/questions:
get:
consumes:
- application/json
description: Returns all active questions used for initial knowledge assessment
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.AssessmentQuestion'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Get active initial assessment questions
tags:
- assessment
post:
consumes:
- application/json
description: Creates a new question for the initial knowledge assessment
parameters:
- description: Assessment question payload
in: body
name: question
required: true
schema:
$ref: '#/definitions/domain.AssessmentQuestion'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.AssessmentQuestion'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Create assessment question
tags:
- assessment
/api/v1/auth/logout:
post:
consumes:
- application/json
description: Logout user
parameters:
- description: Logout user
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 user
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.loginUserRes'
"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/course-categories:
get:
consumes:
- application/json
description: Returns all active course categories
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.CourseCategory'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: List active course categories
tags:
- courses
post:
consumes:
- application/json
description: Creates a new course category
parameters:
- description: Course category payload
in: body
name: category
required: true
schema:
$ref: '#/definitions/domain.CourseCategory'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.CourseCategory'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Create course category
tags:
- courses
/api/v1/course-categories/{category_id}/courses:
get:
consumes:
- application/json
description: Returns courses under a given category
parameters:
- description: Category ID
in: path
name: category_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.Course'
type: array
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: List courses by category
tags:
- courses
/api/v1/course-categories/{id}:
get:
consumes:
- application/json
description: Get course category by ID
parameters:
- description: Category ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.CourseCategory'
type: object
"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: Get course category
tags:
- courses
put:
consumes:
- application/json
description: Updates a course category
parameters:
- description: Category ID
in: path
name: id
required: true
type: integer
- description: Course category payload
in: body
name: category
required: true
schema:
$ref: '#/definitions/domain.CourseCategory'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.CourseCategory'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Update course category
tags:
- courses
/api/v1/course-categories/{id}/deactivate:
post:
consumes:
- application/json
description: Deactivates a course category
parameters:
- description: Category ID
in: path
name: id
required: true
type: integer
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: Deactivate course category
tags:
- courses
/api/v1/courses:
get:
consumes:
- application/json
description: Returns all active courses
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.Course'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: List active courses
tags:
- courses
post:
consumes:
- application/json
description: Creates a new course
parameters:
- description: Course payload
in: body
name: course
required: true
schema:
$ref: '#/definitions/domain.Course'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Course'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Create course
tags:
- courses
/api/v1/courses/{course_id}/programs:
get:
parameters:
- description: Course ID
in: path
name: course_id
required: true
type: integer
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.Program'
type: array
type: object
summary: List programs by course
tags:
- courses
post:
consumes:
- application/json
parameters:
- description: Program payload
in: body
name: program
required: true
schema:
$ref: '#/definitions/domain.Program'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Program'
type: object
summary: Create program
tags:
- courses
/api/v1/courses/{id}:
get:
consumes:
- application/json
description: Get course by ID
parameters:
- description: Course ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Course'
type: object
"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: Get course
tags:
- courses
put:
consumes:
- application/json
description: Updates a course
parameters:
- description: Course ID
in: path
name: id
required: true
type: integer
- description: Course payload
in: body
name: course
required: true
schema:
$ref: '#/definitions/domain.Course'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Course'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/domain.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/domain.ErrorResponse'
summary: Update course
tags:
- courses
/api/v1/courses/{id}/deactivate:
post:
consumes:
- application/json
description: Deactivates a course
parameters:
- description: Course ID
in: path
name: id
required: true
type: integer
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: Deactivate course
tags:
- courses
/api/v1/levels:
post:
consumes:
- application/json
parameters:
- description: Level payload
in: body
name: level
required: true
schema:
$ref: '#/definitions/domain.Level'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Level'
type: object
summary: Create level
tags:
- courses
/api/v1/levels/{level_id}/modules:
get:
parameters:
- description: Level ID
in: path
name: level_id
required: true
type: integer
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
items:
$ref: '#/definitions/domain.Module'
type: array
type: object
summary: List modules by level
tags:
- courses
/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/module-videos:
post:
consumes:
- application/json
parameters:
- description: Module video payload
in: body
name: video
required: true
schema:
$ref: '#/definitions/domain.ModuleVideo'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.ModuleVideo'
type: object
summary: Create module video
tags:
- courses
/api/v1/modules:
post:
consumes:
- application/json
parameters:
- description: Module payload
in: body
name: module
required: true
schema:
$ref: '#/definitions/domain.Module'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Module'
type: object
summary: Create module
tags:
- courses
/api/v1/practice-questions:
post:
consumes:
- application/json
parameters:
- description: Practice question payload
in: body
name: question
required: true
schema:
$ref: '#/definitions/domain.PracticeQuestion'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.PracticeQuestion'
type: object
summary: Create practice question
tags:
- courses
/api/v1/practices:
post:
consumes:
- application/json
parameters:
- description: Practice payload
in: body
name: practice
required: true
schema:
$ref: '#/definitions/domain.Practice'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/domain.Response'
- properties:
data:
$ref: '#/definitions/domain.Practice'
type: object
summary: Create practice
tags:
- courses
/api/v1/sendSMS:
post:
consumes:
- application/json
description: Sends an SMS message to a single phone number using AfroMessage
parameters:
- description: Send SMS request
in: body
name: sendSMS
required: true
schema:
$ref: '#/definitions/handlers.SendSingleAfroSMSReq'
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 single SMS via AfroMessage
tags:
- user
/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
/api/v1/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
securityDefinitions:
Bearer:
in: header
name: Authorization
type: apiKey
swagger: "2.0"