agile-learning-institute / mentorHub-search-api

Apache License 2.0
1 stars 0 forks source link

Refactor for more abstraction #17

Open MyNameIsAndrew-Mangix opened 4 months ago

MyNameIsAndrew-Mangix commented 4 months ago

The data returned from the search API should be something like this:

[
    {
        "collection": "person",
        "_id": "8645acbb85u1094",
        "firstName": "sam",
        "lastName": "smith",
        "email": "foo@bar.com"
    },
    {
        "collection": "partner",
        "_id": "OID VALUE"
        "name": "The Best Partner"
        "contacts": ["oid", "oid", "oid"]
    },
    {
        "collection": "topic",
        "_id": "OID VALUE"
        "name": "Some Topic",
        "skills": ["skill-name-1", "skill-name-2"]
    }
]
FlatBallFlyer commented 2 months ago

Can we please research the elastic mongodb connector. I'm hoping we can do this in the compose file:

FlatBallFlyer commented 2 months ago

and I think the data structure in the index should look something like this - this allows us to search on a collection name as well as everything else. Of course this is highly dependent on the connector.


[
  {
    "_id": "elastic_id_value",
    "collection": "collection name",
    "collection_id": "collection unique ID value",
    "object": {
      "_id": "mongo_id value (same as ../collection_id)",
      "other": "all the other properties of the document"
    }
  },
  {
    "_id": "ACAC00000000000000000001",
    "collection": "Person",
    "collection_id": "AAAA00000000000000000000",
    "object": {
        "_id": "AAAA00000000000000000001",
      "userName": "JamesSmith",
      "firstName": "James",
      "lastName": "Smith",
      "status": "Pending",
      "roles": ["Member"],
      "mentorId": "AAAA00000000000000000005",
      "partnerId": "bbbb00000000000000000007",
      "title": "Apprentice",
      "cadence": "Daily",
      "eMail": "JamesSmith@fakemail.com",
      "gitHub": "JamesSmith",
      "device": "Mac (Intel)",
      "location": "GVL SC",
      "phone": "449-882-6722",
      "description": "She was too busy always talking about what she wanted to do to actually do any of it.",
      "lastSaved": {
        "atTime": "2/27/2024 18:17:58",
        "byUser": AAAA00000000000000000001,
        "fromIp": "192.168.1.3",
        "correlationId": "ae078031-7de2-4519-bcbe-fbd5e72b69d3"
      }
    }
  },
  {
    "_id": "ACAC00000000000000000002",
    "collection": "Topic",
    "collection_id": "BBBB00000000000000000002",
    "object": {
      "_id": "BBBB00000000000000000002",
      "name": "History of Computing",
      "status": "Active",
      "description": "With this topic you'll learn about the history of computing and some of the most important events that shaped the Information Age.",
      "category": "Foundations of ITSM",
      "resources": ["CCCC00000000000000000002", "CCCC00000000000000000003", "CCCC00000000000000000004", "CCCC00000000000000000005", "CCCC00000000000000000006", "CCCC00000000000000000007",   "CCCC00000000000000000008"],
      "skills": "BBBB00000000000000000003", "BBBB00000000000000000004", "BBBB00000000000000000005"],
      "lastSaved": {
        "atTime": "4/3/2024 18:17:58",
        "byUser": "AAAA000000000000000000001",
        "fromIp": "192.168.1.39",
        "correlationId": "ae078031-7de2-4519-bcbe-fbd5e72b69d3"
      }
    }
  }  
]