Skip to content

Commit

Permalink
Deploying to gh-pages from @ 675bf28 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Dec 12, 2023
1 parent 9b42924 commit d1f93f3
Show file tree
Hide file tree
Showing 118 changed files with 3,475 additions and 2,564 deletions.
44 changes: 22 additions & 22 deletions coverage.html
Original file line number Diff line number Diff line change
Expand Up @@ -11964,9 +11964,9 @@
</td>
<td>injectable</td>
<td>ShareTokenRepo</td>
<td align="right" data-sort="9">
<span class="coverage-percent">9 %</span>
<span class="coverage-count">(1/11)</span>
<td align="right" data-sort="8">
<span class="coverage-percent">8 %</span>
<span class="coverage-count">(1/12)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -18984,9 +18984,9 @@
</td>
<td>injectable</td>
<td>BaseDORepo</td>
<td align="right" data-sort="9">
<span class="coverage-percent">9 %</span>
<span class="coverage-count">(1/11)</span>
<td align="right" data-sort="8">
<span class="coverage-percent">8 %</span>
<span class="coverage-count">(1/12)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19022,7 +19022,7 @@
<td>ContextExternalToolRepo</td>
<td align="right" data-sort="5">
<span class="coverage-percent">5 %</span>
<span class="coverage-count">(1/18)</span>
<span class="coverage-count">(1/19)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19154,7 +19154,7 @@
<td>ExternalToolRepo</td>
<td align="right" data-sort="6">
<span class="coverage-percent">6 %</span>
<span class="coverage-count">(1/15)</span>
<span class="coverage-count">(1/16)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19214,7 +19214,7 @@
<td>LtiToolRepo</td>
<td align="right" data-sort="7">
<span class="coverage-percent">7 %</span>
<span class="coverage-count">(1/13)</span>
<span class="coverage-count">(1/14)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19310,7 +19310,7 @@
<td>LegacySchoolRepo</td>
<td align="right" data-sort="7">
<span class="coverage-percent">7 %</span>
<span class="coverage-count">(1/13)</span>
<span class="coverage-count">(1/14)</span>
</td>
</tr>
<tr class="low">
Expand All @@ -19320,9 +19320,9 @@
</td>
<td>injectable</td>
<td>SchoolExternalToolRepo</td>
<td align="right" data-sort="6">
<span class="coverage-percent">6 %</span>
<span class="coverage-count">(1/16)</span>
<td align="right" data-sort="5">
<span class="coverage-percent">5 %</span>
<span class="coverage-count">(1/17)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19452,9 +19452,9 @@
</td>
<td>injectable</td>
<td>UserDORepo</td>
<td align="right" data-sort="6">
<span class="coverage-percent">6 %</span>
<span class="coverage-count">(1/16)</span>
<td align="right" data-sort="5">
<span class="coverage-percent">5 %</span>
<span class="coverage-count">(1/17)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -19488,9 +19488,9 @@
</td>
<td>injectable</td>
<td>UserLoginMigrationRepo</td>
<td align="right" data-sort="8">
<span class="coverage-percent">8 %</span>
<span class="coverage-count">(1/12)</span>
<td align="right" data-sort="7">
<span class="coverage-percent">7 %</span>
<span class="coverage-count">(1/13)</span>
</td>
</tr>
<tr class="low">
Expand All @@ -19500,9 +19500,9 @@
</td>
<td>injectable</td>
<td>VideoConferenceRepo</td>
<td align="right" data-sort="9">
<span class="coverage-percent">9 %</span>
<span class="coverage-count">(1/11)</span>
<td align="right" data-sort="8">
<span class="coverage-percent">8 %</span>
<span class="coverage-count">(1/12)</span>
</td>
</tr>
<tr class="low">
Expand Down
144 changes: 118 additions & 26 deletions injectables/BaseDORepo.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ <h6><b>Methods</b></h6>
<span class="modifier">Abstract</span>
<a href="#mapEntityToDO" >mapEntityToDO</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#remapProtectedEntityFields" >remapProtectedEntityFields</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#removeProtectedEntityFields" >removeProtectedEntityFields</a>
Expand Down Expand Up @@ -296,8 +300,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="32"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:32</a></div>
<div class="io-line">Defined in <a href="" data-line="38"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:38</a></div>
</td>
</tr>

Expand Down Expand Up @@ -333,7 +337,7 @@ <h3 id="methods">
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code>Promise&lt;DO&gt;</code>
<b>Returns : </b> <code>Promise&lt;literal type&gt;</code>

</div>
<div class="io-description">
Expand Down Expand Up @@ -365,8 +369,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="61"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:61</a></div>
<div class="io-line">Defined in <a href="" data-line="55"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:55</a></div>
</td>
</tr>

Expand Down Expand Up @@ -439,8 +443,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="78"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:78</a></div>
<div class="io-line">Defined in <a href="" data-line="72"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:72</a></div>
</td>
</tr>

Expand Down Expand Up @@ -508,8 +512,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="90"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:90</a></div>
<div class="io-line">Defined in <a href="" data-line="84"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:84</a></div>
</td>
</tr>

Expand Down Expand Up @@ -695,6 +699,87 @@ <h3 id="methods">
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="remapProtectedEntityFields"></a>
<span class="name">
<span class="modifier">Private</span>
<span ><b>remapProtectedEntityFields</b></span>
<a href="#remapProtectedEntityFields"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>remapProtectedEntityFields(domainObject: DO, persistedEntity: E)</code>
</td>
</tr>


<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="100"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:100</a></div>
</td>
</tr>


<tr>
<td class="col-md-4">

<div class="io-description">
<b>Parameters :</b>

<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>domainObject</td>
<td>
<code>DO</code>
</td>

<td>
No
</td>


</tr>
<tr>
<td>persistedEntity</td>
<td>
<code>E</code>
</td>

<td>
No
</td>


</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code>DO</code>

</div>
<div class="io-description">

</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
Expand All @@ -717,8 +802,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="98"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:98</a></div>
<div class="io-line">Defined in <a href="" data-line="92"
class="link-to-prism">apps/server/src/shared/repo/base.do.repo.ts:92</a></div>
</td>
</tr>

Expand Down Expand Up @@ -963,12 +1048,18 @@ <h3 id="accessors">
async saveAll(domainObjects: DO[]): Promise&lt;DO[]&gt; {
const promises &#x3D; domainObjects.map(async (dob) &#x3D;&gt; this.createOrUpdateEntity(dob));

const savedDomainObjects &#x3D; await Promise.all(promises);
const results &#x3D; await Promise.all(promises);

await this._em.flush();

const savedDomainObjects &#x3D; results.map(({ domainObject, persistedEntity }) &#x3D;&gt;
this.remapProtectedEntityFields(domainObject, persistedEntity)
);

return savedDomainObjects;
}

private async createOrUpdateEntity(domainObject: DO): Promise&lt;DO&gt; {
private async createOrUpdateEntity(domainObject: DO): Promise&lt;{ domainObject: DO; persistedEntity: E }&gt; {
const entityData &#x3D; this.mapDOToEntityProperties(domainObject);
this.removeProtectedEntityFields(entityData);

Expand All @@ -982,19 +1073,7 @@ <h3 id="accessors">
? this._em.assign(existingEntity, entityData)
: this._em.create(entityName, entityData as RequiredEntityData&lt;E&gt;);

await this._em.flush();

if (!domainObject.id) {
domainObject.id &#x3D; persistedEntity.id;
}
if (&#x27;createdAt&#x27; in domainObject &amp;&amp; &#x27;createdAt&#x27; in persistedEntity) {
domainObject.createdAt &#x3D; persistedEntity.createdAt;
}
if (&#x27;updatedAt&#x27; in domainObject &amp;&amp; &#x27;updatedAt&#x27; in persistedEntity) {
domainObject.updatedAt &#x3D; persistedEntity.updatedAt;
}

return domainObject;
return { domainObject, persistedEntity };
}

async delete(domainObjects: DO[] | DO): Promise&lt;void&gt; {
Expand Down Expand Up @@ -1041,6 +1120,19 @@ <h3 id="accessors">
}
});
}

private remapProtectedEntityFields(domainObject: DO, persistedEntity: E) {
if (!domainObject.id) {
domainObject.id &#x3D; persistedEntity.id;
}
if (&#x27;createdAt&#x27; in domainObject &amp;&amp; &#x27;createdAt&#x27; in persistedEntity) {
domainObject.createdAt &#x3D; persistedEntity.createdAt;
}
if (&#x27;updatedAt&#x27; in domainObject &amp;&amp; &#x27;updatedAt&#x27; in persistedEntity) {
domainObject.updatedAt &#x3D; persistedEntity.updatedAt;
}
return domainObject;
}
}
</code></pre>
</div>
Expand Down
Loading

0 comments on commit d1f93f3

Please sign in to comment.