How to save data against two tables?

How to save data against two tables
example:
Table
Person
*name
*telephone

Table
telephone
*number

How to save this reaction?

@4last Can you provide context to what you are asking as it’s not really clear what you mean. As I mentioned on slack the APIs you were using were not Strapi built ones and without seeing the logic of how your custom ones work it’s not really clear what you are trying to do.

“Not being able to edit the content after I accidentally posted it”


I realized that the strapi does not work correctly with a relational bank.
Foreign key constraints, like their references, just create an integer field for this, without restrictions.
But I’m talking about a one-to-N relationship “hasMany”:
“a person has many phone and a phone belongs to only one person”
where I have a table or collection

Let’s call it a collection, because that’s how it is in WebAdmin
come on:
collection people
fields (name)

phone collection
fields (number, people)

where person would be the foreign key of the person collection


I want to know how to save this data without doing this:

  const resp = await strapi.services.people.create({
             name: 'my name'
  })
  const resp = await strapi.services.phone.create({
            number: '9999999999999', people: resp.id
   })

Currently that is the only method, we don’t support nested relational create/update/delete statements yet. Both the internal and REST/GraphQL function like this, using multiple API calls to link relational data.

The only exception to this is components, as they have no model or direct queries, they are handled by the parent.

Ok, Thanks…

Have this example on the website:

const result = await strapi
  .query('restaurant')
  .model.query(qb => {
      qb.where('id', 1);
  }) .fetch();
const fields = result.toJSON();

where can I find examples of UPDATE and DELETE using this structure?