Uploaded image for project: 'FlightPath'
  1. FlightPath
  2. FLPATH-258

Issues when a message is for multiple users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      When a message is for multiple users:

      curl -u dev:dev -X 'POST' \
        'http://localhost:8080/api/v1/messages' \
        -H 'accept: */*' \
        -H 'Content-Type: application/json' \
        -d '{
        "usernames": [
          "dev", "myname", "mysecondname"
        ],
        "groupnames": [
          "mygroup"
        ],
        "subject": "My subject",
        "messageType": "My type",
        "body": "My body"
      }'
       

      When try to retrieve, the JPA repo query is failing, my guess is that user is not filter in the query here:

      https://github.com/parodos-dev/parodos/blob/7b559a763b5c54a7f799cc81597535ec2d8613e5/notification-service/src/main/java/com/redhat/parodos/notification/jpa/repository/NotificationRecordRepository.java#L37

      to test it create the record, and after that, execute the GET request:

      curl -u dev:dev -X 'GET' \
          'http://localhost:8080/api/v1/notifications' \
        -H 'accept: */*'
       

      If I create only one user for message, things works ok:

      $ --> curl -u dev:dev -X 'POST' \
        'http://localhost:8080/api/v1/messages' \
        -H 'accept: */*' \
        -H 'Content-Type: application/json' \
        -d '{
        "usernames": [
          "dev"
        ],
        "groupnames": [
          "mygroup"
        ],
        "subject": "My subject2",
        "messageType": "My type",
        "body": "My body"
      }'
      $ --> curl -u dev:dev -X 'GET' \
          'http://localhost:8080/api/v1/notifications' \
        -H 'accept: */*'
      {
        "_embedded" : {
          "notificationrecords" : [ {
            "id" : "5a5cf729-0206-46fa-813e-c9f47184ac99",
            "subject" : "My subject",
            "createdOn" : "2023-03-29T10:00:22.503029Z",
            "messageType" : "My type",
            "body" : "My body",
            "fromuser" : "dev",
            "read" : false,
            "tags" : [ ]
          }, {
            "id" : "3197a8f8-9139-4a4f-85f7-23912599517a",
            "subject" : "My subject2",
            "createdOn" : "2023-03-29T10:01:50.787607Z",
            "messageType" : "My type",
            "body" : "My body",
            "fromuser" : "dev",
            "read" : false,
            "tags" : [ ]
          } ]
        },
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/v1/notifications?page=0&size=100"
          }
        },
        "page" : {
          "size" : 100,
          "totalElements" : 2,
          "totalPages" : 1,
          "number" : 0
        }
      }%
      $ --> 

              Unassigned Unassigned
              eloycoto Eloy Coto
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: