Skip to content

Commit

Permalink
Deploying to gh-pages from @ aae9a5b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Aug 23, 2024
1 parent 986ce3a commit 4fe140c
Show file tree
Hide file tree
Showing 143 changed files with 3,677 additions and 3,703 deletions.
2 changes: 1 addition & 1 deletion coverage.html
Original file line number Diff line number Diff line change
Expand Up @@ -25819,7 +25819,7 @@
<td>UserImportFetchUc</td>
<td align="right" data-sort="0">
<span class="coverage-percent">0 %</span>
<span class="coverage-count">(0/4)</span>
<span class="coverage-count">(0/3)</span>
</td>
</tr>
<tr class="low">
Expand Down
21 changes: 10 additions & 11 deletions injectables/SchulconnexFetchImportUsersService.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h3 id="constructor">Constructor</h3>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:13</a></div>
<div class="io-line">Defined in <a href="" data-line="12" class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:12</a></div>
</td>
</tr>

Expand Down Expand Up @@ -251,15 +251,15 @@ <h3 id="methods">
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>filterAlreadyMigratedUser(importUsers: <a href="../interfaces/User.html" target="_self">ImportUser[]</a>, systemId: <a href="../undefineds/EntityId.html" target="_self">EntityId</a>)</code>
<code>filterAlreadyMigratedUser(importUsers: <a href="../interfaces/User.html" target="_self">ImportUser[]</a>, system: <a href="../classes/System.html" target="_self">System</a>)</code>
</td>
</tr>


<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="41"
class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:41</a></div>
<div class="io-line">Defined in <a href="" data-line="40"
class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:40</a></div>
</td>
</tr>

Expand Down Expand Up @@ -292,9 +292,9 @@ <h3 id="methods">

</tr>
<tr>
<td>systemId</td>
<td>system</td>
<td>
<code><a href="../miscellaneous/typealiases.html#EntityId" target="_self" >EntityId</a></code>
<code><a href="../classes/System.html" target="_self" >System</a></code>
</td>

<td>
Expand Down Expand Up @@ -340,8 +340,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="20"
class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:20</a></div>
<div class="io-line">Defined in <a href="" data-line="19"
class="link-to-prism">apps/server/src/modules/user-import/service/schulconnex-fetch-import-users.service.ts:19</a></div>
</td>
</tr>

Expand Down Expand Up @@ -412,7 +412,6 @@ <h3 id="methods">
import { Injectable } from &#x27;@nestjs/common&#x27;;
import { UserDO } from &#x27;@shared/domain/domainobject&#x27;;
import { ImportUser, SchoolEntity } from &#x27;@shared/domain/entity&#x27;;
import { EntityId } from &#x27;@shared/domain/types&#x27;;
import { UserImportSchoolExternalIdMissingLoggableException } from &#x27;../loggable&#x27;;
import { SchulconnexImportUserMapper } from &#x27;../mapper&#x27;;

Expand Down Expand Up @@ -445,11 +444,11 @@ <h3 id="methods">
return mappedImportUsers;
}

public async filterAlreadyMigratedUser(importUsers: ImportUser[], systemId: EntityId): Promise&lt;ImportUser[]&gt; {
public async filterAlreadyMigratedUser(importUsers: ImportUser[], system: System): Promise&lt;ImportUser[]&gt; {
const filteredUsers: ImportUser[] &#x3D; (
await Promise.all(
importUsers.map(async (importUser: ImportUser): Promise&lt;ImportUser | null&gt; &#x3D;&gt; {
const foundUser: UserDO | null &#x3D; await this.userService.findByExternalId(importUser.externalId, systemId);
const foundUser: UserDO | null &#x3D; await this.userService.findByExternalId(importUser.externalId, system.id);
return foundUser ? null : importUser;
})
)
Expand Down
145 changes: 52 additions & 93 deletions injectables/UserImportFetchUc.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ <h6><b>Methods</b></h6>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Private</span>
<a href="#checkMigrationEnabled" >checkMigrationEnabled</a>
</li>
<li>
<span class="modifier">Public</span>
<span class="modifier">Async</span>
Expand All @@ -162,12 +158,12 @@ <h3 id="constructor">Constructor</h3>
<tbody>
<tr>
<td class="col-md-4">
<code>constructor(configService: <a href="../classes/User.html" target="_self">ConfigService&lt;UserImportConfig | &gt;</a>, schulconnexFetchImportUsersService: <a href="../injectables/SchulconnexFetchImportUsersService.html" target="_self">SchulconnexFetchImportUsersService</a>, authorizationService: <a href="../injectables/AuthorizationService.html" target="_self">AuthorizationService</a>, userImportService: <a href="../injectables/UserImportService.html" target="_self">UserImportService</a>)</code>
<code>constructor(configService: <a href="../classes/User.html" target="_self">ConfigService&lt;UserImportConfig | &gt;</a>, schulconnexFetchImportUsersService: <a href="../injectables/SchulconnexFetchImportUsersService.html" target="_self">SchulconnexFetchImportUsersService</a>, authorizationService: <a href="../injectables/AuthorizationService.html" target="_self">AuthorizationService</a>, userImportService: <a href="../injectables/UserImportService.html" target="_self">UserImportService</a>, userLoginMigrationService: <a href="../injectables/UserLoginMigrationService.html" target="_self">UserLoginMigrationService</a>, systemService: <a href="../injectables/SystemService.html" target="_self">SystemService</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">apps/server/src/modules/user-import/uc/user-import-fetch.uc.ts:13</a></div>
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">apps/server/src/modules/user-import/uc/user-import-fetch.uc.ts:15</a></div>
</td>
</tr>

Expand Down Expand Up @@ -232,6 +228,30 @@ <h3 id="constructor">Constructor</h3>
</td>

</tr>
<tr>
<td>userLoginMigrationService</td>

<td>
<code><a href="../injectables/UserLoginMigrationService.html" target="_self" >UserLoginMigrationService</a></code>
</td>

<td>
No
</td>

</tr>
<tr>
<td>systemService</td>

<td>
<code><a href="../injectables/SystemService.html" target="_self" >SystemService</a></code>
</td>

<td>
No
</td>

</tr>
</tbody>
</table>
</div>
Expand All @@ -246,75 +266,6 @@ <h3 id="constructor">Constructor</h3>
<h3 id="methods">
Methods
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="checkMigrationEnabled"></a>
<span class="name">
<span class="modifier">Private</span>
<span ><b>checkMigrationEnabled</b></span>
<a href="#checkMigrationEnabled"><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>checkMigrationEnabled(userId: <a href="../undefineds/EntityId.html" target="_self">EntityId</a>)</code>
</td>
</tr>


<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="42"
class="link-to-prism">apps/server/src/modules/user-import/uc/user-import-fetch.uc.ts:42</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>userId</td>
<td>
<code><a href="../miscellaneous/typealiases.html#EntityId" target="_self" >EntityId</a></code>
</td>

<td>
No
</td>


</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>

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

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

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="21"
class="link-to-prism">apps/server/src/modules/user-import/uc/user-import-fetch.uc.ts:21</a></div>
<div class="io-line">Defined in <a href="" data-line="25"
class="link-to-prism">apps/server/src/modules/user-import/uc/user-import-fetch.uc.ts:25</a></div>
</td>
</tr>

Expand Down Expand Up @@ -392,13 +343,15 @@ <h3 id="methods">

<div class="tab-pane fade tab-source-code" id="source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { AuthorizationService } from &#x27;@modules/authorization&#x27;;
import { System } from &#x27;@modules/system&#x27;;
import { System, SystemService } from &#x27;@modules/system&#x27;;
import { UserLoginMigrationService } from &#x27;@modules/user-login-migration&#x27;;
import { Injectable } from &#x27;@nestjs/common&#x27;;
import { ConfigService } from &#x27;@nestjs/config&#x27;;
import { UserLoginMigrationDO } from &#x27;@shared/domain/domainobject&#x27;;
import { ImportUser, User } from &#x27;@shared/domain/entity&#x27;;
import { Permission } from &#x27;@shared/domain/interface&#x27;;
import { EntityId } from &#x27;@shared/domain/types&#x27;;
import { UserMigrationIsNotEnabledLoggableException } from &#x27;../loggable&#x27;;
import { UserLoginMigrationNotActiveLoggableException, UserMigrationIsNotEnabledLoggableException } from &#x27;../loggable&#x27;;
import { SchulconnexFetchImportUsersService, UserImportService } from &#x27;../service&#x27;;
import { UserImportConfig } from &#x27;../user-import-config&#x27;;

Expand All @@ -408,38 +361,44 @@ <h3 id="methods">
private readonly configService: ConfigService&lt;UserImportConfig, true&gt;,
private readonly schulconnexFetchImportUsersService: SchulconnexFetchImportUsersService,
private readonly authorizationService: AuthorizationService,
private readonly userImportService: UserImportService
private readonly userImportService: UserImportService,
private readonly userLoginMigrationService: UserLoginMigrationService,
private readonly systemService: SystemService
) {}

public async populateImportUsers(currentUserId: EntityId): Promise&lt;void&gt; {
this.checkMigrationEnabled(currentUserId);
if (!this.configService.get(&#x27;FEATURE_USER_MIGRATION_ENABLED&#x27;)) {
throw new UserMigrationIsNotEnabledLoggableException(currentUserId);
}

const user: User &#x3D; await this.authorizationService.getUserWithPermissions(currentUserId);
this.authorizationService.checkAllPermissions(user, [Permission.IMPORT_USER_MIGRATE]);

const system: System &#x3D; await this.userImportService.getMigrationSystem();
const userLoginMigration: UserLoginMigrationDO | null &#x3D; await this.userLoginMigrationService.findMigrationBySchool(
user.school.id
);

if (!userLoginMigration || userLoginMigration?.closedAt) {
throw new UserLoginMigrationNotActiveLoggableException(user.school.id);
}

const system: System &#x3D; await this.systemService.findByIdOrFail(userLoginMigration.targetSystemId);
const fetchedData: ImportUser[] &#x3D; await this.schulconnexFetchImportUsersService.getData(user.school, system);

const filteredFetchedData: ImportUser[] &#x3D; await this.schulconnexFetchImportUsersService.filterAlreadyMigratedUser(
fetchedData,
this.configService.get(&#x27;FEATURE_USER_MIGRATION_SYSTEM_ID&#x27;)
system
);

const matchedImportUsers: ImportUser[] &#x3D; await this.userImportService.matchUsers(filteredFetchedData);
const matchedImportUsers: ImportUser[] &#x3D; await this.userImportService.matchUsers(
filteredFetchedData,
userLoginMigration
);

await this.userImportService.deleteImportUsersBySchool(user.school);

await this.userImportService.saveImportUsers(matchedImportUsers);
}

private checkMigrationEnabled(userId: EntityId): void {
if (
!this.configService.get(&#x27;FEATURE_USER_MIGRATION_ENABLED&#x27;) ||
!this.configService.get(&#x27;FEATURE_USER_MIGRATION_SYSTEM_ID&#x27;)
) {
throw new UserMigrationIsNotEnabledLoggableException(userId);
}
}
}
</code></pre>
</div>
Expand Down
Loading

0 comments on commit 4fe140c

Please sign in to comment.