Rename the module, proto service, and all identifiers from simple_bank/ SimpleBank to api_tmpl/ApiTmpl, and regenerate the gRPC/gateway/swagger/ mock code accordingly. - Scrub real secrets (SMTP password, auth token secret) from api.env/ api_test.env, untrack them, and add api.env.example/api_test.env.example - Remove committed build artifacts (tmp/main, tmp/build-errors.log, dbml-error.log) and gitignore them going forward - Fix Dockerfile paths (build target, migrations copy) that referenced a stale project layout - Rewrite README to match the actual cmd/ + internal/ structure and add a "using this as a template" section
313 lines
6.7 KiB
JSON
313 lines
6.7 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "API Template",
|
|
"version": "0.0.1",
|
|
"contact": {
|
|
"name": "fvideira",
|
|
"url": "https://github.com/FernandoJVideira/api_tmpl",
|
|
"email": "[email protected]"
|
|
}
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "ApiTmpl"
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"paths": {
|
|
"/v1/create_user": {
|
|
"post": {
|
|
"summary": "Create User",
|
|
"description": "Create a new user.",
|
|
"operationId": "ApiTmpl_CreateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbCreateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbCreateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"ApiTmpl"
|
|
]
|
|
}
|
|
},
|
|
"/v1/login_user": {
|
|
"post": {
|
|
"summary": "Login User",
|
|
"description": "Login an existing user.",
|
|
"operationId": "ApiTmpl_LoginUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbLoginUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbLoginUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"ApiTmpl"
|
|
]
|
|
}
|
|
},
|
|
"/v1/update_user": {
|
|
"patch": {
|
|
"summary": "Update User",
|
|
"description": "Update an existing user.",
|
|
"operationId": "ApiTmpl_UpdateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbUpdateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbUpdateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"ApiTmpl"
|
|
]
|
|
}
|
|
},
|
|
"/v1/verify_email": {
|
|
"get": {
|
|
"summary": "Verify Email",
|
|
"description": "Verify a user's email.",
|
|
"operationId": "ApiTmpl_VerifyEmail",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbVerifyEmailResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string",
|
|
"format": "int64"
|
|
},
|
|
{
|
|
"name": "code",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"tags": [
|
|
"ApiTmpl"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"pbCreateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbCreateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbLoginUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbLoginUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sessionId": {
|
|
"type": "string"
|
|
},
|
|
"accessToken": {
|
|
"type": "string"
|
|
},
|
|
"accessTokenExpiresAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"refreshToken": {
|
|
"type": "string"
|
|
},
|
|
"refreshTokenExpiresAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbUpdateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbUpdateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbUser": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"passwordChangedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
},
|
|
"pbVerifyEmailResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"isVerified": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"protobufAny": {
|
|
"type": "object",
|
|
"properties": {
|
|
"@type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": {}
|
|
},
|
|
"rpcStatus": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/protobufAny"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|