From 49b55db66f25da7bceb7d41872f297eeec1b9030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wieland=20Sch=C3=B6bl?= Date: Wed, 25 Sep 2019 08:54:05 +0200 Subject: [PATCH] docs: add checklist for adding new SCThings --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3946e5c5..c9664885 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,33 @@ The [core tools](https://openstapps.gitlab.io/core-tools) are more or less not d App and connectors should be updated regularly to new releases of the core but not as important like API and backend. Since the app is just a view for the data stored in the backend it is not necessary to be up to date with the newest core immediately and the connectors are developed independently by every school and up to their responsibility. +## Adding new Types + +Adding new types requires changes at multiple locations for it to work correctly + +### Required changes +* Add your SCThing and SCThingWithoutReferences to `src/things/your-thing-name.ts` and make them extend `SCThingWithoutReferences` and `SCThing` respectively +* Add your SCThingMeta to `src/things/your-thing-name.ts` and make it extend `SCThingMeta` +* Add your SCThingMeta to `SCClasses` in `src/meta.ts` +* Add your SCThing to `SCThingsWithoutDiff` in `src/meta.ts` +* Add your SCThingWithoutReferences to `SCAssociatedThingWithoutReferences` in `src/meta.ts` +* Add your SCThing to `SCAssociatedThing` in `src/meta.ts` +* Add your SCThing to the `SCThingType` enum in `src/things/abstract/thing.ts` +* Add an example file for your SCThing in `test/resources/YourThingName.json` +* Add the following lines for your SCThing in `test/type.spec.ts`: +```typescript +/** + * Types of properties of SCYourThingName + */ +type SCYourThingNamePropertyTypes = PropertyTypesNested; +assert>(false); +assert>(true); +assert>(true); +assert>(false); +assert>(false); +assert>(true); +``` + ## Additional coding style ### Extract inline type definitions