Skip to content

Commit

Permalink
Merge pull request #72 from Serpico1899/main
Browse files Browse the repository at this point in the history
📝 add getRelatedRelations document(api reference)
  • Loading branch information
hemedani authored Jan 13, 2024
2 parents c6306fa + 01e4453 commit bcadf99
Showing 1 changed file with 84 additions and 2 deletions.
86 changes: 84 additions & 2 deletions pages/src/api/schemas/relatedRelationFns/getRelatedRelations_fn.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,86 @@
# getRelatedRelations

getOutRelations of one schema
@param schemaName - name of schema that we want outerRelations
```ts
getRelatedRelations: (schemaName: string)
```

_GetOutRelations of one schema_

<details open>
<summary>
Example
</summary>
<pre>
<code class="language-ts" style="padding: 0;">
const coreApp = lesan();
const locationPure = {
name: string(),
population: number(),
abb: string(),
};
const cities = coreApp.odm.newModel(
"city",
locationPure,
{
country: {
schemaName: "country",
type: "single",
optional: false,
relatedRelations: {
cities: {
type: "multiple",
limit: 5,
sort: {
field: "_id",
order: "asc",
},
},
},
},
},
);
<p style="border: 2px solid gray; border-right: transparent; border-left: transparent; padding: 5px 1rem; background-color: #000000" >const getCityRelatedRelations = coreApp.schemas.getRelatedRelations("city");</p>
</code>
</pre>
</details>

<details>
<summary>
Return Of Example
</summary>
<pre>
<code class="language-json" style="padding: 0;">
{
"users": {
"mainRelationName": "livedCities",
"mainRelationType": "multiple",
"schemaName": "user",
"type": "multiple",
"limit": 5,
"sort": {
"field": "_id",
"order": "desc"
}
},
"lovedByUser": {
"mainRelationName": "mostLovedCity",
"mainRelationType": "single",
"schemaName": "user",
"type": "multiple",
"limit": 3,
"sort": {
"field": "_id",
"order": "desc"
}
}
}
</code>
</pre>
</details>

<h3>Parameters</h3>
<pre>
<code class="language-ts" style="padding: 0; margin-top: 12px; margin-top: -18px;">
schemaName: string
</code>
</pre>

0 comments on commit bcadf99

Please sign in to comment.