Files
mongotest/docs/swagger.json
T

224 lines
7.1 KiB
JSON

{
"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"
}
}
}
}
}