From 68840303c88a4db1c5e93fc3909cdcea93854b9a Mon Sep 17 00:00:00 2001 From: "taekyu.kang" Date: Tue, 23 Apr 2024 15:32:33 +0900 Subject: [PATCH] feature. fix filter bugs --- api/swagger/docs.go | 3 +++ api/swagger/swagger.json | 3 +++ api/swagger/swagger.yaml | 2 ++ internal/filter/operator.go | 8 ++++---- pkg/domain/system-notification.go | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/api/swagger/docs.go b/api/swagger/docs.go index 428b2ba2..38e47a3d 100644 --- a/api/swagger/docs.go +++ b/api/swagger/docs.go @@ -15249,6 +15249,9 @@ const docTemplate = `{ "messageTitle": { "type": "string" }, + "name": { + "type": "string" + }, "node": { "type": "string" }, diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 379290e4..483d81ab 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -15243,6 +15243,9 @@ "messageTitle": { "type": "string" }, + "name": { + "type": "string" + }, "node": { "type": "string" }, diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 947fbb88..c407380e 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -3348,6 +3348,8 @@ definitions: type: string messageTitle: type: string + name: + type: string node: type: string notificationType: diff --git a/internal/filter/operator.go b/internal/filter/operator.go index de992369..4dcd01b5 100644 --- a/internal/filter/operator.go +++ b/internal/filter/operator.go @@ -35,7 +35,7 @@ var ( if dataType != DataTypeText && dataType != DataTypeEnum { return filter.Where(tx, "FALSE") } - query := castEnumAsText(column, dataType) + " LIKE ?" + query := castEnumAsText(column, dataType) + " ILIKE ?" value := sqlutil.EscapeLike(filter.Args[0]) + "%" return filter.Where(tx, query, value) }, @@ -46,7 +46,7 @@ var ( if dataType != DataTypeText && dataType != DataTypeEnum { return filter.Where(tx, "FALSE") } - query := castEnumAsText(column, dataType) + " LIKE ?" + query := castEnumAsText(column, dataType) + " ILIKE ?" value := "%" + sqlutil.EscapeLike(filter.Args[0]) return filter.Where(tx, query, value) }, @@ -57,7 +57,7 @@ var ( if dataType != DataTypeText && dataType != DataTypeEnum { return filter.Where(tx, "FALSE") } - query := castEnumAsText(column, dataType) + " LIKE ?" + query := castEnumAsText(column, dataType) + " ILIKE ?" value := "%" + sqlutil.EscapeLike(filter.Args[0]) + "%" return filter.Where(tx, query, value) }, @@ -68,7 +68,7 @@ var ( if dataType != DataTypeText && dataType != DataTypeEnum { return filter.Where(tx, "FALSE") } - query := castEnumAsText(column, dataType) + " NOT LIKE ?" + query := castEnumAsText(column, dataType) + " NOT ILIKE ?" value := "%" + sqlutil.EscapeLike(filter.Args[0]) + "%" return filter.Where(tx, query, value) }, diff --git a/pkg/domain/system-notification.go b/pkg/domain/system-notification.go index 8c2f63f1..27d9dc5b 100644 --- a/pkg/domain/system-notification.go +++ b/pkg/domain/system-notification.go @@ -80,6 +80,7 @@ type CreateSystemNotificationRequest struct { type SystemNotificationResponse struct { ID string `json:"id"` + Name string `json:"name"` OrganizationId string `json:"organizationId"` Severity string `json:"severity"` MessageTitle string `json:"messageTitle"`