Perbaikan Swagger dan ke DB Prod SIMRS

This commit is contained in:
2025-11-18 14:31:13 +07:00
parent a14562cfe0
commit 85a83b6659
7 changed files with 36 additions and 36 deletions
+4 -4
View File
@@ -17,10 +17,10 @@ services:
# Default Database Configuration (PostgreSQL)
DB_CONNECTION: postgres
DB_USERNAME: simtest
DB_PASSWORD: 12345
DB_HOST: 10.10.123.223
DB_DATABASE: simrsbackup
DB_USERNAME: simrs
DB_PASSWORD: simrs.rssa
DB_HOST: 10.10.123.163
DB_DATABASE: simrs
DB_PORT: 5432
DB_SSLMODE: disable
+8 -8
View File
@@ -24,7 +24,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/auth/login": {
"/auth/login": {
"post": {
"description": "Authenticate user with username and password to receive JWT token",
"consumes": [
@@ -76,7 +76,7 @@ const docTemplate = `{
}
}
},
"/api/v1/auth/me": {
"/auth/me": {
"get": {
"security": [
{
@@ -110,7 +110,7 @@ const docTemplate = `{
}
}
},
"/api/v1/auth/refresh": {
"/auth/refresh": {
"post": {
"description": "Refresh the JWT token using a valid refresh token",
"consumes": [
@@ -165,7 +165,7 @@ const docTemplate = `{
}
}
},
"/api/v1/auth/register": {
"/auth/register": {
"post": {
"description": "Register a new user account",
"consumes": [
@@ -214,7 +214,7 @@ const docTemplate = `{
}
}
},
"/api/v1/token/generate": {
"/token/generate": {
"post": {
"description": "Generate a JWT token for a user",
"consumes": [
@@ -266,7 +266,7 @@ const docTemplate = `{
}
}
},
"/api/v1/token/generate-direct": {
"/token/generate-direct": {
"post": {
"description": "Generate a JWT token directly without password verification (for testing)",
"consumes": [
@@ -312,7 +312,7 @@ const docTemplate = `{
}
}
},
"/api/v1/ws/broadcast/check": {
"/ws/broadcast/check": {
"post": {
"description": "Creates and broadcasts a WebSocket message with the specified type and data",
"consumes": [
@@ -363,7 +363,7 @@ const docTemplate = `{
}
}
},
"/api/v1/ws/broadcast/qris": {
"/ws/broadcast/qris": {
"post": {
"description": "Creates and broadcasts a WebSocket message with the specified type and data for QRIS operations",
"consumes": [
+8 -8
View File
@@ -22,7 +22,7 @@
"host": "localhost:8080",
"basePath": "/api/v1",
"paths": {
"/api/v1/auth/login": {
"/auth/login": {
"post": {
"description": "Authenticate user with username and password to receive JWT token",
"consumes": [
@@ -74,7 +74,7 @@
}
}
},
"/api/v1/auth/me": {
"/auth/me": {
"get": {
"security": [
{
@@ -108,7 +108,7 @@
}
}
},
"/api/v1/auth/refresh": {
"/auth/refresh": {
"post": {
"description": "Refresh the JWT token using a valid refresh token",
"consumes": [
@@ -163,7 +163,7 @@
}
}
},
"/api/v1/auth/register": {
"/auth/register": {
"post": {
"description": "Register a new user account",
"consumes": [
@@ -212,7 +212,7 @@
}
}
},
"/api/v1/token/generate": {
"/token/generate": {
"post": {
"description": "Generate a JWT token for a user",
"consumes": [
@@ -264,7 +264,7 @@
}
}
},
"/api/v1/token/generate-direct": {
"/token/generate-direct": {
"post": {
"description": "Generate a JWT token directly without password verification (for testing)",
"consumes": [
@@ -310,7 +310,7 @@
}
}
},
"/api/v1/ws/broadcast/check": {
"/ws/broadcast/check": {
"post": {
"description": "Creates and broadcasts a WebSocket message with the specified type and data",
"consumes": [
@@ -361,7 +361,7 @@
}
}
},
"/api/v1/ws/broadcast/qris": {
"/ws/broadcast/qris": {
"post": {
"description": "Creates and broadcasts a WebSocket message with the specified type and data for QRIS operations",
"consumes": [
+8 -8
View File
@@ -44,7 +44,7 @@ info:
title: API Service
version: 1.0.0
paths:
/api/v1/auth/login:
/auth/login:
post:
consumes:
- application/json
@@ -78,7 +78,7 @@ paths:
summary: Login user and get JWT token
tags:
- Authentication
/api/v1/auth/me:
/auth/me:
get:
description: Get information about the currently authenticated user
produces:
@@ -99,7 +99,7 @@ paths:
summary: Get current user info
tags:
- Authentication
/api/v1/auth/refresh:
/auth/refresh:
post:
consumes:
- application/json
@@ -135,7 +135,7 @@ paths:
summary: Refresh JWT token
tags:
- Authentication
/api/v1/auth/register:
/auth/register:
post:
consumes:
- application/json
@@ -167,7 +167,7 @@ paths:
summary: Register new user
tags:
- Authentication
/api/v1/token/generate:
/token/generate:
post:
consumes:
- application/json
@@ -201,7 +201,7 @@ paths:
summary: Generate JWT token
tags:
- Token
/api/v1/token/generate-direct:
/token/generate-direct:
post:
consumes:
- application/json
@@ -232,7 +232,7 @@ paths:
summary: Generate token directly
tags:
- Token
/api/v1/ws/broadcast/check:
/ws/broadcast/check:
post:
consumes:
- application/json
@@ -267,7 +267,7 @@ paths:
summary: Broadcast a WebSocket message
tags:
- WebSocket QRIS
/api/v1/ws/broadcast/qris:
/ws/broadcast/qris:
post:
consumes:
- application/json
+4 -4
View File
@@ -30,7 +30,7 @@ func NewAuthHandler(authService *services.AuthService) *AuthHandler {
// @Success 200 {object} models.TokenResponse
// @Failure 400 {object} map[string]string "Bad request"
// @Failure 401 {object} map[string]string "Unauthorized"
// @Router /api/v1/auth/login [post]
// @Router /auth/login [post]
func (h *AuthHandler) Login(c *gin.Context) {
var loginReq models.LoginRequest
@@ -60,7 +60,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
// @Success 200 {object} models.TokenResponse
// @Failure 400 {object} map[string]string "Bad request"
// @Failure 401 {object} map[string]string "Unauthorized"
// @Router /api/v1/auth/refresh [post]
// @Router /auth/refresh [post]
func (h *AuthHandler) RefreshToken(c *gin.Context) {
// For now, this is a placeholder for refresh token functionality
// In a real implementation, you would handle refresh tokens here
@@ -76,7 +76,7 @@ func (h *AuthHandler) RefreshToken(c *gin.Context) {
// @Param register body map[string]string true "Registration data"
// @Success 201 {object} map[string]string
// @Failure 400 {object} map[string]string "Bad request"
// @Router /api/v1/auth/register [post]
// @Router /auth/register [post]
func (h *AuthHandler) Register(c *gin.Context) {
var registerReq struct {
Username string `json:"username" binding:"required"`
@@ -113,7 +113,7 @@ func (h *AuthHandler) Register(c *gin.Context) {
// @Security Bearer
// @Success 200 {object} models.User
// @Failure 401 {object} map[string]string "Unauthorized"
// @Router /api/v1/auth/me [get]
// @Router /auth/me [get]
func (h *AuthHandler) Me(c *gin.Context) {
// Get user info from context (set by middleware)
userID, exists := c.Get("user_id")
+2 -2
View File
@@ -30,7 +30,7 @@ func NewTokenHandler(authService *services.AuthService) *TokenHandler {
// @Success 200 {object} models.TokenResponse
// @Failure 400 {object} map[string]string "Bad request"
// @Failure 401 {object} map[string]string "Unauthorized"
// @Router /api/v1/token/generate [post]
// @Router /token/generate [post]
func (h *TokenHandler) GenerateToken(c *gin.Context) {
var loginReq models.LoginRequest
@@ -59,7 +59,7 @@ func (h *TokenHandler) GenerateToken(c *gin.Context) {
// @Param user body map[string]string true "User info"
// @Success 200 {object} models.TokenResponse
// @Failure 400 {object} map[string]string "Bad request"
// @Router /api/v1/token/generate-direct [post]
// @Router /token/generate-direct [post]
func (h *TokenHandler) GenerateTokenDirect(c *gin.Context) {
var req struct {
Username string `json:"username" binding:"required"`
+2 -2
View File
@@ -119,7 +119,7 @@ func (b *Broadcaster) BroadcastMessage(messageType string, data interface{}) {
// @Param data body interface{} true "QRIS data payload for the message"
// @Success 200 {object} map[string]string "QRIS message successfully queued for broadcast"
// @Failure 500 {object} map[string]string "Failed to queue QRIS message (queue full)"
// @Router /api/v1/ws/broadcast/qris [post]
// @Router /ws/broadcast/qris [post]
func (b *Broadcaster) BroadcastQris(messageType string, data interface{}) {
msg := NewWebSocketMessage(MessageType(messageType), data, "", "")
@@ -150,7 +150,7 @@ func (b *Broadcaster) BroadcastQris(messageType string, data interface{}) {
// @Param data body interface{} true "Data payload for the message"
// @Success 200 {object} map[string]string "Message successfully queued for broadcast"
// @Failure 500 {object} map[string]string "Failed to queue message (queue full)"
// @Router /api/v1/ws/broadcast/check [post]
// @Router /ws/broadcast/check [post]
func (b *Broadcaster) BroadcastCheck(messageType string, data interface{}) {
msg := NewWebSocketMessage(MessageType(messageType), data, "", "")