Merge pull request #4229 from FinnStutzenstein/repositories

Restructure the client, register Repositories and map to collection
This commit is contained in:
Finn Stutzenstein 2019-02-01 10:42:51 +01:00 committed by GitHub
commit 6a60280172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
277 changed files with 868 additions and 622 deletions

View File

@ -10,6 +10,7 @@
"README": "https://github.com/OpenSlides/OpenSlides/blob/master/client/README.md", "README": "https://github.com/OpenSlides/OpenSlides/blob/master/client/README.md",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"ng-high-memory": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng",
"start": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0", "start": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0",
"build": "ng build --prod --aot", "build": "ng build --prod --aot",
"test": "ng test", "test": "ng test",
@ -77,6 +78,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^1.16.2", "prettier": "^1.16.2",
"protractor": "^5.4.2", "protractor": "^5.4.2",
"source-map-explorer": "^1.6.0",
"ts-node": "~8.0.2", "ts-node": "~8.0.2",
"tslint": "~5.12.1", "tslint": "~5.12.1",
"tsutils": "^3.7.0", "tsutils": "^3.7.0",

View File

@ -7,7 +7,6 @@ import { LoginLegalNoticeComponent } from './site/login/components/login-legal-n
import { LoginPrivacyPolicyComponent } from './site/login/components/login-privacy-policy/login-privacy-policy.component'; import { LoginPrivacyPolicyComponent } from './site/login/components/login-privacy-policy/login-privacy-policy.component';
import { ResetPasswordComponent } from './site/login/components/reset-password/reset-password.component'; import { ResetPasswordComponent } from './site/login/components/reset-password/reset-password.component';
import { ResetPasswordConfirmComponent } from './site/login/components/reset-password-confirm/reset-password-confirm.component'; import { ResetPasswordConfirmComponent } from './site/login/components/reset-password-confirm/reset-password-confirm.component';
import { FullscreenProjectorComponent } from './site/projector/components/fullscreen-projector/fullscreen-projector.component';
/** /**
* Global app routing * Global app routing
@ -24,8 +23,7 @@ const routes: Routes = [
{ path: 'privacypolicy', component: LoginPrivacyPolicyComponent } { path: 'privacypolicy', component: LoginPrivacyPolicyComponent }
] ]
}, },
{ path: 'projector', component: FullscreenProjectorComponent }, { path: 'projector', loadChildren: './fullscreen-projector/fullscreen-projector.module#FullscreenProjectorModule' },
{ path: 'projector/:id', component: FullscreenProjectorComponent },
{ path: '', loadChildren: './site/site.module#SiteModule' }, { path: '', loadChildren: './site/site.module#SiteModule' },
{ path: '**', redirectTo: '' } { path: '**', redirectTo: '' }
]; ];

View File

@ -1,7 +1,7 @@
import { TestBed, async } from '@angular/core/testing'; import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { E2EImportsModule } from './../e2e-imports.module'; import { E2EImportsModule } from './../e2e-imports.module';
import { ServertimeService } from './core/services/servertime.service'; import { ServertimeService } from './core/core-services/servertime.service';
describe('AppComponent', () => { describe('AppComponent', () => {
let servertimeService; let servertimeService;

View File

@ -1,11 +1,11 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { OperatorService } from './core/services/operator.service'; import { OperatorService } from './core/core-services/operator.service';
import { LoginDataService } from './core/services/login-data.service'; import { LoginDataService } from './core/ui-services/login-data.service';
import { ConfigService } from './core/services/config.service'; import { ConfigService } from './core/ui-services/config.service';
import { ConstantsService } from './core/services/constants.service'; import { ConstantsService } from './core/ui-services/constants.service';
import { ServertimeService } from './core/services/servertime.service'; import { ServertimeService } from './core/core-services/servertime.service';
import { ThemeService } from './core/services/theme.service'; import { ThemeService } from './core/ui-services/theme.service';
/** /**
* Angular's global App Component * Angular's global App Component

View File

@ -9,11 +9,8 @@ import { PapaParseModule } from 'ngx-papaparse';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module'; import { CoreModule } from './core/core.module';
// translation module.
import { LoginModule } from './site/login/login.module'; import { LoginModule } from './site/login/login.module';
import { AppLoadService } from './core/services/app-load.service'; import { AppLoadService } from './core/core-services/app-load.service';
import { ProjectorModule } from './site/projector/projector.module';
import { SlidesModule } from './slides/slides.module'; import { SlidesModule } from './slides/slides.module';
import { OpenSlidesTranslateModule } from './core/translate/openslides-translate-module'; import { OpenSlidesTranslateModule } from './core/translate/openslides-translate-module';
@ -48,7 +45,6 @@ export function AppLoaderFactory(appLoadService: AppLoadService): () => Promise<
LoginModule, LoginModule,
PapaParseModule, PapaParseModule,
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
ProjectorModule,
SlidesModule.forRoot() SlidesModule.forRoot()
], ],
providers: [{ provide: APP_INITIALIZER, useFactory: AppLoaderFactory, deps: [AppLoadService], multi: true }], providers: [{ provide: APP_INITIALIZER, useFactory: AppLoaderFactory, deps: [AppLoadService], multi: true }],

View File

@ -0,0 +1,39 @@
import { ModelConstructor, BaseModel } from '../shared/models/base/base-model';
import { MainMenuEntry } from './core-services/main-menu.service';
import { Searchable } from '../shared/models/base/searchable';
import { Type } from '@angular/core';
import { BaseRepository } from './repositories/base-repository';
interface BaseModelEntry {
collectionString: string;
repository: Type<BaseRepository<any, any>>;
}
export interface ModelEntry extends BaseModelEntry {
model: ModelConstructor<BaseModel>;
}
export interface SearchableModelEntry extends BaseModelEntry {
model: new (...args: any[]) => BaseModel & Searchable;
searchOrder: number;
}
/**
* The configuration of an app.
*/
export interface AppConfig {
/**
* The name.
*/
name: string;
/**
* All models, that should be registered.
*/
models?: (ModelEntry | SearchableModelEntry)[];
/**
* Main menu entries.
*/
mainMenuEntries?: MainMenuEntry[];
}

View File

@ -1,8 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable, Injector } from '@angular/core';
import { plugins } from '../../../plugins'; import { plugins } from '../../../plugins';
import { CommonAppConfig } from '../../site/common/common.config'; import { CommonAppConfig } from '../../site/common/common.config';
import { AppConfig, SearchableModelEntry, ModelEntry } from '../../site/base/app-config'; import { AppConfig, SearchableModelEntry, ModelEntry } from '../app-config';
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; import { CollectionStringMapperService } from './collectionStringMapper.service';
import { MediafileAppConfig } from '../../site/mediafiles/mediafile.config'; import { MediafileAppConfig } from '../../site/mediafiles/mediafile.config';
import { MotionsAppConfig } from '../../site/motions/motions.config'; import { MotionsAppConfig } from '../../site/motions/motions.config';
import { ConfigAppConfig } from '../../site/config/config.config'; import { ConfigAppConfig } from '../../site/config/config.config';
@ -12,9 +13,10 @@ import { UsersAppConfig } from '../../site/users/users.config';
import { TagAppConfig } from '../../site/tags/tag.config'; import { TagAppConfig } from '../../site/tags/tag.config';
import { MainMenuService } from './main-menu.service'; import { MainMenuService } from './main-menu.service';
import { HistoryAppConfig } from 'app/site/history/history.config'; import { HistoryAppConfig } from 'app/site/history/history.config';
import { SearchService } from './search.service'; import { SearchService } from '../ui-services/search.service';
import { isSearchable } from '../../shared/models/base/searchable'; import { isSearchable } from '../../shared/models/base/searchable';
import { ProjectorAppConfig } from 'app/site/projector/projector.config'; import { ProjectorAppConfig } from 'app/site/projector/projector.config';
import { BaseRepository } from 'app/core/repositories/base-repository';
/** /**
* A list of all app configurations of all delivered apps. * A list of all app configurations of all delivered apps.
@ -47,9 +49,10 @@ export class AppLoadService {
* @param searchService * @param searchService
*/ */
public constructor( public constructor(
private modelMapper: CollectionStringModelMapperService, private modelMapper: CollectionStringMapperService,
private mainMenuService: MainMenuService, private mainMenuService: MainMenuService,
private searchService: SearchService private searchService: SearchService,
private injector: Injector
) {} ) {}
public async loadApps(): Promise<void> { public async loadApps(): Promise<void> {
@ -63,7 +66,11 @@ export class AppLoadService {
appConfigs.forEach((config: AppConfig) => { appConfigs.forEach((config: AppConfig) => {
if (config.models) { if (config.models) {
config.models.forEach(entry => { config.models.forEach(entry => {
this.modelMapper.registerCollectionElement(entry.collectionString, entry.model); let repository: BaseRepository<any, any> = null;
if (entry.repository) {
repository = this.injector.get(entry.repository);
}
this.modelMapper.registerCollectionElement(entry.collectionString, entry.model, repository);
if (this.isSearchableModelEntry(entry)) { if (this.isSearchableModelEntry(entry)) {
this.searchService.registerModel(entry.collectionString, entry.model, entry.searchOrder); this.searchService.registerModel(entry.collectionString, entry.model, entry.searchOrder);
} }

View File

@ -1,11 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { OperatorService } from 'app/core/services/operator.service'; import { OperatorService } from 'app/core/core-services/operator.service';
import { OpenSlidesComponent } from '../../openslides.component'; import { OpenSlidesComponent } from '../../openslides.component';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { User } from '../../shared/models/users/user'; import { User } from '../../shared/models/users/user';
import { OpenSlidesService } from './openslides.service'; import { OpenSlidesService } from './openslides.service';
import { Router } from '@angular/router';
import { HttpService } from './http.service'; import { HttpService } from './http.service';
/** /**

View File

@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from './websocket.service';
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; import { CollectionStringMapperService } from './collectionStringMapper.service';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
import { BaseModel } from '../../shared/models/base/base-model'; import { BaseModel } from '../../shared/models/base/base-model';
@ -58,7 +58,7 @@ export class AutoupdateService extends OpenSlidesComponent {
public constructor( public constructor(
private websocketService: WebsocketService, private websocketService: WebsocketService,
private DS: DataStoreService, private DS: DataStoreService,
private modelMapper: CollectionStringModelMapperService private modelMapper: CollectionStringMapperService
) { ) {
super(); super();
this.websocketService.getOberservable<AutoupdateFormat>('autoupdate').subscribe(response => { this.websocketService.getOberservable<AutoupdateFormat>('autoupdate').subscribe(response => {

View File

@ -1,5 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ModelConstructor, BaseModel } from '../../shared/models/base/base-model'; import { ModelConstructor, BaseModel } from '../../shared/models/base/base-model';
import { BaseRepository } from 'app/core/repositories/base-repository';
/** /**
* Registeres the mapping of collection strings <--> actual types. Every Model should register itself here. * Registeres the mapping of collection strings <--> actual types. Every Model should register itself here.
@ -7,12 +9,14 @@ import { ModelConstructor, BaseModel } from '../../shared/models/base/base-model
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class CollectionStringModelMapperService { export class CollectionStringMapperService {
/** /**
* Mapps collection strings to model constructors. Accessed by {@method registerCollectionElement} and * Mapps collection strings to model constructors. Accessed by {@method registerCollectionElement} and
* {@method getCollectionStringType}. * {@method getCollectionStringType}.
*/ */
private collectionStringsTypeMapping: { [collectionString: string]: ModelConstructor<BaseModel> } = {}; private collectionStringsTypeMapping: {
[collectionString: string]: [ModelConstructor<BaseModel>, BaseRepository<any, any>];
} = {};
/** /**
* Constructor to create the NotifyService. Registers itself to the WebsocketService. * Constructor to create the NotifyService. Registers itself to the WebsocketService.
@ -23,10 +27,14 @@ export class CollectionStringModelMapperService {
/** /**
* Registers the type to the collection string * Registers the type to the collection string
* @param collectionString * @param collectionString
* @param type * @param model
*/ */
public registerCollectionElement(collectionString: string, type: ModelConstructor<BaseModel>): void { public registerCollectionElement(
this.collectionStringsTypeMapping[collectionString] = type; collectionString: string,
model: ModelConstructor<BaseModel>,
repository: BaseRepository<any, any>
): void {
this.collectionStringsTypeMapping[collectionString] = [model, repository];
} }
/** /**
@ -34,7 +42,15 @@ export class CollectionStringModelMapperService {
* @param collectionString the requested collection * @param collectionString the requested collection
*/ */
public getModelConstructor(collectionString: string): ModelConstructor<BaseModel> { public getModelConstructor(collectionString: string): ModelConstructor<BaseModel> {
return this.collectionStringsTypeMapping[collectionString]; return this.collectionStringsTypeMapping[collectionString][0];
}
/**
* Returns the repository of the requested collection or undefined, if it is not registered.
* @param collectionString the requested collection
*/
public getRepository(collectionString: string): BaseRepository<any, any> {
return this.collectionStringsTypeMapping[collectionString][1];
} }
/** /**
@ -43,7 +59,7 @@ export class CollectionStringModelMapperService {
*/ */
public getCollectionString(ctor: ModelConstructor<BaseModel>): string { public getCollectionString(ctor: ModelConstructor<BaseModel>): string {
return Object.keys(this.collectionStringsTypeMapping).find((collectionString: string) => { return Object.keys(this.collectionStringsTypeMapping).find((collectionString: string) => {
return ctor === this.collectionStringsTypeMapping[collectionString]; return ctor === this.collectionStringsTypeMapping[collectionString][0];
}); });
} }
} }

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseModel } from '../../shared/models/base/base-model'; import { BaseModel } from '../../shared/models/base/base-model';
import { HttpService } from './http.service'; import { HttpService } from './http.service';
import { Identifiable } from '../../shared/models/base/identifiable'; import { Identifiable } from '../../shared/models/base/identifiable';

View File

@ -1,9 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model'; import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model';
import { StorageService } from './storage.service'; import { StorageService } from './storage.service';
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; import { CollectionStringMapperService } from './collectionStringMapper.service';
/** /**
* Represents information about a deleted model. * Represents information about a deleted model.
@ -126,10 +127,7 @@ export class DataStoreService {
* @param storageService use StorageService to preserve the DataStore. * @param storageService use StorageService to preserve the DataStore.
* @param modelMapper * @param modelMapper
*/ */
public constructor( public constructor(private storageService: StorageService, private modelMapper: CollectionStringMapperService) {}
private storageService: StorageService,
private modelMapper: CollectionStringModelMapperService
) {}
/** /**
* Gets the DataStore from cache and instantiate all models out of the serialized version. * Gets the DataStore from cache and instantiate all models out of the serialized version.

View File

@ -1,6 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { formatQueryParams, QueryParams } from '../query-params'; import { formatQueryParams, QueryParams } from '../query-params';
import { OpenSlidesStatusService } from './openslides-status.service'; import { OpenSlidesStatusService } from './openslides-status.service';

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
/** /**

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject, Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';

View File

@ -1,6 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Observable, BehaviorSubject } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';
import { Group } from 'app/shared/models/users/group'; import { Group } from 'app/shared/models/users/group';
import { User } from '../../shared/models/users/user'; import { User } from '../../shared/models/users/user';

View File

@ -1,9 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';
import { HttpService } from './http.service'; import { HttpService } from './http.service';
import { environment } from 'environments/environment.prod'; import { environment } from 'environments/environment.prod';
import { BehaviorSubject, Observable } from 'rxjs';
/** /**
* This service provides the timeoffset to the server and a user of this service * This service provides the timeoffset to the server and a user of this service

View File

@ -1,5 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { LocalStorage } from '@ngx-pwa/local-storage'; import { LocalStorage } from '@ngx-pwa/local-storage';
import { OpenSlidesStatusService } from './openslides-status.service'; import { OpenSlidesStatusService } from './openslides-status.service';
/** /**

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; import { CollectionStringMapperService } from './collectionStringMapper.service';
import { History } from 'app/shared/models/core/history'; import { History } from 'app/shared/models/core/history';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from './websocket.service';
@ -48,7 +48,7 @@ export class TimeTravelService {
public constructor( public constructor(
private httpService: HttpService, private httpService: HttpService,
private webSocketService: WebsocketService, private webSocketService: WebsocketService,
private modelMapperService: CollectionStringModelMapperService, private modelMapperService: CollectionStringMapperService,
private DS: DataStoreService, private DS: DataStoreService,
private OSStatus: OpenSlidesStatusService, private OSStatus: OpenSlidesStatusService,
private OpenSlides: OpenSlidesService private OpenSlides: OpenSlidesService

View File

@ -1,7 +1,9 @@
import { Injectable, NgZone, EventEmitter } from '@angular/core'; import { Injectable, NgZone, EventEmitter } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material'; import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material';
import { Observable, Subject } from 'rxjs';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { formatQueryParams, QueryParams } from '../query-params'; import { formatQueryParams, QueryParams } from '../query-params';
/** /**

View File

@ -2,37 +2,17 @@ import { NgModule, Optional, SkipSelf } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
// Core Services, Directives // Shared Components
import { AuthGuard } from './services/auth-guard.service';
import { AuthService } from './services/auth.service';
import { AutoupdateService } from './services/autoupdate.service';
import { DataStoreService } from './services/data-store.service';
import { OperatorService } from './services/operator.service';
import { WebsocketService } from './services/websocket.service';
import { DataSendService } from './services/data-send.service';
import { ViewportService } from './services/viewport.service';
import { PromptDialogComponent } from '../shared/components/prompt-dialog/prompt-dialog.component'; import { PromptDialogComponent } from '../shared/components/prompt-dialog/prompt-dialog.component';
import { HttpService } from './services/http.service';
import { ChoiceDialogComponent } from '../shared/components/choice-dialog/choice-dialog.component'; import { ChoiceDialogComponent } from '../shared/components/choice-dialog/choice-dialog.component';
import { ProjectionDialogComponent } from 'app/shared/components/projection-dialog/projection-dialog.component'; import { ProjectionDialogComponent } from 'app/shared/components/projection-dialog/projection-dialog.component';
/** Global Core Module. Contains all global (singleton) services /**
* * Global Core Module.
*/ */
@NgModule({ @NgModule({
imports: [CommonModule], imports: [CommonModule],
providers: [ providers: [Title],
Title,
AuthGuard,
AuthService,
AutoupdateService,
DataStoreService,
DataSendService,
HttpService,
OperatorService,
ViewportService,
WebsocketService
],
entryComponents: [PromptDialogComponent, ChoiceDialogComponent, ProjectionDialogComponent] entryComponents: [PromptDialogComponent, ChoiceDialogComponent, ProjectionDialogComponent]
}) })
export class CoreModule { export class CoreModule {

View File

@ -2,22 +2,22 @@ import { Injectable } from '@angular/core';
import { tap, map } from 'rxjs/operators'; import { tap, map } from 'rxjs/operators';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { AgendaBaseModel } from '../../../shared/models/base/agenda-base-model'; import { AgendaBaseModel } from '../../../shared/models/base/agenda-base-model';
import { BaseModel } from '../../../shared/models/base/base-model'; import { BaseModel } from '../../../shared/models/base/base-model';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ConfigService } from 'app/core/services/config.service'; import { ConfigService } from 'app/core/ui-services/config.service';
import { DataSendService } from 'app/core/services/data-send.service'; import { DataSendService } from 'app/core/core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { Item } from '../../../shared/models/agenda/item'; import { Item } from '../../../shared/models/agenda/item';
import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component'; import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component';
import { Speaker } from 'app/shared/models/agenda/speaker'; import { Speaker } from 'app/shared/models/agenda/speaker';
import { User } from 'app/shared/models/users/user'; import { User } from 'app/shared/models/users/user';
import { ViewItem } from '../models/view-item'; import { ViewItem } from '../../../site/agenda/models/view-item';
import { ViewSpeaker } from '../models/view-speaker'; import { ViewSpeaker } from '../../../site/agenda/models/view-speaker';
import { TreeService } from 'app/core/services/tree.service'; import { TreeService } from 'app/core/ui-services/tree.service';
/** /**
* Repository service for users * Repository service for users
@ -41,7 +41,7 @@ export class AgendaRepositoryService extends BaseRepository<ViewItem, Item> {
public constructor( public constructor(
protected DS: DataStoreService, protected DS: DataStoreService,
private httpService: HttpService, private httpService: HttpService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private config: ConfigService, private config: ConfigService,
private dataSend: DataSendService, private dataSend: DataSendService,
private treeService: TreeService private treeService: TreeService

View File

@ -1,15 +1,15 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Topic } from 'app/shared/models/topics/topic'; import { Topic } from 'app/shared/models/topics/topic';
import { BaseRepository } from 'app/site/base/base-repository'; import { BaseRepository } from 'app/core/repositories/base-repository';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile'; import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
import { Item } from 'app/shared/models/agenda/item'; import { Item } from 'app/shared/models/agenda/item';
import { DataStoreService } from 'app/core/services/data-store.service'; import { DataStoreService } from 'app/core/core-services/data-store.service';
import { DataSendService } from 'app/core/services/data-send.service'; import { DataSendService } from 'app/core/core-services/data-send.service';
import { ViewTopic } from '../models/view-topic'; import { ViewTopic } from '../../../site/agenda/models/view-topic';
import { Identifiable } from 'app/shared/models/base/identifiable'; import { Identifiable } from 'app/shared/models/base/identifiable';
import { CollectionStringModelMapperService } from 'app/core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from 'app/core/core-services/collectionStringMapper.service';
import { CreateTopic } from '../models/create-topic'; import { CreateTopic } from '../../../site/agenda/models/create-topic';
/** /**
* Repository for topics * Repository for topics
@ -27,7 +27,7 @@ export class TopicRepositoryService extends BaseRepository<ViewTopic, Topic> {
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, Topic, [Mediafile, Item]); super(DS, mapperService, Topic, [Mediafile, Item]);

View File

@ -1,13 +1,13 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ViewAssignment } from '../models/view-assignment'; import { ViewAssignment } from '../../../site/assignments/models/view-assignment';
import { Assignment } from '../../../shared/models/assignments/assignment'; import { Assignment } from '../../../shared/models/assignments/assignment';
import { User } from '../../../shared/models/users/user'; import { User } from '../../../shared/models/users/user';
import { Tag } from '../../../shared/models/core/tag'; import { Tag } from '../../../shared/models/core/tag';
import { Item } from '../../../shared/models/agenda/item'; import { Item } from '../../../shared/models/agenda/item';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
/** /**
* Repository Service for Assignments. * Repository Service for Assignments.
@ -24,7 +24,7 @@ export class AssignmentRepositoryService extends BaseRepository<ViewAssignment,
* @param DS The DataStore * @param DS The DataStore
* @param mapperService Maps collection strings to classes * @param mapperService Maps collection strings to classes
*/ */
public constructor(DS: DataStoreService, mapperService: CollectionStringModelMapperService) { public constructor(DS: DataStoreService, mapperService: CollectionStringMapperService) {
super(DS, mapperService, Assignment, [User, Item, Tag]); super(DS, mapperService, Assignment, [User, Item, Tag]);
} }

View File

@ -1,10 +1,10 @@
import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { OpenSlidesComponent } from '../../openslides.component'; import { OpenSlidesComponent } from '../../openslides.component';
import { BaseViewModel } from './base-view-model'; import { BaseViewModel } from '../../site/base/base-view-model';
import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model'; import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model';
import { CollectionStringModelMapperService } from '../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../core-services/collectionStringMapper.service';
import { DataStoreService } from '../../core/services/data-store.service'; import { DataStoreService } from '../core-services/data-store.service';
import { Identifiable } from '../../shared/models/base/identifiable'; import { Identifiable } from '../../shared/models/base/identifiable';
import { auditTime } from 'rxjs/operators'; import { auditTime } from 'rxjs/operators';
@ -40,7 +40,7 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
*/ */
public constructor( public constructor(
protected DS: DataStoreService, protected DS: DataStoreService,
protected collectionStringModelMapperService: CollectionStringModelMapperService, protected collectionStringModelMapperService: CollectionStringMapperService,
protected baseModelCtor: ModelConstructor<M>, protected baseModelCtor: ModelConstructor<M>,
protected depsModelCtors?: ModelConstructor<BaseModel>[] protected depsModelCtors?: ModelConstructor<BaseModel>[]
) { ) {

View File

@ -0,0 +1,17 @@
import { TestBed, inject } from '@angular/core/testing';
import { E2EImportsModule } from 'e2e-imports.module';
import { ChatMessageRepositoryService } from './chatmessage-repository.service';
describe('ChatMessageRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [ChatMessageRepositoryService]
});
});
it('should be created', inject([ChatMessageRepositoryService], (service: ChatMessageRepositoryService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../base-repository';
import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ChatMessage } from 'app/shared/models/core/chat-message';
import { ViewChatMessage } from 'app/site/common/models/view-chatmessage';
@Injectable({
providedIn: 'root'
})
export class ChatMessageRepositoryService extends BaseRepository<ViewChatMessage, ChatMessage> {
public constructor(DS: DataStoreService, mapperService: CollectionStringMapperService) {
super(DS, mapperService, ChatMessage);
}
protected createViewModel(message: ChatMessage): ViewChatMessage {
return new ViewChatMessage(message);
}
public async create(message: ChatMessage): Promise<Identifiable> {
throw new Error('TODO');
}
public async update(message: Partial<ChatMessage>, viewMessage: ViewChatMessage): Promise<void> {
throw new Error('TODO');
}
public async delete(viewMessage: ViewChatMessage): Promise<void> {
throw new Error('TODO');
}
}

View File

@ -1,14 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CollectionStringModelMapperService } from 'app/core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from 'app/core/core-services/collectionStringMapper.service';
import { DataStoreService } from 'app/core/services/data-store.service'; import { DataStoreService } from 'app/core/core-services/data-store.service';
import { BaseRepository } from 'app/site/base/base-repository'; import { BaseRepository } from 'app/core/repositories/base-repository';
import { History } from 'app/shared/models/core/history'; import { History } from 'app/shared/models/core/history';
import { User } from 'app/shared/models/users/user'; import { User } from 'app/shared/models/users/user';
import { Identifiable } from 'app/shared/models/base/identifiable'; import { Identifiable } from 'app/shared/models/base/identifiable';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { ViewHistory } from '../models/view-history'; import { ViewHistory } from '../../../site/history/models/view-history';
import { TimeTravelService } from 'app/core/services/time-travel.service'; import { TimeTravelService } from 'app/core/core-services/time-travel.service';
import { BaseModel } from 'app/shared/models/base/base-model'; import { BaseModel } from 'app/shared/models/base/base-model';
/** /**
@ -30,7 +30,7 @@ export class HistoryRepositoryService extends BaseRepository<ViewHistory, Histor
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private httpService: HttpService, private httpService: HttpService,
private timeTravel: TimeTravelService private timeTravel: TimeTravelService
) { ) {

View File

@ -1,14 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { ViewMediafile } from '../models/view-mediafile'; import { ViewMediafile } from '../../../site/mediafiles/models/view-mediafile';
import { Mediafile } from '../../../shared/models/mediafiles/mediafile'; import { Mediafile } from '../../../shared/models/mediafiles/mediafile';
import { User } from '../../../shared/models/users/user'; import { User } from '../../../shared/models/users/user';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { DataSendService } from 'app/core/services/data-send.service'; import { DataSendService } from 'app/core/core-services/data-send.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { HttpHeaders } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http';
/** /**
@ -27,7 +27,7 @@ export class MediafileRepositoryService extends BaseRepository<ViewMediafile, Me
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private httpService: HttpService private httpService: HttpService
) { ) {

View File

@ -1,14 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Category } from '../../../shared/models/motions/category'; import { Category } from '../../../shared/models/motions/category';
import { ViewCategory } from '../models/view-category'; import { ViewCategory } from '../../../site/motions/models/view-category';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Motion } from '../../../shared/models/motions/motion'; import { Motion } from '../../../shared/models/motions/motion';
import { HttpService } from '../../../core/services/http.service'; import { HttpService } from '../../core-services/http.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
/** /**
* Repository Services for Categories * Repository Services for Categories
@ -36,7 +36,7 @@ export class CategoryRepositoryService extends BaseRepository<ViewCategory, Cate
*/ */
public constructor( public constructor(
protected DS: DataStoreService, protected DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private httpService: HttpService private httpService: HttpService
) { ) {

View File

@ -1,17 +1,18 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { User } from '../../../shared/models/users/user'; import { User } from '../../../shared/models/users/user';
import { Category } from '../../../shared/models/motions/category'; import { Category } from '../../../shared/models/motions/category';
import { Workflow } from '../../../shared/models/motions/workflow'; import { Workflow } from '../../../shared/models/motions/workflow';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { MotionChangeReco } from '../../../shared/models/motions/motion-change-reco'; import { MotionChangeReco } from '../../../shared/models/motions/motion-change-reco';
import { ViewChangeReco } from '../models/view-change-reco'; import { ViewChangeReco } from '../../../site/motions/models/view-change-reco';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
/** /**
* Repository Services for change recommendations * Repository Services for change recommendations
@ -39,7 +40,7 @@ export class ChangeRecommendationRepositoryService extends BaseRepository<ViewCh
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, MotionChangeReco, [Category, User, Workflow]); super(DS, mapperService, MotionChangeReco, [Category, User, Workflow]);

View File

@ -1,18 +1,19 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { BaseRepository } from 'app/site/base/base-repository'; import { BaseRepository } from 'app/core/repositories/base-repository';
import { CollectionStringModelMapperService } from 'app/core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from 'app/core/core-services/collectionStringMapper.service';
import { DataSendService } from 'app/core/services/data-send.service'; import { DataSendService } from 'app/core/core-services/data-send.service';
import { DataStoreService } from 'app/core/services/data-store.service'; import { DataStoreService } from 'app/core/core-services/data-store.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { Identifiable } from 'app/shared/models/base/identifiable'; import { Identifiable } from 'app/shared/models/base/identifiable';
import { Motion } from 'app/shared/models/motions/motion'; import { Motion } from 'app/shared/models/motions/motion';
import { MotionBlock } from 'app/shared/models/motions/motion-block'; import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { MotionRepositoryService } from './motion-repository.service'; import { MotionRepositoryService } from './motion-repository.service';
import { ViewMotion } from '../models/view-motion'; import { ViewMotion } from '../../../site/motions/models/view-motion';
import { ViewMotionBlock } from '../models/view-motion-block'; import { ViewMotionBlock } from '../../../site/motions/models/view-motion-block';
/** /**
* Repository service for motion blocks * Repository service for motion blocks
@ -32,7 +33,7 @@ export class MotionBlockRepositoryService extends BaseRepository<ViewMotionBlock
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private motionRepo: MotionRepositoryService, private motionRepo: MotionRepositoryService,
private httpService: HttpService private httpService: HttpService

View File

@ -1,13 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DataSendService } from '../../../core/services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataSendService } from '../../core-services/data-send.service';
import { BaseRepository } from '../../base/base-repository'; import { DataStoreService } from '../../core-services/data-store.service';
import { ViewMotionCommentSection } from '../models/view-motion-comment-section'; import { BaseRepository } from '../base-repository';
import { ViewMotionCommentSection } from '../../../site/motions/models/view-motion-comment-section';
import { MotionCommentSection } from '../../../shared/models/motions/motion-comment-section'; import { MotionCommentSection } from '../../../shared/models/motions/motion-comment-section';
import { Group } from '../../../shared/models/users/group'; import { Group } from '../../../shared/models/users/group';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
/** /**
* Repository Services for Categories * Repository Services for Categories
@ -37,7 +38,7 @@ export class MotionCommentSectionRepositoryService extends BaseRepository<
* @param http Service to handle direct http-communication * @param http Service to handle direct http-communication
*/ */
public constructor( public constructor(
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
protected DS: DataStoreService, protected DS: DataStoreService,
private dataSend: DataSendService, private dataSend: DataSendService,
private http: HttpService private http: HttpService

View File

@ -1,34 +1,34 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { tap, map } from 'rxjs/operators'; import { tap, map } from 'rxjs/operators';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Category } from '../../../shared/models/motions/category'; import { Category } from '../../../shared/models/motions/category';
import { ChangeRecoMode, ViewMotion } from '../models/view-motion'; import { ChangeRecoMode, ViewMotion } from '../../../site/motions/models/view-motion';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { CreateMotion } from '../models/create-motion'; import { CreateMotion } from '../../../site/motions/models/create-motion';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { DiffLinesInParagraph, DiffService, LineRange, ModificationType } from './diff.service'; import { DiffLinesInParagraph, DiffService, LineRange, ModificationType } from '../../ui-services/diff.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { Item } from 'app/shared/models/agenda/item'; import { Item } from 'app/shared/models/agenda/item';
import { LinenumberingService } from './linenumbering.service'; import { LinenumberingService } from '../../ui-services/linenumbering.service';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile'; import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
import { Motion } from '../../../shared/models/motions/motion'; import { Motion } from '../../../shared/models/motions/motion';
import { MotionBlock } from 'app/shared/models/motions/motion-block'; import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { MotionChangeReco } from '../../../shared/models/motions/motion-change-reco'; import { MotionChangeReco } from '../../../shared/models/motions/motion-change-reco';
import { MotionPoll } from 'app/shared/models/motions/motion-poll'; import { MotionPoll } from 'app/shared/models/motions/motion-poll';
import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component'; import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component';
import { PersonalNoteService } from './personal-note.service'; import { PersonalNoteService } from '../../ui-services/personal-note.service';
import { TreeService } from 'app/core/services/tree.service'; import { TreeService } from 'app/core/ui-services/tree.service';
import { User } from '../../../shared/models/users/user'; import { User } from '../../../shared/models/users/user';
import { ViewChangeReco } from '../models/view-change-reco'; import { ViewChangeReco } from '../../../site/motions/models/view-change-reco';
import { ViewMotionAmendedParagraph } from '../models/view-motion-amended-paragraph'; import { ViewMotionAmendedParagraph } from '../../../site/motions/models/view-motion-amended-paragraph';
import { ViewUnifiedChange } from '../models/view-unified-change'; import { ViewUnifiedChange } from '../../../site/motions/models/view-unified-change';
import { ViewStatuteParagraph } from '../models/view-statute-paragraph'; import { ViewStatuteParagraph } from '../../../site/motions/models/view-statute-paragraph';
import { Workflow } from '../../../shared/models/motions/workflow'; import { Workflow } from '../../../shared/models/motions/workflow';
import { WorkflowState } from '../../../shared/models/motions/workflow-state'; import { WorkflowState } from '../../../shared/models/motions/workflow-state';
@ -62,7 +62,7 @@ export class MotionRepositoryService extends BaseRepository<ViewMotion, Motion>
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private httpService: HttpService, private httpService: HttpService,
private readonly lineNumbering: LinenumberingService, private readonly lineNumbering: LinenumberingService,

View File

@ -1,11 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DataSendService } from '../../../core/services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataSendService } from '../../core-services/data-send.service';
import { BaseRepository } from '../../base/base-repository'; import { DataStoreService } from '../../core-services/data-store.service';
import { ViewStatuteParagraph } from '../models/view-statute-paragraph'; import { BaseRepository } from '../base-repository';
import { ViewStatuteParagraph } from '../../../site/motions/models/view-statute-paragraph';
import { StatuteParagraph } from '../../../shared/models/motions/statute-paragraph'; import { StatuteParagraph } from '../../../shared/models/motions/statute-paragraph';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
/** /**
* Repository Services for statute paragraphs * Repository Services for statute paragraphs
@ -29,7 +30,7 @@ export class StatuteParagraphRepositoryService extends BaseRepository<ViewStatut
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, StatuteParagraph); super(DS, mapperService, StatuteParagraph);

View File

@ -1,14 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Workflow } from '../../../shared/models/motions/workflow'; import { Workflow } from '../../../shared/models/motions/workflow';
import { ViewWorkflow } from '../models/view-workflow'; import { ViewWorkflow } from '../../../site/motions/models/view-workflow';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { WorkflowState } from 'app/shared/models/motions/workflow-state'; import { WorkflowState } from 'app/shared/models/motions/workflow-state';
import { ViewMotion } from '../models/view-motion'; import { ViewMotion } from '../../../site/motions/models/view-motion';
/** /**
* Repository Services for Categories * Repository Services for Categories
@ -32,7 +32,7 @@ export class WorkflowRepositoryService extends BaseRepository<ViewWorkflow, Work
*/ */
public constructor( public constructor(
protected DS: DataStoreService, protected DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, Workflow); super(DS, mapperService, Workflow);

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ViewCountdown } from '../models/view-countdown'; import { ViewCountdown } from '../../../site/projector/models/view-countdown';
import { Countdown } from '../../../shared/models/core/countdown'; import { Countdown } from '../../../shared/models/core/countdown';
@Injectable({ @Injectable({
@ -13,7 +13,7 @@ import { Countdown } from '../../../shared/models/core/countdown';
export class CountdownRepositoryService extends BaseRepository<ViewCountdown, Countdown> { export class CountdownRepositoryService extends BaseRepository<ViewCountdown, Countdown> {
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, Countdown); super(DS, mapperService, Countdown);

View File

@ -1,13 +1,13 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { ViewProjector } from '../models/view-projector'; import { ViewProjector } from '../../../site/projector/models/view-projector';
import { Projector } from '../../../shared/models/core/projector'; import { Projector } from '../../../shared/models/core/projector';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
/** /**
* Directions for scale and scroll requests. * Directions for scale and scroll requests.
@ -35,7 +35,7 @@ export class ProjectorRepositoryService extends BaseRepository<ViewProjector, Pr
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private http: HttpService private http: HttpService
) { ) {

View File

@ -1,16 +1,16 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ProjectorMessage } from 'app/shared/models/core/projector-message'; import { ProjectorMessage } from 'app/shared/models/core/projector-message';
import { ViewProjectorMessage } from '../models/view-projectormessage'; import { ViewProjectorMessage } from '../../../site/projector/models/view-projectormessage';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ProjectorMessageRepositoryService extends BaseRepository<ViewProjectorMessage, ProjectorMessage> { export class ProjectorMessageRepositoryService extends BaseRepository<ViewProjectorMessage, ProjectorMessage> {
public constructor(DS: DataStoreService, mapperService: CollectionStringModelMapperService) { public constructor(DS: DataStoreService, mapperService: CollectionStringMapperService) {
super(DS, mapperService, ProjectorMessage); super(DS, mapperService, ProjectorMessage);
} }

View File

@ -1,12 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Tag } from '../../../shared/models/core/tag'; import { Tag } from '../../../shared/models/core/tag';
import { ViewTag } from '../models/view-tag'; import { ViewTag } from '../../../site/tags/models/view-tag';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
/** /**
* Repository Services for Tags * Repository Services for Tags
@ -33,7 +33,7 @@ export class TagRepositoryService extends BaseRepository<ViewTag, Tag> {
*/ */
public constructor( public constructor(
protected DS: DataStoreService, protected DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService private dataSend: DataSendService
) { ) {
super(DS, mapperService, Tag); super(DS, mapperService, Tag);

View File

@ -1,13 +1,13 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ConstantsService } from '../../../core/services/constants.service'; import { ConstantsService } from '../../ui-services/constants.service';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { Group } from '../../../shared/models/users/group'; import { Group } from '../../../shared/models/users/group';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { ViewGroup } from '../models/view-group'; import { ViewGroup } from '../../../site/users/models/view-group';
/** /**
* Shape of a permission * Shape of a permission
@ -48,7 +48,7 @@ export class GroupRepositoryService extends BaseRepository<ViewGroup, Group> {
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private constants: ConstantsService private constants: ConstantsService
) { ) {

View File

@ -0,0 +1,17 @@
import { TestBed, inject } from '@angular/core/testing';
import { E2EImportsModule } from '../../../../e2e-imports.module';
import { PersonalNoteRepositoryService } from './personal-note-repository.service';
describe('PersonalNoteRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [PersonalNoteRepositoryService]
});
});
it('should be created', inject([PersonalNoteRepositoryService], (service: PersonalNoteRepositoryService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../base-repository';
import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { PersonalNote } from 'app/shared/models/users/personal-note';
import { Identifiable } from 'app/shared/models/base/identifiable';
/**
*/
@Injectable({
providedIn: 'root'
})
export class PersonalNoteRepositoryService extends BaseRepository<any, PersonalNote> {
/**
* @param DS The DataStore
* @param mapperService Maps collection strings to classes
*/
public constructor(protected DS: DataStoreService, mapperService: CollectionStringMapperService) {
super(DS, mapperService, PersonalNote);
}
protected createViewModel(personalNote: PersonalNote): any {
return {};
}
public async create(personalNote: PersonalNote): Promise<Identifiable> {
throw new Error('TODO');
}
public async update(personalNote: Partial<PersonalNote>, viewPersonalNote: any): Promise<void> {
throw new Error('TODO');
}
public async delete(viewPersonalNote: any): Promise<void> {
throw new Error('TODO');
}
}

View File

@ -1,15 +1,15 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseRepository } from '../../base/base-repository'; import { BaseRepository } from '../base-repository';
import { ViewUser } from '../models/view-user'; import { ViewUser } from '../../../site/users/models/view-user';
import { User } from '../../../shared/models/users/user'; import { User } from '../../../shared/models/users/user';
import { Group } from '../../../shared/models/users/group'; import { Group } from '../../../shared/models/users/group';
import { DataStoreService } from '../../../core/services/data-store.service'; import { DataStoreService } from '../../core-services/data-store.service';
import { DataSendService } from '../../../core/services/data-send.service'; import { DataSendService } from '../../core-services/data-send.service';
import { Identifiable } from '../../../shared/models/base/identifiable'; import { Identifiable } from '../../../shared/models/base/identifiable';
import { CollectionStringModelMapperService } from '../../../core/services/collectionStringModelMapper.service'; import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ConfigService } from 'app/core/services/config.service'; import { ConfigService } from 'app/core/ui-services/config.service';
import { HttpService } from 'app/core/services/http.service'; import { HttpService } from 'app/core/core-services/http.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
@ -37,7 +37,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
*/ */
public constructor( public constructor(
DS: DataStoreService, DS: DataStoreService,
mapperService: CollectionStringModelMapperService, mapperService: CollectionStringMapperService,
private dataSend: DataSendService, private dataSend: DataSendService,
private translate: TranslateService, private translate: TranslateService,
private httpService: HttpService, private httpService: HttpService,

View File

@ -1,5 +1,5 @@
import { TranslateDefaultParser, TranslateStore } from '@ngx-translate/core'; import { TranslateDefaultParser, TranslateStore } from '@ngx-translate/core';
import { ConfigService } from '../services/config.service'; import { ConfigService } from '../ui-services/config.service';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
export interface CustomTranslation { export interface CustomTranslation {

View File

@ -1,17 +1,17 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { FilterListService } from './filter-list.service'; import { BaseFilterListService } from './base-filter-list.service';
import { E2EImportsModule } from '../../../e2e-imports.module'; import { E2EImportsModule } from '../../../e2e-imports.module';
describe('FilterListService', () => { describe('BaseFilterListService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [E2EImportsModule], imports: [E2EImportsModule],
providers: [FilterListService] providers: [BaseFilterListService]
}); });
}); });
// TODO testing needs a BaseViewComponent // TODO testing needs an actual service..
// it('should be created', inject([FilterListService], (service: FilterListService) => { // it('should be created', inject([FilterListService], (service: FilterListService) => {
// expect(service).toBeTruthy(); // expect(service).toBeTruthy();
// })); // }));

View File

@ -3,7 +3,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { BaseModel } from '../../shared/models/base/base-model'; import { BaseModel } from '../../shared/models/base/base-model';
import { BaseViewModel } from '../../site/base/base-view-model'; import { BaseViewModel } from '../../site/base/base-view-model';
import { StorageService } from './storage.service'; import { StorageService } from '../core-services/storage.service';
/** /**
* Describes the available filters for a listView. * Describes the available filters for a listView.
@ -39,7 +39,7 @@ export interface OsFilterOption {
* and will receive their filtered data as observable * and will receive their filtered data as observable
*/ */
export abstract class FilterListService<M extends BaseModel, V extends BaseViewModel> { export abstract class BaseFilterListService<M extends BaseModel, V extends BaseViewModel> {
/** /**
* stores the currently used raw data to be used for the filter * stores the currently used raw data to be used for the filter
*/ */

View File

@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { SortListService } from './sort-list.service'; import { BaseSortListService } from './base-sort-list.service';
import { E2EImportsModule } from '../../../e2e-imports.module'; import { E2EImportsModule } from '../../../e2e-imports.module';
describe('SortListService', () => { describe('BaseSortListService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [E2EImportsModule], imports: [E2EImportsModule],
providers: [SortListService] providers: [BaseSortListService]
}); });
}); });

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { BaseViewModel } from '../../site/base/base-view-model'; import { BaseViewModel } from '../../site/base/base-view-model';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { StorageService } from './storage.service'; import { StorageService } from '../core-services/storage.service';
/** /**
* Describes the sorting columns of an associated ListView, and their state. * Describes the sorting columns of an associated ListView, and their state.
@ -25,7 +25,7 @@ export interface OsSortingItem<V> {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export abstract class SortListService<V extends BaseViewModel> { export abstract class BaseSortListService<V extends BaseViewModel> {
/** /**
* Observable output that submits the newly sorted data each time a sorting has been done * Observable output that submits the newly sorted data each time a sorting has been done
*/ */

View File

@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';
import { Observable, BehaviorSubject } from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs';
import { Config } from '../../shared/models/core/config'; import { Config } from '../../shared/models/core/config';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from '../core-services/data-store.service';
/** /**
* Handler for config variables. * Handler for config variables.

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component'; import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from '../core-services/websocket.service';
import { Observable, of, Subject } from 'rxjs'; import { Observable, of, Subject } from 'rxjs';
/** /**

Some files were not shown because too many files have changed in this diff Show More