diff --git a/docs/fcm/google-services.json b/docs/fcm/google-services.json new file mode 100644 index 0000000..6766643 --- /dev/null +++ b/docs/fcm/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "6923326255", + "project_id": "opplens-270d1", + "storage_bucket": "opplens-270d1.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:6923326255:android:6704c5b71e4451abed87da", + "android_client_info": { + "package_name": "com.opplens.app" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyCqZ6B5iih0RdFj0lf5_erwbZvMyb7obEg" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/docs/fcm/opplens-270d1-c93fc2059648.json b/docs/fcm/opplens-270d1-c93fc2059648.json new file mode 100644 index 0000000..fee93f9 --- /dev/null +++ b/docs/fcm/opplens-270d1-c93fc2059648.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "opplens-270d1", + "private_key_id": "c93fc2059648add37b362e57c5e08c1da052eb9f", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDcSxjuz+/NmjqG\nDPhgKoexDYOQVDopQOEHR/oPk9lLKMwja9AAjRPXNAx4iRPFVJoylbNeqo9sPO0U\nxUTJ1gkGLNSewpMOpFSGKw5M1Tv7A907+31CjK8qNZEi+fhSOidy9EE3Ps6kCmjN\nTqK+va2fCZwFUY6TyN94RThxWy56mmnf8eRs9x810FgwpnDtG3w2twOvZTiB+wQv\njLHNkCsT5qv/aN6L8tF/lzPcoUEasJB3ZsnwOxgx8AkZLjfJ4AUEaARArbxQu/LQ\n1+VMl1LtMqiYyW6sz4HKxKm+h0JH6rXDozsSw3DkxgwDevmElrLMTEMnJIagM2Kn\nFp/9w8krAgMBAAECggEAZAD3bZoZu5VTEf2bV1SXSsneustxp76bKQoEu8ObdiIs\nIbxU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x1sg//jTgvTangnnAOsn\n6gGz0lsPTn9w6KKOJuDEbNUVQdFlcHE/9gEr1RIUS5dnHCJRL5GDr4VsmB9lwhR/\nA2HfPXE2lGGNaqcUB9PVhPHl\n-----END PRIVATE KEY-----\n", + "client_email": "firebase-adminsdk-fbsvc@opplens-270d1.iam.gserviceaccount.com", + "client_id": "108524830678171284272", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fbsvc%40opplens-270d1.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/internal/notification/form.go b/internal/notification/form.go index 39a19fc..b565db0 100644 --- a/internal/notification/form.go +++ b/internal/notification/form.go @@ -26,6 +26,8 @@ type SearchForm struct { EventType string `query:"event_type" valid:"optional"` Type string `query:"type" valid:"optional"` Recipient string `query:"recipient" valid:"optional"` + Seen *bool `query:"seen" valid:"optional"` + Priority string `query:"priority" valid:"optional"` } type NotificationListResponse struct { diff --git a/internal/notification/handler.go b/internal/notification/handler.go index 76afc93..97e96a7 100644 --- a/internal/notification/handler.go +++ b/internal/notification/handler.go @@ -64,6 +64,8 @@ func (h *NotificationHandler) Send(c echo.Context) error { // @Param event_type query string false "Event type filter" // @Param type query string false "Type filter" // @Param recipient query string false "Recipient filter" +// @Param seen query bool false "Seen filter" +// @Param priority query string false "Priority filter" // @Param limit query int false "Limit results" // @Param offset query int false "Offset results" // @Param sort_by query string false "Sort field" @@ -108,6 +110,8 @@ func (h *NotificationHandler) GetNotifications(c echo.Context) error { // @Param event_type query string false "Event type filter" // @Param type query string false "Type filter" // @Param recipient query string false "Recipient filter" +// @Param seen query bool false "Seen filter" +// @Param priority query string false "Priority filter" // @Param limit query int false "Limit results" // @Param offset query int false "Offset results" // @Param sort_by query string false "Sort field" @@ -219,6 +223,8 @@ func (h *NotificationHandler) ViewNotification(c echo.Context) error { // @Param event_type query string false "Event type filter" // @Param type query string false "Type filter" // @Param recipient query string false "Recipient filter" +// @Param seen query bool false "Seen filter" +// @Param priority query string false "Priority filter" // @Param limit query int false "Limit results" // @Param offset query int false "Offset results" // @Param sort_by query string false "Sort field" diff --git a/internal/notification/service.go b/internal/notification/service.go index ab4fc79..4ed4210 100644 --- a/internal/notification/service.go +++ b/internal/notification/service.go @@ -165,6 +165,8 @@ func (s *notificationService) GetNotifications(ctx context.Context, req *SearchF "event_type": req.EventType, "type": req.Type, "recipient": req.Recipient, + "seen": req.Seen, + "priority": req.Priority, "limit": pagination.Limit, "offset": pagination.Offset, }) @@ -175,6 +177,8 @@ func (s *notificationService) GetNotifications(ctx context.Context, req *SearchF EventType: req.EventType, Type: req.Type, UserID: req.Recipient, + Seen: req.Seen, + Priority: req.Priority, PerPage: pagination.Limit, Page: pagination.Offset / pagination.Limit, }) diff --git a/pkg/notification/client.go b/pkg/notification/client.go index 8d908e4..e451f22 100644 --- a/pkg/notification/client.go +++ b/pkg/notification/client.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net/http" + "strings" "time" ) @@ -206,6 +207,8 @@ func (c *Client) GetNotifications(ctx context.Context, req *GetNotificationsRequ "event_type": req.EventType, "type": req.Type, "user_id": req.UserID, + "seen": req.Seen, + "priority": req.Priority, "base_url": c.config.BaseURL, }) } @@ -354,16 +357,19 @@ func (c *Client) buildQueryParams(req *GetNotificationsRequest) string { if req.PerPage > 0 { params = append(params, fmt.Sprintf("per_page=%d", req.PerPage)) } + if req.Seen != nil { + params = append(params, fmt.Sprintf("seen=%t", *req.Seen)) + } + if req.Priority != "" { + params = append(params, fmt.Sprintf("priority=%s", req.Priority)) + } // Join parameters with & if len(params) == 0 { return "" } - result := params[0] - for i := 1; i < len(params); i++ { - result += "&" + params[i] - } + result := strings.Join(params, "&") return result } diff --git a/pkg/notification/entities.go b/pkg/notification/entities.go index 8f6e7e6..94cd0c6 100644 --- a/pkg/notification/entities.go +++ b/pkg/notification/entities.go @@ -187,6 +187,8 @@ type GetNotificationsRequest struct { EventType string `json:"event_type,omitempty" valid:"optional"` Type string `json:"type,omitempty" valid:"optional"` UserID string `json:"user_id,omitempty" valid:"optional"` + Seen *bool `json:"seen,omitempty" valid:"optional"` + Priority string `json:"priority,omitempty" valid:"optional"` Page int `json:"page,omitempty" valid:"optional"` PerPage int `json:"per_page,omitempty" valid:"optional"` }