Update API Documentation and Swagger Configuration for Opplens

- Changed API title and version in Swagger documentation from "Tender Management API" to "Opplens API" with version 1.0.0.
- Updated contact information and terms of service URLs to reflect the new branding for Opplens.
- Added a new "Notification" tag in the Swagger documentation for public notification management operations.
- Adjusted the Swagger endpoint path for documentation to improve routing consistency.
- Enhanced response structure in notification handlers to include metadata, improving clarity in API responses.
This commit is contained in:
n.nakhostin
2025-09-27 10:57:30 +03:30
parent 939f940499
commit 7110e55cf5
6 changed files with 51 additions and 44 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ func InitHTTPServer(conf Config, log logger.Logger) *echo.Echo {
e.GET("/admin/v1/health", healthHandler) e.GET("/admin/v1/health", healthHandler)
// Add Swagger documentation endpoint // Add Swagger documentation endpoint
e.GET("/swagger/*", echoSwagger.WrapHandler) e.GET("/swagger*", echoSwagger.WrapHandler)
log.Info("HTTP server initialized successfully", map[string]interface{}{ log.Info("HTTP server initialized successfully", map[string]interface{}{
"middleware": []string{"recover", "request_id", "logger", "cors", "custom_logging"}, "middleware": []string{"recover", "request_id", "logger", "cors", "custom_logging"},
+13 -9
View File
@@ -9,11 +9,11 @@ const docTemplate = `{
"info": { "info": {
"description": "{{escape .Description}}", "description": "{{escape .Description}}",
"title": "{{.Title}}", "title": "{{.Title}}",
"termsOfService": "https://tender-management.com/terms", "termsOfService": "https://opplens.com/terms",
"contact": { "contact": {
"name": "Tender Management API Support", "name": "Opplens API Support",
"url": "https://tender-management.com/support", "url": "https://opplens.com",
"email": "api-support@tender-management.com" "email": "info@opplens.com"
}, },
"license": { "license": {
"name": "MIT", "name": "MIT",
@@ -8952,18 +8952,22 @@ const docTemplate = `{
{ {
"description": "Public flag management operations for mobile application including flag retrieval and listing", "description": "Public flag management operations for mobile application including flag retrieval and listing",
"name": "Flags" "name": "Flags"
},
{
"description": "Public notification management operations for mobile application including notification listing and detailed notification information",
"name": "Notification"
} }
] ]
}` }`
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{ var SwaggerInfo = &swag.Spec{
Version: "2.0.0", Version: "1.0.0",
Host: "localhost:8082", Host: "",
BasePath: "/", BasePath: "",
Schemes: []string{}, Schemes: []string{},
Title: "Tender Management API", Title: "Opplens API",
Description: "This is a comprehensive API for the Tender Management System built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access.", Description: "This is a comprehensive API for the Opplens built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access.",
InfoInstanceName: "swagger", InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate, SwaggerTemplate: docTemplate,
LeftDelim: "{{", LeftDelim: "{{",
+11 -9
View File
@@ -1,22 +1,20 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "This is a comprehensive API for the Tender Management System built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access.", "description": "This is a comprehensive API for the Opplens built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access.",
"title": "Tender Management API", "title": "Opplens API",
"termsOfService": "https://tender-management.com/terms", "termsOfService": "https://opplens.com/terms",
"contact": { "contact": {
"name": "Tender Management API Support", "name": "Opplens API Support",
"url": "https://tender-management.com/support", "url": "https://opplens.com",
"email": "api-support@tender-management.com" "email": "info@opplens.com"
}, },
"license": { "license": {
"name": "MIT", "name": "MIT",
"url": "https://opensource.org/licenses/MIT" "url": "https://opensource.org/licenses/MIT"
}, },
"version": "2.0.0" "version": "1.0.0"
}, },
"host": "localhost:8082",
"basePath": "/",
"paths": { "paths": {
"/admin/v1/companies": { "/admin/v1/companies": {
"get": { "get": {
@@ -8946,6 +8944,10 @@
{ {
"description": "Public flag management operations for mobile application including flag retrieval and listing", "description": "Public flag management operations for mobile application including flag retrieval and listing",
"name": "Flags" "name": "Flags"
},
{
"description": "Public notification management operations for mobile application including notification listing and detailed notification information",
"name": "Notification"
} }
] ]
} }
+13 -12
View File
@@ -1,4 +1,3 @@
basePath: /
definitions: definitions:
bootstrap.HealthResponse: bootstrap.HealthResponse:
properties: properties:
@@ -1329,22 +1328,21 @@ definitions:
username: username:
type: string type: string
type: object type: object
host: localhost:8082
info: info:
contact: contact:
email: api-support@tender-management.com email: info@opplens.com
name: Tender Management API Support name: Opplens API Support
url: https://tender-management.com/support url: https://opplens.com
description: This is a comprehensive API for the Tender Management System built description: This is a comprehensive API for the Opplens built with Clean Architecture
with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The principles and Domain-Driven Design (DDD) patterns. The API provides endpoints
API provides endpoints for user management, customer management, company management, for user management, customer management, company management, and authentication
and authentication for both web panel administration and mobile application access. for both web panel administration and mobile application access.
license: license:
name: MIT name: MIT
url: https://opensource.org/licenses/MIT url: https://opensource.org/licenses/MIT
termsOfService: https://tender-management.com/terms termsOfService: https://opplens.com/terms
title: Tender Management API title: Opplens API
version: 2.0.0 version: 1.0.0
paths: paths:
/admin/v1/companies: /admin/v1/companies:
get: get:
@@ -5736,3 +5734,6 @@ tags:
- description: Public flag management operations for mobile application including - description: Public flag management operations for mobile application including
flag retrieval and listing flag retrieval and listing
name: Flags name: Flags
- description: Public notification management operations for mobile application including
notification listing and detailed notification information
name: Notification
+10 -10
View File
@@ -1,20 +1,17 @@
package main package main
// @title Tender Management API // @title Opplens API
// @version 2.0.0 // @version 1.0.0
// @description This is a comprehensive API for the Tender Management System built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access. // @description This is a comprehensive API for the Opplens built with Clean Architecture principles and Domain-Driven Design (DDD) patterns. The API provides endpoints for user management, customer management, company management, and authentication for both web panel administration and mobile application access.
// @termsOfService https://tender-management.com/terms // @termsOfService https://opplens.com/terms
// @contact.name Tender Management API Support // @contact.name Opplens API Support
// @contact.url https://tender-management.com/support // @contact.url https://opplens.com
// @contact.email api-support@tender-management.com // @contact.email info@opplens.com
// @license.name MIT // @license.name MIT
// @license.url https://opensource.org/licenses/MIT // @license.url https://opensource.org/licenses/MIT
// @host localhost:8082
// @BasePath /
// @securityDefinitions.apikey BearerAuth // @securityDefinitions.apikey BearerAuth
// @in header // @in header
// @name Authorization // @name Authorization
@@ -77,6 +74,9 @@ package main
// @tag.name Flags // @tag.name Flags
// @tag.description Public flag management operations for mobile application including flag retrieval and listing // @tag.description Public flag management operations for mobile application including flag retrieval and listing
// @tag.name Notification
// @tag.description Public notification management operations for mobile application including notification listing and detailed notification information
import ( import (
"context" "context"
"fmt" "fmt"
+3 -3
View File
@@ -96,7 +96,7 @@ func (h *NotificationHandler) GetNotifications(c echo.Context) error {
return response.InternalServerError(c, "Failed to get notifications") return response.InternalServerError(c, "Failed to get notifications")
} }
return response.Success(c, notifications, "Notifications retrieved successfully") return response.SuccessWithMeta(c, notifications.Notifications, notifications.Meta, "Notifications retrieved successfully")
} }
// MyAdminNotifications gets notifications for the admin // MyAdminNotifications gets notifications for the admin
@@ -150,7 +150,7 @@ func (h *NotificationHandler) AdminNotifications(c echo.Context) error {
return response.InternalServerError(c, "Failed to get notifications") return response.InternalServerError(c, "Failed to get notifications")
} }
return response.Success(c, notifications, "Notifications retrieved successfully") return response.SuccessWithMeta(c, notifications.Notifications, notifications.Meta, "Notifications retrieved successfully")
} }
// MarkSeen marks a notification as seen // MarkSeen marks a notification as seen
@@ -263,7 +263,7 @@ func (h *NotificationHandler) CustomerNotifications(c echo.Context) error {
return response.InternalServerError(c, "Failed to get notifications") return response.InternalServerError(c, "Failed to get notifications")
} }
return response.Success(c, notifications, "Notifications retrieved successfully") return response.SuccessWithMeta(c, notifications.Notifications, notifications.Meta, "Notifications retrieved successfully")
} }
// MarkSeen marks a notification as seen // MarkSeen marks a notification as seen