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.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.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 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: type: string required: - refresh_token type: object handlers.refreshToken: properties: access_token: example: type: string refresh_token: example: 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/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/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"