-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #14
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
Dev #14
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package org.poolc.api.kubernetes.dto; | ||
|
|
||
| public interface ActiveMemberDto { | ||
| String getMember_uuid(); | ||
| String getLogin_id(); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package org.poolc.api.kubernetes.dto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.Getter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Getter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class GetMyKubernetesKeyResponseDto { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private final String key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JsonCreator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public GetMyKubernetesKeyResponseDto(String key){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.key = key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard Jackson constructor binding with With -import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
@@
- @JsonCreator
- public GetMyKubernetesKeyResponseDto(String key){
+ @JsonCreator
+ public GetMyKubernetesKeyResponseDto(@JsonProperty("key") String key){
this.key = key;
}π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||||||
| package org.poolc.api.kubernetes.repository; | ||||||||||
|
|
||||||||||
| import org.poolc.api.kubernetes.domain.KubernetesMapping; | ||||||||||
| import org.poolc.api.kubernetes.dto.ActiveMemberDto; | ||||||||||
| import org.springframework.data.jpa.repository.JpaRepository; | ||||||||||
| import org.springframework.data.jpa.repository.Modifying; | ||||||||||
| import org.springframework.data.jpa.repository.Query; | ||||||||||
|
|
@@ -12,25 +13,28 @@ | |||||||||
| public interface KubernetesRepository extends JpaRepository<KubernetesMapping, Long> { | ||||||||||
|
|
||||||||||
|
|
||||||||||
| @Query(value = "SELECT DISTINCT MEMBER_UUID\n" + | ||||||||||
| "FROM ROLES\n" + | ||||||||||
| "WHERE MEMBER_UUID IN (\n" + | ||||||||||
| @Query(value = "SELECT DISTINCT T2.MEMBER_UUID\n" + | ||||||||||
| " , (SELECT login_id" + | ||||||||||
| " FROM MEMBER T1" + | ||||||||||
| " WHERE T1.UUID = T2.MEMBER_UUID)\n" + | ||||||||||
| "FROM ROLES T2\n" + | ||||||||||
| "WHERE T2.MEMBER_UUID IN (\n" + | ||||||||||
| " SELECT MEMBER_UUID\n" + | ||||||||||
| " FROM ROLES\n" + | ||||||||||
| " WHERE ROLES = 'MEMBER'\n" + | ||||||||||
| ")\n" + | ||||||||||
| "AND MEMBER_UUID NOT IN (\n" + | ||||||||||
| "AND T2.MEMBER_UUID NOT IN (\n" + | ||||||||||
| " SELECT MEMBER_UUID\n" + | ||||||||||
| " FROM ROLES\n" + | ||||||||||
| " WHERE ROLES = 'INACTIVE'\n" + | ||||||||||
| ")", nativeQuery = true) | ||||||||||
| List<String> findAllActiveMembers(); | ||||||||||
| List<ActiveMemberDto> findAllActiveMembers(); | ||||||||||
|
Comment on lines
+16
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alias the selected columns for ActiveMemberDto projection Line 17 currently returns the login ID via a scalar subquery without an alias. In Postgres (and most RDBMSs) that yields a - @Query(value = "SELECT DISTINCT T2.MEMBER_UUID\n" +
- " , (SELECT login_id" +
- " FROM MEMBER T1" +
- " WHERE T1.UUID = T2.MEMBER_UUID)\n" +
+ @Query(value = "SELECT DISTINCT T2.MEMBER_UUID AS memberUuid\n" +
+ " , (SELECT login_id" +
+ " FROM MEMBER T1" +
+ " WHERE T1.UUID = T2.MEMBER_UUID) AS loginId\n" +
"FROM ROLES T2\n" +
"WHERE T2.MEMBER_UUID IN (\n" +
" SELECT MEMBER_UUID\n" +
" FROM ROLES\n" +
" WHERE ROLES = 'MEMBER'\n" +
")\n" +
"AND T2.MEMBER_UUID NOT IN (\n" +
" SELECT MEMBER_UUID\n" +
" FROM ROLES\n" +
" WHERE ROLES = 'INACTIVE'\n" +
")", nativeQuery = true)π€ Prompt for AI Agents |
||||||||||
|
|
||||||||||
| @Modifying | ||||||||||
| @Transactional | ||||||||||
| @Query(value = "TRUNCATE TABLE KUBERNETES_MAPPINGS", nativeQuery = true) | ||||||||||
| void truncateKubernetesMappingTable(); | ||||||||||
|
|
||||||||||
| @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID IN (SELECT UUID FROM Member WHERE loginID = :userId)") | ||||||||||
| Optional<String> findKubernetesKeyByUserId(String userId); | ||||||||||
| @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :UUID") | ||||||||||
| Optional<String> findKubernetesKeyByUUID(String UUID); | ||||||||||
|
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore Line 38 is still raw SQL against - @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :UUID")
- Optional<String> findKubernetesKeyByUUID(String UUID);
+ @Query(value = "SELECT kubernetesKey FROM kubernetes_mappings WHERE UUID = :uuid", nativeQuery = true)
+ Optional<String> findKubernetesKeyByUUID(@Param("uuid") String uuid);π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||
| } | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.