Skip to content

Commit

Permalink
imported federal state from new module
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfganggreschus committed Sep 26, 2023
1 parent 3a17ed0 commit 936ef41
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Embeddable, Embedded, Entity, Property } from '@mikro-orm/core';
import { BaseEntityWithTimestamps } from '@shared/domain';
import { BaseEntityWithTimestamps } from '@shared/domain/entity/base.entity';

export interface IFederalStateProperties {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { FederalStateService } from './service';

@Module({
providers: [FederalStateService, FederalStateRepo],
exports: [FederalStateService],
exports: [FederalStateService, FederalStateRepo],
})
export class FederalStateModule {}
6 changes: 4 additions & 2 deletions apps/server/src/modules/legacy-school/legacy-school.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Module } from '@nestjs/common';
import { FederalStateRepo, LegacySchoolRepo } from '@shared/repo';
import { LegacySchoolRepo } from '@shared/repo';
import { LoggerModule } from '@src/core/logger';
import { FederalStateService } from '@src/modules/federal-state';
import { FederalStateRepo } from '../federal-state/repo';
import { SchoolYearRepo } from './repo';
import { FederalStateService, LegacySchoolService, SchoolValidationService, SchoolYearService } from './service';
import { LegacySchoolService, SchoolValidationService, SchoolYearService } from './service';

/**
* @deprecated because it uses the deprecated LegacySchoolDo.
Expand Down
9 changes: 1 addition & 8 deletions apps/server/src/modules/management/seed-data/schools.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/* eslint-disable @typescript-eslint/dot-notation */
import {
FederalStateEntity,
ISchoolProperties,
SchoolFeatures,
SchoolRoles,
SchoolYearEntity,
SystemEntity,
} from '@shared/domain';
import { ISchoolProperties, SchoolFeatures, SchoolRoles, SchoolYearEntity, SystemEntity } from '@shared/domain';
import { federalStateFactory, schoolFactory } from '@shared/testing';
import { FederalStateEntity } from '@src/modules/federal-state/entity';
import { DeepPartial } from 'fishery';
Expand Down
5 changes: 2 additions & 3 deletions apps/server/src/modules/provisioning/provisioning.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { LoggerModule } from '@src/core/logger';
import { AccountModule } from '@src/modules/account/account.module';
import { FederalStateModule } from '@src/modules/federal-state';
import { GroupModule } from '@src/modules/group';
import { RoleModule } from '@src/modules/role';
import { LegacySchoolModule } from '@src/modules/legacy-school';
import { RoleModule } from '@src/modules/role';
import { SystemModule } from '@src/modules/system/system.module';
import { UserModule } from '@src/modules/user';
import { ProvisioningService } from './service/provisioning.service';
import { IservProvisioningStrategy, OidcMockProvisioningStrategy, SanisProvisioningStrategy } from './strategy';
import { OidcProvisioningService } from './strategy/oidc/service/oidc-provisioning.service';
import { SanisResponseMapper } from './strategy/sanis/sanis-response.mappers';
import { SanisResponseMapper } from './strategy/sanis/sanis-response.mapper';

@Module({
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Injectable, UnprocessableEntityException } from '@nestjs/common';
import { EntityId, ExternalSource, FederalStateEntity, SchoolFeatures, SchoolYearEntity } from '@shared/domain';
import { EntityId, ExternalSource, SchoolFeatures, SchoolYearEntity } from '@shared/domain';
import { LegacySchoolDo, RoleReference, UserDO } from '@shared/domain/domainobject';
import { Logger } from '@src/core/logger';
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountSaveDto } from '@src/modules/account/services/dto';
import { FederalStateService } from '@src/modules/federal-state';
import { FederalStateDO } from '@src/modules/federal-state/domainobject';
import { Group, GroupService, GroupUser } from '@src/modules/group';
import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/legacy-school';
import { LegacySchoolService, SchoolYearService } from '@src/modules/legacy-school';
import { FederalStateNames } from '@src/modules/legacy-school/types';
import { RoleService } from '@src/modules/role';
import { RoleDto } from '@src/modules/role/service/dto/role.dto';
import { UserService } from '@src/modules/user';
import { ObjectId } from 'bson';
import CryptoJS from 'crypto-js';
import { FederalStateDO } from '@src/modules/federal-state/domainobject/federal-state.do';
import { ExternalGroupDto, ExternalGroupUserDto, ExternalSchoolDto, ExternalUserDto } from '../../../dto';
import { SchoolForGroupNotFoundLoggable, UserForGroupNotFoundLoggable } from '../../../loggable';

Expand Down Expand Up @@ -46,7 +47,7 @@ export class OidcProvisioningService {
}
} else {
const schoolYear: SchoolYearEntity = await this.schoolYearService.getCurrentSchoolYear();
const federalState: FederalStateEntity = await this.federalStateService.findFederalStateByName(
const federalState: FederalStateDO = await this.federalStateService.findFederalStateByName(
FederalStateNames.NIEDERSACHEN
);

Expand Down
9 changes: 5 additions & 4 deletions apps/server/src/modules/server/server.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MongoDatabaseModuleOptions, MongoMemoryDatabaseModule } from '@shared/i
import { MailModule } from '@shared/infra/mail';
import { RabbitMQWrapperModule, RabbitMQWrapperTestModule } from '@shared/infra/rabbitmq';
import { REDIS_CLIENT, RedisModule } from '@shared/infra/redis';
import { createConfigModuleOptions, DB_PASSWORD, DB_URL, DB_USERNAME } from '@src/config';
import { DB_PASSWORD, DB_URL, DB_USERNAME, createConfigModuleOptions } from '@src/config';
import { CoreModule } from '@src/core';
import { LegacyLogger, LoggerModule } from '@src/core/logger';
import { AccountApiModule } from '@src/modules/account/account-api.module';
Expand All @@ -18,15 +18,17 @@ import { CollaborativeStorageModule } from '@src/modules/collaborative-storage';
import { FilesStorageClientModule } from '@src/modules/files-storage-client';
import { GroupApiModule } from '@src/modules/group/group-api.module';
import { LearnroomApiModule } from '@src/modules/learnroom/learnroom-api.module';
import { LegacySchoolApiModule } from '@src/modules/legacy-school/legacy-school-api.module';
import { LessonApiModule } from '@src/modules/lesson/lesson-api.module';
import { NewsModule } from '@src/modules/news';
import { OauthProviderApiModule } from '@src/modules/oauth-provider';
import { OauthApiModule } from '@src/modules/oauth/oauth-api.module';
import { PseudonymApiModule } from '@src/modules/pseudonym/pseudonym-api.module';
import { RocketChatModule } from '@src/modules/rocketchat';
import { LegacySchoolApiModule } from '@src/modules/legacy-school/legacy-school-api.module';
import { SharingApiModule } from '@src/modules/sharing/sharing.module';
import { SystemApiModule } from '@src/modules/system/system-api.module';
import { TaskApiModule } from '@src/modules/task/task-api.module';
import { TeamsApiModule } from '@src/modules/teams/teams-api.module';
import { ToolApiModule } from '@src/modules/tool/tool-api.module';
import { ImportUserModule } from '@src/modules/user-import';
import { UserLoginMigrationApiModule } from '@src/modules/user-login-migration/user-login-migration-api.module';
Expand All @@ -35,8 +37,7 @@ import { VideoConferenceApiModule } from '@src/modules/video-conference/video-co
import connectRedis from 'connect-redis';
import session from 'express-session';
import { RedisClient } from 'redis';
import { TeamsApiModule } from '@src/modules/teams/teams-api.module';
import { PseudonymApiModule } from '@src/modules/pseudonym/pseudonym-api.module';
import { FederalStateApiModule } from '../federal-state/federal-state-api.module';
import { ServerController } from './controller/server.controller';
import { serverConfig } from './server.config';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FederalStateEntity, SchoolFeatures, SchoolYearEntity } from '@shared/domain/entity';
import { SchoolFeatures, SchoolYearEntity } from '@shared/domain/entity';
import { EntityId } from '@shared/domain/types';
import { FederalStateDO } from '@src/modules/federal-state/domainobject/federal-state.do';
import { FederalStateDO } from '@src/modules/federal-state/domainobject';
import { BaseDO } from './base.do';

/**
Expand Down Expand Up @@ -29,7 +29,7 @@ export class LegacySchoolDo extends BaseDO {
userLoginMigrationId?: EntityId;

// TODO: N21-990 Refactoring: Create domain objects for schoolYear and federalState
federalState: FederalStateEntity;
federalState: FederalStateDO;

constructor(params: LegacySchoolDo) {
super();
Expand Down
4 changes: 1 addition & 3 deletions apps/server/src/shared/domain/entity/all-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ import {
import { Course } from './course.entity';
import { CourseGroup } from './coursegroup.entity';
import { DashboardGridElementModel, DashboardModelEntity } from './dashboard.model.entity';
import { FederalStateEntity } from './federal-state.entity';
import { ImportUser } from './import-user.entity';
import {
Board,
BoardElement,
ColumnboardBoardElement,
ColumnBoardTarget,
ColumnboardBoardElement,
LessonBoardElement,
TaskBoardElement,
} from './legacy-board';
Expand Down Expand Up @@ -69,7 +68,6 @@ export const ALL_ENTITIES = [
DashboardGridElementModel,
DashboardModelEntity,
ExternalToolEntity,
FederalStateEntity,
ImportUser,
LessonEntity,
LessonBoardElement,
Expand Down
1 change: 0 additions & 1 deletion apps/server/src/shared/domain/entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from './course.entity';
export * from './coursegroup.entity';
export * from './dashboard.entity';
export * from './dashboard.model.entity';
export * from './federal-state.entity';
export * from './import-user.entity';
export * from './legacy-board';
export * from './lesson.entity';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/shared/domain/entity/school.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
Property,
} from '@mikro-orm/core';
import { UserLoginMigrationEntity } from '@shared/domain/entity/user-login-migration.entity';
import { FederalStateEntity } from '@src/modules/federal-state/entity';
import { BaseEntity } from './base.entity';
import { SchoolYearEntity } from './schoolyear.entity';
import { SystemEntity } from './system.entity';
import { FederalStateEntity } from './federal-state.entity';

export enum SchoolFeatures {
ROCKET_CHAT = 'rocketChat',
Expand Down
5 changes: 2 additions & 3 deletions apps/server/src/shared/repo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
export * from './base.do.repo';
export * from './base.repo';
export * from './board';
export * from './contextexternaltool';
export * from './course';
export * from './coursegroup';
export * from './dashboard';
export * from './federalstate';
export * from './externaltool';
export * from './importuser';
export * from './lesson';
export * from './ltitool';
Expand All @@ -28,5 +29,3 @@ export * from './teams';
export * from './user';
export * from './userloginmigration';
export * from './videoconference';
export * from './contextexternaltool';
export * from './externaltool';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LegacySchoolDo } from '@shared/domain';
import { federalStateFactory } from '../federal-state.factory';
import { schoolYearFactory } from '../schoolyear.factory';
import { DoBaseFactory } from './do-base.factory';
import { federalStateDoFactory } from './federal-state.do.factory';

class LegacySchoolFactory extends DoBaseFactory<LegacySchoolDo, LegacySchoolDo> {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { County, FederalStateEntity, IFederalStateProperties } from '@shared/domain';
import { County, FederalStateEntity, IFederalStateProperties } from '@src/modules/federal-state/entity';
import { BaseFactory } from './base.factory';

export const federalStateFactory = BaseFactory.define<FederalStateEntity, IFederalStateProperties>(
Expand Down

0 comments on commit 936ef41

Please sign in to comment.