Feat(ktm-booking): Initial commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
609
backend/docs/docs.go
Normal file
609
backend/docs/docs.go
Normal file
@@ -0,0 +1,609 @@
|
||||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {
|
||||
"name": "Samuel Pua",
|
||||
"url": "https://git.samuelpua.com/telboon"
|
||||
},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Base"
|
||||
],
|
||||
"summary": "This is test",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/booking": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Get All Booking",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Create New Booking",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Booking Create Request",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingCreateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/booking/{bookingID}": {
|
||||
"delete": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Delete booking",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Booking ID",
|
||||
"name": "bookingID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/current-time": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Info"
|
||||
],
|
||||
"summary": "Get current server time",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.ServerTimeResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/login": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User Login info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserLoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/logout": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user logout",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.TextResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/me": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "Returns current logged in user",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/profile": {
|
||||
"put": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For setting current user profile",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User registration info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.ProfileRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/register": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user registration",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User registration info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserRegisterRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Base"
|
||||
],
|
||||
"summary": "Responds to health check",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"common.ErrResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "application-specific error code",
|
||||
"type": "integer"
|
||||
},
|
||||
"error": {
|
||||
"description": "application-level error message, for debugging",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "user-level status message",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"common.TextResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"description": "user-level status message",
|
||||
"type": "string"
|
||||
},
|
||||
"text": {
|
||||
"description": "application-specific error code",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.BookingCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"passport",
|
||||
"passportExpiry",
|
||||
"travelDate"
|
||||
],
|
||||
"properties": {
|
||||
"contact": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"passport": {
|
||||
"type": "string"
|
||||
},
|
||||
"passportExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"travelDate": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.BookingResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contact": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"passport": {
|
||||
"type": "string"
|
||||
},
|
||||
"passportExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"travelDate": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.ServerTimeResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"serverLocalTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ProfileRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ktmTrainCreditCard": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardCVV": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainUsername": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ProfileResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ktmTrainCreditCard": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardCVV": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainUsername": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserLoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserRegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 6
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile": {
|
||||
"$ref": "#/definitions/user.ProfileResponse"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "",
|
||||
BasePath: "/",
|
||||
Schemes: []string{},
|
||||
Title: "KTM Train Booking Bot",
|
||||
Description: "API for frontend - built on Go-chi",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
585
backend/docs/swagger.json
Normal file
585
backend/docs/swagger.json
Normal file
@@ -0,0 +1,585 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "API for frontend - built on Go-chi",
|
||||
"title": "KTM Train Booking Bot",
|
||||
"contact": {
|
||||
"name": "Samuel Pua",
|
||||
"url": "https://git.samuelpua.com/telboon"
|
||||
},
|
||||
"version": "1.0"
|
||||
},
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Base"
|
||||
],
|
||||
"summary": "This is test",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/booking": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Get All Booking",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Create New Booking",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Booking Create Request",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingCreateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/booking/{bookingID}": {
|
||||
"delete": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ktmtrainbot Booking"
|
||||
],
|
||||
"summary": "Delete booking",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Booking ID",
|
||||
"name": "bookingID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.BookingResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/ktmtrainbot/current-time": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Info"
|
||||
],
|
||||
"summary": "Get current server time",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ktmtrainbot.ServerTimeResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/login": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User Login info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserLoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/logout": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user logout",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.TextResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/me": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "Returns current logged in user",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/profile": {
|
||||
"put": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For setting current user profile",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User registration info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.ProfileRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/user/register": {
|
||||
"post": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "For user registration",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "User registration info",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserRegisterRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.ErrResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "Description",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Base"
|
||||
],
|
||||
"summary": "Responds to health check",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"common.ErrResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "application-specific error code",
|
||||
"type": "integer"
|
||||
},
|
||||
"error": {
|
||||
"description": "application-level error message, for debugging",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "user-level status message",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"common.TextResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"description": "user-level status message",
|
||||
"type": "string"
|
||||
},
|
||||
"text": {
|
||||
"description": "application-specific error code",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.BookingCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"passport",
|
||||
"passportExpiry",
|
||||
"travelDate"
|
||||
],
|
||||
"properties": {
|
||||
"contact": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"passport": {
|
||||
"type": "string"
|
||||
},
|
||||
"passportExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"travelDate": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.BookingResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contact": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"passport": {
|
||||
"type": "string"
|
||||
},
|
||||
"passportExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"timeCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"travelDate": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ktmtrainbot.ServerTimeResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"serverLocalTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ProfileRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ktmTrainCreditCard": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardCVV": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainUsername": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ProfileResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ktmTrainCreditCard": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardCVV": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardExpiry": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainCreditCardType": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"ktmTrainUsername": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserLoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserRegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 6
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.UserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile": {
|
||||
"$ref": "#/definitions/user.ProfileResponse"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
387
backend/docs/swagger.yaml
Normal file
387
backend/docs/swagger.yaml
Normal file
@@ -0,0 +1,387 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
common.ErrResponse:
|
||||
properties:
|
||||
code:
|
||||
description: application-specific error code
|
||||
type: integer
|
||||
error:
|
||||
description: application-level error message, for debugging
|
||||
type: string
|
||||
status:
|
||||
description: user-level status message
|
||||
type: string
|
||||
type: object
|
||||
common.TextResponse:
|
||||
properties:
|
||||
status:
|
||||
description: user-level status message
|
||||
type: string
|
||||
text:
|
||||
description: application-specific error code
|
||||
type: string
|
||||
type: object
|
||||
ktmtrainbot.BookingCreateRequest:
|
||||
properties:
|
||||
contact:
|
||||
type: string
|
||||
gender:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
passport:
|
||||
type: string
|
||||
passportExpiry:
|
||||
type: string
|
||||
timeCode:
|
||||
type: string
|
||||
travelDate:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- passport
|
||||
- passportExpiry
|
||||
- travelDate
|
||||
type: object
|
||||
ktmtrainbot.BookingResponse:
|
||||
properties:
|
||||
contact:
|
||||
type: string
|
||||
gender:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
passport:
|
||||
type: string
|
||||
passportExpiry:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
timeCode:
|
||||
type: string
|
||||
travelDate:
|
||||
type: string
|
||||
type: object
|
||||
ktmtrainbot.ServerTimeResponse:
|
||||
properties:
|
||||
serverLocalTime:
|
||||
type: string
|
||||
type: object
|
||||
user.ProfileRequest:
|
||||
properties:
|
||||
ktmTrainCreditCard:
|
||||
type: string
|
||||
ktmTrainCreditCardCVV:
|
||||
type: string
|
||||
ktmTrainCreditCardExpiry:
|
||||
type: string
|
||||
ktmTrainCreditCardType:
|
||||
type: string
|
||||
ktmTrainPassword:
|
||||
type: string
|
||||
ktmTrainUsername:
|
||||
type: string
|
||||
type: object
|
||||
user.ProfileResponse:
|
||||
properties:
|
||||
ktmTrainCreditCard:
|
||||
type: string
|
||||
ktmTrainCreditCardCVV:
|
||||
type: string
|
||||
ktmTrainCreditCardExpiry:
|
||||
type: string
|
||||
ktmTrainCreditCardType:
|
||||
type: string
|
||||
ktmTrainPassword:
|
||||
type: string
|
||||
ktmTrainUsername:
|
||||
type: string
|
||||
type: object
|
||||
user.UserLoginRequest:
|
||||
properties:
|
||||
password:
|
||||
type: string
|
||||
username:
|
||||
maxLength: 100
|
||||
minLength: 2
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
user.UserRegisterRequest:
|
||||
properties:
|
||||
password:
|
||||
maxLength: 100
|
||||
minLength: 6
|
||||
type: string
|
||||
username:
|
||||
maxLength: 100
|
||||
minLength: 2
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
user.UserResponse:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
profile:
|
||||
$ref: '#/definitions/user.ProfileResponse'
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact:
|
||||
name: Samuel Pua
|
||||
url: https://git.samuelpua.com/telboon
|
||||
description: API for frontend - built on Go-chi
|
||||
title: KTM Train Booking Bot
|
||||
version: "1.0"
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
type: string
|
||||
summary: This is test
|
||||
tags:
|
||||
- Base
|
||||
/api/v1/ktmtrainbot/booking:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: Get All Booking
|
||||
tags:
|
||||
- ktmtrainbot Booking
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
parameters:
|
||||
- description: Booking Create Request
|
||||
in: body
|
||||
name: user
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/ktmtrainbot.BookingCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: Create New Booking
|
||||
tags:
|
||||
- ktmtrainbot Booking
|
||||
/api/v1/ktmtrainbot/booking/{bookingID}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
parameters:
|
||||
- description: Booking ID
|
||||
in: path
|
||||
name: bookingID
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: Delete booking
|
||||
tags:
|
||||
- ktmtrainbot Booking
|
||||
/api/v1/ktmtrainbot/current-time:
|
||||
get:
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/ktmtrainbot.ServerTimeResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: Get current server time
|
||||
tags:
|
||||
- Info
|
||||
/api/v1/user/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
parameters:
|
||||
- description: User Login info
|
||||
in: body
|
||||
name: user
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserLoginRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: For user login
|
||||
tags:
|
||||
- User
|
||||
/api/v1/user/logout:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/common.TextResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: For user logout
|
||||
tags:
|
||||
- User
|
||||
/api/v1/user/me:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: Returns current logged in user
|
||||
tags:
|
||||
- User
|
||||
/api/v1/user/profile:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
parameters:
|
||||
- description: User registration info
|
||||
in: body
|
||||
name: user
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/user.ProfileRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: For setting current user profile
|
||||
tags:
|
||||
- User
|
||||
/api/v1/user/register:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
parameters:
|
||||
- description: User registration info
|
||||
in: body
|
||||
name: user
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserRegisterRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/user.UserResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/common.ErrResponse'
|
||||
summary: For user registration
|
||||
tags:
|
||||
- User
|
||||
/health:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Description
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
type: string
|
||||
summary: Responds to health check
|
||||
tags:
|
||||
- Base
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user