diff --git a/cmd/web/docs/docs.go b/cmd/web/docs/docs.go index 1439d7c..d0eaf04 100644 --- a/cmd/web/docs/docs.go +++ b/cmd/web/docs/docs.go @@ -24,6 +24,342 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/admin/v1/cms": { + "get": { + "description": "Search CMS entries with filters and pagination (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Search CMS entries", + "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "q", + "in": "query" + }, + { + "type": "string", + "description": "CMS key filter", + "name": "key", + "in": "query" + }, + { + "maximum": 100, + "minimum": 1, + "type": "integer", + "default": 20, + "description": "Number of CMS entries per page (1-100)", + "name": "limit", + "in": "query" + }, + { + "minimum": 0, + "type": "integer", + "default": 0, + "description": "Number of CMS entries to skip for pagination", + "name": "offset", + "in": "query" + }, + { + "enum": [ + "key", + "created_at", + "updated_at" + ], + "type": "string", + "default": "created_at", + "description": "Field to sort by", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "default": "desc", + "description": "Sort order", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSListResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "post": { + "description": "Create a new CMS entry for content management (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Create a new CMS entry", + "parameters": [ + { + "description": "CMS information", + "name": "cms", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/cms.CMSForm" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/admin/v1/cms/{id}": { + "get": { + "description": "Retrieve a CMS entry by its ID for editing (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Get CMS by ID", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "put": { + "description": "Update an existing CMS entry by its ID (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Update CMS entry", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Updated CMS information", + "name": "cms", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/cms.CMSForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "delete": { + "description": "Delete a CMS entry by its ID (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Delete CMS entry", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/admin/v1/companies": { "get": { "security": [ @@ -1053,7 +1389,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Search contacts", "parameters": [ @@ -1174,7 +1510,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Get contact statistics", "responses": { @@ -1215,7 +1551,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Get contact by ID", "parameters": [ @@ -1275,7 +1611,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Delete contact", "parameters": [ @@ -1325,7 +1661,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Update contact status", "parameters": [ @@ -4978,6 +5314,62 @@ const docTemplate = `{ } } }, + "/api/v1/cms/{key}": { + "get": { + "description": "Retrieve CMS content for public display by its key", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "CMS" + ], + "summary": "Get CMS content by key", + "parameters": [ + { + "type": "string", + "description": "CMS key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/companies": { "get": { "security": [ @@ -5040,7 +5432,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "contacts" + "Contacts" ], "summary": "Create a new contact message", "parameters": [ @@ -7340,6 +7732,383 @@ const docTemplate = `{ } } }, + "cms.CMSForm": { + "type": "object", + "properties": { + "advantages": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "challenges": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "chart": { + "$ref": "#/definitions/cms.chartSectionForm" + }, + "contact": { + "$ref": "#/definitions/cms.contactSectionForm" + }, + "features": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "footer": { + "$ref": "#/definitions/cms.footerSectionForm" + }, + "hero": { + "$ref": "#/definitions/cms.heroSectionForm" + }, + "key": { + "type": "string", + "example": "SW-001" + } + } + }, + "cms.CMSListResponse": { + "type": "object", + "properties": { + "cms": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + }, + "cms.CMSResponse": { + "type": "object", + "properties": { + "advantages": { + "$ref": "#/definitions/cms.cardSection" + }, + "challenges": { + "$ref": "#/definitions/cms.cardSection" + }, + "chart": { + "$ref": "#/definitions/cms.chartSection" + }, + "contact": { + "$ref": "#/definitions/cms.contactSection" + }, + "created_at": { + "type": "integer" + }, + "features": { + "$ref": "#/definitions/cms.cardSection" + }, + "footer": { + "$ref": "#/definitions/cms.footerSection" + }, + "hero": { + "$ref": "#/definitions/cms.heroSection" + }, + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "updated_at": { + "type": "integer" + } + } + }, + "cms.card": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.cardForm": { + "type": "object", + "properties": { + "description": { + "type": "string", + "example": "Card Description" + }, + "icon": { + "type": "string", + "example": "https://example.com/icon.png" + }, + "title": { + "type": "string", + "example": "Card Title" + } + } + }, + "cms.cardSection": { + "type": "object", + "properties": { + "cards": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.card" + } + }, + "description": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.cardSectionForm": { + "type": "object", + "properties": { + "cards": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.cardForm" + } + }, + "description": { + "type": "string", + "example": "Card Description" + }, + "title": { + "type": "string", + "example": "Card Title" + } + } + }, + "cms.chartPoint": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, + "cms.chartPointForm": { + "type": "object", + "properties": { + "key": { + "type": "string", + "example": "Key" + }, + "value": { + "type": "integer", + "example": 1000000 + } + } + }, + "cms.chartSection": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.chartPoint" + } + }, + "missedAmount": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.chartSectionForm": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.chartPointForm" + } + }, + "missed_amount": { + "type": "string", + "example": "Missed Amount" + }, + "title": { + "type": "string", + "example": "Chart Title" + } + } + }, + "cms.contactSection": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.formField" + } + }, + "submitButtonText": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.contactSectionForm": { + "type": "object", + "properties": { + "description": { + "type": "string", + "example": "Contact Description" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.formFieldForm" + } + }, + "submit_button_text": { + "type": "string", + "example": "Submit Button Text" + }, + "title": { + "type": "string", + "example": "Contact Title" + } + } + }, + "cms.footerSection": { + "type": "object", + "properties": { + "copyright": { + "type": "string" + }, + "email": { + "type": "string" + }, + "location": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "tagline": { + "type": "string" + } + } + }, + "cms.footerSectionForm": { + "type": "object", + "properties": { + "copyright": { + "type": "string", + "example": "Copyright" + }, + "email": { + "type": "string", + "example": "info@example.com" + }, + "location": { + "type": "string", + "example": "Location" + }, + "phone": { + "type": "string", + "example": "+1234567890" + }, + "tagline": { + "type": "string", + "example": "Tagline" + } + } + }, + "cms.formField": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "name": { + "type": "string" + }, + "placeholder": { + "type": "string" + }, + "required": { + "type": "boolean" + } + } + }, + "cms.formFieldForm": { + "type": "object", + "properties": { + "label": { + "type": "string", + "example": "Label" + }, + "name": { + "type": "string", + "example": "Name" + }, + "placeholder": { + "type": "string", + "example": "Placeholder" + }, + "required": { + "type": "boolean", + "example": true + } + } + }, + "cms.heroSection": { + "type": "object", + "properties": { + "buttonLink": { + "type": "string" + }, + "buttonText": { + "type": "string" + }, + "description": { + "type": "string" + }, + "gifFile": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.heroSectionForm": { + "type": "object", + "properties": { + "button_link": { + "type": "string", + "example": "https://example.com" + }, + "button_text": { + "type": "string", + "example": "Button Text" + }, + "description": { + "type": "string", + "example": "Hero Description" + }, + "gif_file": { + "type": "string", + "example": "https://example.com/gif.gif" + }, + "title": { + "type": "string", + "example": "Hero Title" + } + } + }, "company.Address": { "type": "object", "properties": { @@ -9429,6 +10198,14 @@ const docTemplate = `{ "description": "Administrative notification management operations for web panel including CRUD operations, bulk notifications, queue management, and comprehensive filtering with pagination", "name": "Admin-Notification" }, + { + "description": "Administrative contact management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination", + "name": "Admin-Contacts" + }, + { + "description": "Administrative CMS management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination", + "name": "Admin-CMS" + }, { "description": "Customer authentication and authorization operations for mobile application including login, logout, token refresh, and profile access", "name": "Authorization" @@ -9460,6 +10237,14 @@ const docTemplate = `{ { "description": "Public notification management operations for mobile application including notification listing and detailed notification information", "name": "Notification" + }, + { + "description": "Public contact management operations for mobile application including contact submission and contact listing", + "name": "Contacts" + }, + { + "description": "Public CMS management operations for mobile application including CMS listing and detailed CMS information", + "name": "CMS" } ] }` diff --git a/cmd/web/docs/swagger.json b/cmd/web/docs/swagger.json index d4c494d..b0a0d9f 100644 --- a/cmd/web/docs/swagger.json +++ b/cmd/web/docs/swagger.json @@ -16,6 +16,342 @@ "version": "1.0.0" }, "paths": { + "/admin/v1/cms": { + "get": { + "description": "Search CMS entries with filters and pagination (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Search CMS entries", + "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "q", + "in": "query" + }, + { + "type": "string", + "description": "CMS key filter", + "name": "key", + "in": "query" + }, + { + "maximum": 100, + "minimum": 1, + "type": "integer", + "default": 20, + "description": "Number of CMS entries per page (1-100)", + "name": "limit", + "in": "query" + }, + { + "minimum": 0, + "type": "integer", + "default": 0, + "description": "Number of CMS entries to skip for pagination", + "name": "offset", + "in": "query" + }, + { + "enum": [ + "key", + "created_at", + "updated_at" + ], + "type": "string", + "default": "created_at", + "description": "Field to sort by", + "name": "sort_by", + "in": "query" + }, + { + "enum": [ + "asc", + "desc" + ], + "type": "string", + "default": "desc", + "description": "Sort order", + "name": "sort_order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSListResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "post": { + "description": "Create a new CMS entry for content management (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Create a new CMS entry", + "parameters": [ + { + "description": "CMS information", + "name": "cms", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/cms.CMSForm" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, + "/admin/v1/cms/{id}": { + "get": { + "description": "Retrieve a CMS entry by its ID for editing (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Get CMS by ID", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "put": { + "description": "Update an existing CMS entry by its ID (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Update CMS entry", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Updated CMS information", + "name": "cms", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/cms.CMSForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + }, + "delete": { + "description": "Delete a CMS entry by its ID (admin only)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Admin-CMS" + ], + "summary": "Delete CMS entry", + "parameters": [ + { + "type": "string", + "description": "CMS ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/admin/v1/companies": { "get": { "security": [ @@ -1045,7 +1381,7 @@ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Search contacts", "parameters": [ @@ -1166,7 +1502,7 @@ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Get contact statistics", "responses": { @@ -1207,7 +1543,7 @@ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Get contact by ID", "parameters": [ @@ -1267,7 +1603,7 @@ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Delete contact", "parameters": [ @@ -1317,7 +1653,7 @@ "application/json" ], "tags": [ - "contacts" + "Admin-Contacts" ], "summary": "Update contact status", "parameters": [ @@ -4970,6 +5306,62 @@ } } }, + "/api/v1/cms/{key}": { + "get": { + "description": "Retrieve CMS content for public display by its key", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "CMS" + ], + "summary": "Get CMS content by key", + "parameters": [ + { + "type": "string", + "description": "CMS key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } + }, "/api/v1/companies": { "get": { "security": [ @@ -5032,7 +5424,7 @@ "application/json" ], "tags": [ - "contacts" + "Contacts" ], "summary": "Create a new contact message", "parameters": [ @@ -7332,6 +7724,383 @@ } } }, + "cms.CMSForm": { + "type": "object", + "properties": { + "advantages": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "challenges": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "chart": { + "$ref": "#/definitions/cms.chartSectionForm" + }, + "contact": { + "$ref": "#/definitions/cms.contactSectionForm" + }, + "features": { + "$ref": "#/definitions/cms.cardSectionForm" + }, + "footer": { + "$ref": "#/definitions/cms.footerSectionForm" + }, + "hero": { + "$ref": "#/definitions/cms.heroSectionForm" + }, + "key": { + "type": "string", + "example": "SW-001" + } + } + }, + "cms.CMSListResponse": { + "type": "object", + "properties": { + "cms": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.CMSResponse" + } + } + } + }, + "cms.CMSResponse": { + "type": "object", + "properties": { + "advantages": { + "$ref": "#/definitions/cms.cardSection" + }, + "challenges": { + "$ref": "#/definitions/cms.cardSection" + }, + "chart": { + "$ref": "#/definitions/cms.chartSection" + }, + "contact": { + "$ref": "#/definitions/cms.contactSection" + }, + "created_at": { + "type": "integer" + }, + "features": { + "$ref": "#/definitions/cms.cardSection" + }, + "footer": { + "$ref": "#/definitions/cms.footerSection" + }, + "hero": { + "$ref": "#/definitions/cms.heroSection" + }, + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "updated_at": { + "type": "integer" + } + } + }, + "cms.card": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.cardForm": { + "type": "object", + "properties": { + "description": { + "type": "string", + "example": "Card Description" + }, + "icon": { + "type": "string", + "example": "https://example.com/icon.png" + }, + "title": { + "type": "string", + "example": "Card Title" + } + } + }, + "cms.cardSection": { + "type": "object", + "properties": { + "cards": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.card" + } + }, + "description": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.cardSectionForm": { + "type": "object", + "properties": { + "cards": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.cardForm" + } + }, + "description": { + "type": "string", + "example": "Card Description" + }, + "title": { + "type": "string", + "example": "Card Title" + } + } + }, + "cms.chartPoint": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "integer" + } + } + }, + "cms.chartPointForm": { + "type": "object", + "properties": { + "key": { + "type": "string", + "example": "Key" + }, + "value": { + "type": "integer", + "example": 1000000 + } + } + }, + "cms.chartSection": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.chartPoint" + } + }, + "missedAmount": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.chartSectionForm": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.chartPointForm" + } + }, + "missed_amount": { + "type": "string", + "example": "Missed Amount" + }, + "title": { + "type": "string", + "example": "Chart Title" + } + } + }, + "cms.contactSection": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.formField" + } + }, + "submitButtonText": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.contactSectionForm": { + "type": "object", + "properties": { + "description": { + "type": "string", + "example": "Contact Description" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/cms.formFieldForm" + } + }, + "submit_button_text": { + "type": "string", + "example": "Submit Button Text" + }, + "title": { + "type": "string", + "example": "Contact Title" + } + } + }, + "cms.footerSection": { + "type": "object", + "properties": { + "copyright": { + "type": "string" + }, + "email": { + "type": "string" + }, + "location": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "tagline": { + "type": "string" + } + } + }, + "cms.footerSectionForm": { + "type": "object", + "properties": { + "copyright": { + "type": "string", + "example": "Copyright" + }, + "email": { + "type": "string", + "example": "info@example.com" + }, + "location": { + "type": "string", + "example": "Location" + }, + "phone": { + "type": "string", + "example": "+1234567890" + }, + "tagline": { + "type": "string", + "example": "Tagline" + } + } + }, + "cms.formField": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "name": { + "type": "string" + }, + "placeholder": { + "type": "string" + }, + "required": { + "type": "boolean" + } + } + }, + "cms.formFieldForm": { + "type": "object", + "properties": { + "label": { + "type": "string", + "example": "Label" + }, + "name": { + "type": "string", + "example": "Name" + }, + "placeholder": { + "type": "string", + "example": "Placeholder" + }, + "required": { + "type": "boolean", + "example": true + } + } + }, + "cms.heroSection": { + "type": "object", + "properties": { + "buttonLink": { + "type": "string" + }, + "buttonText": { + "type": "string" + }, + "description": { + "type": "string" + }, + "gifFile": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, + "cms.heroSectionForm": { + "type": "object", + "properties": { + "button_link": { + "type": "string", + "example": "https://example.com" + }, + "button_text": { + "type": "string", + "example": "Button Text" + }, + "description": { + "type": "string", + "example": "Hero Description" + }, + "gif_file": { + "type": "string", + "example": "https://example.com/gif.gif" + }, + "title": { + "type": "string", + "example": "Hero Title" + } + } + }, "company.Address": { "type": "object", "properties": { @@ -9421,6 +10190,14 @@ "description": "Administrative notification management operations for web panel including CRUD operations, bulk notifications, queue management, and comprehensive filtering with pagination", "name": "Admin-Notification" }, + { + "description": "Administrative contact management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination", + "name": "Admin-Contacts" + }, + { + "description": "Administrative CMS management operations for web panel including CRUD operations, search, statistics, and comprehensive filtering with pagination", + "name": "Admin-CMS" + }, { "description": "Customer authentication and authorization operations for mobile application including login, logout, token refresh, and profile access", "name": "Authorization" @@ -9452,6 +10229,14 @@ { "description": "Public notification management operations for mobile application including notification listing and detailed notification information", "name": "Notification" + }, + { + "description": "Public contact management operations for mobile application including contact submission and contact listing", + "name": "Contacts" + }, + { + "description": "Public CMS management operations for mobile application including CMS listing and detailed CMS information", + "name": "CMS" } ] } \ No newline at end of file diff --git a/cmd/web/docs/swagger.yaml b/cmd/web/docs/swagger.yaml index 90cd48b..3a949f7 100644 --- a/cmd/web/docs/swagger.yaml +++ b/cmd/web/docs/swagger.yaml @@ -22,6 +22,260 @@ definitions: example: 2.0.0 type: string type: object + cms.CMSForm: + properties: + advantages: + $ref: '#/definitions/cms.cardSectionForm' + challenges: + $ref: '#/definitions/cms.cardSectionForm' + chart: + $ref: '#/definitions/cms.chartSectionForm' + contact: + $ref: '#/definitions/cms.contactSectionForm' + features: + $ref: '#/definitions/cms.cardSectionForm' + footer: + $ref: '#/definitions/cms.footerSectionForm' + hero: + $ref: '#/definitions/cms.heroSectionForm' + key: + example: SW-001 + type: string + type: object + cms.CMSListResponse: + properties: + cms: + items: + $ref: '#/definitions/cms.CMSResponse' + type: array + type: object + cms.CMSResponse: + properties: + advantages: + $ref: '#/definitions/cms.cardSection' + challenges: + $ref: '#/definitions/cms.cardSection' + chart: + $ref: '#/definitions/cms.chartSection' + contact: + $ref: '#/definitions/cms.contactSection' + created_at: + type: integer + features: + $ref: '#/definitions/cms.cardSection' + footer: + $ref: '#/definitions/cms.footerSection' + hero: + $ref: '#/definitions/cms.heroSection' + id: + type: string + key: + type: string + updated_at: + type: integer + type: object + cms.card: + properties: + description: + type: string + icon: + type: string + title: + type: string + type: object + cms.cardForm: + properties: + description: + example: Card Description + type: string + icon: + example: https://example.com/icon.png + type: string + title: + example: Card Title + type: string + type: object + cms.cardSection: + properties: + cards: + items: + $ref: '#/definitions/cms.card' + type: array + description: + type: string + title: + type: string + type: object + cms.cardSectionForm: + properties: + cards: + items: + $ref: '#/definitions/cms.cardForm' + type: array + description: + example: Card Description + type: string + title: + example: Card Title + type: string + type: object + cms.chartPoint: + properties: + key: + type: string + value: + type: integer + type: object + cms.chartPointForm: + properties: + key: + example: Key + type: string + value: + example: 1000000 + type: integer + type: object + cms.chartSection: + properties: + data: + items: + $ref: '#/definitions/cms.chartPoint' + type: array + missedAmount: + type: string + title: + type: string + type: object + cms.chartSectionForm: + properties: + data: + items: + $ref: '#/definitions/cms.chartPointForm' + type: array + missed_amount: + example: Missed Amount + type: string + title: + example: Chart Title + type: string + type: object + cms.contactSection: + properties: + description: + type: string + fields: + items: + $ref: '#/definitions/cms.formField' + type: array + submitButtonText: + type: string + title: + type: string + type: object + cms.contactSectionForm: + properties: + description: + example: Contact Description + type: string + fields: + items: + $ref: '#/definitions/cms.formFieldForm' + type: array + submit_button_text: + example: Submit Button Text + type: string + title: + example: Contact Title + type: string + type: object + cms.footerSection: + properties: + copyright: + type: string + email: + type: string + location: + type: string + phone: + type: string + tagline: + type: string + type: object + cms.footerSectionForm: + properties: + copyright: + example: Copyright + type: string + email: + example: info@example.com + type: string + location: + example: Location + type: string + phone: + example: "+1234567890" + type: string + tagline: + example: Tagline + type: string + type: object + cms.formField: + properties: + label: + type: string + name: + type: string + placeholder: + type: string + required: + type: boolean + type: object + cms.formFieldForm: + properties: + label: + example: Label + type: string + name: + example: Name + type: string + placeholder: + example: Placeholder + type: string + required: + example: true + type: boolean + type: object + cms.heroSection: + properties: + buttonLink: + type: string + buttonText: + type: string + description: + type: string + gifFile: + type: string + title: + type: string + type: object + cms.heroSectionForm: + properties: + button_link: + example: https://example.com + type: string + button_text: + example: Button Text + type: string + description: + example: Hero Description + type: string + gif_file: + example: https://example.com/gif.gif + type: string + title: + example: Hero Title + type: string + type: object company.Address: properties: city: @@ -1424,6 +1678,220 @@ info: title: Opplens API version: 1.0.0 paths: + /admin/v1/cms: + get: + consumes: + - application/json + description: Search CMS entries with filters and pagination (admin only) + parameters: + - description: Search query + in: query + name: q + type: string + - description: CMS key filter + in: query + name: key + type: string + - default: 20 + description: Number of CMS entries per page (1-100) + in: query + maximum: 100 + minimum: 1 + name: limit + type: integer + - default: 0 + description: Number of CMS entries to skip for pagination + in: query + minimum: 0 + name: offset + type: integer + - default: created_at + description: Field to sort by + enum: + - key + - created_at + - updated_at + in: query + name: sort_by + type: string + - default: desc + description: Sort order + enum: + - asc + - desc + in: query + name: sort_order + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/cms.CMSListResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Search CMS entries + tags: + - Admin-CMS + post: + consumes: + - application/json + description: Create a new CMS entry for content management (admin only) + parameters: + - description: CMS information + in: body + name: cms + required: true + schema: + $ref: '#/definitions/cms.CMSForm' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/cms.CMSResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "409": + description: Conflict + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Create a new CMS entry + tags: + - Admin-CMS + /admin/v1/cms/{id}: + delete: + consumes: + - application/json + description: Delete a CMS entry by its ID (admin only) + parameters: + - description: CMS ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.APIResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Delete CMS entry + tags: + - Admin-CMS + get: + consumes: + - application/json + description: Retrieve a CMS entry by its ID for editing (admin only) + parameters: + - description: CMS ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/cms.CMSResponse' + type: object + "404": + description: Not Found + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Get CMS by ID + tags: + - Admin-CMS + put: + consumes: + - application/json + description: Update an existing CMS entry by its ID (admin only) + parameters: + - description: CMS ID + in: path + name: id + required: true + type: string + - description: Updated CMS information + in: body + name: cms + required: true + schema: + $ref: '#/definitions/cms.CMSForm' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/cms.CMSResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/response.APIResponse' + "409": + description: Conflict + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Update CMS entry + tags: + - Admin-CMS /admin/v1/companies: get: consumes: @@ -2149,7 +2617,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Search contacts tags: - - contacts + - Admin-Contacts /admin/v1/contacts/{id}: delete: consumes: @@ -2182,7 +2650,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Delete contact tags: - - contacts + - Admin-Contacts get: consumes: - application/json @@ -2219,7 +2687,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Get contact by ID tags: - - contacts + - Admin-Contacts /admin/v1/contacts/{id}/status: put: consumes: @@ -2258,7 +2726,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Update contact status tags: - - contacts + - Admin-Contacts /admin/v1/contacts/stats: get: consumes: @@ -2282,7 +2750,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Get contact statistics tags: - - contacts + - Admin-Contacts /admin/v1/customers: get: consumes: @@ -4567,6 +5035,40 @@ paths: summary: Get flag SVG tags: - Flags + /api/v1/cms/{key}: + get: + consumes: + - application/json + description: Retrieve CMS content for public display by its key + parameters: + - description: CMS key + in: path + name: key + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/cms.CMSResponse' + type: object + "404": + description: Not Found + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + summary: Get CMS content by key + tags: + - CMS /api/v1/companies: get: consumes: @@ -4632,7 +5134,7 @@ paths: $ref: '#/definitions/response.APIResponse' summary: Create a new contact message tags: - - contacts + - Contacts /api/v1/feedback: get: consumes: @@ -6043,6 +6545,12 @@ tags: CRUD operations, bulk notifications, queue management, and comprehensive filtering with pagination name: Admin-Notification +- description: Administrative contact management operations for web panel including + CRUD operations, search, statistics, and comprehensive filtering with pagination + name: Admin-Contacts +- description: Administrative CMS management operations for web panel including CRUD + operations, search, statistics, and comprehensive filtering with pagination + name: Admin-CMS - description: Customer authentication and authorization operations for mobile application including login, logout, token refresh, and profile access name: Authorization @@ -6067,3 +6575,9 @@ tags: - description: Public notification management operations for mobile application including notification listing and detailed notification information name: Notification +- description: Public contact management operations for mobile application including + contact submission and contact listing + name: Contacts +- description: Public CMS management operations for mobile application including CMS + listing and detailed CMS information + name: CMS