Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add : MySql Data gen #29

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions websrc/controllers/gendata.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,22 @@ type GenDataParams struct {
GCPCredential *multipart.FileHeader `form:"gcpCredential" swaggerignore:"true"`
ProjectID string `json:"projectid" form:"projectid"`
}

type GenFirestoreParams struct {
Region string `json:"region" form:"region"`
GCPCredential *multipart.FileHeader `form:"gcpCredential" swaggerignore:"true"`
ProjectID string `json:"projectid" form:"projectid"`
}

type GenMySQLParams struct {
DBProvider string `json:"provider" form:"provider"`
DBHost string `json:"host" form:"host"`
DBPort string `json:"port" form:"port"`
DBUser string `json:"username" form:"username"`
DBPassword string `json:"password" form:"password"`
DatabaseName string `json:"databaseName" form:"databaseName"`
}

func genData(params GenDataParams, logger *logrus.Logger) error {
if params.CheckSQL == "on" {
logger.Info("Start creating sql dummy")
Expand Down
2 changes: 1 addition & 1 deletion websrc/controllers/generateHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func GenerateNCPPostHandler(ctx echo.Context) error {
// @Tags [Test Data Generation]
// @Accept json
// @Produce json
// @Param RequestBody body GenDataParams true "Parameters required to generate test data"
// @Param RequestBody body GenMySQLParams true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully generated test data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
// @Router /generate/mysql [post]
Expand Down
25 changes: 24 additions & 1 deletion websrc/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.GenDataParams"
"$ref": "#/definitions/controllers.GenMySQLParams"
}
}
],
Expand Down Expand Up @@ -2671,6 +2671,29 @@ const docTemplate = `{
}
}
},
"controllers.GenMySQLParams": {
"type": "object",
"properties": {
"databaseName": {
"type": "string"
},
"host": {
"type": "string"
},
"password": {
"type": "string"
},
"port": {
"type": "string"
},
"provider": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"controllers.LinuxMigrationParams": {
"type": "object",
"properties": {
Expand Down
25 changes: 24 additions & 1 deletion websrc/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.GenDataParams"
"$ref": "#/definitions/controllers.GenMySQLParams"
}
}
],
Expand Down Expand Up @@ -2664,6 +2664,29 @@
}
}
},
"controllers.GenMySQLParams": {
"type": "object",
"properties": {
"databaseName": {
"type": "string"
},
"host": {
"type": "string"
},
"password": {
"type": "string"
},
"port": {
"type": "string"
},
"provider": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"controllers.LinuxMigrationParams": {
"type": "object",
"properties": {
Expand Down
17 changes: 16 additions & 1 deletion websrc/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ definitions:
username:
type: string
type: object
controllers.GenMySQLParams:
properties:
databaseName:
type: string
host:
type: string
password:
type: string
port:
type: string
provider:
type: string
username:
type: string
type: object
controllers.LinuxMigrationParams:
properties:
path:
Expand Down Expand Up @@ -422,7 +437,7 @@ paths:
name: RequestBody
required: true
schema:
$ref: '#/definitions/controllers.GenDataParams'
$ref: '#/definitions/controllers.GenMySQLParams'
produces:
- application/json
responses:
Expand Down
Loading