mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-11 00:36:14 +00:00
docs: add checklist for adding new SCThings
This commit is contained in:
committed by
Karl-Philipp Wulfert
parent
01f92baa98
commit
49b55db66f
@@ -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<SCYourThingName>;
|
||||
assert<NotHas<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCYourThingNamePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCYourThingNamePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCYourThingNameWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCYourThingName, SCThing>>(true);
|
||||
```
|
||||
|
||||
## Additional coding style
|
||||
|
||||
### Extract inline type definitions
|
||||
|
||||
Reference in New Issue
Block a user