Skip to content

Commit

Permalink
refactor(core): change EntityConfig to flattened structure with Entit…
Browse files Browse the repository at this point in the history
…ySchemaField including .id (#2102)

---------
This functionality has been developed for the project “codo”.
codo is developed under the projects “Landungsbrücken – Patenschaften in Hamburg stärken” and “openTransfer Patenschaften”. It is funded through the program “Menschen stärken Menschen” by the German Federal Ministry of Family Affairs, Senior Citizens, Women and Youth.
More information at https://github.com/codo-mentoring

“Landungsbrücken – Patenschaften in Hamburg stärken” is a project of BürgerStiftung Hamburg in cooperation with the Mentor.Ring Hamburg. With a mix of networking opportunities, capacity building and financial support the project strengthens Hamburg’s scene of mentoring projects since its founding in 2016.

The “Stiftung Bürgermut” foundation since 2007 supports the digital and real exchange of experiences and connections of active citizens. Within the federal program “Menschen stärken Menschen” the foundation as part of its program “openTransfer Patenschaften” offers support services for connecting, spreading and upskilling mentoring organisations across Germany.

Diese Funktion wurde entwickelt für das Projekt codo.
codo wird entwickelt im Rahmen der Projekte Landungsbrücken – Patenschaften in Hamburg stärken und openTransfer Patenschaften. Er ist gefördert durch das Bundesprogramm Menschen stärken Menschen des Bundesministeriums für Familie, Senioren, Frauen und Jugend.
Mehr Informationen unter https://github.com/codo-mentoring

“Landungsbrücken – Patenschaften in Hamburg stärken” ist ein Projekt der BürgerStiftung Hamburg in Kooperation mit dem Mentor.Ring Hamburg. Mit einer Mischung aus Vernetzungsangeboten, Qualifizierungsmaßnahmen und finanzieller Förderung stärkt das Projekt die Hamburger Szene der Patenschaftsprojekte seit der Gründung im Jahr 2016.

Die Stiftung Bürgermut fördert seit 2007 den digitalen und realen Erfahrungsaustausch und die Vernetzung von engagierten Bürger:innen. Innerhalb des Bundesprogramms „Menschen stärken Menschen” bietet die Stiftung im Rahmen ihres Programms openTransfer Patenschaften Unterstützungsleistungen zur Vernetzung, Verbreitung und Qualifizierung von Patenschafts- und Mentoringorganisationen bundesweit.

Co-authored-by: codo-mentoring <117934638+codo-mentoring@users.noreply.github.com>
  • Loading branch information
sleidig and codo-mentoring authored Nov 30, 2023
1 parent 8eb7f48 commit 9eb2b4f
Show file tree
Hide file tree
Showing 23 changed files with 330 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class EventAttendance {
private _status: AttendanceStatusType;
@DatabaseField({
dataType: "configurable-enum",
innerDataType: ATTENDANCE_STATUS_CONFIG_ID,
additional: ATTENDANCE_STATUS_CONFIG_ID,
})
get status(): AttendanceStatusType {
return this._status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class RecurringActivity extends Entity {
@DatabaseField({
label: $localize`:Label for the interaction type of a recurring activity:Type`,
dataType: "configurable-enum",
innerDataType: INTERACTION_TYPE_CONFIG_ID,
additional: INTERACTION_TYPE_CONFIG_ID,
})
type: InteractionType;

Expand Down
8 changes: 4 additions & 4 deletions src/app/child-dev-project/children/aser/model/aser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ export class Aser extends Entity {
@DatabaseField({
label: $localize`:Label of the Hindi ASER result:Hindi`,
dataType: "configurable-enum",
innerDataType: "reading-levels",
additional: "reading-levels",
})
hindi: SkillLevel;
@DatabaseField({
label: $localize`:Label of the Bengali ASER result:Bengali`,
dataType: "configurable-enum",
innerDataType: "reading-levels",
additional: "reading-levels",
})
bengali: SkillLevel;
@DatabaseField({
label: $localize`:Label of the English ASER result:English`,
dataType: "configurable-enum",
innerDataType: "reading-levels",
additional: "reading-levels",
})
english: SkillLevel;
@DatabaseField({
label: $localize`:Label of the Math ASER result:Math`,
dataType: "configurable-enum",
innerDataType: "math-levels",
additional: "math-levels",
})
math: SkillLevel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class EducationalMaterial extends Entity {
@DatabaseField({
label: $localize`:The material which has been borrowed:Material`,
dataType: "configurable-enum",
innerDataType: "materials",
additional: "materials",
validators: {
required: true,
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/child-dev-project/children/model/child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ export class Child extends Entity {
@DatabaseField({
dataType: "configurable-enum",
label: $localize`:Label for the gender of a child:Gender`,
innerDataType: "genders",
additional: "genders",
anonymize: "retain",
})
gender: ConfigurableEnumValue;

@DatabaseField({
dataType: "configurable-enum",
innerDataType: "center",
additional: "center",
label: $localize`:Label for the center of a child:Center`,
anonymize: "retain",
})
Expand Down
4 changes: 2 additions & 2 deletions src/app/child-dev-project/notes/model/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class Note extends Entity {
@DatabaseField({
label: $localize`:Label for the category of a note:Category`,
dataType: "configurable-enum",
innerDataType: INTERACTION_TYPE_CONFIG_ID,
additional: INTERACTION_TYPE_CONFIG_ID,
anonymize: "retain",
})
category: InteractionType;
Expand Down Expand Up @@ -175,7 +175,7 @@ export class Note extends Entity {
@DatabaseField({
label: $localize`:Status of a note:Status`,
dataType: "configurable-enum",
innerDataType: "warning-levels",
additional: "warning-levels",
anonymize: "retain",
})
warningLevel: Ordering.EnumValue;
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/basic-datatypes/entity/entity.datatype.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { mockEntityMapper } from "../../entity/entity-mapper/mock-entity-mapper-
import { Child } from "../../../child-dev-project/children/model/child";
import { ChildSchoolRelation } from "../../../child-dev-project/children/model/childSchoolRelation";
import { EntityActionsService } from "../../entity/entity-actions/entity-actions.service";
import { EntitySchemaField } from "../../entity/schema/entity-schema-field";

describe("Schema data type: entity", () => {
testDatatype(new EntityDatatype(null, null), "1", "1", "User");
Expand Down Expand Up @@ -55,7 +56,10 @@ describe("Schema data type: entity", () => {
const dataType = new EntityDatatype(entityMapper, mockRemoveService);

const testValue = referencedEntity.getId();
const testSchemaField = { additional: "Child", dataType: "entity" };
const testSchemaField: EntitySchemaField = {
additional: "Child",
dataType: "entity",
};

const anonymizedValue = await dataType.anonymize(
testValue,
Expand Down
214 changes: 79 additions & 135 deletions src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,164 +944,108 @@ export const defaultJsonConfig = {
"entity:Child": {
"label": $localize`:Label for child:Child`,
"labelPlural": $localize`:Plural label for child:Children`,
"attributes": [
{
"name": "address",
"schema": {
"dataType": "location",
"label": $localize`:Label for the address of a child:Address`
}

"attributes": {
"address": {
"dataType": "location",
"label": $localize`:Label for the address of a child:Address`
},
{
"name": "health_bloodGroup",
"schema": {
"dataType": "string",
"label": $localize`:Label for a child attribute:Blood Group`
}
"health_bloodGroup": {
"dataType": "string",
"label": $localize`:Label for a child attribute:Blood Group`
},
{
"name": "religion",
"schema": {
"dataType": "string",
"label": $localize`:Label for the religion of a child:Religion`
}
"religion": {
"dataType": "string",
"label": $localize`:Label for the religion of a child:Religion`
},
{
"name": "motherTongue",
"schema": {
"dataType": "string",
"label": $localize`:Label for the mother tongue of a child:Mother Tongue`,
description: $localize`:Tooltip description for the mother tongue of a child:The primary language spoken at home`,
}
"motherTongue": {
"dataType": "string",
"label": $localize`:Label for the mother tongue of a child:Mother Tongue`,
description: $localize`:Tooltip description for the mother tongue of a child:The primary language spoken at home`,
},
{
"name": "health_lastDentalCheckup",
"schema": {
"dataType": "date",
"label": $localize`:Label for a child attribute:Last Dental Check-Up`
}
"health_lastDentalCheckup": {
"dataType": "date",
"label": $localize`:Label for a child attribute:Last Dental Check-Up`
},
{
"name": "birth_certificate",
"schema": {
"dataType": "file",
"label": $localize`:Label for a child attribute:Birth certificate`
}
"birth_certificate": {
"dataType": "file",
"label": $localize`:Label for a child attribute:Birth certificate`
}
]
},
},
"entity:School": {
"attributes": [
{
"name": "name",
"schema": {
"dataType": "string",
"label": $localize`:Label for the name of a school:Name`
}
"attributes": {
"name": {
"dataType": "string",
"label": $localize`:Label for the name of a school:Name`
},
{
"name": "privateSchool",
"schema": {
"dataType": "boolean",
"label": $localize`:Label for if a school is a private school:Private School`
}
"privateSchool": {
"dataType": "boolean",
"label": $localize`:Label for if a school is a private school:Private School`
},
{
"name": "language",
"schema": {
"dataType": "string",
"label": $localize`:Label for the language of a school:Language`
}
"language": {
"dataType": "string",
"label": $localize`:Label for the language of a school:Language`
},
{
"name": "address",
"schema": {
"dataType": "location",
"label": $localize`:Label for the address of a school:Address`
}
"address": {
"dataType": "location",
"label": $localize`:Label for the address of a school:Address`
},
{
"name": "phone",
"schema": {
"dataType": "string",
"label": $localize`:Label for the phone number of a school:Phone Number`
}
"phone": {
"dataType": "string",
"label": $localize`:Label for the phone number of a school:Phone Number`
},
{
"name": "timing",
"schema": {
"dataType": "string",
"label": $localize`:Label for the timing of a school:School Timing`
}
"timing": {
"dataType": "string",
"label": $localize`:Label for the timing of a school:School Timing`
},
{
"name": "remarks",
"schema": {
"dataType": "string",
"label": $localize`:Label for the remarks for a school:Remarks`
}
"remarks": {
"dataType": "string",
"label": $localize`:Label for the remarks for a school:Remarks`
}
]
},
},
"entity:HistoricalEntityData": {
"attributes": [
{
"name": "isMotivatedDuringClass",
"schema": {
"dataType": "configurable-enum",
"innerDataType": "rating-answer",
"label": $localize`:Label for a child attribute:Motivated`,
description: $localize`:Description for a child attribute:The child is motivated during the class.`
}
"attributes": {
"isMotivatedDuringClass": {
"dataType": "configurable-enum",
"additional": "rating-answer",
"label": $localize`:Label for a child attribute:Motivated`,
description: $localize`:Description for a child attribute:The child is motivated during the class.`
},
{
"name": "isParticipatingInClass",
"schema": {
"dataType": "configurable-enum",
"innerDataType": "rating-answer",
"label": $localize`:Label for a child attribute:Participating`,
description: $localize`:Description for a child attribute:The child is actively participating in the class.`
}
"isParticipatingInClass": {
"dataType": "configurable-enum",
"additional": "rating-answer",
"label": $localize`:Label for a child attribute:Participating`,
description: $localize`:Description for a child attribute:The child is actively participating in the class.`
},
{
"name": "isInteractingWithOthers",
"schema": {
"dataType": "configurable-enum",
"innerDataType": "rating-answer",
"label": $localize`:Label for a child attribute:Interacting`,
description: $localize`:Description for a child attribute:The child interacts with other students during the class.`
}
"isInteractingWithOthers": {
"dataType": "configurable-enum",
"additional": "rating-answer",
"label": $localize`:Label for a child attribute:Interacting`,
description: $localize`:Description for a child attribute:The child interacts with other students during the class.`
},
{
"name": "doesHomework",
"schema": {
"dataType": "configurable-enum",
"innerDataType": "rating-answer",
"label": $localize`:Label for a child attribute:Homework`,
description: $localize`:Description for a child attribute:The child does its homework.`
}
"doesHomework": {
"dataType": "configurable-enum",
"additional": "rating-answer",
"label": $localize`:Label for a child attribute:Homework`,
description: $localize`:Description for a child attribute:The child does its homework.`
},
{
"name": "asksQuestions",
"schema": {
"dataType": "configurable-enum",
"innerDataType": "rating-answer",
"label": $localize`:Label for a child attribute:Asking Questions`,
description: $localize`:Description for a child attribute:The child is asking questions during the class.`
}
"asksQuestions": {
"dataType": "configurable-enum",
"additional": "rating-answer",
"label": $localize`:Label for a child attribute:Asking Questions`,
description: $localize`:Description for a child attribute:The child is asking questions during the class.`
},
]
}
},
"entity:User": {
"attributes": [
{
"name": "phone",
"schema": {
"dataType": "string",
"label": $localize`:Label of user phone:Contact`
}
},
]
"attributes": {
"phone": {
"dataType": "string",
"label": $localize`:Label of user phone:Contact`
}
},
},
"view:matching": {
"component": "MatchingEntities",
Expand Down Expand Up @@ -1130,7 +1074,7 @@ export const defaultJsonConfig = {
},

"entity:Todo": {
"attributes": []
"attributes": {}
},
"view:todo": {
"component": "TodoList",
Expand Down
Loading

0 comments on commit 9eb2b4f

Please sign in to comment.