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