fix code crud user and insert master data for fhir

This commit is contained in:
2025-03-07 11:11:44 +07:00
parent 26271ef9e3
commit a0fdf0240f
18 changed files with 940 additions and 54 deletions

No files matched your search

+251
View File
@@ -0,0 +1,251 @@
// 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}}",
"contact": {},
"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"
}
}
}
}
}
},
"/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": {
"user.ReqInsertUser": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
+224
View File
@@ -0,0 +1,224 @@
{
"swagger": "2.0",
"info": {
"contact": {}
},
"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"
}
}
}
}
}
},
"/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": {
"user.ReqInsertUser": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"age": {
"type": "integer"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}
+145
View File
@@ -0,0 +1,145 @@
definitions:
user.ReqInsertUser:
properties:
address:
type: string
age:
type: integer
id:
type: string
name:
type: string
type: object
user.User:
properties:
address:
type: string
age:
type: integer
id:
type: string
name:
type: string
type: object
info:
contact: {}
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
/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"