Join unrelated entities in Cell

Hello

I hope someone can help me with this issue, I’ve been stuck on this for days.

I have the following entities:

model BusinessUnit {
  id                   Int                     @id @default(autoincrement())
  name                 String                  @unique
  seriesName           String?                 @unique
  currencyCodeId       Int?
  taxAccountingBasisId Int?
  fieldValue           FieldValue[]
}

model FieldValue {
  id             Int           @id @default(autoincrement())
  field          Field         @relation(fields: [fieldId], references: [id])
  fieldId        Int
  value          String
  BusinessUnit   BusinessUnit? @relation(fields: [businessUnitId], references: [id])
  businessUnitId Int?
}

model Field {
  id         Int            @id @default(autoincrement())
  type       FieldTypeEnum? @default(string)
  code       String         @unique
  name       String         @unique
  isCustom   Boolean?       @default(true)
  isRequired Boolean?       @default(false)
  fieldValue FieldValue[]
  entities   EntityEnum[]
}

enum EntityEnum {
  person
  businessUnit
  product
  category
}

enum FieldTypeEnum {
  string
  email
  integer
  taxNumber
  phone
  boolean
  currency
  url
  attachment
  calendarPast
  calendarFuture
  multiEnum
  enum
}

My issue is with the create and update business unit cells. I can’t figure out how to get a business unit with an array of fields and the field value inside regardless of whether they have a field value.

My goal is to receive something like this:

{
    "id": 1,
    "seriesName": "Biz",
    "fields": [
        {
            "type": "number",
            "name": "Tax number",
            "isCustom": false,
            "id": 1,
            "code": "taxNumber",
            "fieldValue": {
                "value": "123456789"
            }
        },
        {
            "type": "string",
            "name": "Name",
            "isCustom": false,
            "id": 2,
            "code": "name",
            "fieldValue": {
                "value": null
            }
        }
    ]
}

I was able to get that object from prisma, but in the cell I only the fields that have a field value.