Skip to content

Commit

Permalink
fix: fix field issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 14, 2023
1 parent 0e3e2d7 commit a38182d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
36 changes: 18 additions & 18 deletions docs/instruction/related-code-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ temp dir:
{
"language": "java",
"beforeCursor": "package com.example;\n\nimport com.example.admin.common.AdminCriteria;\nimport com.example.config.ResetDbListener;\nimport com.example.domain.iam.auth.model.Authorize;\nimport com.example.domain.iam.auth.service.AuthorizeService;\nimport com.example.domain.iam.user.model.User;\nimport com.example.domain.iam.user.repository.UserRepository;\nimport io.restassured.RestAssured;\nimport org.junit.jupiter.api.BeforeEach;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\nimport org.springframework.boot.test.context.SpringBootTest;\nimport org.springframework.boot.web.server.LocalServerPort;\nimport org.springframework.test.context.ActiveProfiles;\nimport org.springframework.test.context.TestExecutionListeners;\nimport org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener;\nimport org.springframework.test.context.support.DependencyInjectionTestExecutionListener;\n\nimport static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;\n\n@SpringBootTest(webEnvironment = RANDOM_PORT, classes = {AdminTestApplication.class})\n@TestExecutionListeners({\n DependencyInjectionTestExecutionListener.class,\n ResetDbListener.class,\n SqlScriptsTestExecutionListener.class,\n})\n@AutoConfigureMockMvc\n@ActiveProfiles(\"test\")\npublic abstract class TestBase {\n\n @LocalServerPort\n private int port;\n\n @Autowired\n private UserRepository userRepository;\n\n @Autowired\n private AuthorizeService authorizeService;\n\n @BeforeEach\n public void setUp() {",
"relatedCode": "// class AdminCriteria {\n// \n// + ofName(name: String): Specification<User>\n// }\n// \n// class ResetDbListener {\n// \n// 'getter/setter: getOrder\n// \n// + beforeTestMethod(testContext: TestContext): void\n// + afterTestMethod(testContext: TestContext): void\n// }\n// \n// class Authorize {\n// : String\n// : String\n// : User\n// : Long\n// \n// 'getter/setter: setExpire\n// \n// + build(userId: Stringrole: User.Role): Authorize\n// }\n// \n// class AuthorizeService {\n// : AuthorizeRepository\n// : BCryptPasswordEncoder\n// \n// 'getter/setter: getOperator\n// \n// + create(user: Userpassword: String): Authorize\n// + delete(id: String): void\n// }\n// \n// class Status {\n// : String\n// : String\n// : String\n// : String\n// : Instant\n// : Instant\n// : Role\n// : Status\n// \n// + build(name: Stringemail: Stringpassword: String): User\n// }\n// \n// class UserRepository {\n// \n// }\n// ",
"relatedCode": "// class AdminCriteria {\n// \n// + ofName(name: String): Specification<User>\n// }\n// \n// class ResetDbListener {\n// \n// 'getter/setter: getOrder\n// \n// + beforeTestMethod(testContext: TestContext): void\n// + afterTestMethod(testContext: TestContext): void\n// }\n// \n// class Authorize {\n// : String\n// : String\n// : User\n// : Long\n// \n// 'getter/setter: setExpire\n// \n// + build(userId: String, role: User.Role): Authorize\n// }\n// \n// class AuthorizeService {\n// : AuthorizeRepository\n// : BCryptPasswordEncoder\n// \n// 'getter/setter: getOperator\n// \n// + create(user: User, password: String): Authorize\n// + delete(id: String): void\n// }\n// \n// class Status {\n// : String\n// : String\n// : String\n// : String\n// : Instant\n// : Instant\n// : Role\n// : Status\n// \n// + build(name: String, email: String, password: String): User\n// }\n// \n// class UserRepository {\n// \n// }\n// ",
"output": " System.out.println(\"port:\" + port);\n\n RestAssured.port = port;\n RestAssured.basePath = \"/\";\n RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();\n }"
}
```
Expand All @@ -64,37 +64,37 @@ related code:
// }
//
// class Authorize {
// : String
// : String
// : User
// : Long
// id: String
// userId: String
// role: User
// expire: Long
//
// 'getter/setter: setExpire
//
// + build(userId: Stringrole: User.Role): Authorize
// + build(userId: String, role: User.Role): Authorize
// }
//
// class AuthorizeService {
// : AuthorizeRepository
// : BCryptPasswordEncoder
// repository: AuthorizeRepository
// bCryptPasswordEncoder: BCryptPasswordEncoder
//
// 'getter/setter: getOperator
//
// + create(user: Userpassword: String): Authorize
// + create(user: User, password: String): Authorize
// + delete(id: String): void
// }
//
// class Status {
// : String
// : String
// : String
// : String
// : Instant
// : Instant
// : Role
// : Status
// id: String
// name: String
// email: String
// password: String
// createdAt: Instant
// updatedAt: Instant
// role: Role
// status: Status
//
// + build(name: Stringemail: Stringpassword: String): User
// + build(name: String, email: String, password: String): User
// }
//
// class UserRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fun CodeDataStruct.toUml(): String {

output.append("class $NodeName {\n")
Fields.forEach {
output.append(" ${it.TypeValue}: ${it.TypeType}\n")
output.append(" ${it.TypeKey}: ${it.TypeType}\n")
}

var getterSetter: List<String> = listOf()
Expand All @@ -31,7 +31,9 @@ fun CodeDataStruct.toUml(): String {
val methodCodes = methodsWithoutGetterSetter
.joinToString("\n") { method ->
val params =
method.Parameters.joinToString(",") { parameter -> "${parameter.TypeValue}: ${parameter.TypeType}" }
method.Parameters.joinToString(", ") { parameter ->
"${parameter.TypeValue}: ${parameter.TypeType}"
}
" + ${method.Name}($params)" + if (method.ReturnType.isNotBlank()) ": ${method.ReturnType}" else ""
}

Expand Down

0 comments on commit a38182d

Please sign in to comment.