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:
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user