This commit is contained in:
2025-08-13 13:58:55 +07:00
parent 26765fcc51
commit 71fd910b29
8 changed files with 106 additions and 9 deletions

504
cmd/api/docs/docs.go Normal file
View File

@@ -0,0 +1,504 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "https://tos.santoshk.dev",
"contact": {
"name": "Santosh Kumar",
"url": "https://twitter.com/sntshk",
"email": "sntshkmr60@gmail.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/local/getalluser": {
"get": {
"description": "Retrieves all users from the database",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get all users",
"responses": {
"200": {
"description": "List of users",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/user.User"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/local/getuser/{id}": {
"get": {
"description": "Retrieves a user by their ID",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get user by ID",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "User data",
"schema": {
"$ref": "#/definitions/user.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/localinsertuser": {
"post": {
"description": "Adds a new user to the database",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Insert a new user",
"parameters": [
{
"description": "User Data",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.ReqInsertUser"
}
}
],
"responses": {
"200": {
"description": "Successfully Inserted User",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/deleteretribusi/{ID}": {
"delete": {
"description": "Remove retribution data by id",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Delete retribution",
"parameters": [
{
"type": "string",
"description": "ID",
"name": "ID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Data Berhasil dihapus",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/getData/Limit/{limit}/Offset/{offset}": {
"get": {
"description": "return list of all retribution from the database",
"tags": [
"Retribusi"
],
"summary": "all retribution",
"parameters": [
{
"type": "string",
"description": "limit",
"name": "limit",
"in": "path",
"required": true
},
{
"type": "string",
"description": "offset",
"name": "offset",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
}
}
},
"/retribusi/insertretribusi": {
"post": {
"description": "Save retribution data in DB",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Create retribution",
"parameters": [
{
"description": "data Retribusi",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
],
"responses": {
"200": {
"description": "Data Berhasil disimpan",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/searchData/{kelompok_obyek}": {
"get": {
"description": "search retribution data by id",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Search retribution",
"parameters": [
{
"type": "string",
"description": "Kelompok_obyek",
"name": "Kelompok_obyek",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
}
}
},
"/retribusi/updateretribusi": {
"put": {
"description": "Change retribution data in DB",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Update retribution",
"parameters": [
{
"description": "data Retribusi",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
],
"responses": {
"200": {
"description": "Data Berhasil Diubah",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/users": {
"put": {
"description": "Updates user information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update a user",
"parameters": [
{
"description": "User Data",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.User"
}
}
],
"responses": {
"200": {
"description": "Successfully Updated User",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"satu_data.Retribusi": {
"type": "object",
"properties": {
"Dinas": {
"type": "string"
},
"Jenis": {
"type": "string"
},
"Kelompok_obyek": {
"type": "string"
},
"Kode_tarif": {
"type": "string"
},
"Pelayanan": {
"type": "string"
},
"Rekening_denda": {
"type": "string"
},
"Rekening_pokok": {
"type": "string"
},
"Satuan": {
"type": "string"
},
"Satuan_overtime": {
"type": "string"
},
"Tarif": {
"type": "string"
},
"Tarif_overtime": {
"type": "string"
},
"Uraian_1": {
"type": "string"
},
"Uraian_2": {
"type": "string"
},
"Uraian_3": {
"type": "string"
},
"date_created": {
"type": "string"
},
"date_updated": {
"type": "string"
},
"id": {
"type": "string"
},
"sort": {
"type": "integer"
},
"status": {
"type": "string"
},
"user_created": {
"type": "string"
},
"user_updated": {
"type": "string"
}
}
},
"user.ReqInsertUser": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"religion": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"religion": {
"type": "string"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "10.10.150.181:8084",
BasePath: "/api",
Schemes: []string{},
Title: "Tag Service API0",
Description: "A Tag service API in Go using Gin framework",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

480
cmd/api/docs/swagger.json Normal file
View File

@@ -0,0 +1,480 @@
{
"swagger": "2.0",
"info": {
"description": "A Tag service API in Go using Gin framework",
"title": "Tag Service API0",
"termsOfService": "https://tos.santoshk.dev",
"contact": {
"name": "Santosh Kumar",
"url": "https://twitter.com/sntshk",
"email": "sntshkmr60@gmail.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "10.10.150.181:8084",
"basePath": "/api",
"paths": {
"/api/local/getalluser": {
"get": {
"description": "Retrieves all users from the database",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get all users",
"responses": {
"200": {
"description": "List of users",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/user.User"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/local/getuser/{id}": {
"get": {
"description": "Retrieves a user by their ID",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get user by ID",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "User data",
"schema": {
"$ref": "#/definitions/user.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/localinsertuser": {
"post": {
"description": "Adds a new user to the database",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Insert a new user",
"parameters": [
{
"description": "User Data",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.ReqInsertUser"
}
}
],
"responses": {
"200": {
"description": "Successfully Inserted User",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/deleteretribusi/{ID}": {
"delete": {
"description": "Remove retribution data by id",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Delete retribution",
"parameters": [
{
"type": "string",
"description": "ID",
"name": "ID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Data Berhasil dihapus",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/getData/Limit/{limit}/Offset/{offset}": {
"get": {
"description": "return list of all retribution from the database",
"tags": [
"Retribusi"
],
"summary": "all retribution",
"parameters": [
{
"type": "string",
"description": "limit",
"name": "limit",
"in": "path",
"required": true
},
{
"type": "string",
"description": "offset",
"name": "offset",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
}
}
},
"/retribusi/insertretribusi": {
"post": {
"description": "Save retribution data in DB",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Create retribution",
"parameters": [
{
"description": "data Retribusi",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
],
"responses": {
"200": {
"description": "Data Berhasil disimpan",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/retribusi/searchData/{kelompok_obyek}": {
"get": {
"description": "search retribution data by id",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Search retribution",
"parameters": [
{
"type": "string",
"description": "Kelompok_obyek",
"name": "Kelompok_obyek",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
}
}
},
"/retribusi/updateretribusi": {
"put": {
"description": "Change retribution data in DB",
"produces": [
"application/json"
],
"tags": [
"Retribusi"
],
"summary": "Update retribution",
"parameters": [
{
"description": "data Retribusi",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/satu_data.Retribusi"
}
}
],
"responses": {
"200": {
"description": "Data Berhasil Diubah",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/users": {
"put": {
"description": "Updates user information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update a user",
"parameters": [
{
"description": "User Data",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.User"
}
}
],
"responses": {
"200": {
"description": "Successfully Updated User",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Database connection failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"satu_data.Retribusi": {
"type": "object",
"properties": {
"Dinas": {
"type": "string"
},
"Jenis": {
"type": "string"
},
"Kelompok_obyek": {
"type": "string"
},
"Kode_tarif": {
"type": "string"
},
"Pelayanan": {
"type": "string"
},
"Rekening_denda": {
"type": "string"
},
"Rekening_pokok": {
"type": "string"
},
"Satuan": {
"type": "string"
},
"Satuan_overtime": {
"type": "string"
},
"Tarif": {
"type": "string"
},
"Tarif_overtime": {
"type": "string"
},
"Uraian_1": {
"type": "string"
},
"Uraian_2": {
"type": "string"
},
"Uraian_3": {
"type": "string"
},
"date_created": {
"type": "string"
},
"date_updated": {
"type": "string"
},
"id": {
"type": "string"
},
"sort": {
"type": "integer"
},
"status": {
"type": "string"
},
"user_created": {
"type": "string"
},
"user_updated": {
"type": "string"
}
}
},
"user.ReqInsertUser": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"religion": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"religion": {
"type": "string"
}
}
}
}
}

316
cmd/api/docs/swagger.yaml Normal file
View File

@@ -0,0 +1,316 @@
basePath: /api
definitions:
satu_data.Retribusi:
properties:
Dinas:
type: string
Jenis:
type: string
Kelompok_obyek:
type: string
Kode_tarif:
type: string
Pelayanan:
type: string
Rekening_denda:
type: string
Rekening_pokok:
type: string
Satuan:
type: string
Satuan_overtime:
type: string
Tarif:
type: string
Tarif_overtime:
type: string
Uraian_1:
type: string
Uraian_2:
type: string
Uraian_3:
type: string
date_created:
type: string
date_updated:
type: string
id:
type: string
sort:
type: integer
status:
type: string
user_created:
type: string
user_updated:
type: string
type: object
user.ReqInsertUser:
properties:
address:
type: string
age:
type: integer
gender:
type: string
id:
type: string
name:
type: string
religion:
type: string
type: object
user.User:
properties:
address:
type: string
age:
type: integer
gender:
type: string
id:
type: string
name:
type: string
religion:
type: string
type: object
host: 10.10.150.181:8084
info:
contact:
email: sntshkmr60@gmail.com
name: Santosh Kumar
url: https://twitter.com/sntshk
description: A Tag service API in Go using Gin framework
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: https://tos.santoshk.dev
title: Tag Service API0
version: "1.0"
paths:
/api/local/getalluser:
get:
description: Retrieves all users from the database
produces:
- application/json
responses:
"200":
description: List of users
schema:
items:
$ref: '#/definitions/user.User'
type: array
"500":
description: Database connection failed
schema:
additionalProperties:
type: string
type: object
summary: Get all users
tags:
- users
/api/local/getuser/{id}:
get:
description: Retrieves a user by their ID
parameters:
- description: User ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: User data
schema:
$ref: '#/definitions/user.User'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
summary: Get user by ID
tags:
- users
/api/localinsertuser:
post:
consumes:
- application/json
description: Adds a new user to the database
parameters:
- description: User Data
in: body
name: request
required: true
schema:
$ref: '#/definitions/user.ReqInsertUser'
produces:
- application/json
responses:
"200":
description: Successfully Inserted User
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Database connection failed
schema:
additionalProperties:
type: string
type: object
summary: Insert a new user
tags:
- users
/retribusi/deleteretribusi/{ID}:
delete:
description: Remove retribution data by id
parameters:
- description: ID
in: path
name: ID
required: true
type: string
produces:
- application/json
responses:
"200":
description: Data Berhasil dihapus
schema:
additionalProperties:
type: string
type: object
summary: Delete retribution
tags:
- Retribusi
/retribusi/getData/Limit/{limit}/Offset/{offset}:
get:
description: return list of all retribution from the database
parameters:
- description: limit
in: path
name: limit
required: true
type: string
- description: offset
in: path
name: offset
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/satu_data.Retribusi'
summary: all retribution
tags:
- Retribusi
/retribusi/insertretribusi:
post:
description: Save retribution data in DB
parameters:
- description: data Retribusi
in: body
name: data
required: true
schema:
$ref: '#/definitions/satu_data.Retribusi'
produces:
- application/json
responses:
"200":
description: Data Berhasil disimpan
schema:
additionalProperties:
type: string
type: object
summary: Create retribution
tags:
- Retribusi
/retribusi/searchData/{kelompok_obyek}:
get:
description: search retribution data by id
parameters:
- description: Kelompok_obyek
in: path
name: Kelompok_obyek
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/satu_data.Retribusi'
summary: Search retribution
tags:
- Retribusi
/retribusi/updateretribusi:
put:
description: Change retribution data in DB
parameters:
- description: data Retribusi
in: body
name: data
required: true
schema:
$ref: '#/definitions/satu_data.Retribusi'
produces:
- application/json
responses:
"200":
description: Data Berhasil Diubah
schema:
additionalProperties:
type: string
type: object
summary: Update retribution
tags:
- Retribusi
/users:
put:
consumes:
- application/json
description: Updates user information
parameters:
- description: User Data
in: body
name: request
required: true
schema:
$ref: '#/definitions/user.User'
produces:
- application/json
responses:
"200":
description: Successfully Updated User
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Database connection failed
schema:
additionalProperties:
type: string
type: object
summary: Update a user
tags:
- users
swagger: "2.0"

View File

@@ -8,8 +8,8 @@ import (
"os/signal"
"syscall"
_ "template_blueprint/docs"
//_ "template_blueprint/cmd/api/docs"
//_ "template_blueprint/docs"
_ "template_blueprint/cmd/api/docs"
//_ "template_blueprint/internal/docs"
"template_blueprint/internal/server"
"time"