Skip to content

Commit

Permalink
Release 3.12.0
Browse files Browse the repository at this point in the history
Merge pull request #1484 from Aam-Digital/master
  • Loading branch information
sleidig authored Oct 20, 2022
2 parents 98b5ae2 + 5c258ae commit 8ca60c3
Show file tree
Hide file tree
Showing 71 changed files with 4,419 additions and 3,912 deletions.
2 changes: 1 addition & 1 deletion e2e/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Cypress.Commands.add("create", create);
// Overwriting default visit function to wait for index creation
Cypress.Commands.overwrite("visit", (originalFun, url, options) => {
originalFun(url, options);
cy.get("app-search", { timeout: 4000 }).should("be.visible");
cy.get("app-search", { timeout: 10000 }).should("be.visible");
// wait for demo data generation
cy.wait(4000);
// wait for indexing
Expand Down
5,424 changes: 2,345 additions & 3,079 deletions package-lock.json

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,74 +20,74 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.0",
"@angular/cdk": "^14.2.0",
"@angular/common": "^14.2.0",
"@angular/compiler": "^14.2.0",
"@angular/core": "^14.2.0",
"@angular/animations": "^14.2.4",
"@angular/cdk": "^14.2.3",
"@angular/common": "^14.2.4",
"@angular/compiler": "^14.2.4",
"@angular/core": "^14.2.4",
"@angular/flex-layout": "^14.0.0-beta.40",
"@angular/forms": "^14.2.0",
"@angular/localize": "^14.2.0",
"@angular/material": "^14.2.0",
"@angular/platform-browser": "^14.2.0",
"@angular/platform-browser-dynamic": "^14.2.0",
"@angular/router": "^14.2.0",
"@angular/service-worker": "^14.2.0",
"@casl/ability": "^6.1.1",
"@angular/forms": "^14.2.4",
"@angular/localize": "^14.2.4",
"@angular/material": "^14.2.3",
"@angular/platform-browser": "^14.2.4",
"@angular/platform-browser-dynamic": "^14.2.4",
"@angular/router": "^14.2.4",
"@angular/service-worker": "^14.2.4",
"@casl/ability": "^6.3.1",
"@casl/angular": "^8.1.0",
"@faker-js/faker": "^7.5.0",
"@fortawesome/angular-fontawesome": "^0.11.1",
"@fortawesome/fontawesome-svg-core": "^6.2.0",
"@fortawesome/free-regular-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@ngneat/until-destroy": "^9.2.2",
"@sentry/browser": "^7.12.1",
"@sentry/browser": "^7.14.1",
"angulartics2": "^12.1.0",
"assert": "^2.0.0",
"crypto-es": "^1.2.7",
"deep-object-diff": "^1.1.7",
"flag-icons": "^6.6.6",
"hammerjs": "^2.0.8",
"json-query": "^2.2.2",
"keycloak-js": "^18.0.1",
"keycloak-js": "^19.0.2",
"lodash-es": "^4.17.21",
"md5": "^2.3.0",
"moment": "^2.29.4",
"ngx-markdown": "^14.0.1",
"ngx-papaparse": "^5.1.0",
"ngx-papaparse": "^6.0.0",
"pouchdb-adapter-memory": "^7.3.0",
"pouchdb-browser": "^7.3.0",
"process": "^0.11.10",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.6",
"rxjs": "^7.5.7",
"stream-browserify": "^3.0.0",
"tslib": "^2.4.0",
"util": "^0.12.4",
"uuid": "^8.3.2",
"uuid": "^9.0.0",
"webpack": "5.74.0",
"zone.js": "~0.11.8"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.0",
"@angular-eslint/builder": "14.0.3",
"@angular-eslint/eslint-plugin": "14.0.3",
"@angular-eslint/eslint-plugin-template": "14.0.3",
"@angular-eslint/schematics": "14.0.3",
"@angular-eslint/template-parser": "14.0.3",
"@angular/cli": "^14.2.0",
"@angular/compiler-cli": "^14.2.0",
"@babel/core": "^7.18.13",
"@angular-devkit/build-angular": "^14.2.4",
"@angular-eslint/builder": "14.1.2",
"@angular-eslint/eslint-plugin": "14.1.2",
"@angular-eslint/eslint-plugin-template": "14.1.2",
"@angular-eslint/schematics": "14.1.2",
"@angular-eslint/template-parser": "14.1.2",
"@angular/cli": "^14.2.4",
"@angular/compiler-cli": "^14.2.4",
"@babel/core": "^7.19.3",
"@compodoc/compodoc": "^1.1.19",
"@cypress/schematic": "~2.0.3",
"@cypress/schematic": "~2.1.1",
"@oasisdigital/angular-typed-forms-helpers": "^1.3.2",
"@schematics/angular": "^14.2.0",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-links": "^6.5.10",
"@storybook/angular": "^6.5.10",
"@storybook/builder-webpack5": "^6.5.10",
"@storybook/manager-webpack5": "^6.5.10",
"@schematics/angular": "^14.2.4",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-essentials": "^6.5.12",
"@storybook/addon-interactions": "^6.5.12",
"@storybook/addon-links": "^6.5.12",
"@storybook/angular": "^6.5.12",
"@storybook/builder-webpack5": "^6.5.12",
"@storybook/manager-webpack5": "^6.5.12",
"@storybook/testing-library": "^0.0.13",
"@types/file-saver": "^2.0.5",
"@types/hammerjs": "^2.0.41",
Expand All @@ -98,15 +98,15 @@
"@types/node": "^16.0.0",
"@types/pouchdb": "^6.4.0",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "5.35.1",
"@typescript-eslint/parser": "5.35.1",
"@typescript-eslint/eslint-plugin": "5.39.0",
"@typescript-eslint/parser": "5.39.0",
"babel-loader": "^8.2.5",
"cypress": "10.6.0",
"eslint": "^8.22.0",
"cypress": "10.9.0",
"eslint": "^8.24.0",
"husky": "^8.0.1",
"jasmine-core": "^4.3.0",
"jasmine-core": "^4.4.0",
"jasmine-spec-reporter": "^7.0.0",
"karma": "^6.4.0",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"karma-cli": "^2.0.0",
"karma-coverage": "^2.2.0",
Expand All @@ -119,7 +119,7 @@
"ts-node": "^10.9.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typescript": "~4.7.4",
"typescript": "~4.8.4",
"xliff": "^6.1.0"
},
"overrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";

import { ChildBlockComponent } from "./child-block.component";
import { RouterTestingModule } from "@angular/router/testing";
import { of } from "rxjs";
import { SchoolBlockComponent } from "../../schools/school-block/school-block.component";
import { ChildrenService } from "../children.service";
import { Child } from "../model/child";
Expand All @@ -12,22 +11,18 @@ describe("ChildBlockComponent", () => {
let fixture: ComponentFixture<ChildBlockComponent>;
let mockChildrenService: jasmine.SpyObj<ChildrenService>;

beforeEach(
waitForAsync(() => {
mockChildrenService = jasmine.createSpyObj("mockChildrenService", [
"getChild",
]);
mockChildrenService.getChild.and.returnValue(of(new Child("")));
beforeEach(waitForAsync(() => {
mockChildrenService = jasmine.createSpyObj("mockChildrenService", [
"getChild",
]);
mockChildrenService.getChild.and.resolveTo(new Child(""));

TestBed.configureTestingModule({
declarations: [SchoolBlockComponent, ChildBlockComponent],
imports: [RouterTestingModule],
providers: [
{ provide: ChildrenService, useValue: mockChildrenService },
],
}).compileComponents();
})
);
TestBed.configureTestingModule({
declarations: [SchoolBlockComponent, ChildBlockComponent],
imports: [RouterTestingModule],
providers: [{ provide: ChildrenService, useValue: mockChildrenService }],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ChildBlockComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import {
SimpleChange,
SimpleChanges,
} from "@angular/core";
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
import { OnInitDynamicComponent } from "../../../core/view/dynamic-components/on-init-dynamic-component.interface";
import { ChildrenService } from "../children.service";
import { Child } from "../model/child";
import { DynamicComponent } from "../../../core/view/dynamic-components/dynamic-component.decorator";

@UntilDestroy()
@DynamicComponent("ChildBlock")
@Component({
selector: "app-child-block",
Expand All @@ -31,14 +29,9 @@ export class ChildBlockComponent implements OnInitDynamicComponent, OnChanges {

constructor(@Optional() private childrenService: ChildrenService) {}

ngOnChanges(changes: SimpleChanges) {
async ngOnChanges(changes: SimpleChanges) {
if (changes.hasOwnProperty("entityId")) {
this.childrenService
.getChild(this.entityId)
.pipe(untilDestroyed(this))
.subscribe((child) => {
this.entity = child;
});
this.entity = await this.childrenService.getChild(this.entityId);
}
}

Expand Down
19 changes: 10 additions & 9 deletions src/app/child-dev-project/children/children.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { genders } from "./model/genders";
import { DatabaseTestingModule } from "../../utils/database-testing.module";
import { sortByAttribute } from "../../utils/utils";
import { expectEntitiesToMatch } from "../../utils/expect-entity-data.spec";
import { lastValueFrom } from "rxjs";

describe("ChildrenService", () => {
let service: ChildrenService;
Expand Down Expand Up @@ -41,10 +42,10 @@ describe("ChildrenService", () => {
});

it("should list newly saved children", async () => {
const childrenBefore = await service.getChildren().toPromise();
const childrenBefore = await lastValueFrom(service.getChildren());
const child = new Child("10");
await entityMapper.save<Child>(child);
const childrenAfter = await service.getChildren().toPromise();
const childrenAfter = await lastValueFrom(service.getChildren());

let find = childrenBefore.find((c) => c.getId() === child.getId());
expect(find).toBeUndefined();
Expand All @@ -59,14 +60,14 @@ describe("ChildrenService", () => {
const child = new Child("10");
let error;
try {
await service.getChild(child.getId()).toPromise();
await service.getChild(child.getId());
} catch (err) {
error = err;
}
expect(error).toBeDefined();

await entityMapper.save<Child>(child);
const childAfter = await service.getChild(child.getId()).toPromise();
const childAfter = await service.getChild(child.getId());
expect(childAfter).toBeDefined();
expect(childAfter).toHaveId(child.getId());
});
Expand Down Expand Up @@ -109,12 +110,12 @@ describe("ChildrenService", () => {

it("should load a single child and add school info", async () => {
// no active relation
const child2 = await service.getChild("2").toPromise();
const child2 = await service.getChild("2");
expect(child2.schoolClass).toBeUndefined();
expect(child2.schoolId).toBeUndefined();

// one active relation
let child1 = await service.getChild("1").toPromise();
let child1 = await service.getChild("1");
expect(child1.schoolClass).toBe("2");
expect(child1.schoolId).toBe("1");

Expand All @@ -125,7 +126,7 @@ describe("ChildrenService", () => {
newRelation.schoolId = "2";
newRelation.schoolClass = "3";
await entityMapper.save(newRelation);
child1 = await service.getChild(child1.getId()).toPromise();
child1 = await service.getChild(child1.getId());
expect(child1.schoolClass).toBe("3");
expect(child1.schoolId).toBe("2");

Expand All @@ -135,13 +136,13 @@ describe("ChildrenService", () => {
noStartDate.schoolId = "2";
noStartDate.schoolClass = "4";
await entityMapper.save(noStartDate);
child1 = await service.getChild(child1.getId()).toPromise();
child1 = await service.getChild(child1.getId());
expect(child1.schoolClass).toBe("4");
expect(child1.schoolId).toBe("2");
});

it("should load all children with school info", async () => {
const children = await service.getChildren().toPromise();
const children = await lastValueFrom(service.getChildren());
const child1 = children.find((child) => child.getId() === "1");
expect(child1.schoolClass).toBe("2");
expect(child1.schoolId).toBe("1");
Expand Down
18 changes: 7 additions & 11 deletions src/app/child-dev-project/children/children.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ChildPhotoService } from "./child-photo-service/child-photo.service";
import moment, { Moment } from "moment";
import { LoggingService } from "../../core/logging/logging.service";
import { DatabaseIndexingService } from "../../core/entity/database-indexing/database-indexing.service";
import { Entity } from "../../core/entity/model/entity";

@Injectable()
export class ChildrenService {
Expand Down Expand Up @@ -57,17 +56,14 @@ export class ChildrenService {
* returns an observable which retrieves a single child and loads its photo
* @param id id of child
*/
getChild(id: string): Observable<Child> {
const promise = this.entityMapper
.load<Child>(Child, id)
.then((loadedChild) => {
return this.queryLatestRelation(id).then((currentSchoolInfo) => {
loadedChild.schoolClass = currentSchoolInfo?.schoolClass;
loadedChild.schoolId = currentSchoolInfo?.schoolId;
return loadedChild;
});
getChild(id: string): Promise<Child> {
return this.entityMapper.load<Child>(Child, id).then((loadedChild) => {
return this.queryLatestRelation(id).then((currentSchoolInfo) => {
loadedChild.schoolClass = currentSchoolInfo?.schoolClass;
loadedChild.schoolId = currentSchoolInfo?.schoolId;
return loadedChild;
});
return from(promise);
});
}

private createChildSchoolRelationIndex(): Promise<any> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ describe("HealthCheckupComponent", () => {
let mockChildrenService: jasmine.SpyObj<ChildrenService>;
const child = new Child();

beforeEach(
waitForAsync(() => {
mockChildrenService = jasmine.createSpyObj([
"getChild",
"getHealthChecksOfChild",
]);
mockChildrenService.getChild.and.returnValue(of(child));
mockChildrenService.getHealthChecksOfChild.and.returnValue(of([]));
beforeEach(waitForAsync(() => {
mockChildrenService = jasmine.createSpyObj([
"getChild",
"getHealthChecksOfChild",
]);
mockChildrenService.getChild.and.resolveTo(child);
mockChildrenService.getHealthChecksOfChild.and.returnValue(of([]));

TestBed.configureTestingModule({
imports: [ChildrenModule, MockedTestingModule.withState()],
providers: [
{ provide: ChildrenService, useValue: mockChildrenService },
],
}).compileComponents();
})
);
TestBed.configureTestingModule({
imports: [ChildrenModule, MockedTestingModule.withState()],
providers: [{ provide: ChildrenService, useValue: mockChildrenService }],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(HealthCheckupComponent);
Expand Down
5 changes: 3 additions & 2 deletions src/app/child-dev-project/children/model/child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { SafeUrl } from "@angular/platform-browser";
import { ChildPhotoService } from "../child-photo-service/child-photo.service";

export type Center = ConfigurableEnumValue;

@DatabaseEntity("Child")
export class Child extends Entity {
static toStringAttributes = ["name"];
Expand Down Expand Up @@ -134,11 +135,11 @@ export class Child extends Entity {
let indices = [];

indices = indices.concat(this.toString().split(" "));
if (this.projectNumber !== undefined) {
if (this.projectNumber !== undefined && this.projectNumber !== null) {
indices.push(this.projectNumber);
}

return indices;
}

set searchIndices(value) {}
}
Loading

0 comments on commit 8ca60c3

Please sign in to comment.