Merge remote-tracking branch 'origin/main'

This commit is contained in:
Kerod-Fresenbet-Gebremedhin2660 2026-11-01 14:59:11 +03:00
commit d0c48f03c4
59 changed files with 14811 additions and 1751 deletions

View File

@ -304,6 +304,11 @@ make postgres # psql shell into Compose Postgres
3. **Postman collections**: `postman/` (FAQ, personas, mobile app versions, dynamic question types, …) 3. **Postman collections**: `postman/` (FAQ, personas, mobile app versions, dynamic question types, …)
4. **Feature integration guides**: `docs/*-admin-panel-integration.md` (see [below](#admin-panel-integration-docs)) 4. **Feature integration guides**: `docs/*-admin-panel-integration.md` (see [below](#admin-panel-integration-docs))
Every API operation documents a concrete response schema, including envelopes,
pagination, message-only results, and notification scheduling variants. See
[Swagger response contracts](docs/swagger-response-schemas.md) for conventions,
intentional JSON extension fields, and the regression checks.
Regenerate after handler / annotation changes: Regenerate after handler / annotation changes:
```bash ```bash

View File

@ -2,9 +2,12 @@
## Browse without signing in ## Browse without signing in
The web app exposes `/catalog` and `/catalog/courses/:id` outside the authenticated Public discovery is intended for customer-facing web and mobile learning apps.
admin layout. Visitors to `/` see the catalog; signed-in staff retain their usual The admin panel is a staff application: signed-out visitors to `/` are redirected
dashboard redirect. The staff login page also links to the catalog. to `/login`, and signed-in staff go to their role's default management page.
The admin panel does not host customer catalog pages or use anonymous catalog APIs
for content management. Its course, chapter, lesson, and quiz tools continue to
use authenticated `/api/v1/admin` endpoints.
Anonymous APIs: Anonymous APIs:
@ -21,11 +24,26 @@ question delivery, and completion remain behind the existing learning endpoints
and their authentication/subscription rules. Previewing a premium lesson does not and their authentication/subscription rules. Previewing a premium lesson does not
grant access to it. grant access to it.
The web app uses `VITE_API_BASE_URL` with a trailing `/admin` removed for catalog ### Client app integration
requests. Requests omit cookies and staff authorization. Optionally set
`VITE_LEARNER_APP_URL` to your customer web/mobile sign-in destination to display Use the backend's public API base (for example `https://api.example.com/api/v1`)
a **Sign in to learn** link. Without it, the page directs visitors to their in the customer app, without the `/admin` suffix. No bearer token is required.
learning app. The staff login continues to be labeled **Staff sign in**. Render course highlights from the list response and load the course outline
when a visitor selects a course. For browser requests, omit staff credentials:
```javascript
const apiBase = "https://api.example.com/api/v1";
const response = await fetch(`${apiBase}/catalog/courses?limit=20&offset=0`, {
credentials: "omit",
});
if (!response.ok) throw new Error("Unable to load course highlights");
const { data } = await response.json();
// data.courses, data.total_count, data.limit, data.offset
```
Use `GET /catalog/courses/{id}` on the same base for the published outline.
Customer apps should offer their own learner sign-in flow when visitors choose
to start learning; authenticated playback, quiz, and progress APIs enforce access.
## Install the demo fixture ## Install the demo fixture

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
# Swagger response contracts
Every registered API operation has an explicit success response schema. JSON
payloads document their envelope, property names, arrays, nested objects, and
pagination. Operations without a data payload use message-only schemas; CSV,
HTML, OAuth redirects, and WebSocket upgrades retain their actual media/protocol
contracts rather than being described as generic JSON.
## Response envelopes
- `domain.Response{data=ConcreteType}` documents `message`, `success`,
`status_code`, endpoint-specific `data`, and `metadata`.
- `response.APIResponse{data=ConcreteType}` documents legacy account responses
with `status`, `message`, typed `data`, `timestamp`, and optional pagination.
- `MessageResponse` and `MessageAPIResponse` describe responses that omit `data`.
- Some endpoints, such as notification counts/lists and analytics, return a
top-level object. Their schemas describe that object without adding an envelope.
Raw service/domain records retain their existing JSON casing. For example,
assessment question sets and raw Vimeo upload results expose PascalCase fields.
Their Swagger models use those exact names; this documentation update does not
rename existing API properties.
Both immediately dispatched and scheduled bulk notifications are documented:
`200` returns the delivery summary and `201` returns a scheduled notification.
Free-plan checkout includes an optional `subscription` in the checkout response.
Pagination metadata for staff lists and Vimeo lists has a concrete schema.
## Extensible JSON and errors
Activity/notification metadata and template variables are intentionally extensible
objects. Their descriptions identify the source of their keys. A dynamic question
component's `value` depends on its `kind`; its description and `x-json-types`
extension explicitly document the permitted JSON variants. These fields cannot
truthfully be represented as one fixed object or as a byte array.
Reserved response `metadata` is null, or omitted in the legacy envelope, unless
the operation supplies a concrete metadata schema. Message-only responses document
this null value explicitly.
Error responses retain their real transport shape: JSON handler errors use
`domain.ErrorResponse`; handlers/middleware returning Fiber errors use a plain-text
string. The API does not have a universal JSON error envelope. Consumers should
respect the response Content-Type, particularly on authentication and service
failures. The documentation does not change runtime error handling.
## Maintaining complete schemas
When adding an operation:
1. Reuse an existing response type or add a small tagged payload DTO for maps.
2. Specify the complete response envelope and typed `data` in `@Success`.
3. Document each success status variant and the actual error bodies.
4. Use explicit descriptions for genuinely open JSON extension points.
5. Regenerate all artifacts and run the contract checks:
```powershell
swag init -g cmd/main.go
go test ./internal/web_server/... ./internal/domain ./internal/apidocs/...
go run ./cmd/swagger-export -out exports/swagger-offline
```
`TestEveryAPIResponseHasDetailedSchema` checks response definitions recursively,
including item schemas and composed envelope overrides. It rejects generic success
envelopes, missing schemas, and unexplained empty fields. Other checks ensure route,
security, request-body, and path-parameter coverage, valid references, and parity
between `docs.go`, `swagger.json`, and `swagger.yaml`. Representative payload tests
also compare documentation-only DTOs with the JSON written by the runtime types.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -72,8 +72,8 @@ type ArifpayVerifyByTransactionIDRequest struct {
} }
type ARIFPAYPaymentMethod struct { type ARIFPAYPaymentMethod struct {
ID int ID int `json:"ID"`
Name string Name string `json:"Name"`
} }
// Direct Payment Types // Direct Payment Types

View File

@ -13,10 +13,11 @@ type ResponseWDataFactory[T any] struct {
type Response struct { type Response struct {
Message string `json:"message"` Message string `json:"message"`
Data interface{} `json:"data,omitempty"` Data interface{} `json:"data,omitempty" swaggerignore:"true"`
Success bool `json:"success"` Success bool `json:"success"`
StatusCode int `json:"status_code"` StatusCode int `json:"status_code"`
MetaData interface{} `json:"metadata"` // Optional endpoint-specific metadata; null unless the operation documents a concrete metadata schema.
MetaData interface{} `json:"metadata" swaggertype:"object" extensions:"x-nullable"`
} }
func NewResponse(message string, data interface{}) Response { func NewResponse(message string, data interface{}) Response {

View File

@ -91,7 +91,8 @@ type Notification struct {
Timestamp time.Time `json:"timestamp"` Timestamp time.Time `json:"timestamp"`
Expires time.Time `json:"expires"` Expires time.Time `json:"expires"`
Image string `json:"image"` Image string `json:"image"`
Metadata json.RawMessage `json:"metadata,omitempty"` // Free-form notification metadata supplied by the sending application. Keys are application-defined.
Metadata json.RawMessage `json:"metadata,omitempty" swaggertype:"object"`
} }
type CreateNotification struct { type CreateNotification struct {
RecipientID int64 `json:"recipient_id"` RecipientID int64 `json:"recipient_id"`
@ -107,7 +108,8 @@ type CreateNotification struct {
Priority int `json:"priority,omitempty"` Priority int `json:"priority,omitempty"`
Expires time.Time `json:"expires"` Expires time.Time `json:"expires"`
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"` // Free-form notification metadata supplied by the sending application. Keys are application-defined.
Metadata json.RawMessage `json:"metadata,omitempty" swaggertype:"object"`
} }
type NotificationFilter struct { type NotificationFilter struct {

View File

@ -52,7 +52,8 @@ type DynamicElementDefinition struct {
type DynamicElementInstance struct { type DynamicElementInstance struct {
ID string `json:"id"` ID string `json:"id"`
Kind string `json:"kind"` Kind string `json:"kind"`
Value interface{} `json:"value,omitempty"` // Component-specific JSON value selected by kind: string, number, boolean, object, array, or null. Use the component catalog and definition schema to interpret it.
Value interface{} `json:"value,omitempty" extensions:"x-json-types=string|number|boolean|object|array|null"`
Meta map[string]interface{} `json:"meta,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"`
} }

View File

@ -3,19 +3,19 @@ package domain
import "time" import "time"
type QuestionTypeDefinition struct { type QuestionTypeDefinition struct {
ID int64 ID int64 `json:"ID"`
Key string Key string `json:"Key"`
DisplayName string DisplayName string `json:"DisplayName"`
Description *string Description *string `json:"Description"`
GroupIDs *[]int64 `json:"group_ids"` GroupIDs *[]int64 `json:"group_ids"`
StimulusComponentKinds []string StimulusComponentKinds []string `json:"StimulusComponentKinds"`
ResponseComponentKinds []string ResponseComponentKinds []string `json:"ResponseComponentKinds"`
StimulusSchema []DynamicElementDefinition StimulusSchema []DynamicElementDefinition `json:"StimulusSchema"`
ResponseSchema []DynamicElementDefinition ResponseSchema []DynamicElementDefinition `json:"ResponseSchema"`
IsSystem bool IsSystem bool `json:"IsSystem"`
Status string Status string `json:"Status"`
CreatedAt time.Time CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt *time.Time UpdatedAt *time.Time `json:"UpdatedAt"`
} }
type CreateQuestionTypeDefinitionInput struct { type CreateQuestionTypeDefinitionInput struct {

View File

@ -93,22 +93,22 @@ type QuestionShortAnswer struct {
} }
type QuestionSet struct { type QuestionSet struct {
ID int64 ID int64 `json:"ID"`
Title string Title string `json:"Title"`
Description *string Description *string `json:"Description"`
SetType string SetType string `json:"SetType"`
OwnerType *string OwnerType *string `json:"OwnerType"`
OwnerID *int64 OwnerID *int64 `json:"OwnerID"`
BannerImage *string BannerImage *string `json:"BannerImage"`
Persona *string Persona *string `json:"Persona"`
TimeLimitMinutes *int32 TimeLimitMinutes *int32 `json:"TimeLimitMinutes"`
PassingScore *int32 PassingScore *int32 `json:"PassingScore"`
ShuffleQuestions bool ShuffleQuestions bool `json:"ShuffleQuestions"`
Status string Status string `json:"Status"`
IntroVideoURL *string IntroVideoURL *string `json:"IntroVideoURL"`
UserPersonas []UserPersona UserPersonas []UserPersona `json:"UserPersonas"`
CreatedAt time.Time CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt *time.Time UpdatedAt *time.Time `json:"UpdatedAt"`
} }
type QuestionSetItem struct { type QuestionSetItem struct {
@ -205,11 +205,11 @@ type CreateQuestionSetInput struct {
// UserPersona represents a user acting as a persona in a practice session // UserPersona represents a user acting as a persona in a practice session
type UserPersona struct { type UserPersona struct {
ID int64 ID int64 `json:"ID"`
FirstName *string FirstName *string `json:"FirstName"`
LastName *string LastName *string `json:"LastName"`
NickName *string NickName *string `json:"NickName"`
ProfilePictureURL *string ProfilePictureURL *string `json:"ProfilePictureURL"`
Role string Role string `json:"Role"`
DisplayOrder int32 DisplayOrder int32 `json:"DisplayOrder"`
} }

View File

@ -56,7 +56,8 @@ type ScheduledNotification struct {
HTML string `json:"html,omitempty"` HTML string `json:"html,omitempty"`
EmailTemplateSlug string `json:"email_template_slug,omitempty"` EmailTemplateSlug string `json:"email_template_slug,omitempty"`
EmailTemplateVariables json.RawMessage `json:"email_template_variables,omitempty"` // Free-form template variable object. Keys are defined by the selected email template.
EmailTemplateVariables json.RawMessage `json:"email_template_variables,omitempty" swaggertype:"object"`
ScheduledAt time.Time `json:"scheduled_at"` ScheduledAt time.Time `json:"scheduled_at"`
Status ScheduledNotificationStatus `json:"status"` Status ScheduledNotificationStatus `json:"status"`
@ -65,7 +66,8 @@ type ScheduledNotification struct {
TargetRole string `json:"target_role,omitempty"` TargetRole string `json:"target_role,omitempty"`
TargetTeamMemberIDs []int64 `json:"target_team_member_ids,omitempty"` TargetTeamMemberIDs []int64 `json:"target_team_member_ids,omitempty"`
TargetTeamRole string `json:"target_team_role,omitempty"` TargetTeamRole string `json:"target_team_role,omitempty"`
TargetRaw json.RawMessage `json:"target_raw,omitempty"` // Optional extra targets: phones and emails arrays, team_member_ids array, team_role, level, and type strings.
TargetRaw json.RawMessage `json:"target_raw,omitempty" swaggertype:"object"`
AttemptCount int32 `json:"attempt_count"` AttemptCount int32 `json:"attempt_count"`
LastError string `json:"last_error,omitempty"` LastError string `json:"last_error,omitempty"`

View File

@ -226,17 +226,17 @@ type AccountDeletionRequestFilter struct {
} }
type AccountDeletionRequest struct { type AccountDeletionRequest struct {
UserID int64 UserID int64 `json:"UserID"`
FirstName string FirstName string `json:"FirstName"`
LastName string LastName string `json:"LastName"`
Email string Email string `json:"Email"`
PhoneNumber string PhoneNumber string `json:"PhoneNumber"`
Role Role Role Role `json:"Role"`
Status UserStatus Status UserStatus `json:"Status"`
DeletionRequestedAt *time.Time DeletionRequestedAt *time.Time `json:"DeletionRequestedAt"`
DeletionScheduledAt *time.Time DeletionScheduledAt *time.Time `json:"DeletionScheduledAt"`
DeletionCancelledAt *time.Time DeletionCancelledAt *time.Time `json:"DeletionCancelledAt"`
DeletionState AccountDeletionState DeletionState AccountDeletionState `json:"DeletionState"`
} }
type RegisterUserReq struct { type RegisterUserReq struct {

View File

@ -22,7 +22,8 @@ type activityLogRes struct {
ResourceType string `json:"resource_type"` ResourceType string `json:"resource_type"`
ResourceID *int64 `json:"resource_id,omitempty"` ResourceID *int64 `json:"resource_id,omitempty"`
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`
Metadata json.RawMessage `json:"metadata"` // Free-form event metadata; keys depend on action and resource_type. Null when the event has no metadata.
Metadata json.RawMessage `json:"metadata" swaggertype:"object"`
IPAddress *string `json:"ip_address,omitempty"` IPAddress *string `json:"ip_address,omitempty"`
UserAgent *string `json:"user_agent,omitempty"` UserAgent *string `json:"user_agent,omitempty"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
@ -48,7 +49,7 @@ type activityLogListRes struct {
// @Param before query string false "Filter logs before this RFC3339 timestamp" // @Param before query string false "Filter logs before this RFC3339 timestamp"
// @Param limit query int false "Limit" default(20) // @Param limit query int false "Limit" default(20)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=activityLogListRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/activity-logs [get] // @Router /api/v1/admin/activity-logs [get]
@ -165,7 +166,7 @@ func (h *Handler) GetActivityLogs(c *fiber.Ctx) error {
// @Tags activity-logs // @Tags activity-logs
// @Produce json // @Produce json
// @Param id path int true "Activity Log ID" // @Param id path int true "Activity Log ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=activityLogRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/activity-logs/{id} [get] // @Router /api/v1/admin/activity-logs/{id} [get]

View File

@ -32,10 +32,10 @@ type CreateAdminReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param manger body CreateAdminReq true "Create admin" // @Param manger body CreateAdminReq true "Create admin"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/admins [post] // @Router /api/v1/admin/admins [post]
// @Security Bearer // @Security Bearer
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -170,10 +170,10 @@ type AdminRes struct {
// @Produce json // @Produce json
// @Param page query int false "Page number" // @Param page query int false "Page number"
// @Param page_size query int false "Page size" // @Param page_size query int false "Page size"
// @Success 200 {object} AdminRes // @Success 200 {object} response.APIResponse{data=[]AdminRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/admins [get] // @Router /api/v1/admin/admins [get]
// @Security Bearer // @Security Bearer
// @Param query query string false "Query" // @Param query query string false "Query"
@ -292,10 +292,10 @@ func (h *Handler) GetAllAdmins(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "User ID" // @Param id path int true "User ID"
// @Success 200 {object} AdminRes // @Success 200 {object} response.APIResponse{data=AdminRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/admins/{id} [get] // @Router /api/v1/admin/admins/{id} [get]
// @Security Bearer // @Security Bearer
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -348,10 +348,10 @@ type updateAdminReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param admin body updateAdminReq true "Update Admin" // @Param admin body updateAdminReq true "Update Admin"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/admins/{id} [put] // @Router /api/v1/admin/admins/{id} [put]
// @Security Bearer // @Security Bearer
// @Param id path int64 true "Id" // @Param id path int64 true "Id"
@ -442,7 +442,7 @@ func (h *Handler) bulkAccountsRoleFromPath(c *fiber.Ctx) (roleKey string, ok boo
// @Produce json // @Produce json
// @Param role path string true "Role key (INSTRUCTOR etc.) or RBAC roles.id (integer string)" // @Param role path string true "Role key (INSTRUCTOR etc.) or RBAC roles.id (integer string)"
// @Param body body domain.BulkAccountsByRoleRequest false "Optional exclusions" // @Param body body domain.BulkAccountsByRoleRequest false "Optional exclusions"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.BulkDeactivateAccountsByRoleResult}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
@ -567,7 +567,7 @@ func (h *Handler) BulkDeactivateAccountsByRole(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param role path string true "Role key (INSTRUCTOR etc.) or RBAC roles.id (integer string)" // @Param role path string true "Role key (INSTRUCTOR etc.) or RBAC roles.id (integer string)"
// @Param body body domain.BulkAccountsByRoleRequest false "Optional exclusions" // @Param body body domain.BulkAccountsByRoleRequest false "Optional exclusions"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.BulkReactivateAccountsByRoleResult}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse

View File

@ -110,6 +110,7 @@ func csvJSON(raw json.RawMessage) string {
// @Security Bearer // @Security Bearer
// @Produce text/csv // @Produce text/csv
// @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition" // @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition"
// @Header 200 {string} Content-Disposition "attachment; filename=export.csv"
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
@ -176,6 +177,7 @@ func (h *Handler) ExportAdminPaymentsCSV(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Produce text/csv // @Produce text/csv
// @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition" // @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition"
// @Header 200 {string} Content-Disposition "attachment; filename=export.csv"
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Failure 400 {string} string "Invalid request" // @Failure 400 {string} string "Invalid request"
@ -260,6 +262,7 @@ func (h *Handler) ExportUsersCSV(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Produce text/csv // @Produce text/csv
// @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition" // @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition"
// @Header 200 {string} Content-Disposition "attachment; filename=export.csv"
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
@ -318,6 +321,7 @@ func (h *Handler) ExportActivityLogsCSV(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Produce text/csv // @Produce text/csv
// @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition" // @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition"
// @Header 200 {string} Content-Disposition "attachment; filename=export.csv"
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
@ -385,6 +389,7 @@ func (h *Handler) ExportUserSubscriptionsCSV(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Produce text/csv // @Produce text/csv
// @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition" // @Success 200 {file} file "CSV export; filename is supplied in Content-Disposition"
// @Header 200 {string} Content-Disposition "attachment; filename=export.csv"
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Failure 500 {object} domain.ErrorResponse "Internal server error" // @Failure 500 {object} domain.ErrorResponse "Internal server error"

View File

@ -33,8 +33,8 @@ func (r adminApplySubscriptionReq) recordPaymentOrDefault() bool {
// @Produce json // @Produce json
// @Param user_id path int true "Target learner user ID" // @Param user_id path int true "Target learner user ID"
// @Param body body adminApplySubscriptionReq true "Plan to grant or extend" // @Param body body adminApplySubscriptionReq true "Plan to grant or extend"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=subscriptionRes}
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=subscriptionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -160,7 +160,7 @@ func (h *Handler) AdminExtendOrGrantUserSubscription(c *fiber.Ctx) error {
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Param id path int true "Subscription ID" // @Param id path int true "Subscription ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=subscriptionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -52,7 +52,7 @@ type paymentRes struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body initiatePaymentReq true "Payment request" // @Param body body initiatePaymentReq true "Payment request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.InitiateSubscriptionPaymentResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/payments/subscribe [post] // @Router /api/v1/payments/subscribe [post]
@ -112,7 +112,7 @@ func (h *Handler) InitiateSubscriptionPayment(c *fiber.Ctx) error {
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Param session_id path string true "Session ID" // @Param session_id path string true "Session ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=paymentRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/payments/verify/{session_id} [get] // @Router /api/v1/payments/verify/{session_id} [get]
@ -155,7 +155,7 @@ func (h *Handler) VerifyPayment(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param limit query int false "Limit" default(20) // @Param limit query int false "Limit" default(20)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]paymentRes}
// @Router /api/v1/payments [get] // @Router /api/v1/payments [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -197,7 +197,7 @@ func (h *Handler) GetMyPayments(c *fiber.Ctx) error {
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Param id path int true "Payment ID" // @Param id path int true "Payment ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=paymentRes}
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/payments/{id} [get] // @Router /api/v1/payments/{id} [get]
// @Security Bearer // @Security Bearer
@ -244,7 +244,7 @@ func (h *Handler) GetPaymentByID(c *fiber.Ctx) error {
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Param id path int true "Payment ID" // @Param id path int true "Payment ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Router /api/v1/payments/{id}/cancel [post] // @Router /api/v1/payments/{id}/cancel [post]
// @Security Bearer // @Security Bearer
@ -469,7 +469,7 @@ type verifyOTPReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body initiateDirectPaymentReq true "Direct payment request" // @Param body body initiateDirectPaymentReq true "Direct payment request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.InitiateDirectPaymentResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/payments/direct [post] // @Router /api/v1/payments/direct [post]
@ -525,7 +525,7 @@ func (h *Handler) InitiateDirectPayment(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body verifyOTPReq true "OTP verification request" // @Param body body verifyOTPReq true "OTP verification request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.VerifyOTPResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/payments/direct/verify-otp [post] // @Router /api/v1/payments/direct/verify-otp [post]
@ -586,7 +586,7 @@ func (h *Handler) VerifyDirectPaymentOTP(c *fiber.Ctx) error {
// @Description Returns list of payment methods that support direct payment (OTP-based) // @Description Returns list of payment methods that support direct payment (OTP-based)
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]domain.ARIFPAYPaymentMethod}
// @Router /api/v1/payments/direct/methods [get] // @Router /api/v1/payments/direct/methods [get]
func (h *Handler) GetDirectPaymentMethods(c *fiber.Ctx) error { func (h *Handler) GetDirectPaymentMethods(c *fiber.Ctx) error {
methods := h.arifpaySvc.GetDirectPaymentMethods() methods := h.arifpaySvc.GetDirectPaymentMethods()

View File

@ -37,7 +37,7 @@ type loginUserRes struct {
// @Tags auth // @Tags auth
// @Param idToken body string true "Google ID Token from Android" // @Param idToken body string true "Google ID Token from Android"
// @Router /api/v1/auth/google/android [post] // @Router /api/v1/auth/google/android [post]
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=loginUserRes}
// @Produce json // @Produce json
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 401 {object} domain.ErrorResponse "Authentication failed" // @Failure 401 {object} domain.ErrorResponse "Authentication failed"
@ -108,7 +108,7 @@ func (h *Handler) GoogleAndroidLogin(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param body body object true "Apple login payload" // @Param body body object true "Apple login payload"
// @Router /api/v1/auth/apple [post] // @Router /api/v1/auth/apple [post]
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=loginUserRes}
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 401 {object} domain.ErrorResponse "Authentication failed" // @Failure 401 {object} domain.ErrorResponse "Authentication failed"
// @Failure 500 {object} domain.ErrorResponse "Internal server error" // @Failure 500 {object} domain.ErrorResponse "Internal server error"
@ -184,6 +184,7 @@ func (h *Handler) AppleLogin(c *fiber.Ctx) error {
// @Tags auth // @Tags auth
// @Router /api/v1/auth/google/login [get] // @Router /api/v1/auth/google/login [get]
// @Success 302 {string} string "Redirect to Google authorization URL; see Location header" // @Success 302 {string} string "Redirect to Google authorization URL; see Location header"
// @Header 302 {string} Location "Google authorization URL"
// @Failure 503 {object} domain.ErrorResponse "Google OAuth is not configured" // @Failure 503 {object} domain.ErrorResponse "Google OAuth is not configured"
// @Produce plain // @Produce plain
func (h *Handler) GoogleLogin(c *fiber.Ctx) error { func (h *Handler) GoogleLogin(c *fiber.Ctx) error {
@ -203,7 +204,7 @@ func (h *Handler) GoogleLogin(c *fiber.Ctx) error {
// @Tags auth // @Tags auth
// @Router /api/v1/auth/google/callback [get] // @Router /api/v1/auth/google/callback [get]
// @Param code query string false "Code" // @Param code query string false "Code"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=loginUserRes}
// @Produce json // @Produce json
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 401 {object} domain.ErrorResponse "Authentication failed" // @Failure 401 {object} domain.ErrorResponse "Authentication failed"
@ -271,10 +272,10 @@ func (h *Handler) GoogleCallback(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param login body domain.LoginRequest true "Login user" // @Param login body domain.LoginRequest true "Login user"
// @Success 200 {object} loginUserRes // @Success 200 {object} domain.Response{data=loginUserRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} response.APIResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/auth/customer-login [post] // @Router /api/v1/auth/customer-login [post]
// @Failure 403 {object} domain.ErrorResponse "Access denied" // @Failure 403 {object} domain.ErrorResponse "Access denied"
func (h *Handler) LoginUser(c *fiber.Ctx) error { func (h *Handler) LoginUser(c *fiber.Ctx) error {
@ -421,10 +422,10 @@ type LoginAdminRes struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param login body domain.LoginRequest true "Login admin" // @Param login body domain.LoginRequest true "Login admin"
// @Success 200 {object} LoginAdminRes // @Success 200 {object} response.APIResponse{data=loginUserRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/auth/admin-login [post] // @Router /api/v1/admin/auth/admin-login [post]
// @Failure 403 {string} string "Access denied" // @Failure 403 {string} string "Access denied"
func (h *Handler) LoginAdmin(c *fiber.Ctx) error { func (h *Handler) LoginAdmin(c *fiber.Ctx) error {
@ -524,10 +525,10 @@ func (h *Handler) LoginAdmin(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param login body domain.LoginRequest true "Login super-admin" // @Param login body domain.LoginRequest true "Login super-admin"
// @Success 200 {object} LoginAdminRes // @Success 200 {object} response.APIResponse{data=loginUserRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/auth/super-login [post] // @Router /api/v1/admin/auth/super-login [post]
// @Failure 403 {string} string "Access denied" // @Failure 403 {string} string "Access denied"
func (h *Handler) LoginSuper(c *fiber.Ctx) error { func (h *Handler) LoginSuper(c *fiber.Ctx) error {
@ -631,10 +632,10 @@ type refreshToken struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param refresh body refreshToken true "tokens" // @Param refresh body refreshToken true "tokens"
// @Success 200 {object} loginUserRes // @Success 200 {object} domain.Response{data=loginUserRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/auth/refresh [post] // @Router /api/v1/auth/refresh [post]
// @Failure 403 {string} string "Access denied" // @Failure 403 {string} string "Access denied"
func (h *Handler) RefreshToken(c *fiber.Ctx) error { func (h *Handler) RefreshToken(c *fiber.Ctx) error {
@ -772,10 +773,10 @@ type logoutReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param logout body logoutReq true "Logout user" // @Param logout body logoutReq true "Logout user"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/auth/logout [post] // @Router /api/v1/auth/logout [post]
// @Security Bearer // @Security Bearer
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -17,7 +17,7 @@ import (
// @Tags payments // @Tags payments
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Router /api/v1/payments/webhook [post] // @Router /api/v1/payments/webhook [post]
// @Accept json // @Accept json
@ -88,7 +88,7 @@ func (h *Handler) logChapaWebhookActivity(c *fiber.Ctx, payload domain.ChapaWebh
// @Param trx_ref query string false "Transaction reference" // @Param trx_ref query string false "Transaction reference"
// @Param ref_id query string false "Chapa reference ID" // @Param ref_id query string false "Chapa reference ID"
// @Param status query string false "Payment status" // @Param status query string false "Payment status"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Router /api/v1/payments/chapa/callback [get] // @Router /api/v1/payments/chapa/callback [get]
// @Param tx_ref query string false "Tx ref" // @Param tx_ref query string false "Tx ref"
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
@ -181,7 +181,7 @@ func (h *Handler) HandleChapaSuccessPage(c *fiber.Ctx) error {
// @Description Returns payment methods available on Chapa checkout // @Description Returns payment methods available on Chapa checkout
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]domain.ChapaPaymentMethod}
// @Router /api/v1/payments/methods [get] // @Router /api/v1/payments/methods [get]
func (h *Handler) GetChapaPaymentMethods(c *fiber.Ctx) error { func (h *Handler) GetChapaPaymentMethods(c *fiber.Ctx) error {
return c.JSON(domain.Response{ return c.JSON(domain.Response{

View File

@ -29,7 +29,7 @@ type authorizeChapaDirectPaymentReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body initiateChapaDirectPaymentReq true "Chapa direct charge request" // @Param body body initiateChapaDirectPaymentReq true "Chapa direct charge request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.InitiateChapaDirectChargeResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/payments/chapa/direct [post] // @Router /api/v1/payments/chapa/direct [post]
@ -79,7 +79,7 @@ func (h *Handler) InitiateChapaDirectPayment(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body authorizeChapaDirectPaymentReq true "Chapa direct charge authorization request" // @Param body body authorizeChapaDirectPaymentReq true "Chapa direct charge authorization request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.AuthorizeChapaDirectChargeResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/payments/chapa/direct/authorize [post] // @Router /api/v1/payments/chapa/direct/authorize [post]
@ -142,7 +142,7 @@ func (h *Handler) AuthorizeChapaDirectPayment(c *fiber.Ctx) error {
// @Description Returns wallet methods supported by Chapa Direct Charge API (USSD push and OTP flows). // @Description Returns wallet methods supported by Chapa Direct Charge API (USSD push and OTP flows).
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]domain.ChapaDirectChargeMethod}
// @Router /api/v1/payments/chapa/direct/methods [get] // @Router /api/v1/payments/chapa/direct/methods [get]
func (h *Handler) GetChapaDirectPaymentMethods(c *fiber.Ctx) error { func (h *Handler) GetChapaDirectPaymentMethods(c *fiber.Ctx) error {
return c.JSON(domain.Response{ return c.JSON(domain.Response{

View File

@ -102,7 +102,7 @@ func (h *Handler) UpdateChapterQuizFull(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Produce json // @Produce json
// @Param id path int true "Quiz shell ID" // @Param id path int true "Quiz shell ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 401 {object} domain.ErrorResponse "Missing or invalid access token" // @Failure 401 {object} domain.ErrorResponse "Missing or invalid access token"
// @Failure 403 {object} domain.ErrorResponse "Permission, subscription, or sequence access denied" // @Failure 403 {object} domain.ErrorResponse "Permission, subscription, or sequence access denied"
@ -143,7 +143,7 @@ func (h *Handler) GetChapterQuizQuestions(c *fiber.Ctx) error {
// @Param id path int true "Quiz shell ID" // @Param id path int true "Quiz shell ID"
// @Accept json // @Accept json
// @Param body body domain.CompletePracticeInput false "Optional chapter scope" // @Param body body domain.CompletePracticeInput false "Optional chapter scope"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 401 {object} domain.ErrorResponse "Missing or invalid access token" // @Failure 401 {object} domain.ErrorResponse "Missing or invalid access token"
// @Failure 403 {object} domain.ErrorResponse "Permission, subscription, or sequence access denied" // @Failure 403 {object} domain.ErrorResponse "Permission, subscription, or sequence access denied"

View File

@ -87,7 +87,7 @@ func mapEmailTemplateToRes(t domain.EmailTemplate) emailTemplateRes {
// @Param query query string false "Search by slug, name, or subject" // @Param query query string false "Search by slug, name, or subject"
// @Param limit query int false "Limit (default 20)" // @Param limit query int false "Limit (default 20)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listEmailTemplatesRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/email-templates [get] // @Router /api/v1/admin/email-templates [get]
@ -149,7 +149,7 @@ func (h *Handler) ListEmailTemplatesAdmin(c *fiber.Ctx) error {
// @Tags email-templates // @Tags email-templates
// @Produce json // @Produce json
// @Param id path int true "Email template ID" // @Param id path int true "Email template ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=emailTemplateRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -191,7 +191,7 @@ func (h *Handler) GetEmailTemplateByIDAdmin(c *fiber.Ctx) error {
// @Tags email-templates // @Tags email-templates
// @Produce json // @Produce json
// @Param slug path string true "Email template slug" // @Param slug path string true "Email template slug"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=emailTemplateRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -234,7 +234,7 @@ func (h *Handler) GetEmailTemplateBySlugAdmin(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createEmailTemplateReq true "Create email template payload" // @Param body body createEmailTemplateReq true "Create email template payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=emailTemplateRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/email-templates [post] // @Router /api/v1/admin/email-templates [post]
@ -288,7 +288,7 @@ func (h *Handler) CreateEmailTemplate(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Email template ID" // @Param id path int true "Email template ID"
// @Param body body updateEmailTemplateReq true "Update email template payload" // @Param body body updateEmailTemplateReq true "Update email template payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=emailTemplateRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -347,7 +347,7 @@ func (h *Handler) UpdateEmailTemplate(c *fiber.Ctx) error {
// @Tags email-templates // @Tags email-templates
// @Produce json // @Produce json
// @Param id path int true "Email template ID" // @Param id path int true "Email template ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=DeleteEmailTemplateData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -392,7 +392,7 @@ func (h *Handler) DeleteEmailTemplate(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param slug path string true "Email template slug" // @Param slug path string true "Email template slug"
// @Param body body previewEmailTemplateReq true "Preview variables" // @Param body body previewEmailTemplateReq true "Preview variables"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.RenderedEmail}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -442,7 +442,7 @@ func (h *Handler) PreviewEmailTemplateBySlug(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Email template ID" // @Param id path int true "Email template ID"
// @Param body body previewEmailTemplateReq true "Preview variables" // @Param body body previewEmailTemplateReq true "Preview variables"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.RenderedEmail}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -26,7 +26,7 @@ func assessmentParentFromQuery(c *fiber.Ctx) (domain.ExamPrepAssessmentParent, e
// @Router /api/v1/admin/assessments [get] // @Router /api/v1/admin/assessments [get]
// @Router /api/v1/assessments [get] // @Router /api/v1/assessments [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListExamPrepAssessmentsData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -50,7 +50,7 @@ func (h *Handler) ListExamPrepAssessments(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Accept json // @Accept json
// @Param body body domain.LinkExamPrepAssessmentInput true "Request payload" // @Param body body domain.LinkExamPrepAssessmentInput true "Request payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=LinkExamPrepAssessmentData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -79,7 +79,7 @@ func (h *Handler) LinkExamPrepAssessment(c *fiber.Ctx) error {
// @Param parentId path int64 true "Parent id" // @Param parentId path int64 true "Parent id"
// @Param parentKind path string true "Parent kind" // @Param parentKind path string true "Parent kind"
// @Param questionSetId path int64 true "Question set id" // @Param questionSetId path int64 true "Question set id"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -105,7 +105,7 @@ func (h *Handler) ListExamPrepCatalogCourses(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.ReorderIDsRequest true "ordered_ids: every course id exactly once" // @Param body body domain.ReorderIDsRequest true "ordered_ids: every course id exactly once"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Router /api/v1/admin/courses/reorder [put] // @Router /api/v1/admin/courses/reorder [put]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -257,7 +257,7 @@ func (h *Handler) UpdateExamPrepCatalogCourse(c *fiber.Ctx) error {
// @Summary Delete course // @Summary Delete course
// @Tags learning // @Tags learning
// @Param id path int true "Course ID" // @Param id path int true "Course ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Router /api/v1/admin/courses/{id} [delete] // @Router /api/v1/admin/courses/{id} [delete]
// @Security Bearer // @Security Bearer
// @Produce json // @Produce json

View File

@ -149,7 +149,7 @@ func (h *Handler) ListExamPrepLessonsByUnitModule(c *fiber.Ctx) error {
// @Param chapterId path int64 true "Chapter id" // @Param chapterId path int64 true "Chapter id"
// @Accept json // @Accept json
// @Param body body domain.ReorderIDsRequest true "Request payload" // @Param body body domain.ReorderIDsRequest true "Request payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -321,7 +321,7 @@ func (h *Handler) UpdateExamPrepLesson(c *fiber.Ctx) error {
// @Router /api/v1/admin/lessons/{id} [delete] // @Router /api/v1/admin/lessons/{id} [delete]
// @Security Bearer // @Security Bearer
// @Param id path int64 true "Id" // @Param id path int64 true "Id"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -16,7 +16,7 @@ import (
// @Param body body domain.CreateExamPrepPracticeInput true "Practice" // @Param body body domain.CreateExamPrepPracticeInput true "Practice"
// @Router /api/v1/admin/practices [post] // @Router /api/v1/admin/practices [post]
// @Security Bearer // @Security Bearer
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -64,7 +64,7 @@ func (h *Handler) CreateExamPrepPracticeFromInput(c *fiber.Ctx) error {
// @Router /api/v1/admin/practices [get] // @Router /api/v1/admin/practices [get]
// @Router /api/v1/practices [get] // @Router /api/v1/practices [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListAllExamPrepPracticesData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -147,7 +147,7 @@ func (h *Handler) CreateExamPrepPractice(c *fiber.Ctx) error {
// @Router /api/v1/admin/lessons/{lessonId}/practices [get] // @Router /api/v1/admin/lessons/{lessonId}/practices [get]
// @Router /api/v1/lessons/{lessonId}/practices [get] // @Router /api/v1/lessons/{lessonId}/practices [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListExamPrepPracticesByLessonData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -189,7 +189,7 @@ func (h *Handler) ListExamPrepPracticesByLesson(c *fiber.Ctx) error {
// @Router /api/v1/admin/practices/{id} [get] // @Router /api/v1/admin/practices/{id} [get]
// @Router /api/v1/practices/{id} [get] // @Router /api/v1/practices/{id} [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -238,7 +238,7 @@ func (h *Handler) GetExamPrepPracticeByID(c *fiber.Ctx) error {
// @Param body body domain.UpdateExamPrepPracticeInput true "Fields to update" // @Param body body domain.UpdateExamPrepPracticeInput true "Fields to update"
// @Router /api/v1/admin/practices/{id} [put] // @Router /api/v1/admin/practices/{id} [put]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -298,7 +298,7 @@ func (h *Handler) UpdateExamPrepPractice(c *fiber.Ctx) error {
// @Param body body domain.UpdateExamPrepPracticeParentsInput true "Parent links (replaces all; use empty array to detach)" // @Param body body domain.UpdateExamPrepPracticeParentsInput true "Parent links (replaces all; use empty array to detach)"
// @Router /api/v1/admin/practices/{id}/parents [put] // @Router /api/v1/admin/practices/{id}/parents [put]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -362,7 +362,7 @@ func (h *Handler) UpdateExamPrepPracticeParents(c *fiber.Ctx) error {
// @Param parentId path int true "Parent entity ID" // @Param parentId path int true "Parent entity ID"
// @Router /api/v1/admin/practices/{id}/parents/{parentKind}/{parentId} [delete] // @Router /api/v1/admin/practices/{id}/parents/{parentKind}/{parentId} [delete]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -424,7 +424,7 @@ func (h *Handler) UnlinkExamPrepPracticeParent(c *fiber.Ctx) error {
// @Param id path int true "Exam prep practice ID" // @Param id path int true "Exam prep practice ID"
// @Router /api/v1/admin/practices/{id} [delete] // @Router /api/v1/admin/practices/{id} [delete]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -522,7 +522,7 @@ func (h *Handler) listExamPrepPracticesResponse(c *fiber.Ctx, items []domain.Exa
// @Param body body domain.CreateExamPrepPracticeInput true "Practice" // @Param body body domain.CreateExamPrepPracticeInput true "Practice"
// @Router /api/v1/admin/courses/{courseId}/practices [post] // @Router /api/v1/admin/courses/{courseId}/practices [post]
// @Security Bearer // @Security Bearer
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -562,7 +562,7 @@ func (h *Handler) CreateExamPrepPracticeForCatalogCourse(c *fiber.Ctx) error {
// @Router /api/v1/admin/courses/{courseId}/practices [get] // @Router /api/v1/admin/courses/{courseId}/practices [get]
// @Router /api/v1/courses/{courseId}/practices [get] // @Router /api/v1/courses/{courseId}/practices [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListExamPrepPracticesByCatalogCourseData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -598,7 +598,7 @@ func (h *Handler) ListExamPrepPracticesByCatalogCourse(c *fiber.Ctx) error {
// @Param body body domain.CreateExamPrepPracticeInput true "Practice" // @Param body body domain.CreateExamPrepPracticeInput true "Practice"
// @Router /api/v1/admin/chapters/{chapterId}/practices [post] // @Router /api/v1/admin/chapters/{chapterId}/practices [post]
// @Security Bearer // @Security Bearer
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.ExamPrepPractice}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -638,7 +638,7 @@ func (h *Handler) CreateExamPrepPracticeForUnit(c *fiber.Ctx) error {
// @Router /api/v1/admin/chapters/{chapterId}/practices [get] // @Router /api/v1/admin/chapters/{chapterId}/practices [get]
// @Router /api/v1/chapters/{chapterId}/practices [get] // @Router /api/v1/chapters/{chapterId}/practices [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListExamPrepPracticesByUnitData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -150,7 +150,7 @@ func (h *Handler) ListExamPrepUnitsByCatalogCourse(c *fiber.Ctx) error {
// @Param body body domain.ReorderIDsRequest true "ordered_ids: every chapter id in this course, new order" // @Param body body domain.ReorderIDsRequest true "ordered_ids: every chapter id in this course, new order"
// @Router /api/v1/admin/courses/{courseId}/chapters/reorder [put] // @Router /api/v1/admin/courses/{courseId}/chapters/reorder [put]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -321,7 +321,7 @@ func (h *Handler) UpdateExamPrepUnit(c *fiber.Ctx) error {
// @Param id path int true "Chapter ID" // @Param id path int true "Chapter ID"
// @Router /api/v1/admin/chapters/{id} [delete] // @Router /api/v1/admin/chapters/{id} [delete]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -69,7 +69,7 @@ func mapFAQToRes(f domain.FAQ) faqRes {
// @Param category query string false "Filter by category" // @Param category query string false "Filter by category"
// @Param limit query int false "Limit (default 50)" // @Param limit query int false "Limit (default 50)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listFAQsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/faqs [get] // @Router /api/v1/faqs [get]
@ -124,7 +124,7 @@ func (h *Handler) ListPublicFAQs(c *fiber.Ctx) error {
// @Tags faqs // @Tags faqs
// @Produce json // @Produce json
// @Param id path int true "FAQ ID" // @Param id path int true "FAQ ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=faqRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/faqs/{id} [get] // @Router /api/v1/faqs/{id} [get]
@ -166,7 +166,7 @@ func (h *Handler) GetPublicFAQByID(c *fiber.Ctx) error {
// @Param category query string false "Filter by category" // @Param category query string false "Filter by category"
// @Param limit query int false "Limit (default 20)" // @Param limit query int false "Limit (default 20)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listFAQsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/faqs [get] // @Router /api/v1/admin/faqs [get]
@ -228,7 +228,7 @@ func (h *Handler) ListFAQsAdmin(c *fiber.Ctx) error {
// @Tags faqs // @Tags faqs
// @Produce json // @Produce json
// @Param id path int true "FAQ ID" // @Param id path int true "FAQ ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=faqRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -271,7 +271,7 @@ func (h *Handler) GetFAQByIDAdmin(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createFAQReq true "Create FAQ payload" // @Param body body createFAQReq true "Create FAQ payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=faqRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/faqs [post] // @Router /api/v1/admin/faqs [post]
@ -323,7 +323,7 @@ func (h *Handler) CreateFAQ(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "FAQ ID" // @Param id path int true "FAQ ID"
// @Param body body updateFAQReq true "Update FAQ payload" // @Param body body updateFAQReq true "Update FAQ payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=faqRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -381,7 +381,7 @@ func (h *Handler) UpdateFAQ(c *fiber.Ctx) error {
// @Tags faqs // @Tags faqs
// @Produce json // @Produce json
// @Param id path int true "FAQ ID" // @Param id path int true "FAQ ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=DeleteFAQData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -65,7 +65,7 @@ func mapFieldOptionToRes(o domain.ProfileFieldOption) fieldOptionRes {
// @Tags field-options // @Tags field-options
// @Produce json // @Produce json
// @Param field_key query string false "Filter by field key" // @Param field_key query string false "Filter by field key"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ProfileFieldOptionsGrouped}
// @Router /api/v1/field-options [get] // @Router /api/v1/field-options [get]
func (h *Handler) ListPublicFieldOptions(c *fiber.Ctx) error { func (h *Handler) ListPublicFieldOptions(c *fiber.Ctx) error {
var fieldKeyPtr *string var fieldKeyPtr *string
@ -91,7 +91,7 @@ func (h *Handler) ListPublicFieldOptions(c *fiber.Ctx) error {
// @Tags field-options // @Tags field-options
// @Produce json // @Produce json
// @Param active_only query bool false "If true, only keys with active options" // @Param active_only query bool false "If true, only keys with active options"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListFieldKeysData}
// @Router /api/v1/field-options/fields [get] // @Router /api/v1/field-options/fields [get]
func (h *Handler) ListFieldKeys(c *fiber.Ctx) error { func (h *Handler) ListFieldKeys(c *fiber.Ctx) error {
activeOnly := c.Query("active_only", "true") == "true" activeOnly := c.Query("active_only", "true") == "true"
@ -117,7 +117,7 @@ func (h *Handler) ListFieldKeys(c *fiber.Ctx) error {
// @Param status query string false "ACTIVE or INACTIVE" // @Param status query string false "ACTIVE or INACTIVE"
// @Param limit query int false "Limit" // @Param limit query int false "Limit"
// @Param offset query int false "Offset" // @Param offset query int false "Offset"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listFieldOptionsRes}
// @Router /api/v1/admin/field-options [get] // @Router /api/v1/admin/field-options [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -159,7 +159,7 @@ func (h *Handler) ListFieldOptionsAdmin(c *fiber.Ctx) error {
// @Tags field-options // @Tags field-options
// @Produce json // @Produce json
// @Param id path int true "Option ID" // @Param id path int true "Option ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=fieldOptionRes}
// @Router /api/v1/admin/field-options/{id} [get] // @Router /api/v1/admin/field-options/{id} [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -191,7 +191,7 @@ func (h *Handler) GetFieldOptionByIDAdmin(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createFieldOptionReq true "Create option" // @Param body body createFieldOptionReq true "Create option"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=fieldOptionRes}
// @Router /api/v1/admin/field-options [post] // @Router /api/v1/admin/field-options [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -239,7 +239,7 @@ func (h *Handler) CreateFieldOption(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Option ID" // @Param id path int true "Option ID"
// @Param body body updateFieldOptionReq true "Update option" // @Param body body updateFieldOptionReq true "Update option"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=fieldOptionRes}
// @Router /api/v1/admin/field-options/{id} [put] // @Router /api/v1/admin/field-options/{id} [put]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -284,7 +284,7 @@ func (h *Handler) UpdateFieldOption(c *fiber.Ctx) error {
// @Tags field-options // @Tags field-options
// @Produce json // @Produce json
// @Param id path int true "Option ID" // @Param id path int true "Option ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Router /api/v1/admin/field-options/{id} [delete] // @Router /api/v1/admin/field-options/{id} [delete]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"

View File

@ -74,7 +74,7 @@ func (h *Handler) resolveFileURL(c *fiber.Ctx, storedPath string) string {
// @Summary Get presigned URL for a file // @Summary Get presigned URL for a file
// @Tags files // @Tags files
// @Param key query string true "MinIO object key (e.g. profile_pictures/uuid.jpg)" // @Param key query string true "MinIO object key (e.g. profile_pictures/uuid.jpg)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=GetFileURLData}
// @Router /api/v1/admin/files/url [get] // @Router /api/v1/admin/files/url [get]
// @Router /api/v1/files/url [get] // @Router /api/v1/files/url [get]
// @Security Bearer // @Security Bearer
@ -128,7 +128,7 @@ func (h *Handler) extractObjectKeyFromReference(reference string) (string, error
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body refreshFileURLReq true "reference (object key, minio://..., or existing presigned URL)" // @Param body body refreshFileURLReq true "reference (object key, minio://..., or existing presigned URL)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=RefreshFileURLData}
// @Router /api/v1/admin/files/refresh-url [post] // @Router /api/v1/admin/files/refresh-url [post]
// @Router /api/v1/files/refresh-url [post] // @Router /api/v1/files/refresh-url [post]
// @Security Bearer // @Security Bearer
@ -187,7 +187,7 @@ func (h *Handler) RefreshFileURL(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body presignedUploadReq true "Presigned upload request" // @Param body body presignedUploadReq true "Presigned upload request"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=presignedUploadRes}
// @Router /api/v1/admin/files/presign-upload [post] // @Router /api/v1/admin/files/presign-upload [post]
// @Router /api/v1/files/presign-upload [post] // @Router /api/v1/files/presign-upload [post]
// @Security Bearer // @Security Bearer
@ -284,7 +284,7 @@ func (h *Handler) CreatePresignedUpload(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body completePresignedUploadReq true "Complete upload request" // @Param body body completePresignedUploadReq true "Complete upload request"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=uploadMediaRes}
// @Router /api/v1/admin/files/complete-upload [post] // @Router /api/v1/admin/files/complete-upload [post]
// @Router /api/v1/files/complete-upload [post] // @Router /api/v1/files/complete-upload [post]
// @Security Bearer // @Security Bearer
@ -412,7 +412,7 @@ func objectKeyMatchesMediaType(objectKey, mediaType string) bool {
// @Accept multipart/form-data // @Accept multipart/form-data
// @Param media_type formData string true "Media type: image|audio|video|pdf" // @Param media_type formData string true "Media type: image|audio|video|pdf"
// @Param file formData file true "Media file" // @Param file formData file true "Media file"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=uploadMediaRes}
// @Router /api/v1/admin/files/upload [post] // @Router /api/v1/admin/files/upload [post]
// @Router /api/v1/files/upload [post] // @Router /api/v1/files/upload [post]
// @Security Bearer // @Security Bearer
@ -663,7 +663,7 @@ func normalizeAndValidateMediaContentType(mediaType, contentType, fileName strin
// @Tags files // @Tags files
// @Accept multipart/form-data // @Accept multipart/form-data
// @Param file formData file true "Audio file (mp3, wav, ogg, m4a, aac, webm)" // @Param file formData file true "Audio file (mp3, wav, ogg, m4a, aac, webm)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=UploadAudioData}
// @Router /api/v1/admin/files/audio [post] // @Router /api/v1/admin/files/audio [post]
// @Router /api/v1/files/audio [post] // @Router /api/v1/files/audio [post]
// @Security Bearer // @Security Bearer
@ -790,7 +790,7 @@ func (h *Handler) UploadAudio(c *fiber.Ctx) error {
// @Param question_id formData int true "Question ID" // @Param question_id formData int true "Question ID"
// @Param question_set_id formData int true "Question Set ID" // @Param question_set_id formData int true "Question Set ID"
// @Param file formData file true "Audio recording" // @Param file formData file true "Audio recording"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SubmitAudioAnswerData}
// @Router /api/v1/questions/audio-answer [post] // @Router /api/v1/questions/audio-answer [post]
// @Security Bearer // @Security Bearer
// @Produce json // @Produce json

View File

@ -323,7 +323,7 @@ func (h *Handler) GetAllIssues(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Issue ID" // @Param id path int true "Issue ID"
// @Param body body updateIssueStatusReq true "Status update payload" // @Param body body updateIssueStatusReq true "Status update payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/issues/{id}/status [patch] // @Router /api/v1/admin/issues/{id}/status [patch]
@ -393,7 +393,7 @@ func (h *Handler) UpdateIssueStatus(c *fiber.Ctx) error {
// @Tags issues // @Tags issues
// @Produce json // @Produce json
// @Param id path int true "Issue ID" // @Param id path int true "Issue ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/issues/{id} [delete] // @Router /api/v1/admin/issues/{id} [delete]

View File

@ -23,7 +23,7 @@ type listPersonasData struct {
// @Tags personas // @Tags personas
// @Accept json // @Accept json
// @Param body body domain.CreateLmsPersonaInput true "Persona" // @Param body body domain.CreateLmsPersonaInput true "Persona"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.LmsPersona}
// @Router /api/v1/admin/personas [post] // @Router /api/v1/admin/personas [post]
// @Security Bearer // @Security Bearer
// @Produce json // @Produce json
@ -70,7 +70,7 @@ func (h *Handler) CreatePersona(c *fiber.Ctx) error {
// @Router /api/v1/admin/personas [get] // @Router /api/v1/admin/personas [get]
// @Router /api/v1/personas [get] // @Router /api/v1/personas [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listPersonasData}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -112,7 +112,7 @@ func (h *Handler) ListPersonas(c *fiber.Ctx) error {
// @Router /api/v1/admin/personas/{id} [get] // @Router /api/v1/admin/personas/{id} [get]
// @Router /api/v1/personas/{id} [get] // @Router /api/v1/personas/{id} [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.LmsPersona}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -145,7 +145,7 @@ func (h *Handler) GetPersona(c *fiber.Ctx) error {
// @Param body body domain.UpdateLmsPersonaInput true "Fields to update" // @Param body body domain.UpdateLmsPersonaInput true "Fields to update"
// @Router /api/v1/admin/personas/{id} [put] // @Router /api/v1/admin/personas/{id} [put]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.LmsPersona}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -185,7 +185,7 @@ func (h *Handler) UpdatePersona(c *fiber.Ctx) error {
// @Param id path int true "Persona ID" // @Param id path int true "Persona ID"
// @Router /api/v1/admin/personas/{id} [delete] // @Router /api/v1/admin/personas/{id} [delete]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -42,7 +42,7 @@ func (h *Handler) GetMyLMSProgress(c *fiber.Ctx) error {
// @Description Returns progress for the course → unit → module → lesson learning hierarchy. // @Description Returns progress for the course → unit → module → lesson learning hierarchy.
// @Tags learning // @Tags learning
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ExamPrepProgressSummary}
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/progress-summary [get] // @Router /api/v1/progress-summary [get]
// @Security Bearer // @Security Bearer
@ -115,7 +115,7 @@ func (h *Handler) AdminGetUserLMSLearningActivity(c *fiber.Ctx) error {
// @Param user_id path int true "Target user ID" // @Param user_id path int true "Target user ID"
// @Param limit query int false "Max items after merge (default 40, max 120)" // @Param limit query int false "Max items after merge (default 40, max 120)"
// @Param include_practices query bool false "Include completed LMS practices (more verbose)" // @Param include_practices query bool false "Include completed LMS practices (more verbose)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.UserRecentActivityFeed}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -79,7 +79,7 @@ func mapMobileAppVersionToRes(v domain.MobileAppVersion) mobileAppVersionRes {
// @Produce json // @Produce json
// @Param platform query string true "Platform: ANDROID or IOS" // @Param platform query string true "Platform: ANDROID or IOS"
// @Param version_code query int true "Client build number (Android versionCode / iOS build number)" // @Param version_code query int true "Client build number (Android versionCode / iOS build number)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.MobileAppVersionCheckResult}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/app/version/check [get] // @Router /api/v1/app/version/check [get]
@ -131,7 +131,7 @@ func (h *Handler) CheckMobileAppVersion(c *fiber.Ctx) error {
// @Param status query string false "Filter by ACTIVE or INACTIVE" // @Param status query string false "Filter by ACTIVE or INACTIVE"
// @Param limit query int false "Limit (default 20)" // @Param limit query int false "Limit (default 20)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listMobileAppVersionsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/app-versions [get] // @Router /api/v1/admin/app-versions [get]
@ -196,7 +196,7 @@ func (h *Handler) ListMobileAppVersionsAdmin(c *fiber.Ctx) error {
// @Tags app-versions // @Tags app-versions
// @Produce json // @Produce json
// @Param id path int true "App version ID" // @Param id path int true "App version ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=mobileAppVersionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -241,7 +241,7 @@ func (h *Handler) GetMobileAppVersionByIDAdmin(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createMobileAppVersionReq true "App version payload" // @Param body body createMobileAppVersionReq true "App version payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=mobileAppVersionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/app-versions [post] // @Router /api/v1/admin/app-versions [post]
@ -301,7 +301,7 @@ func (h *Handler) CreateMobileAppVersion(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "App version ID" // @Param id path int true "App version ID"
// @Param body body updateMobileAppVersionReq true "App version payload" // @Param body body updateMobileAppVersionReq true "App version payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=mobileAppVersionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -367,7 +367,7 @@ func (h *Handler) UpdateMobileAppVersion(c *fiber.Ctx) error {
// @Tags app-versions // @Tags app-versions
// @Produce json // @Produce json
// @Param id path int true "App version ID" // @Param id path int true "App version ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -151,7 +151,7 @@ func (w *hijackResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
// @Tags notifications // @Tags notifications
// @Produce json // @Produce json
// @Param id path int true "Notification ID" // @Param id path int true "Notification ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.Notification}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
@ -226,7 +226,7 @@ func (h *Handler) GetNotificationByID(c *fiber.Ctx) error {
// @Router /api/v1/notifications/{id}/read [patch] // @Router /api/v1/notifications/{id}/read [patch]
// @Security Bearer // @Security Bearer
// @Param id path int64 true "Id" // @Param id path int64 true "Id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.Notification}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -272,7 +272,7 @@ func (h *Handler) MarkNotificationAsRead(c *fiber.Ctx) error {
// @Router /api/v1/admin/notifications/mark-all-read [post] // @Router /api/v1/admin/notifications/mark-all-read [post]
// @Router /api/v1/notifications/mark-all-read [post] // @Router /api/v1/notifications/mark-all-read [post]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -315,7 +315,7 @@ func (h *Handler) MarkAllNotificationsAsRead(c *fiber.Ctx) error {
// @Router /api/v1/notifications/{id}/unread [patch] // @Router /api/v1/notifications/{id}/unread [patch]
// @Security Bearer // @Security Bearer
// @Param id path int64 true "Id" // @Param id path int64 true "Id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.Notification}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -361,7 +361,7 @@ func (h *Handler) MarkNotificationAsUnread(c *fiber.Ctx) error {
// @Router /api/v1/admin/notifications/mark-all-unread [post] // @Router /api/v1/admin/notifications/mark-all-unread [post]
// @Router /api/v1/notifications/mark-all-unread [post] // @Router /api/v1/notifications/mark-all-unread [post]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -403,7 +403,7 @@ func (h *Handler) MarkAllNotificationsAsUnread(c *fiber.Ctx) error {
// @Router /api/v1/admin/notifications [delete] // @Router /api/v1/admin/notifications [delete]
// @Router /api/v1/notifications [delete] // @Router /api/v1/notifications [delete]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -445,7 +445,7 @@ func (h *Handler) DeleteUserNotifications(c *fiber.Ctx) error {
// @Tags notifications // @Tags notifications
// @Produce json // @Produce json
// @Param id path int true "Notification ID" // @Param id path int true "Notification ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -509,7 +509,7 @@ func (h *Handler) DeleteInAppNotification(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object true "Notification IDs" example({"ids":[1,2,3]}) // @Param body body object true "Notification IDs" example({"ids":[1,2,3]})
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=DeleteInAppNotificationsData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/delete-in-app [post] // @Router /api/v1/admin/notifications/delete-in-app [post]
@ -756,7 +756,7 @@ func (h *Handler) CreateAndSendNotification(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Param limit query int false "Limit" default(10) // @Param limit query int false "Limit" default(10)
// @Param offset query int false "Offset" default(0) minimum(0) // @Param offset query int false "Offset" default(0) minimum(0)
// @Success 200 {object} domain.Response // @Success 200 {object} GetUserNotificationResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -829,7 +829,7 @@ func (h *Handler) GetUserNotification(c *fiber.Ctx) error {
// @Router /api/v1/admin/notifications/unread [get] // @Router /api/v1/admin/notifications/unread [get]
// @Router /api/v1/notifications/unread [get] // @Router /api/v1/notifications/unread [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} CountUnreadNotificationsResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -876,7 +876,7 @@ func (h *Handler) CountUnreadNotifications(c *fiber.Ctx) error {
// @Param is_read query bool false "Is read" // @Param is_read query bool false "Is read"
// @Param after query string false "After" // @Param after query string false "After"
// @Param before query string false "Before" // @Param before query string false "Before"
// @Success 200 {object} domain.Response // @Success 200 {object} GetAllNotificationsResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -961,9 +961,9 @@ type SendSingleAfroSMSReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param sendSMS body SendSingleAfroSMSReq true "Send SMS request" // @Param sendSMS body SendSingleAfroSMSReq true "Send SMS request"
// @Success 200 {object} response.APIResponse // @Success 200 {object} domain.Response{data=SendSingleAfroSMSReq}
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/sendSMS [post] // @Router /api/v1/admin/sendSMS [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -1036,7 +1036,7 @@ func (h *Handler) SendSingleAfroSMS(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Accept json // @Accept json
// @Param body body handlers.RegisterDeviceToken.Request true "Device token and platform" // @Param body body handlers.RegisterDeviceToken.Request true "Device token and platform"
// @Success 201 {object} domain.Response // @Success 201 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -1118,7 +1118,7 @@ func (h *Handler) RegisterDeviceToken(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object{title=string,message=string} true "Test notification content" // @Param body body object{title=string,message=string} true "Test notification content"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SendTestPushNotificationData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -1224,14 +1224,14 @@ func (h *Handler) SendTestPushNotification(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object{title=string,message=string,image=string,user_ids=[]int64,role=string,scheduled_at=string} true "Bulk push content" // @Param body body object{title=string,message=string,image=string,user_ids=[]int64,role=string,scheduled_at=string} true "Bulk push content"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SendBulkPushNotificationData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/bulk-push [post] // @Router /api/v1/admin/notifications/bulk-push [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Success 201 {object} domain.Response "Scheduled notification created when scheduled_at is provided" // @Success 201 {object} domain.Response{data=domain.ScheduledNotification} "Scheduled notification created when scheduled_at is provided"
func (h *Handler) SendBulkPushNotification(c *fiber.Ctx) error { func (h *Handler) SendBulkPushNotification(c *fiber.Ctx) error {
title := c.FormValue("title") title := c.FormValue("title")
message := c.FormValue("message") message := c.FormValue("message")
@ -1435,14 +1435,14 @@ func (h *Handler) SendBulkPushNotification(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object{message=string,user_ids=[]int64,role=string,phone_numbers=[]string,scheduled_at=string} true "Bulk SMS content" // @Param body body object{message=string,user_ids=[]int64,role=string,phone_numbers=[]string,scheduled_at=string} true "Bulk SMS content"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SendBulkSMSData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/bulk-sms [post] // @Router /api/v1/admin/notifications/bulk-sms [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Success 201 {object} domain.Response "Scheduled notification created when scheduled_at is provided" // @Success 201 {object} domain.Response{data=domain.ScheduledNotification} "Scheduled notification created when scheduled_at is provided"
func (h *Handler) SendBulkSMS(c *fiber.Ctx) error { func (h *Handler) SendBulkSMS(c *fiber.Ctx) error {
type Request struct { type Request struct {
Message string `json:"message" validate:"required"` Message string `json:"message" validate:"required"`
@ -1623,14 +1623,14 @@ func (h *Handler) SendBulkSMS(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object{title=string,message=string,user_ids=[]int64,role=string,team_member_ids=[]int64,team_role=string,scheduled_at=string,type=string,level=string} true "Bulk in-app content" // @Param body body object{title=string,message=string,user_ids=[]int64,role=string,team_member_ids=[]int64,team_role=string,scheduled_at=string,type=string,level=string} true "Bulk in-app content"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SendBulkInAppNotificationData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/bulk-in-app [post] // @Router /api/v1/admin/notifications/bulk-in-app [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
// @Success 201 {object} domain.Response "Scheduled notification created when scheduled_at is provided" // @Success 201 {object} domain.Response{data=domain.ScheduledNotification} "Scheduled notification created when scheduled_at is provided"
func (h *Handler) SendBulkInAppNotification(c *fiber.Ctx) error { func (h *Handler) SendBulkInAppNotification(c *fiber.Ctx) error {
type Request struct { type Request struct {
Title string `json:"title" validate:"required"` Title string `json:"title" validate:"required"`
@ -1799,7 +1799,7 @@ func (h *Handler) SendBulkInAppNotification(c *fiber.Ctx) error {
// @Tags notifications // @Tags notifications
// @Produce json // @Produce json
// @Param id path int true "Scheduled Notification ID" // @Param id path int true "Scheduled Notification ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ScheduledNotification}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/scheduled/{id} [get] // @Router /api/v1/admin/notifications/scheduled/{id} [get]
@ -1842,7 +1842,7 @@ func (h *Handler) GetScheduledNotification(c *fiber.Ctx) error {
// @Param before query string false "Filter before date (RFC3339)" // @Param before query string false "Filter before date (RFC3339)"
// @Param limit query int false "Page size" default(20) // @Param limit query int false "Page size" default(20)
// @Param page query int false "Page number" default(1) // @Param page query int false "Page number" default(1)
// @Success 200 {object} domain.Response // @Success 200 {object} ListScheduledNotificationsResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/scheduled [get] // @Router /api/v1/admin/notifications/scheduled [get]
@ -1914,7 +1914,7 @@ func (h *Handler) ListScheduledNotifications(c *fiber.Ctx) error {
// @Tags notifications // @Tags notifications
// @Produce json // @Produce json
// @Param id path int true "Scheduled Notification ID" // @Param id path int true "Scheduled Notification ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.ScheduledNotification}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/scheduled/{id}/cancel [post] // @Router /api/v1/admin/notifications/scheduled/{id}/cancel [post]
@ -1980,7 +1980,7 @@ func (h *Handler) parseEmailAttachment(c *fiber.Ctx) []*resend.Attachment {
// @Tags notifications // @Tags notifications
// @Accept multipart/form-data // @Accept multipart/form-data
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/send-email [post] // @Router /api/v1/admin/notifications/send-email [post]
@ -2045,7 +2045,7 @@ func (h *Handler) SendSingleEmail(c *fiber.Ctx) error {
// @Tags notifications // @Tags notifications
// @Accept multipart/form-data // @Accept multipart/form-data
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=SendBulkEmailData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/notifications/bulk-email [post] // @Router /api/v1/admin/notifications/bulk-email [post]
@ -2064,7 +2064,7 @@ func (h *Handler) SendSingleEmail(c *fiber.Ctx) error {
// @Param team_member_ids formData string false "Comma-separated team-member IDs" // @Param team_member_ids formData string false "Comma-separated team-member IDs"
// @Param team_role formData string false "Team role used to select recipients" // @Param team_role formData string false "Team role used to select recipients"
// @Param scheduled_at formData string false "Optional future delivery time in RFC3339 format" // @Param scheduled_at formData string false "Optional future delivery time in RFC3339 format"
// @Success 201 {object} domain.Response "Scheduled notification created when scheduled_at is provided" // @Success 201 {object} domain.Response{data=domain.ScheduledNotification} "Scheduled notification created when scheduled_at is provided"
func (h *Handler) SendBulkEmail(c *fiber.Ctx) error { func (h *Handler) SendBulkEmail(c *fiber.Ctx) error {
role := c.FormValue("role") role := c.FormValue("role")
userIDsRaw := c.FormValue("user_ids") userIDsRaw := c.FormValue("user_ids")
@ -2260,7 +2260,7 @@ func (h *Handler) SendBulkEmail(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Accept json // @Accept json
// @Param body body handlers.UnregisterDeviceToken.Request true "Device token to unregister" // @Param body body handlers.UnregisterDeviceToken.Request true "Device token to unregister"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -88,7 +88,7 @@ type listAdminPaymentsRes struct {
// @Param max_amount query number false "Maximum amount" // @Param max_amount query number false "Maximum amount"
// @Param limit query int false "Page size" default(20) // @Param limit query int false "Page size" default(20)
// @Param offset query int false "Page offset" default(0) // @Param offset query int false "Page offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listAdminPaymentsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Router /api/v1/admin/payments [get] // @Router /api/v1/admin/payments [get]
// @Security Bearer // @Security Bearer
@ -134,7 +134,7 @@ func (h *Handler) ListAdminPayments(c *fiber.Ctx) error {
// @Tags payments // @Tags payments
// @Produce json // @Produce json
// @Param id path int true "Payment ID" // @Param id path int true "Payment ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=adminPaymentRes}
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/payments/{id} [get] // @Router /api/v1/admin/payments/{id} [get]
// @Security Bearer // @Security Bearer

View File

@ -236,7 +236,7 @@ func (h *Handler) GetLmsPracticeFull(c *fiber.Ctx) error {
// @Tags learning // @Tags learning
// @Produce json // @Produce json
// @Param id path int true "Exam prep practice ID" // @Param id path int true "Exam prep practice ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=quizFullData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/practices/{id}/full [get] // @Router /api/v1/admin/practices/{id}/full [get]
@ -381,7 +381,7 @@ func (h *Handler) UpdateLmsPracticeFull(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Exam prep practice ID" // @Param id path int true "Exam prep practice ID"
// @Param body body domain.FullUpdatePracticeInput true "Full practice update payload" // @Param body body domain.FullUpdatePracticeInput true "Full practice update payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=quizFullData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/practices/{id}/full [put] // @Router /api/v1/admin/practices/{id}/full [put]

View File

@ -104,7 +104,7 @@ func parseOptionalGroupIDQuery(c *fiber.Ctx) (*int64, error) {
// @Description Valid stimulus and response component kind codes for dynamic question-type definitions // @Description Valid stimulus and response component kind codes for dynamic question-type definitions
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=componentCatalogRes}
// @Router /api/v1/admin/questions/component-catalog [get] // @Router /api/v1/admin/questions/component-catalog [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -126,7 +126,7 @@ func (h *Handler) GetQuestionTypeComponentCatalog(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body validateQuestionTypeDefinitionReq true "Stimulus and response component kinds" // @Param body body validateQuestionTypeDefinitionReq true "Stimulus and response component kinds"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ValidateQuestionTypeDefinitionData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/validate-question-type-definition [post] // @Router /api/v1/admin/questions/validate-question-type-definition [post]
// @Security Bearer // @Security Bearer
@ -161,7 +161,7 @@ func (h *Handler) ValidateQuestionTypeDefinition(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createQuestionTypeDefinitionReq true "Question type definition payload" // @Param body body createQuestionTypeDefinitionReq true "Question type definition payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.QuestionTypeDefinition}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions [post] // @Router /api/v1/admin/questions/type-definitions [post]
@ -229,7 +229,7 @@ func (h *Handler) CreateQuestionTypeDefinition(c *fiber.Ctx) error {
// @Param include_system query bool false "Include system seeded definitions" default(true) // @Param include_system query bool false "Include system seeded definitions" default(true)
// @Param limit query int false "Page size (default 20, max 200)" default(20) // @Param limit query int false "Page size (default 20, max 200)" default(20)
// @Param offset query int false "Page offset" default(0) // @Param offset query int false "Page offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listQuestionTypeDefinitionsData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions [get] // @Router /api/v1/admin/questions/type-definitions [get]
@ -311,7 +311,7 @@ func (h *Handler) ListQuestionTypeDefinitions(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Question type definition id" // @Param id path int true "Question type definition id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.QuestionTypeDefinition}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions/{id} [get] // @Router /api/v1/admin/questions/type-definitions/{id} [get]
@ -349,7 +349,7 @@ func (h *Handler) GetQuestionTypeDefinitionByID(c *fiber.Ctx) error {
// @Param id path int true "Question type definition id" // @Param id path int true "Question type definition id"
// @Param limit query int false "Limit" default(20) // @Param limit query int false "Limit" default(20)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.PracticesByQuestionTypeDefinitionSummary}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions/{id}/practices [get] // @Router /api/v1/admin/questions/type-definitions/{id}/practices [get]
@ -400,7 +400,7 @@ func (h *Handler) ListPracticesByQuestionTypeDefinition(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Question type definition id" // @Param id path int true "Question type definition id"
// @Param body body updateQuestionTypeDefinitionReq true "Update question type definition payload" // @Param body body updateQuestionTypeDefinitionReq true "Update question type definition payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=UpdateQuestionTypeDefinitionData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions/{id} [put] // @Router /api/v1/admin/questions/type-definitions/{id} [put]
@ -477,7 +477,7 @@ func (h *Handler) UpdateQuestionTypeDefinition(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Question type definition id" // @Param id path int true "Question type definition id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=DeleteQuestionTypeDefinitionData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definitions/{id} [delete] // @Router /api/v1/admin/questions/type-definitions/{id} [delete]
@ -517,7 +517,7 @@ func (h *Handler) DeleteQuestionTypeDefinition(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createQuestionTypeDefinitionGroupReq true "Group payload" // @Param body body createQuestionTypeDefinitionGroupReq true "Group payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.QuestionTypeDefinitionGroup}
// @Router /api/v1/admin/questions/type-definition-groups [post] // @Router /api/v1/admin/questions/type-definition-groups [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -569,7 +569,7 @@ func (h *Handler) CreateQuestionTypeDefinitionGroup(c *fiber.Ctx) error {
// @Param status query string false "Filter by status (ACTIVE, INACTIVE)" // @Param status query string false "Filter by status (ACTIVE, INACTIVE)"
// @Param limit query int false "Page size (default 20, max 200)" default(20) // @Param limit query int false "Page size (default 20, max 200)" default(20)
// @Param offset query int false "Page offset" default(0) // @Param offset query int false "Page offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listQuestionTypeDefinitionGroupsData}
// @Router /api/v1/admin/questions/type-definition-groups [get] // @Router /api/v1/admin/questions/type-definition-groups [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -627,7 +627,7 @@ func (h *Handler) ListQuestionTypeDefinitionGroups(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Group id" // @Param id path int true "Group id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.QuestionTypeDefinitionGroupDetail}
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/type-definition-groups/{id} [get] // @Router /api/v1/admin/questions/type-definition-groups/{id} [get]
// @Security Bearer // @Security Bearer
@ -671,7 +671,7 @@ func (h *Handler) GetQuestionTypeDefinitionGroupByID(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Group id" // @Param id path int true "Group id"
// @Param body body updateQuestionTypeDefinitionGroupReq true "Update group payload" // @Param body body updateQuestionTypeDefinitionGroupReq true "Update group payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.QuestionTypeDefinitionGroup}
// @Router /api/v1/admin/questions/type-definition-groups/{id} [put] // @Router /api/v1/admin/questions/type-definition-groups/{id} [put]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -732,7 +732,7 @@ func (h *Handler) UpdateQuestionTypeDefinitionGroup(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Group id" // @Param id path int true "Group id"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=DeleteQuestionTypeDefinitionGroupData}
// @Router /api/v1/admin/questions/type-definition-groups/{id} [delete] // @Router /api/v1/admin/questions/type-definition-groups/{id} [delete]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"

View File

@ -212,7 +212,7 @@ func activityLogQuestionSummary(questionType string, stored string, payload *dom
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createQuestionReq true "Create question payload" // @Param body body createQuestionReq true "Create question payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=questionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions [post] // @Router /api/v1/admin/questions [post]
@ -369,7 +369,7 @@ func (h *Handler) CreateQuestion(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Question ID" // @Param id path int true "Question ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=questionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/{id} [get] // @Router /api/v1/admin/questions/{id} [get]
@ -419,7 +419,7 @@ func (h *Handler) GetQuestionByID(c *fiber.Ctx) error {
// @Param status query string false "Status filter (DRAFT, PUBLISHED, INACTIVE)" // @Param status query string false "Status filter (DRAFT, PUBLISHED, INACTIVE)"
// @Param limit query int false "Limit" default(10) // @Param limit query int false "Limit" default(10)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listQuestionsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions [get] // @Router /api/v1/admin/questions [get]
@ -485,7 +485,7 @@ func (h *Handler) ListQuestions(c *fiber.Ctx) error {
// @Param q query string true "Search query" // @Param q query string true "Search query"
// @Param limit query int false "Limit" default(10) // @Param limit query int false "Limit" default(10)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listQuestionsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/search [get] // @Router /api/v1/admin/questions/search [get]
@ -561,7 +561,7 @@ type updateQuestionReq struct {
// @Produce json // @Produce json
// @Param id path int true "Question ID" // @Param id path int true "Question ID"
// @Param body body updateQuestionReq true "Update question payload" // @Param body body updateQuestionReq true "Update question payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/{id} [put] // @Router /api/v1/admin/questions/{id} [put]
@ -735,7 +735,7 @@ func (h *Handler) UpdateQuestion(c *fiber.Ctx) error {
// @Tags questions // @Tags questions
// @Produce json // @Produce json
// @Param id path int true "Question ID" // @Param id path int true "Question ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/questions/{id} [delete] // @Router /api/v1/admin/questions/{id} [delete]
@ -858,7 +858,7 @@ func (h *Handler) enforcePracticeSequenceForStudent(c *fiber.Ctx, set domain.Que
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createQuestionSetReq true "Create question set payload" // @Param body body createQuestionSetReq true "Create question set payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=questionSetRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets [post] // @Router /api/v1/admin/question-sets [post]
@ -930,7 +930,7 @@ func (h *Handler) CreateQuestionSet(c *fiber.Ctx) error {
// @Tags question-sets // @Tags question-sets
// @Produce json // @Produce json
// @Param id path int true "Question Set ID" // @Param id path int true "Question Set ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=questionSetRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{id} [get] // @Router /api/v1/admin/question-sets/{id} [get]
@ -998,7 +998,7 @@ func (h *Handler) GetQuestionSetByID(c *fiber.Ctx) error {
// @Param set_type query string true "Set type (PRACTICE, QUIZ, EXAM, SURVEY, CAPSTONE)" // @Param set_type query string true "Set type (PRACTICE, QUIZ, EXAM, SURVEY, CAPSTONE)"
// @Param limit query int false "Limit" default(10) // @Param limit query int false "Limit" default(10)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listQuestionSetsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets [get] // @Router /api/v1/admin/question-sets [get]
@ -1064,7 +1064,7 @@ func (h *Handler) GetQuestionSetsByType(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param owner_type query string true "Owner type (SUB_COURSE, COURSE, CATEGORY, STANDALONE)" // @Param owner_type query string true "Owner type (SUB_COURSE, COURSE, CATEGORY, STANDALONE)"
// @Param owner_id query int true "Owner ID" // @Param owner_id query int true "Owner ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]questionSetRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/by-owner [get] // @Router /api/v1/admin/question-sets/by-owner [get]
@ -1145,7 +1145,7 @@ type updateQuestionSetReq struct {
// @Produce json // @Produce json
// @Param id path int true "Question Set ID" // @Param id path int true "Question Set ID"
// @Param body body updateQuestionSetReq true "Update question set payload" // @Param body body updateQuestionSetReq true "Update question set payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{id} [put] // @Router /api/v1/admin/question-sets/{id} [put]
@ -1231,7 +1231,7 @@ func (h *Handler) UpdateQuestionSet(c *fiber.Ctx) error {
// @Tags question-sets // @Tags question-sets
// @Produce json // @Produce json
// @Param id path int true "Question Set ID" // @Param id path int true "Question Set ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{id} [delete] // @Router /api/v1/admin/question-sets/{id} [delete]
@ -1379,7 +1379,7 @@ func questionSetItemsToRes(
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Param body body addQuestionToSetReq true "Add question to set payload" // @Param body body addQuestionToSetReq true "Add question to set payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=AddQuestionToSetData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/questions [post] // @Router /api/v1/admin/question-sets/{setId}/questions [post]
@ -1453,7 +1453,7 @@ func (h *Handler) AddQuestionToSet(c *fiber.Ctx) error {
// @Tags question-set-items // @Tags question-set-items
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.QuestionSetQuestionTypesSummary}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -1676,7 +1676,7 @@ func (h *Handler) GetQuestionsInSet(c *fiber.Ctx) error {
// @Param question_type query string false "Question type filter (e.g. AUDIO)" // @Param question_type query string false "Question type filter (e.g. AUDIO)"
// @Param limit query int false "Limit" default(10) // @Param limit query int false "Limit" default(10)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=paginatedQuestionSetItemsRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -1787,7 +1787,7 @@ func (h *Handler) GetQuestionsByPractice(c *fiber.Ctx) error {
// @Tags progression // @Tags progression
// @Produce json // @Produce json
// @Param id path int true "Practice Question Set ID" // @Param id path int true "Practice Question Set ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
@ -1957,7 +1957,7 @@ func (h *Handler) CompletePractice(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Param questionId path int true "Question ID" // @Param questionId path int true "Question ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/questions/{questionId} [delete] // @Router /api/v1/admin/question-sets/{setId}/questions/{questionId} [delete]
@ -2020,7 +2020,7 @@ type updateQuestionOrderReq struct {
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Param questionId path int true "Question ID" // @Param questionId path int true "Question ID"
// @Param body body updateQuestionOrderReq true "Update order payload" // @Param body body updateQuestionOrderReq true "Update order payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/questions/{questionId}/order [put] // @Router /api/v1/admin/question-sets/{setId}/questions/{questionId}/order [put]
@ -2107,7 +2107,7 @@ type addUserPersonaReq struct {
// @Tags question-sets // @Tags question-sets
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]userPersonaRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/personas [get] // @Router /api/v1/admin/question-sets/{setId}/personas [get]
@ -2159,7 +2159,7 @@ func (h *Handler) GetUserPersonasByQuestionSet(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Param body body addUserPersonaReq true "Add user persona payload" // @Param body body addUserPersonaReq true "Add user persona payload"
// @Success 201 {object} domain.Response // @Success 201 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/personas [post] // @Router /api/v1/admin/question-sets/{setId}/personas [post]
@ -2215,7 +2215,7 @@ func (h *Handler) AddUserPersonaToQuestionSet(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param setId path int true "Question Set ID" // @Param setId path int true "Question Set ID"
// @Param userId path int true "User ID" // @Param userId path int true "User ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/question-sets/{setId}/personas/{userId} [delete] // @Router /api/v1/admin/question-sets/{setId}/personas/{userId} [delete]

View File

@ -59,7 +59,7 @@ func isValidTargetType(t string) bool {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body submitRatingReq true "Submit rating payload" // @Param body body submitRatingReq true "Submit rating payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=ratingRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/ratings [post] // @Router /api/v1/ratings [post]
@ -112,7 +112,7 @@ func (h *Handler) SubmitRating(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param target_type query string true "Target type (app, course, sub_course)" // @Param target_type query string true "Target type (app, course, sub_course)"
// @Param target_id query int true "Target ID (0 for app)" // @Param target_id query int true "Target ID (0 for app)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ratingRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -165,7 +165,7 @@ func (h *Handler) GetMyRating(c *fiber.Ctx) error {
// @Param target_id query int true "Target ID (0 for app)" // @Param target_id query int true "Target ID (0 for app)"
// @Param limit query int false "Limit (default 20)" // @Param limit query int false "Limit (default 20)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]ratingRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/ratings [get] // @Router /api/v1/admin/ratings [get]
@ -235,7 +235,7 @@ func (h *Handler) GetRatingsByTarget(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param target_type query string true "Target type (app, course, sub_course)" // @Param target_type query string true "Target type (app, course, sub_course)"
// @Param target_id query int true "Target ID (0 for app)" // @Param target_id query int true "Target ID (0 for app)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ratingSummaryRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/ratings/summary [get] // @Router /api/v1/admin/ratings/summary [get]
@ -285,7 +285,7 @@ func (h *Handler) GetRatingSummary(c *fiber.Ctx) error {
// @Description Returns all ratings submitted by the current user // @Description Returns all ratings submitted by the current user
// @Tags ratings // @Tags ratings
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]ratingRes}
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/ratings/me/all [get] // @Router /api/v1/ratings/me/all [get]
// @Security Bearer // @Security Bearer
@ -319,7 +319,7 @@ func (h *Handler) GetMyRatings(c *fiber.Ctx) error {
// @Tags ratings // @Tags ratings
// @Produce json // @Produce json
// @Param id path int true "Rating ID" // @Param id path int true "Rating ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/ratings/{id} [delete] // @Router /api/v1/admin/ratings/{id} [delete]

View File

@ -22,7 +22,7 @@ import (
// @Param is_system query bool false "Filter by system role (true/false)" // @Param is_system query bool false "Filter by system role (true/false)"
// @Param page query int false "Page number (default: 1)" // @Param page query int false "Page number (default: 1)"
// @Param page_size query int false "Page size (default: 20)" // @Param page_size query int false "Page size (default: 20)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=ListRolesData}
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/rbac/roles [get] // @Router /api/v1/admin/rbac/roles [get]
// @Security Bearer // @Security Bearer
@ -210,7 +210,7 @@ func (h *Handler) CreateRole(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Role ID" // @Param id path int true "Role ID"
// @Param body body domain.UpdateRoleReq true "Role update payload" // @Param body body domain.UpdateRoleReq true "Role update payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/rbac/roles/{id} [put] // @Router /api/v1/admin/rbac/roles/{id} [put]
@ -289,7 +289,7 @@ func (h *Handler) UpdateRole(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Role ID" // @Param id path int true "Role ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/rbac/roles/{id} [delete] // @Router /api/v1/admin/rbac/roles/{id} [delete]
@ -345,7 +345,7 @@ func (h *Handler) DeleteRole(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Role ID" // @Param id path int true "Role ID"
// @Param body body domain.SetRolePermissionsReq true "Permission IDs payload" // @Param body body domain.SetRolePermissionsReq true "Permission IDs payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/rbac/roles/{id}/permissions [put] // @Router /api/v1/admin/rbac/roles/{id}/permissions [put]
@ -541,7 +541,7 @@ func (h *Handler) ListPermissionGroups(c *fiber.Ctx) error {
// @Tags rbac // @Tags rbac
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/rbac/permissions/sync [post] // @Router /api/v1/admin/rbac/permissions/sync [post]
// @Security Bearer // @Security Bearer

View File

@ -117,7 +117,7 @@ func (h *Handler) GetMyReferrals(c *fiber.Ctx) error {
// @Description Attributes the authenticated learner to one referrer. Apply within seven days of account creation and before any successful positive payment. Codes are case-insensitive and surrounding whitespace is ignored. Self referral, reassignment, inactive referrers, and invalid codes are rejected. // @Description Attributes the authenticated learner to one referrer. Apply within seven days of account creation and before any successful positive payment. Codes are case-insensitive and surrounding whitespace is ignored. Self referral, reassignment, inactive referrers, and invalid codes are rejected.
// @Accept json // @Accept json
// @Param body body applyReferralReq true "Referral share code" // @Param body body applyReferralReq true "Referral share code"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -0,0 +1,288 @@
package handlers
import (
domain "Rezina-Backend/internal/domain"
time "time"
)
// MessageResponse is returned by operations with no data payload. Metadata is
// reserved and currently null; data is omitted by the runtime JSON encoder.
type MessageResponse struct {
Message string `json:"message"`
Success bool `json:"success"`
StatusCode int `json:"status_code"`
// Always null for message-only domain responses.
Metadata *NullResponseValue `json:"metadata" extensions:"x-nullable"`
}
// NullResponseValue represents a reserved null field (never a populated object).
// @Description Reserved metadata value. Always null; no object properties are returned.
type NullResponseValue struct{}
// MessageAPIResponse is the alternate envelope used by legacy account operations.
type MessageAPIResponse struct {
Status string `json:"status" enums:"success,error"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
}
// Endpoint-specific payloads mirror the JSON fields returned by handlers.
type DeleteEmailTemplateData struct {
Id int64 `json:"id"`
}
type RawQuestionSetResponse struct {
BannerImage *string `json:"BannerImage"`
CreatedAt time.Time `json:"CreatedAt"`
Description *string `json:"Description"`
ID int64 `json:"ID"`
IntroVideoURL *string `json:"IntroVideoURL"`
OwnerID *int64 `json:"OwnerID"`
OwnerType *string `json:"OwnerType"`
PassingScore *int32 `json:"PassingScore"`
Persona *string `json:"Persona"`
SetType string `json:"SetType"`
ShuffleQuestions bool `json:"ShuffleQuestions"`
Status string `json:"Status"`
TimeLimitMinutes *int32 `json:"TimeLimitMinutes"`
Title string `json:"Title"`
UpdatedAt *time.Time `json:"UpdatedAt"`
UserPersonas []domain.UserPersona `json:"UserPersonas"`
}
type ListExamPrepAssessmentsData struct {
Assessments []RawQuestionSetResponse `json:"assessments"`
}
type LinkExamPrepAssessmentData struct {
Assessment RawQuestionSetResponse `json:"assessment"`
ParentId int64 `json:"parent_id"`
ParentKind string `json:"parent_kind"`
}
type ListAllExamPrepPracticesData struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
Practices []domain.ExamPrepPractice `json:"practices"`
TotalCount int64 `json:"total_count"`
}
type ListExamPrepPracticesByLessonData struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
Practices []domain.ExamPrepPractice `json:"practices"`
TotalCount int64 `json:"total_count"`
}
type ListExamPrepPracticesByCatalogCourseData struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
Practices []domain.ExamPrepPractice `json:"practices"`
TotalCount int64 `json:"total_count"`
}
type ListExamPrepPracticesByUnitData struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
Practices []domain.ExamPrepPractice `json:"practices"`
TotalCount int64 `json:"total_count"`
}
type DeleteFAQData struct {
Id int64 `json:"id"`
}
type ListFieldKeysData struct {
Fields []string `json:"fields"`
}
type GetFileURLData struct {
Url string `json:"url"`
}
type RefreshFileURLData struct {
ExpiresIn int `json:"expires_in"`
ObjectKey string `json:"object_key"`
Url string `json:"url"`
}
type UploadAudioData struct {
ContentType string `json:"content_type"`
ObjectKey string `json:"object_key"`
Url string `json:"url"`
}
type SubmitAudioAnswerData struct {
AudioUrl string `json:"audio_url"`
CreatedAt time.Time `json:"created_at"`
Id int64 `json:"id"`
QuestionId int64 `json:"question_id"`
QuestionSetId int64 `json:"question_set_id"`
}
type DeleteInAppNotificationsData struct {
DeletedCount int64 `json:"deleted_count"`
RequestedIds int `json:"requested_ids"`
}
type GetUserNotificationResponse struct {
Limit int `json:"limit"`
Notifications []domain.Notification `json:"notifications"`
Offset int `json:"offset"`
TotalCount int64 `json:"total_count"`
}
type CountUnreadNotificationsResponse struct {
Unread int64 `json:"unread"`
}
type GetAllNotificationsResponse struct {
Limit int `json:"limit"`
Notifications []domain.Notification `json:"notifications"`
Page int `json:"page"`
TotalCount int64 `json:"total_count"`
}
type SendTestPushNotificationData struct {
DevicesCount int `json:"devices_count"`
Image string `json:"image"`
Message string `json:"message"`
Title string `json:"title"`
}
type SendBulkPushNotificationData struct {
DevicesTargeted int `json:"devices_targeted"`
Failed int `json:"failed"`
Image string `json:"image"`
Sent int `json:"sent"`
TargetUsers int `json:"target_users"`
}
type SendBulkSMSData struct {
Failed int `json:"failed"`
Sent int `json:"sent"`
TotalRecipients int `json:"total_recipients"`
}
type SendBulkInAppNotificationData struct {
Failed int `json:"failed"`
Sent int `json:"sent"`
TeamMemberRecipients int `json:"team_member_recipients"`
TotalRecipients int `json:"total_recipients"`
UserRecipients int `json:"user_recipients"`
}
type ListScheduledNotificationsResponse struct {
Limit int `json:"limit"`
Page int `json:"page"`
ScheduledNotifications []domain.ScheduledNotification `json:"scheduled_notifications"`
TotalCount int64 `json:"total_count"`
}
type SendBulkEmailData struct {
Failed int `json:"failed"`
Sent int `json:"sent"`
TeamMemberRecipients int `json:"team_member_recipients"`
TotalRecipients int `json:"total_recipients"`
UserRecipients int `json:"user_recipients"`
}
type ValidateQuestionTypeDefinitionData struct {
Valid bool `json:"valid"`
}
type UpdateQuestionTypeDefinitionData struct {
Id int64 `json:"id"`
}
type DeleteQuestionTypeDefinitionData struct {
Id int64 `json:"id"`
}
type DeleteQuestionTypeDefinitionGroupData struct {
Id int64 `json:"id"`
}
type AddQuestionToSetData struct {
AssociatedQuestionId *int64 `json:"associated_question_id"`
DisplayOrder int32 `json:"display_order"`
Id int64 `json:"id"`
QuestionId int64 `json:"question_id"`
SetId int64 `json:"set_id"`
}
type ListRolesData struct {
Page int64 `json:"page"`
PageSize int64 `json:"page_size"`
Roles []domain.RoleRecord `json:"roles"`
Total int64 `json:"total"`
}
type CheckSubscriptionStatusData struct {
HasActiveSubscription bool `json:"has_active_subscription"`
}
type documentAdminGetSampleVideoData struct {
Iframe string `json:"iframe"`
Video VimeoVideoResponse `json:"video"`
}
type RevokeTeamInvitationData struct {
Id int64 `json:"id"`
}
type CheckProfileCompletedData struct {
IsProfileCompleted bool `json:"is_profile_completed"`
ProfileCompletionPercentage int `json:"profile_completion_percentage"`
}
type CheckUserPendingData struct {
IsPending bool `json:"is_pending"`
}
type GetAllUsersData struct {
Total int64 `json:"total"`
Users []domain.UserProfileResponse `json:"users"`
}
type ListAccountDeletionRequestsData struct {
Items []domain.AccountDeletionRequest `json:"items"`
Page int64 `json:"page"`
PageSize int64 `json:"page_size"`
Total int64 `json:"total"`
}
type DeleteMyUserAccountData struct {
CanCancelUntilAt time.Time `json:"can_cancel_until_at"`
GracePeriodDays int `json:"grace_period_days"`
ScheduledPurgeAt time.Time `json:"scheduled_purge_at"`
}
type PurgeDueDeletedUsersData struct {
BatchLimit int32 `json:"batch_limit"`
DeletedCount int64 `json:"deleted_count"`
}
type UploadProfilePictureData struct {
ProfilePictureUrl string `json:"profile_picture_url"`
}
type GetSampleVideoData struct {
Iframe string `json:"iframe"`
Video VimeoVideoResponse `json:"video"`
}
// VimeoUploadResultData preserves the raw service result's existing JSON names.
type VimeoUploadResultData struct {
VimeoID string `json:"VimeoID"`
URI string `json:"URI"`
Link string `json:"Link"`
UploadLink string `json:"UploadLink"`
Status string `json:"Status"`
}
type VimeoTranscodeStatusData struct {
VideoID string `json:"video_id"`
Status string `json:"status"`
}

View File

@ -0,0 +1,49 @@
package handlers
import (
"encoding/json"
"reflect"
"testing"
"Rezina-Backend/internal/domain"
vimeoservice "Rezina-Backend/internal/services/vimeo"
"Rezina-Backend/internal/web_server/response"
)
func responseJSONFields(t *testing.T, value any) map[string]any {
t.Helper()
raw, err := json.Marshal(value)
if err != nil {
t.Fatal(err)
}
var fields map[string]any
if err = json.Unmarshal(raw, &fields); err != nil {
t.Fatal(err)
}
return fields
}
// Documentation-only payloads must preserve existing wire names, including the
// PascalCase fields returned by raw service/domain structs. This prevents a
// documentation improvement from silently advertising a new JSON API contract.
func TestResponseDocumentationMatchesRuntimeJSONFields(t *testing.T) {
for _, tc := range []struct {
name string
runtime, documented any
}{
{"message domain envelope", domain.Response{}, MessageResponse{}},
{"message legacy envelope", response.APIResponse{}, MessageAPIResponse{}},
{"raw assessment question set", domain.QuestionSet{}, RawQuestionSetResponse{}},
{"raw Vimeo upload result", vimeoservice.UploadResult{}, VimeoUploadResultData{}},
{"notification count", map[string]int{"unread": 0}, CountUnreadNotificationsResponse{}},
{"video status", map[string]string{"video_id": "", "status": ""}, VimeoTranscodeStatusData{}},
} {
t.Run(tc.name, func(t *testing.T) {
runtime := responseJSONFields(t, tc.runtime)
documented := responseJSONFields(t, tc.documented)
if !reflect.DeepEqual(runtime, documented) {
t.Fatalf("runtime JSON=%v; documented JSON=%v", runtime, documented)
}
})
}
}

View File

@ -17,7 +17,7 @@ import (
// @Tags settings // @Tags settings
// @Router /api/v1/admin/settings [get] // @Router /api/v1/admin/settings [get]
// @Security Bearer // @Security Bearer
// @Success 200 {object} domain.Response // @Success 200 {object} response.APIResponse{data=domain.SettingListRes}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -46,7 +46,7 @@ func (h *Handler) GetGlobalSettingList(c *fiber.Ctx) error {
// @Router /api/v1/admin/settings/{key} [get] // @Router /api/v1/admin/settings/{key} [get]
// @Security Bearer // @Security Bearer
// @Param key path string true "Key" // @Param key path string true "Key"
// @Success 200 {object} domain.Response // @Success 200 {object} response.APIResponse{data=domain.SettingRes}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -85,7 +85,7 @@ func (h *Handler) GetGlobalSettingByKey(c *fiber.Ctx) error {
// @Security Bearer // @Security Bearer
// @Accept json // @Accept json
// @Param body body domain.SaveSettingListReq true "Request payload" // @Param body body domain.SaveSettingListReq true "Request payload"
// @Success 200 {object} domain.Response // @Success 200 {object} response.APIResponse{data=domain.SettingListRes}
// @Produce json // @Produce json
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"

View File

@ -31,7 +31,7 @@ type requestCheckoutLinkRes struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body requestCheckoutLinkReq false "Optional plan or category for deep link" // @Param body body requestCheckoutLinkReq false "Optional plan or category for deep link"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=requestCheckoutLinkRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 409 {object} domain.ErrorResponse // @Failure 409 {object} domain.ErrorResponse
// @Failure 429 {object} domain.ErrorResponse // @Failure 429 {object} domain.ErrorResponse

View File

@ -117,7 +117,7 @@ type autoRenewReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body createPlanReq true "Create plan payload" // @Param body body createPlanReq true "Create plan payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=planRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/subscription-plans [post] // @Router /api/v1/admin/subscription-plans [post]
@ -207,7 +207,7 @@ func (h *Handler) CreateSubscriptionPlan(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param active_only query bool false "Customer requests always return active plans; false is honored only by the admin endpoint" default(true) // @Param active_only query bool false "Customer requests always return active plans; false is honored only by the admin endpoint" default(true)
// @Param category query string false "Filter by plan category (EDUCATION)" // @Param category query string false "Filter by plan category (EDUCATION)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]planRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/subscription-plans [get] // @Router /api/v1/subscription-plans [get]
@ -254,7 +254,7 @@ func (h *Handler) ListSubscriptionPlans(c *fiber.Ctx) error {
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Param id path int true "Plan ID" // @Param id path int true "Plan ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=planRes}
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/subscription-plans/{id} [get] // @Router /api/v1/subscription-plans/{id} [get]
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
@ -291,7 +291,7 @@ func (h *Handler) GetSubscriptionPlan(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Plan ID" // @Param id path int true "Plan ID"
// @Param body body updatePlanReq true "Update plan payload" // @Param body body updatePlanReq true "Update plan payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/subscription-plans/{id} [put] // @Router /api/v1/admin/subscription-plans/{id} [put]
@ -398,7 +398,7 @@ func (h *Handler) UpdateSubscriptionPlan(c *fiber.Ctx) error {
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Param id path int true "Plan ID" // @Param id path int true "Plan ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/subscription-plans/{id} [delete] // @Router /api/v1/admin/subscription-plans/{id} [delete]
// @Security Bearer // @Security Bearer
@ -458,7 +458,7 @@ func (h *Handler) DeleteSubscriptionPlan(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body subscribeReq true "Subscribe payload" // @Param body body subscribeReq true "Subscribe payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=subscriptionRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @deprecated Use POST /api/v1/payments/subscribe for user subscriptions with payment // @deprecated Use POST /api/v1/payments/subscribe for user subscriptions with payment
@ -529,7 +529,7 @@ func (h *Handler) Subscribe(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body subscribeWithPaymentReq true "Subscribe with payment payload" // @Param body body subscribeWithPaymentReq true "Subscribe with payment payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=subscriptionCheckoutRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 409 {object} domain.ErrorResponse "User already has active subscription" // @Failure 409 {object} domain.ErrorResponse "User already has active subscription"
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -644,7 +644,7 @@ func (h *Handler) SubscribeWithPayment(c *fiber.Ctx) error {
// @Description Returns all active subscriptions for the authenticated user (one per plan category) // @Description Returns all active subscriptions for the authenticated user (one per plan category)
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]subscriptionRes}
// @Router /api/v1/subscriptions/me [get] // @Router /api/v1/subscriptions/me [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -684,7 +684,7 @@ func (h *Handler) GetMySubscription(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param limit query int false "Limit" default(20) // @Param limit query int false "Limit" default(20)
// @Param offset query int false "Offset" default(0) // @Param offset query int false "Offset" default(0)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]subscriptionRes}
// @Router /api/v1/subscriptions/history [get] // @Router /api/v1/subscriptions/history [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -725,7 +725,7 @@ func (h *Handler) GetMySubscriptionHistory(c *fiber.Ctx) error {
// @Description Returns whether the authenticated user has an active subscription // @Description Returns whether the authenticated user has an active subscription
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=CheckSubscriptionStatusData}
// @Router /api/v1/subscriptions/status [get] // @Router /api/v1/subscriptions/status [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -761,7 +761,7 @@ func (h *Handler) CheckSubscriptionStatus(c *fiber.Ctx) error {
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Param id path int true "Subscription ID" // @Param id path int true "Subscription ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/subscriptions/{id}/cancel [post] // @Router /api/v1/subscriptions/{id}/cancel [post]
// @Security Bearer // @Security Bearer
@ -819,7 +819,7 @@ func (h *Handler) CancelSubscription(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Subscription ID" // @Param id path int true "Subscription ID"
// @Param body body autoRenewReq true "Auto-renew payload" // @Param body body autoRenewReq true "Auto-renew payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/subscriptions/{id}/auto-renew [put] // @Router /api/v1/subscriptions/{id}/auto-renew [put]
// @Security Bearer // @Security Bearer

View File

@ -10,7 +10,7 @@ package handlers
// @Produce json // @Produce json
// @Param active_only query bool false "Return only active plans (default true)" // @Param active_only query bool false "Return only active plans (default true)"
// @Param category query string false "Filter by plan category (EDUCATION)" // @Param category query string false "Filter by plan category (EDUCATION)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=[]planRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -25,7 +25,7 @@ func documentAdminListSubscriptionPlans() {}
// @Tags subscriptions // @Tags subscriptions
// @Produce json // @Produce json
// @Param id path int true "Plan ID" // @Param id path int true "Plan ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=planRes}
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -42,7 +42,7 @@ func documentAdminGetSubscriptionPlan() {}
// @Param video_id query string false "Vimeo Video ID to use as sample" default(76979871) // @Param video_id query string false "Vimeo Video ID to use as sample" default(76979871)
// @Param width query int false "Player width" default(640) // @Param width query int false "Player width" default(640)
// @Param height query int false "Player height" default(360) // @Param height query int false "Player height" default(360)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=documentAdminGetSampleVideoData}
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -59,7 +59,7 @@ func documentAdminGetSampleVideo() {}
// @Param url query string true "Vimeo video URL" // @Param url query string true "Vimeo video URL"
// @Param width query int false "Desired width" // @Param width query int false "Desired width"
// @Param height query int false "Desired height" // @Param height query int false "Desired height"
// @Success 200 {object} vimeo.OEmbedResponse // @Success 200 {object} domain.Response{data=vimeo.OEmbedResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"

View File

@ -0,0 +1,30 @@
package handlers
// Documentation-only declarations for the anonymous service discovery handlers
// registered in routes.go. These functions are not runtime handlers.
type serviceInfoResponse struct {
Message string `json:"message" example:"Welcome to Rezina Backend API"`
Version string `json:"version" example:"1.0.1"`
}
type apiIndexResponse struct {
AdminAPI string `json:"admin_api" example:"/api/v1/admin"`
ClientAPI string `json:"client_api" example:"/api/v1"`
}
// documentServiceInfo godoc
// @Summary Service welcome and version
// @Tags discovery
// @Produce json
// @Success 200 {object} serviceInfoResponse
// @Router / [get]
func documentServiceInfo() {}
// documentAPIIndex godoc
// @Summary Discover the admin and customer API roots
// @Tags discovery
// @Produce json
// @Success 200 {object} apiIndexResponse
// @Router /api/v1/ [get]
func documentAPIIndex() {}

View File

@ -500,7 +500,7 @@ func (h *Handler) GetAllTeamMembers(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Team Member ID" // @Param id path int true "Team Member ID"
// @Param body body domain.UpdateTeamMemberReq true "Team member update payload" // @Param body body domain.UpdateTeamMemberReq true "Team member update payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
@ -590,7 +590,7 @@ func (h *Handler) UpdateTeamMember(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Team Member ID" // @Param id path int true "Team Member ID"
// @Param body body domain.UpdateTeamMemberStatusReq true "Status update payload" // @Param body body domain.UpdateTeamMemberStatusReq true "Status update payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
@ -691,7 +691,7 @@ func (h *Handler) UpdateTeamMemberStatus(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "Team Member ID" // @Param id path int true "Team Member ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 403 {object} domain.ErrorResponse // @Failure 403 {object} domain.ErrorResponse
@ -789,7 +789,7 @@ func (h *Handler) GetTeamMemberStats(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Param id path int true "Team Member ID" // @Param id path int true "Team Member ID"
// @Param body body changePasswordReq true "Password change payload" // @Param body body changePasswordReq true "Password change payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse

View File

@ -56,7 +56,7 @@ func mapTeamInvitationListItem(row domain.TeamInvitationWithMember) teamInvitati
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.InviteTeamMemberReq true "Invite payload" // @Param body body domain.InviteTeamMemberReq true "Invite payload"
// @Success 201 {object} domain.Response // @Success 201 {object} domain.Response{data=domain.InviteTeamMemberRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/team/members/invite [post] // @Router /api/v1/admin/team/members/invite [post]
@ -115,7 +115,7 @@ func (h *Handler) InviteTeamMember(c *fiber.Ctx) error {
// @Tags team // @Tags team
// @Produce json // @Produce json
// @Param id path int true "Team member ID" // @Param id path int true "Team member ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.InviteTeamMemberRes}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Router /api/v1/admin/team/members/{id}/resend-invite [post] // @Router /api/v1/admin/team/members/{id}/resend-invite [post]
@ -163,7 +163,7 @@ func (h *Handler) ResendTeamInvitation(c *fiber.Ctx) error {
// @Param status query string false "pending, accepted, expired, or revoked" // @Param status query string false "pending, accepted, expired, or revoked"
// @Param limit query int false "Limit (default 20)" // @Param limit query int false "Limit (default 20)"
// @Param offset query int false "Offset (default 0)" // @Param offset query int false "Offset (default 0)"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=listTeamInvitationsRes}
// @Router /api/v1/admin/team/invitations [get] // @Router /api/v1/admin/team/invitations [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -208,7 +208,7 @@ func (h *Handler) ListTeamInvitations(c *fiber.Ctx) error {
// @Tags team // @Tags team
// @Produce json // @Produce json
// @Param id path int true "Invitation ID" // @Param id path int true "Invitation ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=RevokeTeamInvitationData}
// @Router /api/v1/admin/team/invitations/{id}/revoke [post] // @Router /api/v1/admin/team/invitations/{id}/revoke [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -242,7 +242,7 @@ func (h *Handler) RevokeTeamInvitation(c *fiber.Ctx) error {
// @Tags team // @Tags team
// @Produce json // @Produce json
// @Param token query string true "Invitation token" // @Param token query string true "Invitation token"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.VerifyTeamInvitationRes}
// @Router /api/v1/admin/team/invitations/verify [get] // @Router /api/v1/admin/team/invitations/verify [get]
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
// @Failure 500 {object} domain.ErrorResponse "Internal server error" // @Failure 500 {object} domain.ErrorResponse "Internal server error"
@ -276,7 +276,7 @@ func (h *Handler) VerifyTeamInvitation(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.AcceptTeamInvitationReq true "Accept invitation payload" // @Param body body domain.AcceptTeamInvitationReq true "Accept invitation payload"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.TeamMemberResponse}
// @Router /api/v1/admin/team/invitations/accept [post] // @Router /api/v1/admin/team/invitations/accept [post]
// @Failure 400 {object} domain.ErrorResponse "Invalid request" // @Failure 400 {object} domain.ErrorResponse "Invalid request"
func (h *Handler) AcceptTeamInvitation(c *fiber.Ctx) error { func (h *Handler) AcceptTeamInvitation(c *fiber.Ctx) error {

View File

@ -15,7 +15,7 @@ import (
// @Produce json // @Produce json
// @Param email query string true "Team member email" // @Param email query string true "Team member email"
// @Param otp query string true "Reset OTP from the email link" // @Param otp query string true "Reset OTP from the email link"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=domain.TeamVerifyPasswordResetRes}
// @Router /api/v1/admin/team/verifyResetCode [get] // @Router /api/v1/admin/team/verifyResetCode [get]
func (h *Handler) VerifyTeamPasswordReset(c *fiber.Ctx) error { func (h *Handler) VerifyTeamPasswordReset(c *fiber.Ctx) error {
email := c.Query("email") email := c.Query("email")
@ -35,7 +35,7 @@ func (h *Handler) VerifyTeamPasswordReset(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.TeamSendPasswordResetReq true "Email" // @Param body body domain.TeamSendPasswordResetReq true "Email"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -72,7 +72,7 @@ func (h *Handler) SendTeamPasswordReset(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.TeamResetPasswordReq true "Reset payload" // @Param body body domain.TeamResetPasswordReq true "Reset payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse

View File

@ -59,7 +59,7 @@ func (h *Handler) GetUserSummary(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param user_id path int true "User ID" // @Param user_id path int true "User ID"
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=CheckProfileCompletedData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -115,7 +115,7 @@ func (h *Handler) CheckProfileCompleted(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.UpdateUserReq true "Update user payload" // @Param body body domain.UpdateUserReq true "Update user payload"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -196,7 +196,7 @@ func (h *Handler) UpdateUser(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param knowledge_level body domain.UpdateKnowledgeLevelReq true "Knowledge level" // @Param knowledge_level body domain.UpdateKnowledgeLevelReq true "Knowledge level"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 401 {object} domain.ErrorResponse // @Failure 401 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
@ -252,9 +252,9 @@ func (h *Handler) UpdateUserKnowledgeLevel(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param resendOtp body domain.ResendOtpReq true "Resend OTP" // @Param resendOtp body domain.ResendOtpReq true "Resend OTP"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/user/resend-otp [post] // @Router /api/v1/user/resend-otp [post]
func (h *Handler) ResendOtp(c *fiber.Ctx) error { func (h *Handler) ResendOtp(c *fiber.Ctx) error {
var req domain.ResendOtpReq var req domain.ResendOtpReq
@ -390,7 +390,7 @@ func (h *Handler) ResendOtp(c *fiber.Ctx) error {
// @Tags user // @Tags user
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=CheckUserPendingData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 404 {object} domain.ErrorResponse // @Failure 404 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
@ -449,9 +449,9 @@ func (h *Handler) CheckUserPending(c *fiber.Ctx) error {
// @Param country query string false "Country filter (case-insensitive match on stored value)" // @Param country query string false "Country filter (case-insensitive match on stored value)"
// @Param region query string false "Region filter (case-insensitive match on stored value)" // @Param region query string false "Region filter (case-insensitive match on stored value)"
// @Param subscription_status query string false "Derived subscription filter: ACTIVE, PENDING, or Unsubscribed (matches response subscription_status semantics)" // @Param subscription_status query string false "Derived subscription filter: ACTIVE, PENDING, or Unsubscribed (matches response subscription_status semantics)"
// @Success 200 {object} response.APIResponse // @Success 200 {object} response.APIResponse{data=GetAllUsersData}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/users [get] // @Router /api/v1/admin/users [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -599,9 +599,9 @@ func (h *Handler) GetAllUsers(c *fiber.Ctx) error {
// @Param scheduled_after query string false "Scheduled after (RFC3339)" // @Param scheduled_after query string false "Scheduled after (RFC3339)"
// @Param page query int false "Page number (default 1)" // @Param page query int false "Page number (default 1)"
// @Param page_size query int false "Page size (default 10, max 100)" // @Param page_size query int false "Page size (default 10, max 100)"
// @Success 200 {object} response.APIResponse // @Success 200 {object} response.APIResponse{data=ListAccountDeletionRequestsData}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/users/deletion-requests [get] // @Router /api/v1/admin/users/deletion-requests [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -686,9 +686,9 @@ func (h *Handler) ListAccountDeletionRequests(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body object true "Status update payload" example({"user_id": 1, "status": "ACTIVE"}) // @Param body body object true "Status update payload" example({"user_id": 1, "status": "ACTIVE"})
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/user/status [patch] // @Router /api/v1/admin/user/status [patch]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -747,9 +747,9 @@ func (h *Handler) UpdateUserStatus(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param verifyOtp body domain.VerifyOtpReq true "Verify OTP" // @Param verifyOtp body domain.VerifyOtpReq true "Verify OTP"
// @Success 200 {object} response.APIResponse // @Success 200 {object} domain.Response{data=loginUserRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/user/verify-otp [post] // @Router /api/v1/user/verify-otp [post]
func (h *Handler) VerifyOtp(c *fiber.Ctx) error { func (h *Handler) VerifyOtp(c *fiber.Ctx) error {
var req domain.VerifyOtpReq var req domain.VerifyOtpReq
@ -933,9 +933,9 @@ type CheckPhoneEmailExistRes struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param checkPhoneEmailExist body CheckPhoneEmailExistReq true "Check phone number or email exist" // @Param checkPhoneEmailExist body CheckPhoneEmailExistReq true "Check phone number or email exist"
// @Success 200 {object} CheckPhoneEmailExistRes // @Success 200 {object} response.APIResponse{data=CheckPhoneEmailExistRes}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/checkPhoneEmailExist [post] // @Router /api/v1/user/checkPhoneEmailExist [post]
func (h *Handler) CheckPhoneEmailExist(c *fiber.Ctx) error { func (h *Handler) CheckPhoneEmailExist(c *fiber.Ctx) error {
// companyID := c.Locals("company_id").(domain.ValidInt64) // companyID := c.Locals("company_id").(domain.ValidInt64)
@ -991,9 +991,9 @@ type RegisterCodeReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param registerCode body RegisterCodeReq true "Send register code" // @Param registerCode body RegisterCodeReq true "Send register code"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/sendRegisterCode [post] // @Router /api/v1/user/sendRegisterCode [post]
func (h *Handler) SendRegisterCode(c *fiber.Ctx) error { func (h *Handler) SendRegisterCode(c *fiber.Ctx) error {
// companyID := c.Locals("company_id").(domain.ValidInt64) // companyID := c.Locals("company_id").(domain.ValidInt64)
@ -1051,9 +1051,9 @@ func (h *Handler) SendRegisterCode(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param registerUser body domain.RegisterUserReq true "Register user" // @Param registerUser body domain.RegisterUserReq true "Register user"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/user/register [post] // @Router /api/v1/user/register [post]
// @Description Registers a learner with email or phone and password. The server assigns the learner role and selects the OTP medium from the contact method. An optional referral_code attributes the new account atomically; invalid or ineligible codes reject registration. // @Description Registers a learner with email or phone and password. The server assigns the learner role and selects the OTP medium from the contact method. An optional referral_code attributes the new account atomically; invalid or ineligible codes reject registration.
func (h *Handler) RegisterUser(c *fiber.Ctx) error { func (h *Handler) RegisterUser(c *fiber.Ctx) error {
@ -1183,9 +1183,9 @@ type ResetCodeReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param resetCode body ResetCodeReq true "Send reset code" // @Param resetCode body ResetCodeReq true "Send reset code"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/sendResetCode [post] // @Router /api/v1/user/sendResetCode [post]
func (h *Handler) SendResetCode(c *fiber.Ctx) error { func (h *Handler) SendResetCode(c *fiber.Ctx) error {
var req ResetCodeReq var req ResetCodeReq
@ -1318,9 +1318,9 @@ type ResetPasswordReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param resetPassword body ResetPasswordReq true "Reset password" // @Param resetPassword body ResetPasswordReq true "Reset password"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/resetPassword [post] // @Router /api/v1/user/resetPassword [post]
func (h *Handler) ResetPassword(c *fiber.Ctx) error { func (h *Handler) ResetPassword(c *fiber.Ctx) error {
var req ResetPasswordReq var req ResetPasswordReq
@ -1389,9 +1389,9 @@ func (h *Handler) ResetTenantPassword(c *fiber.Ctx) error {
// @Tags user // @Tags user
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} domain.UserProfileResponse // @Success 200 {object} response.APIResponse{data=domain.UserProfileResponse}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/user-profile [get] // @Router /api/v1/user/user-profile [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -1513,9 +1513,9 @@ type AdminProfileRes struct {
// @Tags user // @Tags user
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} AdminProfileRes // @Success 200 {object} response.APIResponse{data=domain.UserProfileResponse}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/user/admin-profile [get] // @Router /api/v1/admin/user/admin-profile [get]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -1647,9 +1647,9 @@ type SearchUserByNameOrPhoneReq struct {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param searchUserByNameOrPhone body SearchUserByNameOrPhoneReq true "Search for using his name or phone" // @Param searchUserByNameOrPhone body SearchUserByNameOrPhoneReq true "Search for using his name or phone"
// @Success 200 {object} domain.UserProfileResponse // @Success 200 {object} response.APIResponse{data=[]domain.UserProfileResponse}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/user/search [post] // @Router /api/v1/admin/user/search [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -1785,10 +1785,10 @@ func (h *Handler) SearchUserByNameOrPhone(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "User ID" // @Param id path int true "User ID"
// @Success 200 {object} domain.UserProfileResponse // @Success 200 {object} response.APIResponse{data=domain.UserProfileResponse}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/user/single/{id} [get] // @Router /api/v1/admin/user/single/{id} [get]
// @Security Bearer // @Security Bearer
// @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation" // @Failure 403 {string} string "Account audience, status, permission, or subscription does not allow this operation"
@ -1906,9 +1906,9 @@ func (h *Handler) GetUserByID(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "User ID" // @Param id path int true "User ID"
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/user/delete/{id} [delete] // @Router /api/v1/admin/user/delete/{id} [delete]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -1969,10 +1969,10 @@ const (
// @Description Starts account deletion with grace period before permanent purge // @Description Starts account deletion with grace period before permanent purge
// @Tags user // @Tags user
// @Produce json // @Produce json
// @Success 200 {object} response.APIResponse // @Success 200 {object} response.APIResponse{data=DeleteMyUserAccountData}
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 403 {object} response.APIResponse // @Failure 403 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/me [delete] // @Router /api/v1/user/me [delete]
// @Security Bearer // @Security Bearer
func (h *Handler) DeleteMyUserAccount(c *fiber.Ctx) error { func (h *Handler) DeleteMyUserAccount(c *fiber.Ctx) error {
@ -2022,10 +2022,10 @@ func (h *Handler) DeleteMyUserAccount(c *fiber.Ctx) error {
// @Description Cancels a pending self-deletion request during grace period // @Description Cancels a pending self-deletion request during grace period
// @Tags user // @Tags user
// @Produce json // @Produce json
// @Success 200 {object} response.APIResponse // @Success 200 {object} MessageAPIResponse
// @Failure 401 {object} response.APIResponse // @Failure 401 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 403 {object} response.APIResponse // @Failure 403 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/user/me/deletion/cancel [post] // @Router /api/v1/user/me/deletion/cancel [post]
// @Security Bearer // @Security Bearer
func (h *Handler) CancelMyUserAccountDeletion(c *fiber.Ctx) error { func (h *Handler) CancelMyUserAccountDeletion(c *fiber.Ctx) error {
@ -2070,9 +2070,9 @@ func (h *Handler) CancelMyUserAccountDeletion(c *fiber.Ctx) error {
// @Tags user // @Tags user
// @Produce json // @Produce json
// @Param limit query int false "Max users to purge in one run (default 100, max 1000)" // @Param limit query int false "Max users to purge in one run (default 100, max 1000)"
// @Success 200 {object} response.APIResponse // @Success 200 {object} response.APIResponse{data=PurgeDueDeletedUsersData}
// @Failure 400 {object} response.APIResponse // @Failure 400 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Failure 500 {object} response.APIResponse // @Failure 500 {string} string "Plain-text error returned by the handler or authentication middleware"
// @Router /api/v1/admin/internal/users/purge-due-deletions [post] // @Router /api/v1/admin/internal/users/purge-due-deletions [post]
// @Security Bearer // @Security Bearer
// @Failure 401 {string} string "Missing, invalid, or expired Bearer token" // @Failure 401 {string} string "Missing, invalid, or expired Bearer token"
@ -2123,9 +2123,9 @@ type UpdateUserSuspendRes struct {
// @Produce json // @Produce json
// @Param id path int true "User ID" // @Param id path int true "User ID"
// @Param file formData file true "Image file (jpg|png|webp)" // @Param file formData file true "Image file (jpg|png|webp)"
// @Success 200 {object} response.APIResponse // @Success 200 {object} domain.Response{data=UploadProfilePictureData}
// @Failure 400 {object} response.APIResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} response.APIResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/user/{id}/profile-picture [post] // @Router /api/v1/admin/user/{id}/profile-picture [post]
// @Router /api/v1/user/{id}/profile-picture [post] // @Router /api/v1/user/{id}/profile-picture [post]
// @Security Bearer // @Security Bearer

View File

@ -192,7 +192,7 @@ func (h *Handler) ListVimeoVideos(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param video_id path string true "Vimeo Video ID" // @Param video_id path string true "Vimeo Video ID"
// @Success 200 {object} VimeoVideoResponse // @Success 200 {object} domain.Response{data=VimeoVideoResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/videos/{video_id} [get] // @Router /api/v1/admin/vimeo/videos/{video_id} [get]
@ -239,7 +239,7 @@ func (h *Handler) GetVimeoVideo(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param request body CreatePullUploadRequest true "Pull Upload Request" // @Param request body CreatePullUploadRequest true "Pull Upload Request"
// @Success 201 {object} VimeoUploadResponse // @Success 201 {object} domain.Response{data=VimeoUploadResultData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/uploads/pull [post] // @Router /api/v1/admin/vimeo/uploads/pull [post]
@ -300,7 +300,7 @@ func (h *Handler) CreatePullUpload(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param request body CreateTusUploadRequest true "TUS Upload Request" // @Param request body CreateTusUploadRequest true "TUS Upload Request"
// @Success 201 {object} VimeoUploadResponse // @Success 201 {object} domain.Response{data=VimeoUploadResultData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/uploads/tus [post] // @Router /api/v1/admin/vimeo/uploads/tus [post]
@ -367,7 +367,7 @@ func (h *Handler) CreateTusUpload(c *fiber.Ctx) error {
// @Param loop query bool false "Loop video" // @Param loop query bool false "Loop video"
// @Param muted query bool false "Mute video" // @Param muted query bool false "Mute video"
// @Param background query bool false "Background mode (no controls)" // @Param background query bool false "Background mode (no controls)"
// @Success 200 {object} VimeoEmbedResponse // @Success 200 {object} domain.Response{data=VimeoEmbedResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/videos/{video_id}/embed [get] // @Router /api/v1/admin/vimeo/videos/{video_id}/embed [get]
@ -437,7 +437,7 @@ func (h *Handler) GetEmbedCode(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param video_id path string true "Vimeo Video ID" // @Param video_id path string true "Vimeo Video ID"
// @Success 200 {object} domain.Response // @Success 200 {object} MessageResponse
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/videos/{video_id} [delete] // @Router /api/v1/admin/vimeo/videos/{video_id} [delete]
@ -485,7 +485,7 @@ func (h *Handler) DeleteVimeoVideo(c *fiber.Ctx) error {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param video_id path string true "Vimeo Video ID" // @Param video_id path string true "Vimeo Video ID"
// @Success 200 {object} map[string]string // @Success 200 {object} domain.Response{data=VimeoTranscodeStatusData}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/admin/vimeo/videos/{video_id}/status [get] // @Router /api/v1/admin/vimeo/videos/{video_id}/status [get]
@ -537,7 +537,7 @@ func (h *Handler) GetTranscodeStatus(c *fiber.Ctx) error {
// @Param video_id query string false "Vimeo Video ID to use as sample" default(76979871) // @Param video_id query string false "Vimeo Video ID to use as sample" default(76979871)
// @Param width query int false "Player width" default(640) // @Param width query int false "Player width" default(640)
// @Param height query int false "Player height" default(360) // @Param height query int false "Player height" default(360)
// @Success 200 {object} domain.Response // @Success 200 {object} domain.Response{data=GetSampleVideoData}
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/vimeo/sample [get] // @Router /api/v1/vimeo/sample [get]
// @Failure 503 {object} domain.ErrorResponse "Service unavailable" // @Failure 503 {object} domain.ErrorResponse "Service unavailable"
@ -581,7 +581,7 @@ func (h *Handler) GetSampleVideo(c *fiber.Ctx) error {
// @Param url query string true "Vimeo video URL" // @Param url query string true "Vimeo video URL"
// @Param width query int false "Desired width" // @Param width query int false "Desired width"
// @Param height query int false "Desired height" // @Param height query int false "Desired height"
// @Success 200 {object} vimeo.OEmbedResponse // @Success 200 {object} domain.Response{data=vimeo.OEmbedResponse}
// @Failure 400 {object} domain.ErrorResponse // @Failure 400 {object} domain.ErrorResponse
// @Failure 500 {object} domain.ErrorResponse // @Failure 500 {object} domain.ErrorResponse
// @Router /api/v1/vimeo/oembed [get] // @Router /api/v1/vimeo/oembed [get]

View File

@ -16,8 +16,9 @@ const (
type APIResponse struct { type APIResponse struct {
Status Status `json:"status"` Status Status `json:"status"`
Message string `json:"message"` Message string `json:"message"`
Data interface{} `json:"data,omitempty"` Data interface{} `json:"data,omitempty" swaggerignore:"true"`
Metadata interface{} `json:"metadata,omitempty"` // Optional endpoint-specific metadata; omitted when there is no metadata.
Metadata interface{} `json:"metadata,omitempty" swaggertype:"object"`
Page *int `json:"page,omitempty"` Page *int `json:"page,omitempty"`
Total *int `json:"total,omitempty"` Total *int `json:"total,omitempty"`
Timestamp time.Time `json:"timestamp"` Timestamp time.Time `json:"timestamp"`

View File

@ -102,6 +102,8 @@ func registeredSwaggerContracts(t *testing.T) []swaggerRouteContract {
}) })
} }
result = append(result, swaggerRouteContract{Method: "get", Path: "/payment/success", Handler: "HandleChapaSuccessPage"}) result = append(result, swaggerRouteContract{Method: "get", Path: "/payment/success", Handler: "HandleChapaSuccessPage"})
result = append(result, swaggerRouteContract{Method: "get", Path: "/", Handler: "documentServiceInfo"})
result = append(result, swaggerRouteContract{Method: "get", Path: "/api/v1/", Handler: "documentAPIIndex"})
return result return result
} }

View File

@ -0,0 +1,140 @@
package httpserver
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"testing"
"Rezina-Backend/docs"
)
// Swagger 2 uses allOf to specialize a shared response envelope. Resolve those
// overrides before inspecting data, so an empty base interface cannot hide an
// undocumented response and a typed override is not mistaken for an empty field.
func responseSchemaObject(t *testing.T, spec, schema map[string]any, seen map[string]bool) map[string]any {
t.Helper()
if reference, ok := schema["$ref"].(string); ok {
if seen[reference] {
return map[string]any{"type": "object", "description": "Recursive schema reference"}
}
seen[reference] = true
definitions := spec["definitions"].(map[string]any)
definition, ok := definitions[strings.TrimPrefix(reference, "#/definitions/")].(map[string]any)
if !ok {
t.Fatalf("missing response schema %s", reference)
}
return responseSchemaObject(t, spec, definition, seen)
}
result := map[string]any{}
merge := func(part map[string]any) {
for key, value := range part {
if key == "properties" {
properties, _ := result[key].(map[string]any)
if properties == nil {
properties = map[string]any{}
result[key] = properties
}
for name, property := range value.(map[string]any) {
properties[name] = property
}
} else {
result[key] = value
}
}
}
if parts, ok := schema["allOf"].([]any); ok {
for _, part := range parts {
merge(responseSchemaObject(t, spec, part.(map[string]any), cloneSchemaSeen(seen)))
}
}
merge(schema)
delete(result, "allOf")
return result
}
func cloneSchemaSeen(source map[string]bool) map[string]bool {
result := map[string]bool{}
for k, v := range source {
result[k] = v
}
return result
}
func checkResponseSchemaDetail(t *testing.T, spec, schema map[string]any, path string, seen map[string]bool) {
t.Helper()
schema = responseSchemaObject(t, spec, schema, seen)
kind, _ := schema["type"].(string)
description, _ := schema["description"].(string)
if kind == "" {
// Dynamic question components are intentionally polymorphic. Their allowed
// JSON types and kind-dependent interpretation must be explicit.
if schema["x-json-types"] != nil && description != "" {
return
}
t.Errorf("%s: response field has no type or documented JSON variants", path)
return
}
if kind == "array" {
items, ok := schema["items"].(map[string]any)
if !ok {
t.Errorf("%s: array has no item schema", path)
return
}
checkResponseSchemaDetail(t, spec, items, path+"[]", cloneSchemaSeen(seen))
}
if kind == "object" {
properties, _ := schema["properties"].(map[string]any)
additional, hasAdditional := schema["additionalProperties"]
if len(properties) == 0 && !hasAdditional && description == "" {
t.Errorf("%s: object has no fields or documented extension semantics", path)
}
if values, ok := additional.(map[string]any); ok {
if len(values) == 0 {
if description == "" {
t.Errorf("%s: arbitrary JSON dictionary needs a description", path)
}
} else {
checkResponseSchemaDetail(t, spec, values, path+"{}", cloneSchemaSeen(seen))
}
}
for name, property := range properties {
checkResponseSchemaDetail(t, spec, property.(map[string]any), path+"."+name, cloneSchemaSeen(seen))
}
}
}
func TestEveryAPIResponseHasDetailedSchema(t *testing.T) {
var spec map[string]any
if err := json.Unmarshal([]byte(docs.SwaggerInfo.ReadDoc()), &spec); err != nil {
t.Fatal(err)
}
for path, raw := range spec["paths"].(map[string]any) {
for method, value := range raw.(map[string]any) {
operation := value.(map[string]any)
for code, value := range operation["responses"].(map[string]any) {
status, err := strconv.Atoi(code)
if err != nil {
t.Fatal(err)
}
// Redirects and protocol upgrades are described by status/headers,
// rather than pretending that they return a JSON document.
if status < 200 || (status >= 300 && status < 400) || status == 204 {
continue
}
t.Run(fmt.Sprintf("%s %s %s", method, path, code), func(t *testing.T) {
response := value.(map[string]any)
schema, ok := response["schema"].(map[string]any)
if !ok {
t.Fatal("response is missing its schema")
}
if status < 300 && (schema["$ref"] == "#/definitions/domain.Response" || schema["$ref"] == "#/definitions/response.APIResponse") {
t.Fatal("success uses an unspecialized generic response envelope")
}
checkResponseSchemaDetail(t, spec, schema, "response", map[string]bool{})
})
}
}
}
}